akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL a, b;
    cin >> a >> b;
    vector<LL> da = Div(a);
    vector<LL> db = Div(b);

    set<LL> st;
    for(int i = 0; i < da.size(); ++i) {
        st.insert(da[i]);

    }

    vector<LL> d;
    for(int i = 0; i < db.size(); ++i) {
        int s = st.size();
        st.insert(db[i]);
        if(s == st.size()) {
            d.pb(db[i]);

        }
    }

    int res = d.size();
    for(int i = 0; i < d.size(); ++i) {
        bool f = true;
        for(int j = 1; j < i; ++j) {
            if(d[i] % d[j] == 0) {
                f = false;
                break;

            }
        }
        if(!f) --res;
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String cards;
			String str;
			int h;
			String begin;
			String end;
			while (!(cards = reader.readLine()).equals("-")) {
				str = reader.readLine(); 
				int m = Integer.parseInt(str);
				for (int i = 0; i < m; i++) {
					str = reader.readLine();
					h = Integer.parseInt(str);
					begin = cards.substring(0, h);
					end = cards.substring(h, cards.length());
					cards = end.concat(begin);
				}
				System.out.println(cards);
			}
				
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

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

int main(){
    vector<int> a(3);
    for (int i=0;i<3;i++){
        cin>>a.at(i);
    }
    sort(a.begin(),a.end());

    bool flag= false;
    if(a.at(0)+a.at(1)==a.at(2)){
        flag = true;
    }
    
    if(flag == true){
        cout<<"Yes"<<endl;
    }else if(flag ==false) {
        cout<<"No"<<endl;
    }
}

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


int main() {
  int c[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> c[i][j];
    }
  }
  
  if (c[2][0]-c[1][0] == c[2][1]-c[1][1] && c[2][1]-c[1][1] == c[2][2]-c[1][2] && c[1][0]-c[0][0] == c[1][1]-c[0][1] && c[1][1]-c[0][1] == c[1][2]-c[0][2]) {
    cout << "Yes" << endl;
  } else {cout << "No" << endl;}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
  
}

P dequeue(){
  P x = Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){
  return a<b ? a:b;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head=1;
  tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t-= c;
    elaps+=c;
    if(u.t>0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);

    }


  }
  
  return 0;
}



Measured memory_bytes: 11852
#include <iostream>
#include <string>
using namespace std;
string s;
int main() {
	cin >> s;
	for(int i=0;i<s.length()/2;i++){
		if(s[i]!=s[s.length()-1-i]){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define mid l+(r-l)/2
#define f first
#define s second
#define oo 1e9
#define pi acos(-1)
#define OO 1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n,k,Max,gcd,x;
int main(){
    Hossam_Yehia;
    cin >> n >> k;
    while(n--)
        cin >> x,gcd=__gcd(x,gcd),Max=max(Max,x);
    if(k<=Max&&k%gcd==0)cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
    re 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~

N = int(input())

S = [input().rstrip() for i in range(N)]

ans = 0

for i in range(N):
    for j in range(len(S[i]) - 1):
        if S[i][j] == 'A' and S[i][j + 1] == 'B':
            ans += 1

a = 0
b = 0
ba = 0

for i in range(N):
    if S[i][0] == 'B' and S[i][-1] == 'A':
        ba += 1
    elif S[i][0] == 'B' and S[i][-1] != 'A':
        b += 1
    elif S[i][0] != 'B' and S[i][-1] == 'A':
        a += 1

exist = False

if a > 0 or ba > 0:
    exist = True
    if a > 0:
        a -= 1
    elif ba > 0:
        ba -= 1

if exist:
    ans += ba
    if b > 0:
        b -= 1
        ans += 1
    ans += min(a, b)

print(ans)


Measured memory_bytes: 45912
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n); i >= 0; i--)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	int j, k, l;
	cin >> j >> k >> l;
	cout << (((k * 10 + l) % 4 == 0) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#include <vector>
int main() {
  int c=0, max=0;
string s;
cin>>s;
for(int i=0 ; i<s.size() ; i++)
{
  if(s[i]=='A' or s[i]=='C' or s[i]=='G'
   or s[i]=='T')
   {
     c++;
     if(max<c)
     max=c;
   }
  else 
  c=0;
}

 cout<<max;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int mx = 10e8;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int H, N;
  cin >> H >> N;
  vector<int> dp(H + 5, mx);
  vector<P> A(N);
  REP(i, N) cin >> A[i].first >> A[i].second;
  dp[0] = 0;
  for (int i = 0; i < H; i++) {
    if (dp[i] == mx) continue;
    REP(j, N) {
      if (i + A[j].first <= H) {
        chmin(dp[i + A[j].first], dp[i] + A[j].second);
      } else {
        chmin(dp[H], dp[i] + A[j].second);
      }
    }
  }
  cout << dp[H] << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>

int main(void) {
    int N, buf;
    int Alice = 0, Bob = 0;
    std::vector<int> cards;

    std::cin >> N;

    cards.reserve(N);
    for(int i = 0; i < N; i++) {
        std::cin >> buf;
        cards.push_back(buf);
    }

    std::sort(cards.begin(), cards.end(), std::greater<int>());

    for(int i = 0; i < N; i++) {
        if(i & 1)
            Bob += cards[i];
        else
            Alice += cards[i];
    }

    std::cout << (Alice - Bob) << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

double dot(P a,P b){return real(conj(a)*b);}
double cross(P a,P b){return imag(conj(a)*b);}

int main(){
  int a[255];
  a['I'] = 1;
  a['V'] = 5;
  a['X'] = 10;
  a['L'] = 50;
  a['C'] = 100;
  a['D'] = 500;
  a['M'] = 1000;
  char s[1010];
  while(~scanf("%s",s)){
    int bef = 114514;
    int res = 0;
    int iter = -1;
    while(s[++iter] != '\0'){
      int now = a[s[iter]];
      if(now > bef) res -= bef*2;
      res += now;
      bef = now;
    }
    cout<<res<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
n, x, m = map(int, input().split())

ans = []
flag = False
for i in range(n):
    if x in ans:
        v = x
        flag = True
        break
    ans.append(x)
    x = x**2 % m
if flag:
    p = ans.index(v)
    l = len(ans) - p
    d, e = divmod(n-p, l)
    print(sum(ans[:p]) + d*sum(ans[p:]) + sum(ans[p:p+e]))
else:
    print(sum(ans))


Measured memory_bytes: 68432
#include <iostream>
#include <vector>
#include <set>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.rps", "r", stdin );

	enum { WIN = 1, LOSE = 2, DRAW = 3 };
	enum { ROCK = 0, SISSOR = 1, PAPER = 2};
	int n;
	int i, j;

	while (1){

		vector <int> winlose (5, 0 );
		vector <int> res (5, 0 );
		set <int> hand;

		for (i = 0; i < 5; ++i ){
			cin >> n;

			if (n == 0){
				goto end;
			} // end if

			winlose[i] = n - 1; // 0: rock 1: sissor 2: paper
			hand.insert (winlose[i] );		
		} // end for

		if (hand.size() == 1 || hand.size() == 3 ){
			for (i = 0; i < 5; ++i){
				res[i] = DRAW;
			} // end for
		}else{
			vector <bool> h (3, false );
			set <int>::iterator it = hand.begin();
			for (; it != hand.end(); ++it ){
				h[(*it)] = true;
			} // end for
			for (j = 0; j < 3; ++j){	
				if (!h[j]){	// without hand;
					for (i = 0; i < 5; ++i){
						switch(j){
							case ROCK:
								res[i] = ( winlose[i] == SISSOR ? WIN : LOSE);					break;
							case SISSOR:
								res[i] = ( winlose[i] == PAPER ? WIN : LOSE);					break;
							case PAPER:
								res[i] = ( winlose[i] == ROCK ? WIN : LOSE);					break;
						} // end switch
					} // end for
					break;
				} // end if
			} // end for
		} // end for

		for (i = 0; i < 5; ++i){
			cout << res[i] << endl;
		} // end for
	} // end loop
end:		
	return 0;
}

Measured memory_bytes: 0
n = int(raw_input())

# for 2n number of skewers
skewers = [int(i) for i in raw_input().split(' ')]
index_done = []
numbers = []

foodusage = 0

# do all items which have the same numbers first
for i in range(len(skewers) - 1):
    for j in range(i + 1, len(skewers)):
        if( skewers[i] == skewers[j] and index_done.count(i) == 0 and index_done.count(j) == 0):
            foodusage = foodusage + skewers[i]
            numbers.append(skewers[i])
            # print foodusage
            index_done.append(i)
            index_done.append(j)

            # print index_done

# remove all done indexes from the list
for x in range(len(numbers)):
    del skewers[skewers.index(numbers[0])]
    del skewers[skewers.index(numbers[0])]
    del numbers[0]

# print skewers

# then do all items which are odd, look for the largest value and the next largest value
while(len(skewers) != 0):
    # find largest item and remove it from the list
    current_max = max(skewers)
    skewers.remove(current_max)

    next_max = max(skewers)
    skewers.remove(next_max)

    foodusage = foodusage + next_max
    

print foodusage

Measured memory_bytes: 2696
#include<stdio.h>
#include<string.h>

int main(void){
    char s[100000] = {'\0'};
    int i;
    gets(s);

    for ( i = 0; s[i] != '\0'; i++ ) {
        if ( i % 2 == 0 ) {
            putchar(s[i]);
        }
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
			int sh=sc.nextInt();
			int sm=sc.nextInt();
			int ss=sc.nextInt();
			int gh=sc.nextInt();
			int gm=sc.nextInt();
			int gs=sc.nextInt();
			int zan=(gh*3600+gm*60+gs)-(sh*3600+sm*60+ss);
			pl(zan/3600+" "+(zan%3600)/60+" "+zan%60);
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}


Measured memory_bytes: 26112
#include <iostream>
using namespace std;
int N;
int A[200005];
int l,r,xo;
long long rez;//Long Long
int main()
{cin >> N;
for(int i = 1;i <= N;i++){
cin >> A[i];}
l = 1;
xo = 0;
for(int r = 1;r <= N;r++){
while(xo & A[r]){
xo ^= A[l];
l++;}
xo ^= A[r];//While循环 
rez += r - l + 1;}
cout << rez;
return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int sum = 0;
		for (int i = 1; i < b - a; i++) {
			sum += i;
		}
		System.out.println(sum - a);
	}
}


Measured memory_bytes: 21844
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
    n,k,q=map(int,input().split())
    S=[0]*n
    for _ in range(q):
        S[int(input())-1]+=1
    for i in range(n):
        print('Yes' if k>q-S[i] else 'No')


resolve()

Measured memory_bytes: 46940
#include<bits/stdc++.h>
#define U [7<<15]={}
#define G )+((c=A[a]+A[P[a]]+C[a])%k?c:0)-M(
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c;char s U;L M(L f){return f?B[f]+M(f^f&-f):0;}L S(L a,L i){for(a=M(i++G i);i<2e5;i+=i&-i)B[i]+=a;}L D(L f){L d;Z[f]=1;for(map<L,L>::iterator I=T[f].begin();I!=T[f].end();I++)d=I->first,!Z[d]?P[d]=f,E[d]=E[f]+1,C[d]=I->second,D(d),Z[f]+=Z[d],!H[f]|Z[H[f]]<Z[d]?H[f]=d:0:0;}L K(L f){a=X[f];n=X[b];return a-n?M(O[E[a]<E[n]?a=n,n=b,b=f,n:f]G O[a])+K(P[a]):abs(M(O[f])-M(O[b]));}main(){for(cin>>n>>k;--n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;for(D(a=b=0);n<*Z;a=H[P[++n]]-n?n:0)for(;!b|a;S(a=H[a],O[a]=++b))X[a]=n;for(cin>>a;cin>>s>>a>>b;S(H[a],O[a]),S(a,O[a]-1))*s&2?cout<<K(a)<<endl,0:A[a]+=b;}

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

using namespace std;

// xのn乗のmodでのmodを返す

long long int modpow(long long int x,long long int n,long long int mod){
    long long int res = 1;
    while(n>0){
        if(n&1){
            res = (res*x)%mod;
        }
        x = (x*x)%mod;
        n >>= 1;
    }
    return res;
}

int main(){
    long long int ans=1,div=1,X,Y,movesum,Ymove;
    cin >> X >> Y;

    Ymove = (2*Y-X)/3;

    movesum = (X+Y)/3;

    if((X+Y)%3!=0 || 2*X<Y || 2*Y<X){
        cout << 0 << endl;
        return 0;
    }

    for(int i=0;i<min(movesum-Ymove,Ymove);i++){
        ans *= movesum-i;
        ans %= 1000000007;
        div *= min(movesum-Ymove,Ymove)-i;
        div %= 1000000007;
    }

    ans *= modpow(div,1000000005,1000000007);

    cout << ans%1000000007 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>

using namespace std;

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

    stack<char> st;
    for (auto x : s) {
        if (st.empty()) st.push(x);
        else if (x == 'S') st.push(x);
        else if (st.top() == x) st.push(x);
        else st.pop();
    }
    cout << st.size() << endl;

    return 0;
}


Measured memory_bytes: 644
#include<stdio.h>

#define M 100
#define whi 0
#define gra 1
#define bla 2
#define INF 10000

int n;
int T[M][M];

int prim(void){
  int i;
  int min,u,sum=0;
  int color[M],d[M];

  for(i=0; i<n; i++){
    color[i] = whi;
    d[i] = INF;
  }

  d[0] = 0;

  while(1){
    min = INF;
    for(i=0; i<n; i++){
      if(color[i] != bla && d[i] < min){
	min = d[i];
	u = i;
      }
    }
    
    if(min == INF) break;

    color[u] = bla;

    for(i=0; i<n; i++){
      if(color[i] != bla && T[u][i] != -1){
	if(T[u][i] < d[i]){
	  d[i] = T[u][i];
	  color[i] = gra;
	}
      }
    }
  }

  for(i=0; i<n; i++){
    sum += d[i];
  }
  
  return sum;
}

int main(){
  int i,j;
  
  scanf("%d",&n);

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d",&T[i][j]);
    }
  }

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



Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 0; i < (n) + 1; i++)
#define all(a) (a).begin(), (a).end()
typedef long long int ll;
using namespace std;

// ABC085C
int main()
{
    int n, y;
    cin >> n >> y;

    bool lie = true;
    rep1(i, y / 10000) {
        int y_ = y - i * 10000;
        rep1(g, y_ / 5000) {
            int y__ = y_ - g * 5000;
            int s = y__ / 1000;
            if (i + g + s == n) {
                cout << i << " " << g << " " << s << endl;
                lie = false;
            }
            if (!lie) break;
        }
        if (!lie) break;
    }

    if (lie) cout << "-1 -1 -1" << endl;

    return 0;
}

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

using namespace std;

int main()
{
    long long x;
    long long sum = 100;
    long long cnt = 0;
    cin >> x;
    while(sum < x){
        sum = sum + (sum / 100);
        cnt++;
    }
    cout << cnt << endl;

    return 0;

}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e6 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	char c;cin>>c;
	if(isupper(c)) cout<<"A\n";
	else cout<<"a\n";
	return 0;
}

Measured memory_bytes: 3580
n = int(input())
l = [[0, 0, 0]]
for _ in range(n):
    l.append(list(map(int, input().split())))
flag = 1

def move(time, x, y):
    for t_x in range(time+1):
            for ue in range(t_x+1):
                if (2*ue-t_x)==x:
                    for migi in range(time-t_x+1):
                        if (2*migi-time+t_x)==y:
                            return 1
    return 0

for i in range(n):
    time = l[i+1][0] - l[i][0]
    x = l[i+1][1] - l[i][1]
    y = l[i+1][2] - l[i][2]
    if not move(time, x, y):
        flag = 0
        break

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 27324
S = gets.to_s

int = S.scan(/.{1,#{2}}/)

if int[0].to_i.between?(1, 12) & int[1].to_i.between?(1, 12)
  puts 'AMBIGUOUS'
elsif !int[0].to_i.between?(1, 12) & !int[1].to_i.between?(1, 12)
  puts 'NA'
elsif !int[0].to_i.between?(1, 12) & int[1].to_i.between?(1, 12)
  puts 'YYMM'
else
  puts 'MMYY'
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#define MAXSIZE 101
#define PI 3.141592653589
using namespace std;
int main(){
  double a,b,c;
  std::cin >> a>>b>>c;
  printf("%.8f\n",a*b*sin(c*PI/180)/2);
  printf("%.8f\n",a+b+sqrt(a*a+b*b-2*a*b*cos(c*PI/180)));
  printf("%.8f\n",a*b*sin(c*PI/180)/a);

}

Measured memory_bytes: 3348
n = int(input())
a_ls = list(map(int, input().split()))
n_4k = 0
n_2k = 0
n_odd = 0
for i in range(n):
    if a_ls[i] % 4 ==0:
        n_4k += 1
    elif a_ls[i] % 2 ==0:
        n_2k += 1
    else:
        n_odd += 1
res = 'No'
if n_odd == 0:
    res = 'Yes'
else:
    if n_2k > 0:
        if n_odd <= n_4k:
            res = 'Yes'
    else:
        if n_odd <= n_4k+1:
            res = 'Yes'
print(res)

Measured memory_bytes: 19876
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	int N;
	cin>>N;
	for(int i=0;i<=N/4+1;i++){
		for(int j=0;j<=N/7+1;j++){
			if(i*4+j*7==N){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#include<stdio.h>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<stack>
#define maxm 10000005
#define maxn 800005
#define MB 1e9
using namespace std;
int pre[maxm],to[maxm],las[maxn],in[maxn],dfn[maxn],low[maxn],be[maxn],inc,scc,t;
int mem[maxn];
stack<int> st;
struct node{int a,b;}d[maxn],ha[maxn];
bool operator <(node a,node b){return a.a==b.a?a.b<b.b:a.a<b.a;}
void ins(int a,int b){pre[++inc]=las[a],las[a]=inc,to[inc]=b;}
void Tarjan(int x)
{
    in[x]=1;
    dfn[x]=low[x]=++t;
    st.push(x);
    for(int i=las[x];i;i=pre[i])
    {
        int y=to[i];
        if(!dfn[y]) Tarjan(y),low[x]=min(low[x],low[y]);
        else if(in[y]) low[x]=min(low[x],dfn[y]);
    }
    if(dfn[x]!=low[x])return;
    ++scc;
    while(1)
    {
        int u=st.top();
        st.pop(),in[u]=0,be[u]=scc;
        if(u==x) return;
    }
}
int ls[maxn],rs[maxn],tot=1,n;
int id[maxn],md,cnt=0;
void reset()
{
    for(int i=1;i<=2*n+tot;i++) dfn[i]=in[i]=0,las[i]=mem[i];
    scc=t=0,inc=md;
    while(!st.empty()) st.pop();
}
void connect(int p,int l,int r,int x,int y,int fr)
{
    if(!p) return;
    if(x<=l&&r<=y) {ins(fr,p+2*n);return;}
    int mid=(l+r)>>1;
    if(x<=mid&&y>=l) connect(ls[p],l,mid,x,y,fr);
    if(y>mid&&x<=r) connect(rs[p],mid+1,r,x,y,fr);
}
int solve(int range)
{
    for(int i=1;i<=n;i++)
    {
        int pos=id[i+n];
        int l=lower_bound(ha+1,ha+cnt+1,(node){d[i].b-range+1,0})-ha;
        int r=lower_bound(ha+1,ha+cnt+1,(node){d[i].b+range-1,0})-ha;
        if(ha[r].a>d[i].b+range-1) r--;
        if(pos>l) connect(1,1,cnt,l,pos-1,i);
        if(pos<r) connect(1,1,cnt,pos+1,r,i);

        pos=id[i];
        l=lower_bound(ha+1,ha+cnt+1,(node){d[i].a-range+1,0})-ha;
        r=lower_bound(ha+1,ha+cnt+1,(node){d[i].a+range-1,0})-ha;
        if(ha[r].a>d[i].a+range-1) r--;
        if(pos>l) connect(1,1,cnt,l,pos-1,i+n);
        if(pos<r) connect(1,1,cnt,pos+1,r,i+n);
    }
    for(int i=1;i<=2*n+tot;i++) if(!dfn[i]) Tarjan(i);
    for(int i=1;i<=n;i++) if(be[i]==be[i+n]) {reset();return 0;}
    reset();
    return 1;
}
void Build(int p,int l,int r)
{
    if(l==r){ins(p+2*n,ha[l].b);return;}
    int mid=(l+r)>>1;
    ls[p]=++tot,Build(ls[p],l,mid);
    rs[p]=++tot,Build(rs[p],mid+1,r);
    ins(p+2*n,ls[p]+2*n);
    ins(p+2*n,rs[p]+2*n);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&d[i].a,&d[i].b);
        ha[++cnt]=(node){d[i].a,i};
        ha[++cnt]=(node){d[i].b,i+n};
    }
    sort(ha+1,ha+cnt+1);
    for(int i=1;i<=cnt;i++) id[ha[i].b]=i;
    Build(1,1,cnt);
    md=inc,memcpy(mem,las,sizeof(las));
    int l=0,r=MB,ans=0;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(solve(mid)) ans=mid,l=mid+1;
        else r=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 38528
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

ll N,M,a[51][2],ans=0;
ll b[51]={};//通った点

//N*M*M(間に合う)

int main(void){
	cin>>N>>M;
	rep(i,M)cin>>a[i][0]>>a[i][1];
	rep(i,M){//除く辺
		queue<ll> Q;
		Q.push(1);
		b[1]=1;
		// printf("最初%d",i);
		while(!Q.empty()){
			ll u = Q.front();
			// printf("i:%d, u:%lld\n",i,u);
			rep(j,M){
				// printf("  %lld,%lld\n",b[a[j][0]],b[a[j][1]]);
				if(j==i)continue;
				if(a[j][0]==u){
					// printf("a[j][0]==u\n");
					if(b[a[j][1]]==0){
						Q.push(a[j][1]);
					}
					b[a[j][1]]=1;
				}
				if(a[j][1]==u){
					// printf("a[j][1]==u\n");
					if(b[a[j][0]]==0){
						Q.push(a[j][0]);
					}
					b[a[j][0]]=1;
				}
			}
			Q.pop();
			// printf("%d,%lu,%d\n",i,Q.size(),Q.empty());
		}
		bool t=false;
		reg(j,1,N){
			// printf("bチェック%d,%lld\n",j,b[j]);
			if(b[j]==0){
				t=true;
			}
			b[j]=0;
		}
		if(t)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String [] line = br.readLine().split(" ");
        System.out.println(line[2] + " " + line[0] + " " + line[1]);
    }
}



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

int main() {
	int N;
	cin >> N;
	int NOW = 0;
	bool check = true;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		if (S == "A") NOW++;
		else NOW--;
		if (NOW < 0) check = false;
	}
	if (NOW != 0) check = false;
	cout << (check ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

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

  int n;
  cin >> n;
  map<int, int> m;
  rep(i, n) {
    int a;
    cin >> a;
    m[a]++;
  }

  ll ans = 10000000;
  FOR(i, -100, 101) {
    ll cnt = 0;
    FOR(j, -100, 101) {
      cnt += pow(i-j, 2) * m[j];
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int n, a, b;

int main(){
  scanf("%d %d %d", &n, &a, &b);
  if(a > b){
    printf("0\n");
    return 0;
  }
  if(n == 1){
    printf("%d\n", int(a == b));
    return 0;
  }
  if(n == 2){
    printf("1");
    return 0;
  }
  printf("%lld\n", b * 1ll * (n - 2) - a * 1ll * (n - 2) + 1);
  return 0;
}


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

int main() {
  int r,g,b;
  cin >> r >> g >> b;
  int figure = r*100+g*10+b;
  if(figure % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}




Measured memory_bytes: 256
/*
~Like a small boat
~On the ocean
~Sending big waves
~Into motion
!Like how a single word
!Can make a heart open
!I might only have one match
!But I can make an explosion
#And all those things I didn't say
#Wrecking balls inside my brain
#I will scream them loud tonight
#Can you hear my voice this time?
@This is my fight song
@Take back my life song
@Prove I'm alright song
@My power's turned on
$Starting right now I'll be strong
$I'll play my fight song
$And I don't really care if nobody else believes
$'Cause I've still got a lot of fight left in me!!!
*/

#include "bits/stdc++.h"
using namespace std;

#define  F  first
#define  S  second
#define  pb push_back
#define  mp make_pair
#define  sz(s) (int)s.size()
typedef long long int ll;
const int N = 1e5+5;
set<int>st;
int vis[N],Ball[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n,m;cin>>n>>m;
    for(int i=2;i<=n;i++)
        Ball[i] = 1;
    vis[1] = Ball[1] = 1;
    st.insert(1);
    while(m--)
    {
        int a,b;cin>>a>>b;
        if( vis[a]&&Ball[a]==1 )
            st.insert(b),st.erase(a),vis[a] = 0,vis[b] = 1;
        else if( vis[a]&&Ball[a]>1 )
            st.insert(a),st.insert(b),vis[b]=1;
        Ball[a]--,Ball[b]++;
    }
    cout<<st.size()<< "\n";



    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int x;cin>>x;
	int i=x/100;
	int j=i/2;
	cout<<10-j<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 1000000001;

int main(){
  int a, b;
  cin >> a >> b;
  if(a==1) a+=14;
  if(b==1) b+=14;
  if(a>b) cout << "Alice" <<endl;
  if(b>a) cout << "Bob" <<endl;
  if(a==b) cout << "Draw" <<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[N];
        for(int n=0; n<N; n++) A[n]=sc.nextInt();

        int totalVote = 0;
        for(int n=0; n<N; n++) totalVote += A[n];

        int popular = 0;
        for(int n=0; n<N; n++) if(A[n]*4*M >= totalVote) popular++;
        System.out.println(popular>=M ? "Yes" : "No");
    }
}


Measured memory_bytes: 21844
N = int(input())
a = list(map(int, input().split()))
num = float('inf')
for k in [0, 1]:
    s = 0
    tmp = 0
    for i in range(N):
        s += a[i]
        if i % 2 == k:
            if s <= 0:
                tmp += abs(s) + 1
                s = 1
        else:
            if s >= 0:
                tmp += abs(s) + 1
                s = -1
    num = min(tmp, num)

print(num)

Measured memory_bytes: 14332
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int ar[n + 4];
    for (int i = 1; i <= n; i++) cin >> ar[i];
    int dp[n + 4]; dp[n] = 0;
    for (int i = n - 1; i > 0; i--){
        dp[i] = 1000000000;
        for (int j = 1; j <= k && i + j <= n; j++){
            dp[i] = min(dp[i], dp[i + j] + abs(ar[i + j] - ar[i]));
        }
    }
    cout << dp[1] << endl;
}

Measured memory_bytes: 4412
N=int(input())

A = list(map(int, input().split()))

s=0
for i in range(len(A)):
    if (A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0):
        s=s+1
if s==0:
    print('APPROVED')
else:
    print('DENIED')

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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; }
const ll MOD = 1e9+7;

vector<int> G[100100];
int C[100100];
ll X[2];

bool dfs(int v, int c){
    C[v] = c;
    X[(c+1)/2]++;
    for(int i = 0; i < G[v].size(); i++){
        int next = G[v][i];
        bool valid = true;
        if(C[next] == 0){
            valid = dfs(next, -c);
        }
        else if(C[next] == c){
            valid = false;
        }
        if(!valid) return false;
    }

    return true;
}

int main(){
    ll N, M;
    cin >> N >> M;
    REP(i,M){
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    bool two = dfs(0, -1);
    ll ans = 0;
    if(two){
        ans = X[0]*X[1] - M;
    }
    else{
        ans = N*(N-1)/2 - M;
    }

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


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200010;
ll n,m,a[N],k;
vector<int>v;
bool vis[N];
int main()
{
	cin>>n>>k;
	k++;
	for(int i=1;i<=n;i++) cin>>a[i];
	int pos=1;
	while(!vis[pos])
	{
		v.push_back(pos);
		vis[pos]=1;
		pos=a[pos];
	}
	int x,len;
	for(int i=0;i<v.size();i++)
		if(v[i]==pos)
		{
			x=i;
			break;
		}
	len=v.size()-x;
	if(k>v.size())
	{
		k-=v.size();
		k%=len;
		if(k==0) cout<<v[v.size()-1];
		else
			cout<<v[k+x-1];
	}
	else cout<<v[k-1];
	return 0;
}


Measured memory_bytes: 6012
#include<bits/stdc++.h>
#define IL inline
#define _ 200005
#define ll long long
using namespace std ;

IL int gi(){
	int data = 0 , m = 1; char ch = 0;
	while(ch!='-' && (ch<'0'||ch>'9')) ch = getchar();
	if(ch == '-'){m = 0 ; ch = getchar() ; }
	while(ch >= '0' && ch <= '9'){data = (data<<1) + (data<<3) + (ch^48) ; ch = getchar(); }
	return (m) ? data : -data ; 
}

map<int,int>M[2] ;
struct Item{
	int val , cnt ;
	bool operator < (const Item &B) const {
		return (cnt ^ B.cnt) ? cnt > B.cnt : val > B.val ; 
	}
}p[2][_] ;
int n , A[_] , tot[2] , n1 , n0 , ans ; 

int main() {
	n = gi() ;
	for(int i = 1; i <= n; i ++) A[i] = gi() ;
	for(int i = 1; i <= n; i += 2) {
		M[0][A[i]] ++ ; n0 ++ ; 
	}
	for(int i = 2; i <= n; i += 2) {
		M[1][A[i]] ++ ; n1 ++ ; 
	}
	int p1 , p2 ; 
	for(map<int,int>::iterator it = M[0].begin(); it != M[0].end(); it ++) {
		p[0][++tot[0]].val = it->first ;
		p[0][tot[0]].cnt = it->second ; 
	}
	for(map<int,int>::iterator it = M[1].begin(); it != M[1].end(); it ++) {
		p[1][++tot[1]].val = it->first ;
		p[1][tot[1]].cnt = it->second ; 
	}
	sort(p[0] + 1 , p[0] + tot[0] + 1) ;
	sort(p[1] + 1 , p[1] + tot[1] + 1) ;
	if(tot[0] == 1 && tot[1] == 1) {
		if(p[0][1].val == p[1][1].val) ans = min(n0 , n1) ; 
		else ans = 0 ; 
	}
	else if(tot[0] == 1) {
		if(p[0][1].val == p[1][1].val) {
			ans = min(1 + n1 - p[1][1].cnt , n1 - p[1][2].cnt) ; 
		}
		else ans = n1 - p[1][1].cnt ; 
	}
	else if(tot[1] == 1) {
		if(p[1][1].val == p[0][1].val) {
			ans = min(1 + n0 - p[0][1].cnt , n0 - p[0][2].cnt) ; 
		}
		else ans = n0 - p[0][1].cnt ; 
	}
	else {
		if(p[1][1].val == p[0][1].val)
			ans = min(n1 - p[1][1].cnt + n0 - p[0][2].cnt , n0 - p[0][1].cnt + n1 - p[1][2].cnt) ;
		else ans = n1 - p[1][1].cnt + n0 - p[0][1].cnt ; 
	}
	cout << ans << endl ;
	return 0 ; 
}


Measured memory_bytes: 6144
def samestring():
  N=int(input())
  S=list(input())
  if N % 2 != 0:
    print('No')
  else:
    S1 = S[0:int(N/2)]
    S2 = S[int(N/2):]

    if S1 == S2:
      print('{}'.format('Yes'))
    else:
      print('{}'.format('No'))

samestring()

Measured memory_bytes: 3060
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(list(input()))
for i in range(W):
    flag = True
    for j in range(H):
        if a[j][i] == '#':
            flag = False
    if flag:
        for k in range(H):
            a[k][i] = '-'
for i in a:
    if not '#' in i:
        continue
    for j in range(W):
        if i[j] != '-':
            print(i[j], end = '')
    print('')


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N, P[202020];

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int a[202020], b[202020];
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> P[i];
        P[i]--;
    }

    for (int i = 0; i < N; i++) {
        a[i] = i * N + 1;
        b[i] = N * (N - i);
    }
    for (int i = 0; i < N; i++) {
        a[P[i]] += i;
    }

    for (int i = 0; i < N; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < N; i++) {
        cout << b[i] << " ";
    }
    cout << endl;

    solve();
    return 0;
}


Measured memory_bytes: 4088
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a,b;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		ans=ans+(b-a)+1; 
	} 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
########ワーシャルフロイド法

def warshall_floyd(d):
    # d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


##############################
n, w, L = map(int, input().split())  # n:頂点数　w:辺の数
inf = 10**18
d = [[inf for i in range(n)] for _ in range(n)]
# d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(w):
    x, y, z = map(int, input().split())
    x -= 1
    y -= 1
    d[x][y] = z
    d[y][x] = z
for i in range(n):
    d[i][i] = 0  # 自身のところに行くコストは０
d = warshall_floyd(d)

D = [[inf for i in range(n)] for i in range(n)]

for i in range(n):
    for j in range(n):
        if i == j:
            D[i][j] = 0
        elif d[i][j] <= L:
            D[i][j] = 1

D = warshall_floyd(D)

Q = int(input())
for i in range(Q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    if D[s][t] >= inf:
        print(-1)
    else:
        print(D[s][t] - 1)

Measured memory_bytes: 59736
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double,int>;
const ll inf = numeric_limits<ll>::max()/3;

int main(void){
  int n;
  vector< int > v;
  vector< P > calc;
  cin >> n;
  v.resize(n);
  for(int i = 0;i < n;++i){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  int first = v[n-1];
  int best = (first + 1)/2;
  for(int i = 0;i < n-1;++i){
    calc.push_back(P(abs(v[i] - best),v[i]));
  }
  sort(calc.begin(),calc.end());
  cout << first << " " << calc[0].second << endl;
  return 0;
}



Measured memory_bytes: 2804
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt64(scanner) - 1
	a := getNextInt64(scanner)
	b := getNextInt64(scanner)
	c := getNextInt64(scanner)
	d := getNextInt64(scanner)

	x := b - a

	var l, r int64
	l = -1
	r = n + 1
	ans := "NO"
	for l+1 < r {
		i := (l + r) >> 1
		if i*c-(n-i)*d <= x && x <= i*d-(n-i)*c {
			ans = "YES"
			break
		} else if i*c-(n-i)*d > x {
			r = i
		} else {
			l = i
		}
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n, l, i, sum(0);
    cin>>n>>l;
    int f[n+1], m = INT_MAX, choosedapple(0);
    for (i = 1; i <= n; i++){
        f[i] = l+i-1;
        sum += f[i];
        if (abs(f[i]) < m){
            m = abs(f[i]);
            choosedapple = f[i];
        }
    }
    cout<<sum-choosedapple;
    return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
char str[100001];
int main(){
	int ans = 0; 
	scanf("%s",str);
	for(int i = 1;i<strlen(str);i++){
		if(str[i-1] != str[i]){
			ans += 1;
		}
	} 
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    int N;
    int d[100];
    cin >> N;
    for(int i=0;i < N;i++){
      cin >> d[i];
    }
    int sum=0;

    for(int i=0;i < N;i++){
      for(int j=i+1; j < N;j++){
        sum += d[i]*d[j];
      }
    }
    cout << sum;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(void){
  int N;
  cin>>N;
  double x[N];
  string u;
  vector<string>moneyType;
  for(int i(0);i<N;i++){
    cin>>x[i]>>u;
    moneyType.push_back(u);
  }
  double s(0);
  for(int i(0);i<N;i++){
    if(moneyType[i]=="JPY")s+=x[i];
    else s+=x[i]*380000;
  }
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	if (a == b) {
		cout << c << endl;
	}
	else if (a == c) {
		cout << b << endl;
	}
	else {
		cout << a << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <functional>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
const int MAXK = 1e5+10;
const ll INF = 1e16;

int k;
ll dp[MAXK];

void solve() {
  for (int i=0;i<=k;i++) {
    dp[i] = INF;
  }
  priority_queue<P, vector<P>, greater<P> > pq;
  for (ll i=1;i<10;i++) {
    dp[i % k] = min(dp[i % k], i);
    pq.push(P(dp[i % k], i % k));
  }

  while (!pq.empty()) {
    P p = pq.top();
    pq.pop();
    if (dp[p.second] != p.first) {
      continue;
    }

    for (int i=0;i<10;i++) {
      int mod = (10 * p.second + i) % k;
      ll tmp = p.first + i;
      if (dp[mod] > tmp) {
        dp[mod] = tmp;
        pq.push(P(dp[mod], mod));
      }
    }
  }
  cout << dp[0] << endl;
}

int main() {
  cin >> k;
  solve();
}


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

using namespace std;

int main(){
    int64_t n;
    cin >> n;

    if (n & 1){
        cout << 0 << endl;
        return 0;
    }

    int64_t ans = 0;
    int64_t b = 2;
    for (int i = 0; i < 25; i++){
        b *= 5;
        ans += n / b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string S; cin >> S;
    int B = 0;
    for(char c:S){
        if(c == 'B') B++;
        else{
            res += B;
        }
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 720
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int n,ans=0;
void dfs(int x,int q,int t,int o){
	if (q==t){
		if ((o&(1<<3))>0 && (o&(1<<5))>0 && (o&(1<<7))>0 && x<=n) ans++;
		return;
	}
	dfs(x*10+7,q+1,t,o|(1<<7));
	dfs(x*10+3,q+1,t,o|(1<<3));
	dfs(x*10+5,q+1,t,o|(1<<5));
}
int rub(int x){
	int p=x,oo=0;
	while (p){
		oo++;
		p/=10;
	}
	return oo;
}
int main(){
	cin>>n;
	if (n<357){
		cout<<"0";
		return 0;
	}
	for (int i=3;i<=rub(n);i++){ 
		dfs(0,0,i,0);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
a = int(input())
b,c = map(int, input().split())
if b%a==0:
  print('OK')
elif c%a==0:
  print("OK")
else:
  if c-b>=a-1:
    print("OK")
  else:
    x = int(b/a)
    if a*(x+1)<=c:
      print("OK")
    else:
      print("NG")


Measured memory_bytes: 9068