akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;


namespace ABC126
{
    class Program
    {
        static int Main(string[] args)
        {
            ProblemB();
            return 0;
        }

        static void ProblemB()
        {
            int input = int.Parse(System.Console.ReadLine());
            string answer;

            int ba, dc;
            ba = input % 100;
            dc = (input - ba)/100;

            //YYMM
            if(ba <= 12 && ba >= 1)
            {
                if(dc <= 12 && dc >= 1)
                {
                    answer = "AMBIGUOUS";
                }
                else
                {
                    answer = "YYMM";
                }

            }
            //notYYMM
            else
            {
                if(dc <=12 && dc >= 1)
                {
                    answer = "MMYY";
                }
                else
                {
                    answer = "NA";
                }
            }

            Console.WriteLine(answer);
        }

        static int ProblemA()
        {
            string[] K = System.Console.ReadLine().Split(' ');
            string S = System.Console.ReadLine();
            string L = S.ToLower();
            char[] Answer = new char[S.Length];

            for(int i = 0; i < S.Length; i++)
            {
                if(i == int.Parse(K[1])-1)
                {
                    Answer[i] = L[i];
                }
                else
                {
                    Answer[i] = S[i];
                }
            }

            Console.WriteLine(Answer);

            return 0;
        }
    }
}


Measured memory_bytes: 11092
from sys import exit

c = [list(map(int, input().split())) for _ in range(3)]
l_1 = [0, 1, 2]
l_2 = [1, 2, 0]

for i in range(3):
    if not c[l_1[i]][0] - c[l_2[i]][0] == c[l_1[i]][1] - c[l_2[i]][1] == c[l_1[i]][2] - c[l_2[i]][2]:
        print('No')
        exit()
    
    if not c[0][l_1[i]] - c[0][l_2[i]] == c[1][l_1[i]] - c[1][l_2[i]] == c[2][l_1[i]] - c[2][l_2[i]]:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 61992
#include<bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define SFOR(i,a,b) for(int i=a;i<b;i++)
using namespace std;
typedef long long ll;
int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   int n,m,ans[31]={};
   cin>>n>>m;
   int all=0,k,a;
   FOR(i,n){
     cin>>k;
     FOR(j,k){
       cin>>a;
       ans[a-1]++;
       if(ans[a-1]==n) all++;
     }
   }
   cout<<all<<endl;
   return 0;
}


Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll x,a,b,z;
            cin>>x;
            for(a=0;a<=5000;++a)
            {
                for(b=0;b>=-5000;--b)
                {
                    if(a*a*a*a*a-b*b*b*b*b > x)
                        break;
                    if(a*a*a*a*a-b*b*b*b*b == x)
                    {
                        cout<<a<<" "<<b<<endl;
                        return 0;
                    }
                }
                for(b=0;b<=5000;++b)
                {
                    if(a*a*a*a*a-b*b*b*b*b < x)
                        break;
                    if(a*a*a*a*a-b*b*b*b*b == x)
                    {
                        cout<<a<<" "<<b<<endl;
                        return 0;
                    }
                }
            }
        }
        return 0;
    }


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const int MAXN = 200004;
ll N, M, K, a[MAXN], b[MAXN], psa[MAXN], psb[MAXN], ans;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> M >> K;
    for (int i = 1; i <= N; i++){
        cin >>a[i];
        psa[i] += psa[i-1] + a[i];
    }
    for (int i = 1; i <= M; i++){
        cin>>b[i];
        psb[i] += psb[i-1] + b[i];
    }
    psb[M+1] = 0x3f3f3f3f3f3f3f3f;
    for (int i = 0; i <= N; i++) {
        ll maxb = K-psa[i];
        if(maxb<0) break;
        int lo = 1, hi = M+1;
        while(lo<hi){
            int mid = (lo+hi)/2;
            if(psb[mid]<=maxb) lo = mid+1;
            else hi = mid;
        }
        ans = max(ans, i+lo-1LL);
    }
    cout << ans << '\n';
    return 0;
}

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


ll ten (ll x) {
  if (x == 0) {
    return 1;
  }
  else {
    x %= 672;
    ll res = 1;
    for (int i = 0; i < x; i++) {
      res *= 10;
      res %= 2019;
    }
    return res;
  }
}


int main() {
  string S;
  cin >> S;
  ll lon = (ll)(S.length());
  ll Am[2019] = {0};
  Am[0]++;
  ll back = 0;
  ll ans = 0;
  for (ll i = lon - 1; i >= 0; i--) {
    ll X = S[i] - 48;
    ll ag = ((X * ten(lon - 1 - i)) % 2019 + back) % 2019;
    Am[ag]++;
    back = ag;
  }
  for (int i = 0; i < 2019; i++) {
    if (Am[i] >= 2) {
      ans += (Am[i] * (Am[i] - 1)) / 2;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3740
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<set>
#include<cmath>
using namespace std;
typedef vector<int> vi;

const int MX = 7368791;

int main()
{
  bool pri[7400000];
  while(1) 
    {
      int m,n;
      cin >> m >> n;
      if(!m) break;
      for(int i=0;i<=MX;i++) pri[i]=false;
      for(int i=m ;; i++)
	{
	  if(!pri[i])
	    {
	      if(n==0)
		{
		  cout << i << endl;
		  break;
		}
	   
	      else
		{
		  n--;
		  for(int j=i;j<=MX;j+=i)
		    {
		      pri[j]=true;
		    }
		}
	    }
	}
    }
  return 0;
}
      



Measured memory_bytes: 10284
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

const string YES = "Yes";
const string NO = "No";

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    for(ll i = 0; a > 0 && c > 0; ++i){
        if(i % 2 == 0){
            c -= b;
        }else{
            a -= d;
        }
    }
    if(a > 0){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define move(i) for(int i=-1;i<=1;i+=2)
#define WHITE 0
#define GRAY 1 
#define BLACK 2
#define INF 1e9

using namespace std;
using P = pair<int,int>;

int h,w,M[1010][1010],C[1010][1010],D[1010][1010];
queue<P> Q;

int main()
{
    cin>>h>>w;
    rep(i,h){
        rep(j,w){
            char s;
            cin>>s;

            if(s=='.'){
                M[i][j] = 0;
                C[i][j]=WHITE;
                D[i][j]=INF;
            }else{
                M[i][j] = 1;
                C[i][j]=GRAY;
                D[i][j]=0;
                Q.push(make_pair(i,j));
            }
        }
    }

    //BFS
    int last_d=0;
    while(!Q.empty()){
        P p=Q.front(); Q.pop();
        //cout <<"~("<< p.first << "," << p.second << ")~"<<endl;
        move(x){
            int i=p.first+x, j=p.second;
            //cout <<"("<< i << "," << j << ")"<<endl;
            if((i>=0)&&(i<h)&&(j>=0)&&(j<w) ){
                //cout << M[i][j] << "," << C[i][j] << endl;
                if(M[i][j]==0 && C[i][j]==WHITE){
                    C[i][j]=GRAY;
                    last_d=D[i][j]=D[p.first][p.second]+1;
                    Q.push(make_pair(i,j));
                }
            }
        }

        move(y){
            int i=p.first, j=p.second+y;
            //cout <<"("<< i << "," << j << ")"<<endl;
            if((i>=0)&&(i<h)&&(j>=0)&&(j<w) ){
                //cout << M[i][j] << "," << C[i][j] << endl;
                if(M[i][j]==0 && C[i][j]==WHITE){
                    C[i][j]=GRAY;
                    last_d=D[i][j]=D[p.first][p.second]+1;
                    Q.push(make_pair(i,j));
                }
            }
        }

    }

    cout << last_d << endl;


    return 0;
}


Measured memory_bytes: 20368
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0,0 };


int main(void) {
	int n, k, x, y;
	int total = 0;

	cin >> n >> k >> x >> y;

	if (n > k) {
		total += k * x;
		FOR(i, 1, n - k) {
			total += y;
		}
	}
	else {
		total += n * x;
	}

	cout << total << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int b;
		
		int[] open = new int[3];
		
		for(int i = 0; i < 3; i++){
			b = scan.nextInt();
			open[i] = b;
		}
		
		if((open[0] == 1 && open[1] == 1 && open[2] == 0)
			|| open[2] == 1)System.out.println("Open");
		else System.out.println("Close");
	}
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  if (k % 2) {
    cout << b - a << '\n';
  } else {
    cout << a - b << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
n,k,c=map(int,input().split())
s=list(input())

l=[-99999999]
for i in range(n):
  if s[i]=='o':
    if l[-1]+c<i:
      l.append(i)
l=l[1:k+1]

l2=[99999999]
for i in range(n-1,-1,-1):
  if s[i]=='o':
    if l2[-1]-c>i:
      l2.append(i)
l2.reverse()
l2=l2[len(l2)-1-k:len(l2)-1]

for i in range(k):
  if l[i]==l2[i]:
    print(l[i]+1)

Measured memory_bytes: 68424
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)  
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (int (i)=(a); (i)<=(b); ++(i))
#define INF 0xFFFFFF
#define endl '\n'
#define pp printf("Case %d: \n",t)
const unsigned int mod = 1e9+7;
const int mx=1000005;
const int maxInt = 2147483647;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n,m;
    cin >> n >> m;
   ll minn=2019;
   if((m-n)>=2019)cout << 0 << endl;
  else {
  	for(ll i=n;i<=m;++i){
  	for(ll j=i+1;j<=m;++j){
  			minn=min(minn,(i*j)%2019);
  			}
  		}
  cout << minn << endl;
}
return 0;
}
//if((i*j)%2019<2019)

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

ll gcd (ll a, ll b, ll c) {
  return __gcd(a, __gcd(b,c));
}

int main (void) {
  ios::sync_with_stdio(false);cin.tie(0);
  ll n; cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    for (ll j = 1; j <= n; j++) {
      for (ll k = 1; k <= n; k++) {
        ans += gcd(i,j,k);
      }
    }
  }
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 3640
/*
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  for (;;) {
    int n, x;
    cin >> n >> x;
    if (n == 0) break;

    int cnt = 0;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++) {
	int sij = i + j;
	if (sij + j >= x) break;
	for (int k = j + 1; k <= n; k++) {
	  int sijk = sij + k;
	  if (sijk == x) cnt++;
	  if (sijk > x) break;
	}
      }

    printf("%d\n", cnt);
  }
  return 0;
}

Measured memory_bytes: 1144
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
#define iiii pair<pii,int >
#define mp make_pair 
#define INF 100000000000ll
#define MOD 1000000007 
#define MAXN 300010
using namespace std;
 
bool used[MAXN];
ll len[MAXN];
int n,m;
 
vector<iiii >v;
vector<int >S[MAXN];
 
 
int main()
{
	scanf("%d%d",&n,&m);
	if(!m)
	{
		printf("Yes\n");
		return 0;
	}
	
	for(int i=0;i<n;i++)len[i]=INF;
	int x,y,z;
	scanf("%d%d%d",&x,&y,&z);x--;y--;
	
	queue<int>qu;
	qu.push(x);qu.push(y);
	
	len[x]=0;len[y]=1ll*z;
	m--;
	
	for(int i=0;i<m;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);x--;y--;
		v.push_back(mp(mp(x,y),z));
		S[x].push_back(i);
		S[y].push_back(i);
	}
	
 
	int p=0;
	
	while (p<m)
	{
		while (!qu.empty())
		{
			int u=qu.front();
			qu.pop();
			for(int i=0;i<S[u].size();i++)
			{
				int j=S[u][i];
				used[j]=true;
				
				int x=v[j].first.first,y=v[j].first.second,z=v[j].second;
				if(len[x]==INF)
				{
					qu.push(x);
					len[x]=1ll*len[y]-z;
				}
				else if(len[y]==INF)
				{
					qu.push(y);
					len[y]=1ll*len[x]+z;
				}
				else if(len[y]-len[x]!=(ll)(z))
				{
					printf("No\n");
					return 0;
				}	
			
			}	
		}
 
		while (p<m&&used[p])p++;
		
		if(p<m)
		{
			used[p]=true;
			qu.push(v[p].first.first);
			qu.push(v[p].first.second);
			
			len[v[p].first.first]=0ll;
			len[v[p].first.second]=1ll*v[p].second;
			p++;
		}
 
	}
	
	printf("Yes\n");
	
		
	
 
	return 0;	
} 

Measured memory_bytes: 16180
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

struct Coordinate {
	int x;
	int y;
	bool operator < (const Coordinate& c)const {
		return x <= c.x&&y <= c.y;
	}
	bool operator > (const Coordinate& c)const {
		return !(x <= c.x&&y <= c.y);
	}
};

struct Light{
	int num;
	int r;
	int cost;
	bool operator <(const Light& l)const {
		return cost < l.cost;
	}
	bool operator >(const Light& l)const {
		return cost > l.cost;
	}
};

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

	cin >> W >> H >> N;
	vector<Coordinate>v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i].x >> v[i].y;
		v[i].x--;
		v[i].y--;
	}
	vector<vector<int>>dp(N, vector<int>(1001, MOD));
	priority_queue<Light, vector<Light>, greater<Light>>PQ;
	for (int i = 0; i < N; i++) {
		dp[i][v[i].x + v[i].y] = v[i].x + v[i].y;
		PQ.push({ i,v[i].x + v[i].y,v[i].x + v[i].y });
	}
	while (!PQ.empty()) {
		auto box = PQ.top();
		PQ.pop();
		if (box.cost > dp[box.num][box.r]) {
			continue;
		}
		for (int i = 0; i < N; i++) {
			//if (v[box.num] < v[i]) {
				int cost = abs(v[i].x - v[box.num].x) + abs(v[i].y - v[box.num].y) - 1;
				cost -= box.r;
				if (cost >= 0) {
					if (dp[i][cost] > box.cost + cost) {
						dp[i][cost] = box.cost + cost;
						PQ.push({ i,cost,box.cost + cost });
					}
				}
			//}
		}
	}
	int ans = MOD;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= 1000; j++) {
			//if (dp[i][j] != MOD) {
			//	cout << i << " " << j << " " << dp[i][j] << endl;
			//}
			ans = min((long long int)ans, dp[i][j] + max((long long int)0, W - 1 - v[i].x + H - 1 - v[i].y - j));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)

using namespace std;
using p = pair<long long, int>;
#define INF 100000000

int main(){
    long long a,b,c,k;
	cin >> a >> b >> c >> k;
	
    long long ans = 0;
    
    if(a > k) ans+=k;
    else ans+=a;
	k-=a; if(k <= 0){cout << ans << endl; return 0;}
	
	k-=b;
	if(k <= 0){cout << ans << endl; return 0;}
	
	ans+=k*(-1);
	cout << ans << endl;
    return 0;
		
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	int n;
	cin>>n;
	vector<int> a(n), b(n);
	rep(i, n) cin>>a[i];
	rep(i, n) cin>>b[i];

	map<int, int> ma;
	rep(i, n) ma[a[i]]++;
	rep(i, n) ma[b[i]]++;
	bool ok=true;
	for(auto p : ma) if(p.second>n) ok=false;
	if(!ok){
		cout<<"No"<<endl;
		return 0;
	}

	cout<<"Yes"<<endl;
	vector<bool> ac(n, true);
	int l=0, r=0, c=0, d=0;
	for(int i=1; i<=n; i++){
		l=r;
		for(; a[r]==i && r<n; r++);
		c=d;
		for(; b[d]==i && d<n; d++);
		if(l<r && c<d){
			for(int i=(l-(d-1)+n)%n; (c+i)%n!=r%n; i=(i+1)%n) ac[i]=false;
		}
	}

	int e;
	rep(i, n) if(ac[i]){
		e=i;
		break;
	}

	rep(i, n) cout<<b[(-e+i+n)%n]<<" ";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 14284
from math import sqrt


N = int(input())
ans = 0
for d in range(2, int(sqrt(N)) + 1):
    if N % d == 0:
        i = 1
        while N % d**i == 0:
            ans += 1
            N //= d**i
            i += 1
        while N % d == 0:
            N //= d

if N > 1:
    ans += 1
print(ans)

Measured memory_bytes: 9096
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>; //pop_back pop_front push_back push_front front back clear empty
using L = vector<long long>;
using M = map<int,long long>;  //erase  (でキーごと削除) 追加削除検索O(log(N))
using A = vector<vector<long long>>;
using U = unordered_map<int,long long>; //map  (との違いはkeyの順番を保持していない)
using PQL = priority_queue<long long>; //erase  (でキーごと削除) push pop top 
using PQG = priority_queue<long long,L,greater<long long>>; //erase  (でキーごと削除) push pop top 

#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define sortedreverce(vector) sort(vector.rbegin(),vector.rend()) //O(nlongn)
#define vdel(vector,a) vector.erase(vector.begin()+a)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define max max<unsigned long>
#define min min<unsigned long>
#define inf 1000000000000000000+10
#define setans long long ans=0;

long long MOD=1000000007;

template <typename PQ>
long long pqsum(PQ pq){long long tmp=0;while(!pq.empty()){tmp+=pq.top();pq.pop();};return tmp;};

template <typename T>
void print(T a){for (auto b:a){cout<<b<<" ";};cout<<endl;}
template <>
void print(unsigned long a){cout<<a<<endl;}
template <>
void print(char a){cout<<a<<endl;}
template <>
void print(bool a){cout<<a<<endl;}
template <>
void print(long long a){cout<<a<<endl;}
template <>
void print(A a){for (auto b:a){for (auto c:b){cout<<c<<" ";}cout<<endl;};cout<<endl;}
template <>
void print(string a){cout<<a<<endl;}



//存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避
//__gcd(a,b)はコンパイラがGCC時のみ
//printf("%.16f", ans); 誤差落ち対応君

vector<long long> cumsum(vector<long long> numbers){
    for(int i=1  ;i<numbers.size()  ;i++){
        numbers[i]+=numbers[i-1];
    }
    return numbers;
}

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

    long long n;
    setans;

    cin>>n;
    L a(n,0);
    for(long long i=0  ;i<n  ;i++){
        cin>>a[i];
    }

    L b(n,0);
    for(long long i=0  ;i<n  ;i++){
        cin>>b[i];
    }
    
    ans+=vsum(b);
    
    L c(n,0);
    for(long long i=0  ;i<n  ;i++){
        cin>>c[i];
    }
    //print(c);
    for(long long i=0  ;i<n-1  ;i++){
        if (a[i]+1==a[i+1]){
            ans+=c[a[i]-1];
        }
    }
    print(ans);
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
char s[110];
int n, ans, maxn;
int main()
{
    scanf("%d%s", &n, s + 1);
    for(int i = 1; i <= n; i++)
    {
        if(s[i] == 'I') ++ans;
        else --ans;
        maxn = max(maxn, ans);
    }
    printf("%d\n", maxn);
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll r;
    cin >> r;

    cout << 3 * r * r << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#define mem(a,b) memset((a),(b),sizeof(a))
using namespace std;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-12;
const int MAX=1000000+10;
const int EDGE=100000+10;//边的条数
typedef long long ll;
const int mod=1000000000+7;
int main()
{
	ll n,m;
	while(~scanf("%lld%lld",&n,&m))
	{
		if(n>=m/2) printf("%lld\n",m/2);
		else printf("%lld\n",(n*2+m)/4);
	}
	return 0;
}

Measured memory_bytes: 256
class Node:
	def __init__(self):
		self.parent = -1
		self.depth = 0
		self.child = []
		self.type = "internal node"

global nodes

def setDepth(id, depth):
	nodes[id].depth = depth
	for child_id in nodes[id].child:
		setDepth(child_id, depth + 1)

if __name__ == "__main__":
	n = int(input())
	nodes = []
	for _ in range(n):
		nodes.append(Node())
	for _ in range(n):
		table = list(map(int, input().split()))
		id = table[0]
		child_num = table[1]
		for k in range(child_num):
			child_id = table[k + 2]
			nodes[id].child.append(child_id)
			nodes[child_id].parent = id
	for i in range(n):
		if nodes[i].parent == -1:
			nodes[i].type = "root"
			rootid = i
		elif nodes[i].child == []:
			nodes[i].type = "leaf"
	setDepth(rootid, 0)

	for i in range(n):
		print(f"node {i}: parent = {nodes[i].parent}, depth = {nodes[i].depth}, {nodes[i].type}, {nodes[i].child}")	


Measured memory_bytes: 40000
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>      // sqrt
#include <cstdlib>    // exit
#include <algorithm>  // min,max
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)
#define forv(i,m,n) for (int i=(m); i>=(n); i--)
#define forall(it,p) for (auto it = p.begin(); it != p.end(); ++it)
#define R 1000000007
#define DBG 0
typedef pair<int,int> pii;
typedef long long ll;

#define MAXN 100000
int a[MAXN];

int main() {
  int n,m,qqq;
  cin >> n >> m >> qqq;
  vector< vector<int> > sl(n+1);
  forr(i,0,m-1) {
    int l,r;
    cin >> l >> r;
    sl[l].push_back(r);
  }
  forr(i,1,n) sort(sl[i].begin(), sl[i].end());
  if (DBG) forr(i,1,n) {
    cerr << i << ' ' << sl[i].size() << endl;
    int sz = sl[i].size();
    if (sz>0)
      forr(j,0,sz-1) cerr << j << ':' << sl[i][j] << ' ';
    cerr << "sl" << endl;
  }
  forr(qq,1,qqq) {
    int p,q;
    cin >> p >> q;
    int cnt = 0;
    forr(r,p,q) {
      int mn = -1;
      int mx = sl[r].size();
      while(mn+1<mx) {
        int mid = (mn+mx)/2;
        if (sl[r][mid]<=q) mn = mid;
        else mx = mid;
      }
      if (mn>=0)
        cnt += mn+1;
    }
    cout << cnt << endl;
  }

}


Measured memory_bytes: 2176
N = int(input())
if N == 1:
    print("Yes")
    print(2)
    print(1, 1)
    print(1, 1)
elif N == 2:
    print("No")
else:
    for i in range(N):
        if N == i * (i+1)/2:
            Ans = []
            ans =[1]
            for j in range(i-1):
                ans.append(ans[-1]+j+2)
            Ans.append(ans)
            ini, level = 1, 1
            for j in range(1, i+1):
                ans = [ini + k for k in range(level)]
                step, wide, temp = i-j, level, ini+level-1
                while step > 0:
                    ans.append(temp+wide)
                    temp += wide
                    step -= 1
                    wide += 1
                Ans.append(ans)
                ini += level
                level += 1
            print("Yes")
            print(len(Ans))
            for j in range(len(Ans)):
                print(i, " ".join(map(str, Ans[j])))      
            break
    else:
        print("No")

Measured memory_bytes: 12172
#include<iostream>
#include<vector>
#include<string>
#include<cmath>


using namespace std;



int main() {
	int N;

	cin >> N;

	vector<long long> A(N);


	for (int i = 0; i < N; i++) {
		cin >> A[i];

		if (A[i] == 0) {
			cout << "0";
			return 0;
		}
	}

	long long total = 1;
	for (int i = 0; i < N; i++) {
		if (A[i] <= 1000000000000000000/total) {
			total *= A[i];
		}
		else
		{
			cout << "-1";
			return 0;
		}
	}

	cout << total;
}

Measured memory_bytes: 3996
// https://atcoder.jp/contests/abc139/tasks/abc139_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) cin >> H[i];
    reverse(ALL(H));
    int ans = 0, cnt = 0;
    FOR(i, 1, N) {
        if (H[i] < H[i - 1]) {
            ans = max(ans, cnt);
            cnt = 0;
        } else {
            cnt++;
        }
    }
    ans = max(ans, cnt);
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3972
import java.util.PriorityQueue;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n= scan.nextInt();
        int k = scan.nextInt();
        int cnt[] = new int[n];
        for(int i=0;i<n;++i){
            int m = scan.nextInt() -1;
            cnt[m]++;
        }
        PriorityQueue<Integer> que = new PriorityQueue<>();
        for(int i=0;i<n;++i){
            if(cnt[i]>0)que.add(cnt[i]);
        }
        int ans = 0;
        while(que.size() > k)ans += que.poll();
        System.out.println(ans);
    }
}

Measured memory_bytes: 86452
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define next(a) ( ((a)+1)%SIZE )
#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define INF 1000000000
#define SIZE 100000



typedef struct queue
{
	int front;
	int rear;
	int data[200];
}queue;

void init(queue* p)
{
	p->front = 0;
	p->rear = 0;
}

void enqueue(queue *p,int x)
{
	if (next(p->rear) == p->front)
		printf("OVERFLOW!\n");
	p->data[p->rear] = x;
	p->rear = next(p->rear);
}

int dequeue(queue *p)
{
	int x;

	if (p->front == p->rear)
		printf("NO DADA\n");

	x = p->data[p->front];
	p->front = next(p->front);

	return x;
}

int empty(queue *p)
{
	return p->front == p->rear;
}

int main()
{
	int n;
	char str1[101], str2[101];
	int p1 = 0, p2 = 0;

	scanf("%d", &n);

	int i, j;

	for (i = 0; i < n; i++)
	{
		scanf("%s%s", &str1, &str2);

		if (strcmp(str1, str2) > 0)
			p1 += 3;
		else if (strcmp(str1, str2) < 0)
			p2 += 3;
		else
		{
			p1++;
			p2++;
		}
	}

	printf("%d %d\n", p1, p2);

	return 0;
}



Measured memory_bytes: 2048
//Amazing Graze
#include <iostream>
#include <cmath>
//#include <deque>
#include <vector>
#include <algorithm>

using namespace std;

#define ABS(x) ((x)<0 ? -(x) : x)
#define POW(x) ((x)*(x))

struct Mech{
	int x, y;
	int power;
};

struct Bullet{
	int x, y;
	bool operator<(const Bullet& var) const{ return x < var.x; };
};

int AN, BN, R;
//deque<Mech> mech;
//deque<Bullet> bullet;
vector<Mech> mech;
vector<Bullet> bullet;

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

	int totalpower = 0;
	int i = 0;
	Mech tm1 = {};
	Bullet tb1 = {}, tb2 = {};
	//deque<Bullet>::iterator sortbeg, sortend;
	vector<Bullet>::iterator sortbeg, sortend;
	mech.reserve(100000);
	bullet.reserve(100000);
	while (1){
		cin >> AN >> BN >> R;
		if (AN == 0 && BN == 0)break;
		R *= 4;//R4倍
		mech.clear();
		bullet.clear();
		//代入
		for (i = 0; i < AN; ++i){
			cin >> tm1.x >> tm1.y;
			tm1.power = 0;
			mech.push_back(tm1);
		}
		/*//xソートしながら
		cin >> tb1.x >> tb1.y;
		bullet.push_back(tb1);
		for (i = 1; i < BN; ++i){
			cin >> tb1.x >> tb1.y;
			if(bullet.back() < tb1)bullet.push_back(tb1);
			else bullet.push_front(tb1);
		}*/
		for (i = 0; i < BN; ++i){
			cin >> tb1.x >> tb1.y;
			bullet.push_back(tb1);
		}
		sort(bullet.begin(), bullet.end());
		//戦闘力計算
		totalpower = 0;
		for (i = 0; i < AN; ++i){//各戦闘機について
			//Xソートで範囲確認
			tb1.x = mech[i].x - R; tb2.x = mech[i].x + R;
			if ( tb1.x > 0 )sortbeg = lower_bound(bullet.begin(), bullet.end(), tb1);
				else sortbeg = bullet.begin();
			if (sortbeg == bullet.end())continue;
			sortend = upper_bound(sortbeg, bullet.end(), tb2);
			for (; sortbeg != sortend; ++sortbeg){
				if (ABS(mech[i].y - sortbeg->y) > R)continue;
				if (POW(mech[i].x - sortbeg->x) + POW(mech[i].y - sortbeg->y) <= POW(R)){
					++mech[i].power;
				}
			}
			totalpower += mech[i].power;
		}

		cout << totalpower << endl;
	}

	return 0;
}

Measured memory_bytes: 3124
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w,a,b=map(int,input().split())
    S=[]
    for i in range(b):
        S.append("1"*a+"0"*(w-a))
    for i in range(h-b):
        S.append("0"*a+"1"*(w-a))   
    for i in range(h):
        print(S[i])

if __name__=='__main__':
    main()

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

int points(int dp[][3], int a[], int b[], int c[], int n)
{
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 1; i < n; i++)
    {
        dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
    }
    return max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));
}

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] >> b[i] >> c[i];
    }
    int happ[n][3];
    cout << points(happ, a, b, c, n);
    return 0;
}

Measured memory_bytes: 5964
def area(a,b):
  return (a.real*b.imag-a.imag*b.real)/2

q=int(input())

A=[]
for _ in range(q):
  x,y=map(int,input().split())
  A.append(x+y*1j)

S=0.0
for i in range(1,q-1):
  S+=area(A[i]-A[0],A[i+1]-A[0])

print("{:.1f}".format(S))


Measured memory_bytes: 5632
#include <cstdio>
#include <cmath>

int main(){
  double v;
  while(~scanf("%lf",&v)){
    double y = v*v/19.6;
    for(int i=1;;i++)
      if(5*i-5>y){
	printf("%d\n",i);
	break;
      }
  }
}

Measured memory_bytes: 1056
#include<bits/stdc++.h>
using namespace std;
#define maxn 10010
typedef long long ll;
typedef long double ld;
const ll inF=1e18;
int a,b,c,d;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while (a>0&&c>0) {
        c-=b;
        if (c<=0) {cout << "Yes";exit(0);}
        a-=d;
        if (a<=0) {cout << "No";exit(0);}
    }
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long 
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
const ll mod=998244353;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> data_struct;

int main()
{
	string s;
	cin>>s;
	if(s=="ABC")
		cout<<"ARC";
	else
		cout<<"ABC";
}

Measured memory_bytes: 3596
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		if(N==1){
			Console.WriteLine(A[0]);
			return;
		}
		
		int NN=900;
		bool[][] dp=new bool[NN][];
		for(int i=0;i<NN;i++)dp[i]=new bool[NN];
		
		dp[0][0]=true;
		int tot=0;
		for(int t=0;t<N;t++){
			for(int i=NN-1;i>=0;i--){
				for(int j=NN-1;j>=0;j--){
					if(dp[i][j]==false)continue;
					int a=i;
					int b=j;
					int c=tot-i-j;
					
					int[] aa;
					aa=new int[]{a+A[t],b,c};
					Array.Sort(aa);
					if(aa[1]<NN)dp[aa[0]][aa[1]]=true;
					aa=new int[]{a,b+A[t],c};
					Array.Sort(aa);
					if(aa[1]<NN)dp[aa[0]][aa[1]]=true;
					aa=new int[]{a,b,c+A[t]};
					Array.Sort(aa);
					if(aa[1]<NN)dp[aa[0]][aa[1]]=true;
				}
			}
			tot+=A[t];
		}
		
		
		int min=(int)1e9;
		for(int i=0;i<NN;i++){
			for(int j=0;j<NN;j++){
				if(dp[i][j]==false)continue;
				int a=i;
				int b=j;
				int c=tot-i-j;
					
				int[] aa;
				aa=new int[]{a,b,c};
				min=Math.Min(min,aa.Max());
			}
		}
		
		Console.WriteLine(min);
		
		
		
	}
	
	
	int N;
	int[] A;
	public Sol(){
		N=ri();
		A=new int[N];
		
		for(int i=0;i<N;i++)A[i]=ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

Measured memory_bytes: 11484
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v <= w:
  print('NO')
else:
  diff_start = abs(b - a)
  diff_speed = v - w
  if diff_start <= diff_speed*t:
    print("YES")
  else:
    print("NO")

Measured memory_bytes: 9184
#include<iostream>
#include<string>
#include<vector>
 
using namespace std;
 
int main() {
	int x[3];
	cin >> x[0] >> x[1] >> x[2];
	int s5 = 0, s7 = 0;
	for (int i = 0; i < 3; i++)
	{
		if (x[i] == 5)s5++;
		if (x[i] == 7)s7++;
	}
	if (s5 == 2 && s7 == 1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    res = 0
    for i in range(n):
        if A[A[i] - 1] == i + 1:
            res += 1

    print(res // 2)


if __name__ == '__main__':
    resolve()


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const int MOD = 1e9 + 7;

long long fact[1000005], inv[1000005], power[1000005];

long long inverse(long long a) {
    long long ret = 1;
    for (int b=MOD-2; b>0; b/=2) {
        if (b % 2) ret = ret * a % MOD;
        a = a * a % MOD;
    }
    return ret;
}

long long choose(int n, int k) {
    return fact[n] * inv[k] % MOD * inv[n-k] % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    fact[0] = inv[0] = power[0] = 1;
    for (int i=1; i<=n; i++) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = inverse(fact[i]);
        power[i] = power[i-1] * 8 % MOD;
    }

    long long ret = 0, tot = 1;
    for (int i=1; i<=n; i++) {
        ret += choose(n, i) * power[n-i] % MOD;
        if (ret >= MOD) ret -= MOD;
        tot = tot * 10 % MOD;
    }
    cout << ((tot - 2 * ret - power[n]) % MOD + MOD) % MOD << "\n";

    return 0;
}


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

int main(){
  int X,Y;
  cin >>X >>Y;

  bool answer=false;
  
  for(int t=0; t<=50; t++){
    for(int k=0; k<=25; k++){
      if(X==t+k && Y==t*2+k*4){answer=true;}
    }
  }
  
  if(answer){cout << "Yes" <<endl;}
  else {cout << "No" <<endl;}
}

Measured memory_bytes: 3632
def main():
    a, b, c = map(int, input().split())

    num_5 = 0
    num_7 = 0

    if a == 5:
        num_5 += 1
    if b == 5:
        num_5 += 1
    if c == 5:
        num_5 += 1

    if a == 7:
        num_7 += 1
    if b == 7:
        num_7 += 1
    if c == 7:
        num_7 += 1

    if num_5 == 2 and num_7 == 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
def main():
    N, M, X = list(map(int, input().split()))
    C = []
    A = []
    for _ in range(N):
        c, *a = list(map(int, input().split()))
        C.append(c)
        A.append(a)
    INF = 10 ** 9
    r = INF
    for pat in range(2 ** N):
        m = [sum(A[i][j] for i in range(N) if pat & (1 << i)) for j in range(M)]
        if not all(i >= X for i in m):
            continue
        c = sum(C[i] for i in range(N) if pat & (1 << i))
        r = min(r, c)
    return -1 if r == INF else r

print(main())


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

int main() {
    int r, d, x2000;
    cin >> r >> d >> x2000;
    
    int ans = 0;
    int x = x2000;
    for(int i  = 0; i < 10; i++) {
        x = r * x - d;
        cout << x << endl;
    }
}


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

int main() {
	char a;
	cin >> a;

	if (a == 'a' || a == 'b' || a == 'b' || a == 'd' ||
		a == 'e' || a == 'f' || a == 'g' || a == 'h' ||
		a == 'i' || a == 'j' || a == 'k' || a == 'l' ||
		a == 'm' || a == 'n' || a == 'o' || a == 'p' ||
		a == 'q' || a == 'r' || a == 's' || a == 't' ||
		a == 'u' || a == 'v' || a == 'w' || a == 'x' ||
		a == 'y' || a == 'z' ) {
		cout << 'a' << endl;
	}
	else {
		cout << 'A' << endl;
	}
}

Measured memory_bytes: 3556
//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

typedef long long            ll;
typedef long double          ld;
typedef string               str;
typedef pair < ll , ll >     pll;

#define X               first
#define Y               second
#define pb              push_back
#define sep             ' '
#define endl            '\n'
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define dbl_io(x)       cout << fixed << setprecision(x);

const int N = 3;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 10;

ll a[N][N], mark[N][N];

int main(){
    fast_io
    //dbl_io(10);
    for (ll i = 0; i < 3; i ++)
        for (ll j = 0; j < 3; j ++)
            cin >> a[i][j];
    ll n;
    cin >> n;
    for (ll i = 0; i < n; i ++){
        ll x;
        cin >> x;
        for (ll j = 0; j < 3; j ++)
            for (ll k = 0; k < 3; k ++)
                if (a[j][k] == x)
                    mark[j][k] = 1;
    }
    ll ans = 0;
    for (ll i = 0; i < 3; i ++){
        ll f = 1;
        for (ll j = 0; j < 3; j ++){
            if (!mark[i][j])
                f = 0;
        }
        if (f)
            ans = 1;
    }
    for (ll j = 0; j < 3; j ++){
        ll f = 1;
        for (ll i = 0; i < 3; i ++){
            if (!mark[i][j])
                f = 0;
        }
        if (f)
            ans = 1;
    }
    if (mark[0][0] && mark[1][1] && mark[2][2])
        ans = 1;
    if (mark[0][2] && mark[1][1] && mark[2][0])
        ans = 1;
    cout << (ans ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    cout << (n >= 1000 ? "ABD" : "ABC") << endl;

    return 0;
}


Measured memory_bytes: 256
A,B=map(int,input().split())
tmp=0

if A%2==1 and B%2==1:
  tmp=(B-A)/2%2
  if tmp%2==1:
    print(A-1)
  else:
    print(A)
elif A%2==1 and B%2==0:
  A2=bin(A)[2:]
  B2=bin(B)[2:]
  A2="0"*(len(B2)-len(A2))+A2
  C="0"*len(A2)
  for i in range(len(A2)):
    if A2[i:i+1]!=B2[i:i+1]:
      C=C[:i]+"1"+C[i+1:]
  C=int(C,2)
  tmp=(B-1-A)/2%2
  if tmp%2==1:
    print(C-1)
  else:
    print(C)
elif A%2==0 and B%2==1:
  tmp=(B+1-A)/2%2
  if tmp%2==1:
    print("1")
  else:
    print("0")
elif A%2==0 and B%2==0:
  tmp=(B-A)/2%2
  if tmp%2==1:
    print(B+1)
  else:
    print(B)

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

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define ll long long
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 2e5+10;
const int inf = 1e9+7;

string s;
ll k;

int main() {
    cin >> s >> k;
    for(int i = 0; i < sz(s); i++) {
        if(s[i] == '1' && k <= i + 1) {cout << 1 << endl;return 0;}
        if(s[i] != '1') {cout << s[i] << endl;return 0;}
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N, sum = 0, price, max = 0;

  cin >> N;

  for(int i = 0; i < N; i++){
    cin >> price;
    sum += price;
    if(price > max){
      max = price;
    }
  }

  cout << sum - max / 2 << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;
using ping = pair<ll, ll>;

int main() {
  string N;
  cin >> N;
  if(N[N.size() - 1]=='3'){
    cout << "bon" << endl;
  }
  else if(N[N.size() - 1]=='0' || N[N.size() - 1]=='1' || N[N.size() - 1]=='6' || N[N.size() -1] == '8'){
    cout << "pon" << endl;
  }
  else{
      cout << "hon" << endl;
  }
  return 0;
}

Measured memory_bytes: 3572
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<cstdlib>
#include<time.h>
#include<math.h>
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define repp(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsign long long
#define ms(x,a) memset(x,a,sizeof(x))
#define lowbit(x) ((x)&(-x))
#define gcd(a,b) __gcd(a,b)
#define inf 0x3f3f3f3f
#define eps 1e-8
#define mod 1e9+7
#define sd(x) scanf("%d",&x)
#define pd(x) printf("%d\n",x)
using namespace std;
const int maxn=2e5+10;
const double pi=acos(-1.0);
struct Time{
	ll a,b;
}ss[maxn];
bool cmp(Time x,Time y){
	if(x.b<y.b)return true;
	else return false;
}
int main() 
{
	int n;sd(n);
	rep(i,1,n){
		scanf("%lld%lld",&ss[i].a,&ss[i].b);
	}
	sort(ss+1,ss+1+n,cmp);
	ll sum=0;
	rep(i,1,n){
		sum+=ss[i].a;
		if(sum>ss[i].b){
			printf("No\n");return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main()
{
	int r, c;
	cin >> r >> c;
	long A[1001][1001], B[1002][1002];
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			cin >> A[i][j];
			B[i][j] = A[i][j];
			B[i][c] += B[i][j];
			B[r][j] += B[i][j];
		}
		B[r][c] += B[i][c];
	}

	for (int i = 0; i <= r; i++)
	{
		for (int j = 0; j <= c; j++)
		{
			if (j > 0)
				cout << " ";
			cout << B[i][j];
		}
		cout << "\n";
	}
}




Measured memory_bytes: 3992
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int a, b;
    cin >> a >> b;
    if (a > 0) cout << "Positive" << endl;
    else if (b < 0) {
        if ((b-a+1) % 2 == 1) cout << "Negative" << endl;
        else cout << "Positive" << endl;
    }
    else cout << "Zero" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using vvll = vector<ll, vector<ll> >;
using vll = vector<ll> ;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main() {
    fastio();

    int N;
    cin >> N;
    vector<ll> VEC(N, 0);
    for(int i = 0;i < N;i ++) {
        cin >> VEC[i];
    }
    ll ANS = 0;
    for(int i = 0;i < N;i ++) {
        for(int j = 0;j < i;j ++) {
            ANS += VEC[i] * VEC[j];
        }
    }
    cout << ANS << "\n";
    
}

Measured memory_bytes: 256