akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>

using namespace std;

struct Process {
	string name;
	int time;
};

static void inputProcess(queue<Process>& processQueue, int n) {
  Process in;
  for (int i = 0; i < n; i++) {
    cin >> in.name  >> in.time;
    processQueue.push(in);
   }
}

int main() {
  int n, q;
  cin >> n >> q;

  queue<Process> processQueue;
  inputProcess(processQueue, n);

  int total = 0;
  while(!processQueue.empty()) {
    Process now = processQueue.front();
    processQueue.pop();
    if (now.time <= q) {
      total += now.time;
      cout << now.name << ' ' << total << endl;
    } else {
      now.time -= q;
      total += q;
      processQueue.push(now);
    }
  }
  
  return 0;
}



Measured memory_bytes: 6188
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    int mapi[10][10],x,y,high=0,none=0;
    int penx1[]={-1,0,0,1},peny1[]={0,1,-1,0};
    int penx2[]={-1,-1,-1,0,0,1,1,1},peny2[]={-1,0,1,-1,1,-1,0,1};
    int penx3[]={-2,-1,-1,-1,0,0,0,0,1,1,1,2},peny3[]={0,-1,0,1,2,1,-1,-2,1,0,-1,0};
    char str[7];
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            mapi[i][j]=0;
        }
    }
    while(cin>>str){
        for(int i=0;i<10;i++){
            if(str[0]-48==i)x=i;
            if(str[2]-48==i)y=i;
        }
        if(str[4]=='1'){
            for(int i=0;i<4;i++){
                if(x+penx1[i]<10&&x+penx1[i]>=0&&y+peny1[i]<10&&y+peny1>=0)mapi[y+peny1[i]][x+penx1[i]]++;

            }
        }
        else if(str[4]=='2'){
            for(int i=0;i<8;i++){
                if(x+penx2[i]<10&&x+penx2[i]>=0&&y+peny2[i]<10&&y+peny2>=0)mapi[y+peny2[i]][x+penx2[i]]++;

            }
        }
        else{
            for(int i=0;i<12;i++){
                if(x+penx3[i]<10&&x+penx3[i]>=0&&y+peny3[i]<10&&y+peny3>=0)mapi[y+peny3[i]][x+penx3[i]]++;

            }
        }
        mapi[y][x]++;
    /*    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(high<mapi[i][j])high=mapi[i][j];
            if(mapi[i][j]==0)none++;
        }
    }
    cout<<none<<endl<<high<<endl;
    none=0;high=0;
    /*for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                    cout<<mapi[i][j];
            }
            cout<<endl;
    }*/
    }

    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(high<mapi[i][j])high=mapi[i][j];
            if(mapi[i][j]==0)none++;
        }
    }
    cout<<none<<endl<<high<<endl;
}

Measured memory_bytes: 1140
nm = input().split()
wa = 0
ac = 0
db = [[0 for i in range(2)] for j in range(int(nm[0]))]

for i in range(int(nm[1])):
 tmp = input().split()
 if db[int(tmp[0])-1][1] == 0:
  if tmp[1] == "AC":
   db[int(tmp[0])-1][1]=1
   ac+=1
   wa+=db[int(tmp[0])-1][0]
  elif tmp[1] == "WA":
   db[int(tmp[0])-1][0]+=1
print(ac,wa)

Measured memory_bytes: 14836
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
using ll = long long;
using ld = long double;
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define forn(i,a,b) for (ll i =a; i <=b; ++i)
void debug()
{
    cerr << "\n";
}
template<typename Head, typename... Tail>
void debug(Head H, Tail... T)
{
    cerr << H << " ";
    debug(T...);
}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"] : ";debug(__VA_ARGS__);
const ll maxn = 1e6 + 10;
void solve()
{
    ll n;
    cin>>n;
    ll a[n],b[n];
    rep(i,n)
    cin>>a[i]>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    if(n&1)
    {
        cout<<b[n/2]-a[n/2]+1<<"\n";
    }
    else
    {
        cout<<(b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1)<<"\n";
    }
}
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t=1;
    // cin >> t;
    rep(i, t)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6760
import itertools
N,M,X = map(int,input().split())
C = []
for i in range(N):
    C.append(list(map(int,input().split())))

onedan = []

for j in range(1,N+1):
    #本の全組み合わせリスト(1個からN個まで)
    CCj = list(itertools.combinations(C,j))

    for k in range(len(CCj)):
        rikai = True
        for l in range(1,M+1):
            #各ゴリズムの理解力(rikaipower)判定
            rp = sum([CCj[k][m][l] for m in range(j)])
            if rp < X:
                rikai = False
                break
        if rikai:
            onedan.append(sum([CCj[k][m][0] for m in range(j)]))
if onedan == []:
    print(-1)
else:
    print(min(onedan))

Measured memory_bytes: 9416
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll N,r=0,b=0,g=0;
    string S;
    cin >> N >> S;
    
    for (int i=0; i<N; i++){
        if (S[i]=='R') r++;
        if (S[i]=='G') g++;
        if (S[i]=='B') b++;
    }
    
    ll mis=0;
    ll sum=r*g*b;
    for (int i=0; i<N; i++){
        for (int j=i+1; j<N; j++){
            if (j+(j-i) <N && j>i){
                if (S[i]!=S[j] && S[i]!=S[j+(j-i)] && S[j]!=S[j+(j-i)]) mis++;
            }
        }
    }
    cout << sum-mis << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    vector<P> mix;
    rep(i, N){
        ll A, B;
        cin >> A >> B;
        mix.push_back(P(A, i));
        mix.push_back(P(B, N+i));
    }
    sort(mix.begin(), mix.end());
    ll sum = 0;
    int cnt[N];
    fill_n(cnt, N, 0);
    int a = 0, b = 0;
    rep(i, N){
        P p = mix[i];
        sum += p.first;
        if(p.second < N){a++; cnt[p.second]++;}
        else{b++; cnt[p.second-N] += 2;}
    }
    rep(i, N){
        if(cnt[i] == 3){cout << sum << endl; exit(0);}
    }
    if(a && b){
        if(mix[N-1].second % N != mix[N].second % N){
            sum += mix[N].first - mix[N-1].first;
        }
        elif(a == 1 && cnt[mix[N-1].second%N] == 1){
            sum += mix[N].first - mix[N-1].first;
        }
        elif(b == 1 && cnt[mix[N-1].second%N] == 2){
            sum += mix[N].first - mix[N-1].first;
        }
        else{
            sum += min(mix[N].first-mix[N-2].first, mix[N+1].first-mix[N-1].first);
        }
        cout << sum << endl;
    }
    else cout << sum << endl;
}

Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> g;
vector<long long> sumx;

void bfs(long long c, vector<long long> &dist){
  queue<pair<int,long long>> que;
  dist[0] = c;
  que.emplace(0,c);

  while(!que.empty()){
    int from = que.front().first;
    c = que.front().second;
    que.pop();

    for(int to:g[from]){
      if(dist[to]==-1){
        que.emplace(to,c+sumx[to]);
        dist[to] = c+sumx[to];
      }
    }   
  }
}

int main(){
  int n,q;
  cin >> n >> q;
  g.assign(n,vector<int>());
  sumx.assign(n,0);

  for (int i = 0; i < n-1; i++)
  {
    int a,b;
    cin >> a >> b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  for (int i = 0; i < q; i++)
  {
    int p;
    long long x;
    cin >> p >> x;
    p--;
    sumx[p]+=x;
  }

//  cout << "sumx0" << sumx[0] << endl;
  vector<long long> dist(n,-1);
  bfs(sumx[0],dist);
  for(long long dis:dist){
    cout << dis << " ";
  }
  cout << endl;
}


Measured memory_bytes: 18420
import io,sys
sys.setrecursionlimit(10**6)

def main():
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))
    mul = 1
    if 0 in A:
        mul = 0
    else:
        for a in A:
            mul*=a
            if mul>10**18:
                mul=-1
                break
    
    print(mul)
main()

Measured memory_bytes: 21780
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    int n;
    string s,t;
    cin >> n >> s >> t;
    for(int i=0;i<n;i++){
        cout << s.at(i) << t.at(i);
    }
    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint moe=992186091;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,i,syu=0;cin>>n;
	llint ans=0;
	vector<int>t(n);
	for(i=0;i<n;i++){cin>>t[i];maxeq(syu,t[i]);}
	vector<int>ok;
	for(i=1;i*i<=syu;i++){if(syu%i==0){ok.pub(i);ok.pub(syu/i);}}
	SO(ok);
	for(i=0;i<n;i++){ans+=ok[LBI(ok,t[i])]-t[i];}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3360
k,x=map(int,input().split())

if x-k+1>=-100000:
  if x+k-1<=100000:
    for i in range(2*k-1):
      print(x-k+1+i)

  else:
    for i in range(100000-x-k+1):
      print(100000-x-2*k+1+i)

else:
  for i in range(x-100000+k-1):
        print(-100000+i)

Measured memory_bytes: 3060
#include <iostream>
#include <string>

using namespace std;

int main(){
  string s;
  cin >> s;

  int n = s.size();
  int len = 0;
  for(int i = 0; i < n-1; i++){
    s.erase(s.size() -1);
    len = s.size();
    if(len %2 != 0) {
      continue;
    } else if (s.substr(0, len/2) == s.substr(len/2, len)) {
      break;
    }
  }
  cout << len << endl;
  return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;

int main() {
  int h,w;
  cin >> h >> w;
  int ans[h+2][w+2];
  for(int i=0;i<h+2;i++){
    for(int j=0;j<w+2;j++){
      ans[i][j]=0;
    }
  }
  string s;
  for(int i=0;i<h;i++){
    cin >> s;
    for(int j=0;j<w;j++){
      if(s.at(j)=='#'){
        ans[i][j]++;
        ans[i][j+1]++;
        ans[i][j+2]++;
        ans[i+1][j]++;
        ans[i+1][j+1]+=10;
        ans[i+1][j+2]++;
        ans[i+2][j]++;
        ans[i+2][j+1]++;
        ans[i+2][j+2]++;
      }
    }
  }
  for(int i=1;i<h+1;i++){
    for(int j=1;j<w+1;j++){
      if(ans[i][j]>9)cout << '#';
      else cout << ans[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (300006)
int main(){
	FAST
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans = max({a*c,a*d,b*c,b*d});
	cout<<ans<<'\n';
}


Measured memory_bytes: 3652
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int A,B;
  cin>>A>>B;
  if(A<=9&&B<=9){
    cout<<A*B<<endl;
  }
  else{
    cout<<"-1"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); ++i)

char map[101][101];
int owner[101][101];
int H, W, ans;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

void dfs(const int y, const int x) {
    owner[y][x] = ans;
    rep(i, 4) {
        int mx = x + dx[i];
        int my = y + dy[i];
        if(map[y][x]==map[my][mx] && owner[my][mx] == 0
           && mx >= 0 && my >= 0 && mx < W && my < H) dfs(my, mx);
    }
}


int main(void){
    while(cin >> H >> W && W) {
        rep(i, H) {
            rep(j, W) {
                cin >> map[i][j];
                owner[i][j] = 0;
            }
        }
        ans = 0;
        rep(i, H) {
            rep(j, W) {
                if(owner[i][j] == 0) {
                    ans++;
                    dfs(i, j);
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1672
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
typedef long long LL;
const int N=2005;
struct sl{
	LL v,num;
	sl(LL v_=0,LL num_=0){v=v_;num=num_;}
}f[N][N];
LL ans,n,m,z,x,y,len;
string s,c;
sl DP(int l,int r){
	if (l>=r) return f[l][r]=sl(0,1);
	if (f[l][r].num!=0) return f[l][r];
	if (s[l-1]==s[r-1]){
		f[l][r]=DP(l+1,r-1); return f[l][r];
	}
	sl t1,t2;
	t1=DP(l,r-1);t2=DP(l+1,r);
	++t1.v;++t2.v;
	if (t1.v==t2.v){
		f[l][r].v=t1.v;
		if (t1.num+t2.num<=n) f[l][r].num=t1.num+t2.num;
		else f[l][r].num=n+1;
	}
	else if (t1.v<t2.v) f[l][r]=t1;
	else f[l][r]=t2;
	return f[l][r];
}
void getans(int l,int r,int x,int y){
	if (l>r) return;
	if (l==r) {
		c[x]=s[l-1];return;
	}
	if (s[l-1]==s[r-1]) {
		c[x]=s[l-1];c[y]=s[r-1];
		getans(l+1,r-1,x+1,y-1);
	}
	else if (f[l][r-1].v==f[l+1][r].v){
		if (s[l-1]<s[r-1] && n<=f[l+1][r].num) {
			c[x]=c[y]=s[l-1];
			getans(l+1,r,x+1,y-1);
		}
		else if (s[l-1]<s[r-1] && n>f[l+1][r].num){
			c[x]=c[y]=s[r-1];
			n-=f[l+1][r].num;
			getans(l,r-1,x+1,y-1);
		}
		else if (s[l-1]>s[r-1] && n<=f[l][r-1].num){
			c[x]=c[y]=s[r-1];
			getans(l,r-1,x+1,y-1);
		}
		else if (s[l-1]>s[r-1] && n>f[l][r-1].num){
			c[x]=c[y]=s[l-1];
			n-=f[l][r-1].num;
			getans(l+1,r,x+1,y-1);
		}
	}
	else if (f[l][r-1].v<f[l+1][r].v){
		c[x]=c[y]=s[r-1];
		getans(l,r-1,x+1,y-1);
	}
	else {
		c[x]=c[y]=s[l-1];
		getans(l+1,r,x+1,y-1);
	}
}
int main(){
	cin>>s;
	cin>>n;
	len=s.length();
	DP(1,len);
	ans=f[1][len].v+len;
	c.resize(ans);
	if (f[1][len].num<n) cout<<"NONE"<<endl;
	else{
		getans(1,len,0,ans-1);
		cout<<c<<endl;
	}
}

Measured memory_bytes: 64304
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define _repi(i, s, n) for(ll i = (ll)(s); i < (ll)n; i++)
#define REP(...) _overload(__VA_ARGS__, _repi, _rep,)(__VA_ARGS__)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

ll dp[10001];

int main(){
	ll h, n;	cin >> h >> n;
	pair<ll, ll> magic[n];
	REP(i, n){
		cin >> magic[i].first >> magic[i].second;
	}

	REP(i, h+1)	dp[i] = -1;
	dp[0] = 0;
	REP(i, 1, h+1){
		REP(j, n){
			if( i - magic[j].first >= 0 ){
				if( dp[i] == -1 )	dp[i] = dp[i - magic[j].first] + magic[j].second;
				else				dp[i] = min(dp[i], dp[i - magic[j].first] + magic[j].second);
			}else{
				if( dp[i] == -1 )	dp[i] = dp[0] + magic[j].second;
				else				dp[i] = min(dp[i], dp[0] + magic[j].second);
			}
		}
	}

	cout << dp[h] << endl;

	return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int r, g;
    cin >> r >> g;
    cout << g*2-r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
const int N = 1e6 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;

#define PI acos(-1)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, n) for (int i = 0; i < int(n); i++)
#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)
#define ALL(v) ((v).begin()), ((v).end())
#define SZ(v) ((int)((v).size()))
int dx[] = {1, 0, -1, 0}; // {down , right , up , left}
int dy[] = {0, 1, 0, -1}; //4 Direction
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
//int dy[] = {1, 2, 2, 1, -1, -2, -2, -1}; //Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//-- "كلٌّ من يسعى لابد يصل .. كلٌّ من يسعى مضمون له الوصول" --//

ll n, k;

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

  cin >> n >> k;
  if (n % k == 0)
    cout << "0\n";
  else if (n > k)
  {
    cout << min(n % k, abs((n % k) - k)) << "\n";
  }
  else
  {
    cout << min(abs(n - k), n % k) << "\n";
  }

  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main()
{
    int w, a, b;
    cin >> w >> a >> b;
    if (a + w < b) cout << b - (a + w) << endl;
    else if (b + w < a) cout << a - (b + w) << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    double a, b, x, p = 3.1415926535;
    cin >> a >> b >> x;
    double v = a * a * b, TAN;
    if(x <= v / 2) TAN = a * b * b / (2 * x);
    else TAN = 2 * (v - x) / (a * a * a);
    cout << setprecision(12) << atan(TAN) * 180 / p << endl;
}

Measured memory_bytes: 4148
"""
agc
acg
gac
axgc
agxc
"""

n = int(input())
MOD = 10**9 + 7
dpa = [0, 0, 1]
dpc = [0, 0, 1]
dpg = [0, 0, 1]
dpt = [0, 0, 1]

for i in range(2, n+2):
    dpa.append(dpa[i] + dpc[i] + dpg[i] + dpt[i])
    dpc.append(dpa[i]-dpg[i-1] + dpc[i] + dpg[i]-dpa[i-1]-2*dpa[i-2] + dpt[i]-dpa[i-2])
    dpg.append(dpa[i] + dpc[i]-dpa[i-1]+dpg[i-2] + dpg[i] + dpt[i])
    dpt.append(dpa[i] + dpc[i] + dpg[i] + dpt[i])
    
print((dpa[n+1]+dpg[n+1]+dpc[n+1]+dpt[n+1]) % MOD)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int, input().split()))
max_a = max(a)
a.remove(max_a)
min_diff = 1000000000
for a_i in a:
    if min_diff > abs(max_a / 2 - a_i):
        min_diff = abs(max_a / 2 - a_i)
        half_a = a_i
print(max_a, half_a)


Measured memory_bytes: 14428
#include<bits/stdc++.h>

using namespace std;

#define REP(i,x,y) for (int i=x;i<y;i++)
int a[111];
int main()
{
    int n,m,k,ans=0;
    cin >> n >> m >> k;
    for (int i=0;i<m;i++) cin >> a[i];
    for (int i=0;i<n;i++)
    {
        int tmp=0;
        for (int j=0;j<m;j++)
        {
            int x;
            cin >> x;
            tmp+=x*a[j];
        }
        if (tmp+k>0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
  i64 N;
  cin >> N;

  REPS(a, 9) {
    REPS(b, 9) {
      if (a * b == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        n: i64,
    }
    for i in (1..(n as f64).sqrt().ceil() as i64 + 1).rev() {
        if n % i == 0 {
            println!("{}", i + n / i - 2);
            break;
        }
    }
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> x(N);
    for (int i = 0; i < N; i++) cin >> x[i];
    ll ans = 1;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (x[i] < 2 * cnt + 1) {
            (ans *= (cnt + 1)) %= MOD;
            cnt--;
        }
        cnt++;
    }
    for (int i = 1; i <= cnt; i++) (ans *= i) %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 640
import math
s = input()
n = len(s)
zen_c = 0
kou_c = 0
z = math.floor((n-1)/2)
k = math.floor((n+2)/2)
zenhan = s[0:z]
kouhan = s[k:n]
zen_l = len(zenhan)-1
for i in range(0, math.floor((zen_l+1)/2)):
  if zenhan[i] == zenhan[zen_l-i] and i != (zen_l-i):
    zen_c += 1
print('Yes' if zen_c == math.floor(z/2) and zenhan == kouhan else 'No')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main(){
  string a;
  int count=0;
  cin>>a;
  for(int i=0;i<=a.size();i++){
    if(a[i]==a[i+1]&&a[i+1]=='0'){
      a[i+1]='1';
      count++;
    }else if(a[i]==a[i+1]&&a[i+1]=='1'){
      a[i+1]='0';
      count++;
    }
  }
    cout<<count<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include <cmath>
#include <ctype.h>
#include<vector>
#include<algorithm>
using namespace std;
int N, M;
int a, b, c, d;
int W, H;
string s;
vector<int> v;
int main() {
    cin >> s;
    string str = "abcdefghijklmnopqrstuvwxyz";
    bool flag=false;
    sort(s.begin(), s.end());
    for(int i=0; i<26; ++i){
        for(int j=0; j<s.size(); ++j){
            if(s[j]==str[i]) break;
            if(j==s.size()-1){
                cout << str[i] << endl;
                flag=true;
                break;
            }
        }
        if(flag) break;
    }
    if(!flag) cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    char[] s = sc.next().toCharArray();
    long sum = 1;
    long cnt = 0;
    long mod = 1000000007;
    for(char c = 'a';c<='z';c++){
      for(int i = 0;i < n;i++)if(s[i]==c)cnt++;
      sum=sum*(cnt+1);
      sum = sum%mod;
      cnt=0;
    }
    System.out.println(sum-1);
  }
}

Measured memory_bytes: 27948
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,i;
  cin >> n >> k;
  vector<int> h(n);
  for(i=0;i<n;i++){
    cin >> h[i];
  }
  sort(h.begin(),h.end());
  int p=h[k-1]-h[0];
  for(i=0;i<n-k+1;i++){
    if(h[i+k-1]-h[i]<p)p=h[i+k-1]-h[i];
  }
  cout << p <<endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
 
int main(){
    int tramp[4][13];
    int i,j;
    for (i=0; i<4; i++){
        for (j=0; j<13; j++){
            tramp[i][j] =j+1;
        }
    }
     
    int n;
    cin >>n;
     
    char x;
    int y;
    for (int k=0; k<n; k++){
        cin >>x >>y ;
        for (j=0; j<13; j++){
            if (x=='S' && y==j+1) tramp[0][j] =0;
            if (x=='H' && y==j+1) tramp[1][j] =0;
            if (x=='C' && y==j+1) tramp[2][j] =0;
            if (x=='D' && y==j+1) tramp[3][j] =0;
        }
    }
     
    for (i=0; i<4; i++){
        for (j=0; j<13; j++){
            if (tramp[i][j]==0) continue;
            if (i==0) cout << "S" <<" "<< j+1 <<"\n";
            if (i==1) cout << "H" <<" "<< j+1 <<"\n";
            if (i==2) cout << "C" <<" "<< j+1 <<"\n";
            if (i==3) cout << "D" <<" "<< j+1 <<"\n";
        }
    }   
     
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b==c)
    {
        cout<<"Yes";
    }
    else
    {
        if(a+c==b)
        {
            cout<<"Yes";
        }
        else
        {
            if(b+c==a)
            {
                cout<<"Yes";
            }
            else
            {
                cout<<"No";
            }
        }
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Freed freopen ("0in.txt","r",stdin);
#define Fout freopen ("0out.txt","w",stdout);
#define ll long long int
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define Mod 1000000007
#define limit 1000008
using namespace std;

void solve(int t)
{
    int i,j,n,m;
    string s;
    cin >> s;
    cout <<s;
    if(s[s.size()-1]=='s')
        cout <<"es\n";
    else
        cout <<"s\n";

    return ;
}
int  main()
{
//    Fast
//    Freed
//    Fout
    int t,tt=1;
 //   cin >> tt;
    for(t=1; t<=tt; t++)
        solve(t);
    return 0;
}



Measured memory_bytes: 3628
n=int(input())
mod=10**9+7

sm1=1
sm2=1
sm3=1
for i in range(n):
    sm1*=10
    sm1%=mod
for i in range(n):
    sm2*=9
    sm2%=mod
for i in range(n):
    sm3*=8
    sm3%=mod
sm=sm1-2*sm2+sm3
sm%=mod
print(sm)


Measured memory_bytes: 9184
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		double r=Double.parseDouble(br.readLine());
		double Men,Syu;
		Men=r*r*Math.PI;
		Syu=2*r*Math.PI;
		System.out.printf("%.6f %.6f",Men,Syu);
	}
}

Measured memory_bytes: 24540
#include <stdio.h>
int N, Q, T[100000], V[100000], marked[100000], par[100000]; char W[100001];
int root(int x) {
	return par[x] == x ? x : par[x] = root(par[x]);
}
void unite(int x, int y) {
	x = root(x), y = root(y); if (x != y) par[x] = y;
}
int main() {
	while (true) {
		scanf("%d%d", &N, &Q);
		if (N == 0 && Q == 0) break; T[0] = -1;
		for (int i = 1; i < N; i++) scanf("%d", &T[i]), T[i]--; getchar();
		for (int i = 0; i < Q; i++) scanf("%c%d", &W[i], &V[i]), V[i]--, getchar();
		for (int i = 0; i < N; i++) par[i] = i, marked[i] = -1;
		for (int i = 0; i < Q; i++) if (W[i] == 'M') marked[V[i]] = (marked[V[i]] == -1 ? i : marked[V[i]]);
		for (int i = 1; i < N; i++) if (marked[i] == -1) unite(i, T[i]);
		long long ret = 0;
		for (int i = Q - 1; i >= 0; i--) {
			if (W[i] == 'Q') ret += root(V[i]) + 1;
			else if(marked[V[i]] == i && V[i] != 0) unite(V[i], T[V[i]]);
		}
		printf("%lld\n", ret);
	}
	return 0;
}

Measured memory_bytes: 4248
N = int(input())
D = []
count = 0

for i in range(N):
  d = list(map(int,input().split()))
  D.append(d)
  
for i in range(N-2):
  if (D[i][0]==D[i][1]) and (D[i+1][0]==D[i+1][1]) and (D[i+2][0]==D[i+2][1]):
    print("Yes")
    break
else:
  print("No")


Measured memory_bytes: 8988
# Problem C - Divide the Problem

# input process
N = int(input())
d_nums = map(int, input().split())

# initialization
d_nums = sorted(d_nums)
d_len = len(d_nums)
median_1 = d_nums[d_len//2-1]
median_2 = d_nums[d_len//2]

# process
if d_len%2==0:
    ans = median_2 - median_1
    print(ans)
else:
    print(0)


Measured memory_bytes: 52680
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int k = sc.nextInt();

        if(e-a > k) {
            System.out.println(":(");
        }else{
            System.out.println("Yay!");
        }
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;

void solve(std::istream &ist, std::ostream &ost)
{
    /* ------- 宣言と入力 ------- */

    double R;

    ist >> R;

    /* ------- 計算 ------- */

    double ans = R * 2. * M_PI;

    ost << ans << endl;
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif


Measured memory_bytes: 3788
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		List<Integer> answers = new ArrayList<Integer>();
		for(;;){
			String line = scan.nextLine();
			String[] div = line.split("\\s");
			int a = Integer.parseInt(div[0]);
			String op = div[1];
			int b = Integer.parseInt(div[2]);
			if(op.equals("?")){
				break;
			}
			int ans = 0;
			switch(op){
				case "+" :
					ans = a + b;
					break;
				case "-" :
					ans = a - b;
					break;
				case "*" :
					ans = a * b;
					break;
				case "/" :
					ans = a / b;
					break;
				default :
					break;
			}
			answers.add(ans);
		}

		for(int n : answers){
			System.out.println(n);
		}
		
	}
}

Measured memory_bytes: 26228
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
ll Inc(ll a, ll b) { return (a += b) >= mod ? a - mod : a; }
ll Dec(ll a, ll b) { return (a -= b) < 0 ? a + mod : a; }
ll qpow(ll a, ll b) 
{ 
    ll r=1;
    while(b)
    { 
        if(b&1)
            r=(r*a)%mod; 
        a=(a*a)%mod,b>>=1; 
    } 
    return r; 
}

ll n,m,a,b,fac[100010],inv[100010];

ll Sum(ll x) 
{
	return Dec(qpow(2,x),1);
}

ll C(ll x, ll y) 
{
	return (fac[x]*((inv[y]*inv[x-y])%mod))%mod;
}

ll F(ll x) 
{
	ll ans1=1,ans2=1;
	for(ll i=1;i<=x;++i) 
        ans1=(ans1*i)%mod;
	for(ll i=n-x+1;i<=n;++i) 
        ans2=(ans2*i)%mod;
	ans2=(ans2*qpow(ans1,mod-2))%mod;
	return ans2;
}

int main() 
{   cin>>n>>a>>b;
	cout<<Dec(Sum(n),Inc(F(a),F(b)))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
#include <string.h>
#include <queue>
using namespace std;
const int INF = 1e9;

struct edge{ int to, cap, rev;};
bool used[2002];

int dfs(vector< vector <edge> > &G, int v, int t, int f){
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < G[v].size(); ++i){
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0){
      int d = dfs(G, e.to, t, min(f,e.cap));
      if(d > 0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(vector< vector <edge> > &G, int s, int t){
  int flow = 0;
  for(;;){
    memset(used, 0, sizeof(used));
    int f = dfs(G, s, t, INF);
    if(!f) return flow;
    flow += f;
  }
}

void add_edge(vector< vector <edge> > &G, int from, int to, int cap){
  G[from].push_back((edge){to,cap,G[to].size()});
  G[to].push_back((edge){from,0,G[from].size()-1});
}

int main(){
  int N, M, L;
  while(cin >> N >> M >> L, N){
    vector< vector<int> > D(N, vector<int>(N, INF));
    for(int i = 0; i < M; ++i){
      int u, v, d;
      cin >> u >> v >> d;
      D[u][v] = d;
      D[v][u] = d;
    }
    for(int i = 0; i < N; ++i) D[i][i] = 0;
    for(int k = 0; k < N; ++k){
      for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
          D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
        }
      }
    }
    vector< pair<int,int> > V;
    for(int i = 0; i < L; ++i){
      int p, t;
      cin >> p >> t;
      V.push_back(make_pair(t, p));
    }
    sort(V.begin(), V.end());
    vector< vector<edge> > G(2*L + 2);
    for(int i = 0; i < L; ++i){
      for(int j = 0; j < i; ++j){
        int p_i = V[i].second, t_i = V[i].first, p_j = V[j].second, t_j = V[j].first;
        if(D[p_j][p_i] <= t_i - t_j) add_edge(G, j, L + i, 1);
      }
    }
    for(int i = 0; i < L; ++i){
      add_edge(G, 2*L, i, 1);
      add_edge(G, L + i, 2*L+1, 1);
    }
    int ans = L - max_flow(G, 2*L, 2*L+1);
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 18340
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include<string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
using namespace std;
int main()
{
    //freopen("in.txt","r",stdin);
    char s[15];
    char a[15];
	scanf("%s",s+1);
	scanf("%s",a+1);
	bool st=0;
	int len=strlen(s+1);

	for(int i=1;i<=len;i++)
	{
		if(s[i]!=a[i]) st=1;
	}
	if(st==0) cout<<"Yes";
    else cout<<"No";
	 
 

}

Measured memory_bytes: 3660
#include<iostream>
using namespace std;

int main(){
    long N,K,b,p,r;
    long long count = 0;
    //N = p*b+r
    cin >> N >> K;
    b=N;
    while(b>K){
        p = N/b;
        r = N-p*b;
        count += p*(b-K)-(int)(K==0);
        if(r>=K){
            count += r-K+1;
        }
        b--;
    }

    cout << count << "\n";

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    
    class Solve
    {
        const int mod = 1000000007;
        
        
        static void Main(string[] args)
        {

            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            int N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(a);
            Array.Reverse(a);
            long ans = 0;
            for(var i = 0; i < N; i++)
            {
                ans += i % 2 == 0 ? a[i] : (-1) * a[i];
            }

            Console.WriteLine(ans);
            //Console.Out.Flush();

        }

        
    }

    public class Calculation
    {

    }

    public class Graph
    {
        
    }
}




Measured memory_bytes: 13396
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ac = Counter(A)

    if len(ac) == 1 and 0 in ac:
        return 'Yes'

    if N % 3 == 0 and len(ac) == 2 and 0 in ac and ac[0] == N//3:
        return 'Yes'

    if N % 3 == 0 and len(ac) == 3:
        for v in ac.values():
            if v != N//3:
                break
        else:
            a = list(ac.keys())
            if a[0] ^ a[1] ^ a[2] ==  0:
                return 'Yes'

    return 'No'


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 16480
#include <bits/stdc++.h>
#define ll long long
using namespace std;


ll rec(int i, int j, vector<ll> &a_list, vector<vector<ll>> &memo) {
    if (memo.at(i).at(j) != -1) {
        return memo.at(i).at(j);
    }
    else if (i >= j) {
        memo.at(i).at(j) = 0;
        return 0;
    }
    else {
        int N = a_list.size();
        int turn = (i + N - j) % 2;
        ll score;
        if (turn == 0) {
            score = max(rec(i + 1, j, a_list, memo) + a_list.at(i),
                        rec(i, j - 1, a_list, memo) + a_list.at(j - 1));
        }
        else {
            score = min(rec(i + 1, j, a_list, memo),
                        rec(i, j - 1, a_list, memo));
        }
        memo.at(i).at(j) = score;
        return score;
    }
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> a_list(N);
    for (int i = 0; i < N; i++) {
        ll tmp;
        cin >> tmp;
        a_list.at(i) = tmp;
    }
    vector<vector<ll>> memo(N + 1, vector<ll>(N + 1, -1));
    ll max_score = rec(0, N, a_list, memo);
    ll sum_score = 0;
    for (int i = 0; i < a_list.size(); i++) {
        sum_score += a_list.at(i);
    }
    ll counterpart_score = sum_score - max_score;
    cout << max_score - counterpart_score << "\n";
    return 0;
}


Measured memory_bytes: 71040
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> R( n );
	for( int i = 0; i < n; i++ ) {
		cin >> R[i];
	}

	int mi = R[0];
	int ans = R[1] - mi;
	for( int i = 1; i < n; i++ ) {
		ans = max( ans, R[i] - mi );
		if( R[i] < mi ) {
			mi = R[i];
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 3620
//--------Anivia_kid---------//
//-------did you test n = 1 ?-------//
#include<bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back

typedef long long ll; 
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 100;

void Anivia_kid(){
	int n;
	cin>>n;
	map<string, int> mm;
	for(int i = 0; i < n; i++){
		string s;
		cin>>s;
		++mm[s];
	}
	int maxx = 1;
	for(auto x: mm){
		if(maxx < x.se) maxx = x.se;
	}
	vector<string> res;
	for(auto x: mm){
		if(x.se == maxx) res.pb(x.fi);
	}
	sort(res.begin(), res.end());
	for(auto x: res)
		cout<<x<<'\n';

	return;
}
 
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int q = 1;
	//cin>>q;
	while(q--){
		Anivia_kid();
	}
}


Measured memory_bytes: 25584
#include<bits/stdc++.h>
using namespace std;
#define int long long 

int a[201010];

signed main(void){
  int k,n; cin >> k >> n;
  for(int i = 0; i < n; i++){ cin >> a[i];}
  
  int M = 0;
  
  for(int i = 0; i < n; i++){ 
    if( i == n-1 ){ M = max(M,(a[0]+k-a[n-1])%k);}
    else{
      M = max(M,a[i+1]-a[i]);
    }
  }
  
  cout << k-M << endl;
  
  return 0;
}
 

Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"a=b=c=d=e=f=0;g=1;exec('a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3)%(10**9+7);'*int(input()));print(g)\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 4944
#include<bits/stdc++.h>
using namespace std;
long long n,s,a[1000005],p[1000005];
inline long long read()
{
	char ch;
	while((ch=getchar())<'0'||ch>'9'){;}
	long long res=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')
	res=res*10+ch-'0';
	return res;
}
int main(){
	n=read(),s=read();
	for(long long i=1;i<=n;i++)
	{
		a[i]=read(),p[i]=read();
	}
	long long l=1,r=n;
	long long ans=0;
	while(l<=r)
	{
		if(a[l]>=s)
		{
			ans+=a[r]-s;
			break;
		}
		if(a[r]<=s)
		{
			ans+=s-a[l];
			break;
		}
		ans+=a[r]-a[l];
		if(p[l]>=p[r])
		{
			while(p[l]>=p[r]&&l<r)
			{
				p[l]+=p[r];
				r=r-1;
			}	
		}
		else 
		{
			while(p[r]>p[l]&&l<r)
			{
				p[r]+=p[l];
				l+=1;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
} 


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
#define dd double
#define vi vector<int> 
#define li list<int> 
#define pb push_back
 	ll a[200009];
 	ll b[200009];
 	ll c[200009];
 	ll e[200009];
 int main()
 {
 	ll n, q;
 	cin >> n;
 	for(int i = 0; i < n; i++) {cin >> a[i]; e[a[i]]++;}
 		cin >> q;
 	for(int i = 0; i < q; i++)
 	{
 		cin >> b[i];
 		cin >> c[i];
 	}
 	ll sum = 0;
 	for(int i = 0; i < n; i++) sum =sum + a[i];

 	for(int i = 0; i < q; i++)
 	{
 		sum = sum -e[b[i]] *b[i];


 		sum = sum + e[b[i]]*c[i];
 		e[c[i]] += e[b[i]];	

 		e[b[i]] = 0;

 	

 		cout << sum << endl;
 	}

 	return 0;
 }

Measured memory_bytes: 6660
#include <iostream>
using namespace std;

int main(){
  int N, ans = 0, m = 0;
  int fact[101] = {0};
  int f4i = 0, f4 = 0, f14i = 0, f14 = 0, f24i = 0, f24 = 0, f74 = 0;
  int cmb2[31] = {0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435};
  cin >> N;
  for(int i = 1; i <= N; ++i){
    m = i;
    while (m % 2 == 0) {
      fact[2]++;
      m /= 2;
    }
    for (int j = 3; j * j <= m; j += 2) {
      while (m % j == 0) {
        fact[j]++;
        m /= j;
      }
    }
    if (m > 1) fact[m]++;
  }

  for(int i = 2; i <= 100; ++i){
    if(fact[i] >= 74){
      ++f74;
    }
    if(fact[i] >= 24){
      ++f24;
    }else if(fact[i] >= 2){
      ++f24i;
    }

    if(fact[i] >= 14){
      ++f14;
    }else if(fact[i] >= 4){
      ++f14i;
    }

    if(fact[i] >= 4){
      ++f4;
    }else if(fact[i] >= 2){
      ++f4i;
    }
  }
  if(f4 >= 2 && f4 + f4i >= 3){
    ans = cmb2[f4] * (f4 - 2 + f4i);
  }
  if(f14 >= 1 && f14 + f14i >= 2){
    ans += (f14 - 1 + f14i) * (f14);
  }
  if(f24 >= 1 && f24 + f24i >= 2){
    ans += (f24 - 1 + f24i) * (f24);
  }
  if(f74 >= 1){
    ans += f74;
  }

  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;

string f[8];
string str;
int res;

void cicle(int st, int la, int v, int s)
{
    if (v >= 4) {
        if (s == 0) {
            res = st;
            return;
        }
        else
            return;
    }
    else {
        int k;
        for (k = st; k < (st+la)/2; k++)
            f[k] += '-';
        cicle(st, (st+la)/2, v+1, s+(str[v]-'0'));

        for (; k < la; k++)
            f[k] += '+';
        cicle((st+la)/2, la, v+1, s-(str[v]-'0'));

        return;  
    }
}



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> str;

    cicle(0, 8, 1, 7-(str[0]-'0'));

    cout << str[0];
    for (int i = 0; i < 3; i++)
        cout << f[res][i] << str[i+1];
    cout << "=7" << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    ll x;
    cin >> x;
    ll divi=x/11;
    ll rest=x%11;
    if(rest==0){
        P(2*divi);
    }else{
        P(2*divi+(rest>6 ? 2 : 1));
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  int A[N];
  int B[N];
  int C[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  
  sort(A, A+N);
  sort(B, B+N);
  sort(C, C+N);
  
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    long long index1 = lower_bound(A, A+N, B[i]) - A;
    long long index2 = upper_bound(C, C+N, B[i]) - C;
    ans += index1 * (N - index2);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1408