Задача А. Бушовський Олександр.
from collections import *
n,m=map(int,input().split())
l=list(map(int,input().split()))
f=Counter({1:2})
for x in l:
f[x]+=1
ma=max(f.values())
for k in sorted(f):
if f[k]==ma: print(k); break
Задача В. Бушовський Олександр.
n,m,t=map(int,input().split())
t%=n
ans=[]
for _ in range(m):
i,d=map(int,input().split())
ans+=[(i+d*t+n-1)%n+1]
print(*sorted(ans))
Задача С. Авсієвич Володимир
#include <iostream>
#include <string>
#include <bitset>
#include <cstdio>
using namespace std;
int n,m;
int fld[2002][2002],a[2002][2002];
bitset<2002> bt[2002];
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
scanf("%d",&a[i][j]);
fld[i+1][j+1]=a[i][j]%2;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
fld[i][j]+=fld[i][j-1];
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
fld[i][j]+=fld[i-1][j];
fld[i][j]%=2;
bt[i][j]=fld[i][j];
}
}
long long sol=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<=n;j++){
int c= ( bt[i] ^ bt[j]).count();
int d= m+1-c;
sol += c*1ll*(c-1)/2;
sol += d*1ll*(d-1)/2;
}
}
cout<<sol<<endl;
}
Задача Е. Мельник Софія
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000000000000;
const int N = 200000+10;
const int M = 100;
const int N2 = 100+5;
const int N3 = 1000+5;
const int N4 = 10000+5;
const int N5 = 100000+5;
const int N6 = 1000000+5;
const int N7 = 10000000+5;
const string st2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string s1 = "abcdefghijklmnopqrstuvwxyz";
#define mod % MOD
#define filesio(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout)
#define filesds(x) freopen(x ".dat", "r", stdin); freopen(x ".sol", "w", stdout)
#define filestt(x) freopen(x ".txt", "r", stdin); freopen(x ".txt", "w", stdout)
#define filestxt freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ms(x, y) memset(x, sizeof(x), y)
#define sqr(a) ((a) * (a))
#define ld long double
#define outld(l) cout.precision(l);cout << fixed
#define s second
#define ll long long
#define f first
#define mp make_pair
#define y1 dbfuebfwkmjjzdbhqfja
#define time zdfheajbrkjasghduw
#define ull unsigned long long
#define randomize srand(time(NULL))
#define next ifhiuebf
#define last dkbffjrb
#define pb push_back
#define left second
#define pii pair<ll,ll>
bool use[10][10];
ll dp[20][10],a[20],b[20],lp[20],num;
ll rres(ll x)
{
ll p=0;
for (int i=0; i<=19; i++)
{
a[i]=0;
b[i]=0;
}
ll y=x;
while (y>0)
{
p++;
b[p]=y%10;
y/=10;
}
ll n=0;
for (ll i=p; i>=1; i--)
{
n++;
a[n]=b[i];
}
for (ll i=0; i<=19; i++)
for (ll j=0; j<=9; j++)
{
dp[i][j]=0;
}
for (ll i=1; i<=9; i++)
{
if (i<a[1]) dp[1][i]=1;
}
ll fu=1;
for (ll i=2; i<=n; i++)
{
for (ll j=0; j<=9; j++)
{
if (fu==1&&j<a[i]&&use[a[i-1]][j]==0)
dp[i][j]++;
if (j<a[i]&&x==61) {}
for (ll k=0; k<=9; k++)
if (use[j][k]==0)
dp[i][k]+=dp[i-1][j];
}
if (use[a[i-1]][a[i]]==1) fu=0;
}
ll ans=0;
for (ll i=0; i<=9; i++)
{
ans+=dp[n][i];
}
ans+=fu+lp[n-1];
return ans;
}
void get()
{
ll nn;
cin>>nn;
for (ll i=0; i<=9; i++)
for (ll j=0; j<=9; j++)
use[i][j]=0;
for (ll i=1; i<=nn; i++)
{
ll l,r;
cin>>l>>r;
use[l][r]=1;
}
ll f;
cin>>f;
ll gh=0;
lp[0]=0;
for (int i=1; i<=18; i++)
{
gh=gh*10+9;
lp[i]=rres(gh);
}
ll l=1;
ll r=5000000000000000000;
while(r-l>1)
{
ll k=l/2+r/2;
if (l%2==1&&r%2==1) k++;
if (rres(k)<f) l=k; else r=k;
}
ll pp=0;
if (rres(l)==f) pp=l; else
if (rres(r)==f) pp=r; else
{cout<<-1<<endl;
return;}
l=1;
r=pp;
while (r-l>1)
{
ll k=(l+r)/2;
if (rres(k)<f) l=k; else r=k;
}
if (rres(l)==f) cout<<l<<endl;
else cout<<r<<endl;
}
int main()
{
sync;
ll p;
cin>>p;
for (ll i=1; i<=p; i++)
{
num++;
get();
}
}