akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <numeric>
using namespace std;
int main() {
  long int n;
  cin>>n;
  vector<long int> a(n);
  for(long int i;i<n;i++){
    cin>>a.at(i);
  }
  long int x=a.at(0);
  for(long int i=0;i<n;i++){
    x=__gcd(a.at(i),x);
  }
  cout<<x<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
using namespace std;


int main() {
	int N;
	int T;
	vector<int> c, t;
	int temp1, temp2;
	int ans = 1001;

	cin >> N >> T;

	for (int i = 0; i < N; i++) {
		cin >> temp1 >> temp2;

		c.push_back(temp1);
		t.push_back(temp2);
	}


	for (int i = 0; i < N; i++) {
		if (T >= t[i]) {
			if(ans > c[i]){
				ans = c[i];
			}
		}
	}

	if(ans == 1001){
		cout << "TLE" << endl;
		return 0;
	}




	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <ios>
#include <limits.h>
using namespace std;
#define FOR(i, s, e) for(int i = s; i < e; ++i)
typedef vector<long> vec;
long long c = 0;

void Merge(vec& vA, int l, int m, int r)
{
	int n1 = m - l;
	int n2 = r - m;
	vec vL(n1 + 1, 0);
	vec vR(n2 + 1, 0);
	FOR(i, 0, n1) vL[i] = vA[l + i];
	FOR(i, 0, n2) vR[i] = vA[m + i];
	vL[n1] = LONG_MAX;
	vR[n2] = LONG_MAX;
	int s = 0, t = 0;
	FOR(i, l, r){
		if ( vL[s] > vR[t]){
			vA[i] = vR[t];
			++t;
			c += n1 - s;
		}else{
			vA[i] = vL[s];
			++s;
		}
	}
}

void CountCross(vec& vA, int l, int r)
{
	if (l + 1 >= r) return;
	int m = (l + r) / 2;
	CountCross(vA, l, m);
	CountCross(vA, m, r);
	Merge(vA, l, m, r);
}

int main()
{
	int n;
	cin >> n;
	vec vA(n, 0);
	FOR(i, 0, n) cin >> vA[i];
	CountCross(vA, 0, n);
	cout << c << "\n";
	return 0;
}

Measured memory_bytes: 4140
#include<iostream>
#include<vector>
const int INF=1e9+7;

using namespace std;
int D,G;
vector<int> p(10),c(10);

int dfs(int cur,int score,int f){
    if(cur==D){
        int res=0;
        if(f!=-1){
            while(score<G&&res<p[f]){
            score+=(f+1)*100;
            res++;
            }
        }
        if(score<G) return INF;
        return res;
    }
    int r1,r2;
    r1=dfs(cur+1,score+(cur+1)*100*p[cur]+c[cur],f)+p[cur];
    r2=dfs(cur+1,score,cur);
    return min(r1,r2);
}

int main(){
    cin>>D>>G;
    for(int i=0;i<D;i++) cin>>p[i]>>c[i];
    cout<<dfs(0,0,-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
numlist=list(map(int,input().split()))
result=1
if 0 in numlist:
    print(0)
else:
    for x in numlist:
        result=result*x
        if result>10**18:
            break
    if result<=10**18:
        print(result)
    else:
        print(-1)


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

constexpr long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define rrep(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,n) rep(i,0,n)
#define RREP(i,n) rrep(i,n,0)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int m;
vector<pair<ll,ll>> a(16);
int memo[(1<<16)];
map<pair<ll,ll>,int> mp;

int f(int s) {
  if (s == (1 << m) - 1) {
    int ret = 0;
    for (auto p:mp) {
      ret += p.se * (p.se - 1) / 2;
    }
    return ret;
  }
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    if ((s >> i) & 1) continue;
    for (int j = i+1; j < m; j++) {
      if ((s >> j) & 1) continue;
      //cout << s << " " << i << " " << j << endl;
      int x1 = a[i].fi, x2 = a[j].fi;
      int y1 = a[i].se, y2 = a[j].se;
      int xx = x2 - x1;
      int yy = y2 - y1;
      bool change = 0;
      pair<ll,ll> p = {xx,yy};
      for (auto k : mp) {
        if (xx * k.fi.se == yy * k.fi.fi) {
          p = k.fi;
          change = 1;
          break;
        }
      }
      if (change) {
        mp[p]++;
        cnt = max(cnt, f(((s | (1 << i)) | (1 << j))));
        mp[p]--;
      } else {
        mp[p]++;
        cnt = max(cnt, f(((s | (1 << i)) | (1 << j))));
        mp.erase(p);
      }
    }
    break;
  }
  return cnt;
}

int main(){
  cin >> m;
  REP(i,m) {
    cin >> a[i].fi >> a[i].se;
  }
  cout << f(0) << endl;
  return 0;
}




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

using namespace std;

#define lint long long
#define P pair<lint, lint>

const lint mod = 1E9 + 7;

double leng(double x1, double x2, double y1, double y2){
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

double Cosine(double a, double b, double c){
    return sqrt(((a * a + b * b - c * c) / (4 * a * b)) + 1. / 2);
}

int main(){

    double x[3], y[3], l[6], r[3];

    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];

    l[0] = leng(x[0], x[1], y[0], y[1]);
    l[1] = leng(x[1], x[2], y[1], y[2]);
    l[2] = leng(x[2], x[0], y[2], y[0]);
    l[3] = l[0]; l[4] = l[1]; l[5] = l[2];
    
    for(int i = 0; i < 3; ++i){
        double cos1 = Cosine(l[i], l[i + 1], l[i + 2]);
        double cos2 = Cosine(l[i + 1], l[i + 2], l[i + 3]);

        r[i] = l[i + 1] / (2 + cos1 / sqrt(1 - cos1 * cos1) + cos2 / sqrt(1 - cos2 * cos2));
    }

    cout << setprecision(15) <<  max(r[0], max(r[1], r[2])) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define MOD 1e9+7
using namespace std;
int main(){
    int n,ng=0;
    cin>>n;
    char s[n];
    cin>>s;
    vector<int> alp(26,0);
    rep(i,0,n)alp[(int)s[i]-97]++;
    rep(i,0,26){
        if(alp[i]%2)ng=1;
    }
    if(ng)cout<< "No" <<endl;
    else cout<< "Yes" <<endl;
}

Measured memory_bytes: 256
I=lambda:[int(i)for i in input().split()];F=1<<65;r=range;n,m=I();X=set([0,F,-F]);Y=set(X);R=[((-F,F),F),((-F,F),-F)];H=[(F,(-F,F)),(-F,(-F,F))]
for i in r(n):a,b,c=I();R.append(((a,b),c));Y.add(c);X.add(a);X.add(b)
for i in r(m):a,b,c=I();H.append((a,(b,c)));X.add(a);Y.add(b);Y.add(c)
s=dict(enumerate(sorted(X)));K=len(s);t=dict(enumerate(sorted(Y)));L=len(t);h=dict((s[i],i)for i in s);w=dict((t[i],i)for i in t)
V=[[0]*-~K for i in r(L+1)];U=[i[:]for i in V];v=[i[:]for i in V];q=[(h[0],w[0])];v[w[0]][h[0]]=1;z=0
for (a,b),c in R:U[w[c]][h[a]]+=1;U[w[c]][h[b]]+=-1
for i in r(L+1):
 for j in r(K):
  U[i][j+1]+=U[i][j]
for d,(e,f) in H:V[w[e]][h[d]]+=1;V[w[f]][h[d]]+=-1
for j in r(K+1):
 for i in r(L):
  V[i+1][j]+=V[i][j]
while q:
 x,y=q.pop();z+=(s[x]-s[x+1])*(t[y]-t[y+1])
 for e,f in[(-1,0),(1,0),(0,1),(0,-1)]:
  k=0;c=x+e;d=y+f
  if(0<=c<K)*(0<=d<L)*v[d][c]==0:k=U[-~f//2+y][x]==0if f!=0else V[y][-~e//2+x]==0
  if k:q.append((c,d));v[d][c]=1
if z>F:z='INF'
print(z)

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

typedef vector<int> vi; 
typedef long long ll;
#define F first 
#define S second 
#define PB push_back 
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define pmod 1000000007
#define INF 1000000000000000000
#define pi atan(1)*4
#define modi 1000000

void solve(){
	
	ll n,k;
	
	cin >> n >> k;
	
	ll a[n];
	
	ll sum = 0;
	
	for(ll i = 0; i < n; i++){
		cin >> a[i];
		sum+= a[i];
	}
	
	ll mini = sum;
	
	ll ini = 1, fin = sum;
	
	bool can;
	
	while(ini <= fin){
		
		ll med = (fin+ini)/2;
		ll counter = 0;
		
		for(ll i = 0; i < n; i++){
			
			counter += ( ((a[i]+med-1)/med) - 1);
			
		}
		
		
		if(counter <= k){
			mini = min(mini, med);
			fin = med-1;
		}
		else{
			ini = med+1;
		}
		
	}	
		
	cout << mini << endl;
	
}

int main(){
	
	ifstream fin ("text.in");
    ofstream fout ("text.out");   
	
	ll t = 1;
					
	while(t--) solve();
	
	return 0;
}

Measured memory_bytes: 5140
#include<iostream>
using namespace std;
int main(){
    long int n,i,x,min,max,sum;
    i=0;
    min=10000000;
    max=-10000000;
    sum=0;
    cin>>n;
    while (i<n){
        cin>>x;
        if(min>x) min=x;
        if (max<x) max=x;
        sum=sum+x;
        i=i+1;
        
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
}


Measured memory_bytes: 3108
//https://atcoder.jp/contests/dp/tasks/dp_b
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
	int n, k;
	cin >> n >> k;
	vector<int> h (n);
	for (auto& x:h) {
		cin >> x;
	}
	vector<int> dp (n);
	dp[1] = abs(h[1]-h[0]);
	for (int i = 2; i < (int)h.size(); i++) {
		int jump = 1e9;
		for (int j = 1; j <= k && i-j>=0; j++) {
			jump = min(jump, dp[i-j]+abs(h[i]-h[i-j]));
		}
		dp[i] = jump;
	}
	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
sa = input()
sb = input()
sc = input()

s = sa[0]
sa = sa[1:]
while(True):
    if s == 'a':
        if len(sa) == 0:
            print('A')
            break
        else:
            s = sa[0]
            sa = sa[1:]
    elif s == 'b':
        if len(sb) == 0:
            print('B')
            break
        else:
            s = sb[0]
            sb = sb[1:]
    else:
        if len(sc) == 0:
             print('C')
             break
        else:
            s = sc[0]
            sc = sc[1:]

        


Measured memory_bytes: 3064
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cassert>
#include <ctime>
#include <map>
#include <math.h>
#include <cstdio>
#include <set>
#include <deque>
#include <memory.h>
#include <queue>

#pragma comment(linker, "/STACK:64000000")
typedef long long ll;

using namespace std;

const int MAXN = 1 << 18;
const int MOD = 1; // 1000 * 1000 * 1000 + 7;
const int INF = 2e9;
const double PI = acos(-1.0);

int main() {
#ifdef _MSC_VER
	freopen("input.txt", "r", stdin);
#endif

	int aI, aO, aT, aJ, aL, aS, aZ;
	while (cin >> aI >> aO >> aT >> aJ >> aL >> aS >> aZ) {
		ll ans = 0;
		ans += aO;

		ans += aI / 2 * 2;
		ans += aJ / 2 * 2;
		ans += aL / 2 * 2;

		if (aI % 2 + aJ % 2 + aL % 2 == 3) ans += 3;
		if (aI % 2 + aJ % 2 + aL % 2 == 2 && aI > 0 && aJ > 0 && aL > 0) ans += 1;

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int X, Y, Z;
	cin >> X >> Y >> Z;
	X -= Z;
	cout << X / (Y + Z) << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();
		String s3 = sc.next();
		char c1 = s1.charAt(0);
		char c2 = s2.charAt(0);
		char c3 = s3.charAt(0);
		c1 = (char)(c1 - 'a' + 'A');
		c2 = (char)(c2 - 'a' + 'A');
		c3 = (char)(c3 - 'a' + 'A');
		System.out.println(c1 + "" + c2 + "" + c3);
	}
}

Measured memory_bytes: 21844
/*
ID: usaco.t3
TASK: test
LANG: C++14
*/

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _CRT_SECURE_NO_WARNINGS
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long

#define pii pair<intt,intt>
#define vi vector<intt>
#define vii vector<pii>

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

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

#define IO ios_base::sync_with_stdio(false);cin.tie();
#define endl '\n'

#define wtfis(x) cerr << "at line " << __LINE__ << ": " << #x << " = " << (x) << endl

const intt max3 = 1003;
const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;

const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;

const intt INF = 2LL * 1000000000;
const intt INFLL = 9LL * 1000000000 * 1000000000;
/***************/

intt powmod (intt a, intt b, intt mod) {
    intt res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

intt gcd (intt a, intt b) {
    while (b > 0) {
        intt t = a % b;
        a = b, b = t;
    }
    return a;
}

intt lcm (intt a, intt b) {
    return (a / gcd (a, b)) * b;
}

intt is_prime (intt n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/**************************/

int n, arr[2 * maxx];

long long get(int x) {
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        res += abs(arr[i] - x);
    }
    return res;
}

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    IO;
    cin >> n;
    for (int i =1; i <= n; i++) {
        cin >> arr[i]; arr[i] -= i;
    }
    sort(arr + 1, arr + n + 1);
    long long res = get(arr[n / 2]);
    res = min(res, get(arr[n / 2 + 1]));
    res = min(res, get(arr[n / 2 - 1]));
    res = min(res, get((arr[n / 2] + arr[n / 2 - 1]) / 2));
    res = min(res, get((arr[n / 2] + arr[n / 2 + 1]) / 2));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main() {
    char x;
    cin >> x;
    x=x+1;
    cout << x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vpll = vector<pll>;
#define forn(i,n) for (int i=0; i<int(n); ++i)
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second

void cxxio() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}

const int K=3;

using llk = array<ll, K>;
using vllk = vector<llk>;

int main() {
    cxxio();
    int x, y, z;
    cin>>x>>y>>z;
    int n=x+y+z;
    vllk xs(n);
    forn(i, n) forn(j, K)
        cin>>xs[i][j];
    multiset<pll> delta[K][K];
    vi choice(n);
    auto set=[&](int i, int c) {
        choice[i]=c;
        forn(to, K) if (c!=to) {
            delta[c][to].insert(pll(xs[i][to]-xs[i][c], i));
        }
    };
    auto get=[&](int from, int to) -> pll {
        if (from==to) return pll(0, -1);
        for (;;) {
            assert(!delta[from][to].empty());
            auto it=delta[from][to].rbegin();
            if (choice[it->ss]==from)
                return *it;
            delta[from][to].erase(*it);
        }
    };
    forn(i, n) {
        if (i<x) set(i, 0);
        else if (i<x+y) set(i, 1);
        else set(i, 2);
    }
    for (;;) {
        int diff=0;
        vi perm(K);
        iota(all(perm), 0);
        while (next_permutation(all(perm))) {
            ll sum=0;
            vpll ps(K);
            forn(i, K) {
                ps[i]=get(perm[i], i);
                sum+=ps[i].ff;
            }
            if (sum<=0) continue;
            diff++;
            forn(i, K) if (ps[i].ss!=-1) {
                set(ps[i].ss, i);
            }
        }
        if (!diff) break;
    }
    ll ans=0;
    forn(i, n) ans+=xs[i][choice[i]];
    cout<<ans<<'\n';
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int a[N] ;

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

  for(int i = 0 ;i<n ;i++)cin >> a[i] ;

  cout << (n-1)/(k-1) + ((n-1)%(k-1) == 0?0:1) << endl ; 
	
  return 0 ;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b == c || b + c == a || c + a == b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std; // 575

const int MAX = 100001;

int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}
int main() {
	static int N, A[MAX];
	cin >> N;
	for (int i = 0;i < N;++ i) cin >> A[i];
	static int cumsumL[MAX], cumsumR[MAX];
	cumsumL[0] = A[0];
	for (int i = 1;i < N;++ i) cumsumL[i] = gcd(cumsumL[i - 1], A[i]);
	cumsumR[N - 1] = A[N - 1];
	for (int i = N - 2;i >= 0;-- i) cumsumR[i] = gcd(cumsumR[i + 1], A[i]);
	int ans = cumsumR[1];
	for (int i = 1;i < N - 1;++ i) ans = max(ans, gcd(cumsumL[i-1], cumsumR[i+1]));
	ans = max(ans, cumsumL[N - 2]);
	cout << ans;
	
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

両側gcdを持っておけば、1個の除外がO(1)判定でできるのでO(N)
gcdがO(logN)なのでO(NlogN)
*/

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
using namespace std;
#define ll int64_t
#define REP(i, n) for (int i=0; i<n; i++)

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

    string S;
    cin >> S;

    string target[] = {"KIHBR", "KIHBRA", "KIHBAR", "KIHBARA",
    "KIHABR", "KIHABRA", "KIHABAR", "KIHABARA",
    "AKIHBR", "AKIHBRA", "AKIHBAR", "AKIHBARA",
    "AKIHABR", "AKIHABRA", "AKIHABAR", "AKIHABARA"};

    string ans = "NO";

    for (int i=0; i<16; i++){
        if (S == target[i]){
            ans = "YES";
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 256
from collections import deque
S=input()
Q=deque(list(S))
Q.append("end")
def Sep(Que):
  L=[]
  state=0
  while True:
    q=Que.popleft()
    if q=="end":break
    elif state<=0:
      if q=="R":state-=1
      else:state*=(-1)
      L.append(q)
    else:
      if q=="L":L.append(q)
      else:
        Que.appendleft(q)
        break
  n=len(L)
  if n%2==0:ret=[0]*(state-1)+[n//2,n//2]+[0]*(n-state-1)
  else:
    if state%2==1:ret=[0]*(state-1)+[(n//2)+1,n//2]+[0]*(n-state-1)
    else:ret=[0]*(state-1)+[n//2,(n//2)+1]+[0]*(n-state-1)
  for i in ret:print(i, end=" ")
while len(Q)>=2:Sep(Q)

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

using namespace std;

int main(){
 string a,b;
  cin >> a >> b;
  
  if(a.length()>b.length()) cout << "GREATER" << endl;
  else if(a.length()<b.length()) cout << "LESS" << endl;
  else if(a.length()==b.length()){
   if(a>b) cout << "GREATER" << endl;
   else if(a<b) cout << "LESS" << endl;
   else cout << "EQUAL" << endl; 
  }

}

Measured memory_bytes: 256
n = int(input())
s = input()
a = 0
if n%2 == 0:
  for i in range (n//2):
    if s[i] == s[n//2+i]:
      continue
    else:
      a = 1
      break
else:
  a = 1
print('Yes' if a==0 else 'No')

Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10 ** 9)

N, M = map(int, input().split())

G = [[] for _ in range(N + 1)]

for _ in range(M):
    x, y = map(int, input().split())
    G[x].append(y)

lst = [-1] * (N + 1)


def calc(x):
    if lst[x] != -1:
        return lst[x]
    tmp = 0
    for next_ in G[x]:
        tmp = max(tmp, calc(next_))
    
    lst[x] = tmp + 1
    return tmp + 1

for i in range(1, N + 1):
    if lst[i] == -1:
        calc(i)

print (max(lst) - 1)

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

ll A, B, C;

int main(int argc, char **argv)
{
	cin >> A >> B >> C;

	for (int i = 1; i < B; ++i)
	{
		ll tmp_a = A * i;
		if (tmp_a % B == C)
		{
			std::cout << "YES"<< std::endl;
			return 0;
		}
	}
	std::cout << "NO"<< std::endl;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool DP[31][1145149];
int cost[31];
bool prime(int N){
	if(N==0)return false;
	for(int i=2;i*i<=N;i++){
		if(N%i==0)return false;
	}
	return true;
}
int main()
{
	while(true){
		int N,X;
		scanf("%d%d",&N,&X);
		if(N==0&&X==0)return 0;
		for(int i=0;i<N;i++)scanf("%d",&cost[i]);
		for(int i=0;i<=N;i++){
			for(int j=0;j<=X;j++){
				DP[i][j]=false;
			}
		}
		DP[0][0]=true;
		for(int i=1;i<=N;i++){
			for(int j=0;j<=X;j++){
				if(DP[i-1][j])DP[i][j]=true;
				if(j>=cost[i-1]&&DP[i-1][j-cost[i-1]])DP[i][j]=true;
				if(j>=cost[i-1]&&DP[i][j-cost[i-1]])DP[i][j]=true;
				
			}
		}
		bool F=true;
		for(int i=X;i>=1;i--){
			if(F&&DP[N][i]&&prime(i)){
				printf("%d\n",i);
				F=false;
			}
		}
		if(F)printf("NA\n");
	}
}

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

using namespace std;

#define EACH(i, a) for(auto&& i:(a))
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define REP(i,n) FOR(i,0,n)

int N;

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

  cin >> N;

  unordered_map< int, int > mp;
  REP(i, N) {
    int tmp; cin >> tmp;
    if (mp[tmp - 1]) {
      // 1つ前の要素が繋がっていた時に+1して更新
      mp[tmp] = mp[tmp - 1] + 1;
    } else {
      // 1つ前の要素が虚無の時に1で初期化
      mp[tmp] = 1;
    }
  }


  int mx = -1;
  EACH(x, mp) {
    mx = max(mx, x.second);
  }

  int ans = N - mx;
  cout << ans << endl;

  return 0;
}



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

using namespace std;
  
int main(){
    
    int n, K;
    cin >> n >> K;

    vector<int> h(n+1);
    for(int i=1; i<=n; i++){
        cin >> h[i];
    }
    
    vector<int> dp(n+1, INT32_MAX);
    dp[1] = 0;
    for(int i=2; i<=n; i++){
        for(int k=1; k<=K && i-k>0; k++){
            dp[i] = min(dp[i], dp[i-k] + abs(h[i]-h[i-k]));
        }
    }

    cout << dp[n] << "\n";

    return 0; 
} 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
                    
                    
int main(){
    long long X, x, ans;
    cin >> X;
    ans = 0;
    x = 100;

    while(x < X){
        x *= 1.01;
        ans++;
    }

    cout << ans << endl;

    return 0;
            
}

Measured memory_bytes: 3644
def solve():
  M, D = map(int, input().split())
  ans = 0
  D1 = D // 10
  D10 = D % 10

  for m in range(1, M + 1):
    for d1 in range(2, D1 + 1):
      if m % d1 != 0: continue
      d10 = m // d1
      if 1 < d10 and d10 < 10 and (d1 != D1 or d10 <= D10): ans += 1

  return ans

print(solve())

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

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

  int n; cin >> n;
  vector<int> t(n);
  int sum = 0;
  rep(i, n) {
    cin >> t.at(i);
    sum += t.at(i);
  }
  int m; cin >> m;
  rep(i, m) {
    int p, x; cin >> p >> x;
    p--;
    cout << sum - t.at(p) + x << '\n';
  }
}

Measured memory_bytes: 256
from math import log10
from math import ceil


N =  int(input())
all_evidences = []
for i in range(N):
    oneman_evidences = []
    A = int(input())
    for _ in range(A):
        x,y= list(map(int,input().split(" ")))
        x-=1
        oneman_evidences.append((x,y) )
    all_evidences.append(oneman_evidences)


ans = 0
for all_people_states in range(2 ** N ): # 1→ honest 0→ not
    temp = 0
    people_is_honest = []
    for j in range(N):
        is_honest = (all_people_states >> j) & 1
        temp += is_honest
        people_is_honest.append(is_honest)
    people_is_honest.reverse()
    HONEST_FLAG = True
    for human_num,human in enumerate(people_is_honest):
        if human == 1:
            human_evidence= all_evidences[human_num]
            for evidence in human_evidence:
                state_human,is_honest = evidence
                if people_is_honest[state_human] != is_honest:
                    HONEST_FLAG = False
    if HONEST_FLAG:
        ans = max(ans,temp)

print(ans)



Measured memory_bytes: 43628
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

#define MAX_P 200010
int fact[MAX_P]; //n! mid p

int extgcd(int a, int b, int &x, int &y)
{
    int d = a;
    if (b != 0)
    {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }
    else
    {
        x = 1;
        y = 0;
    }
    return d;
}
int mod_inverse(int a, int m)
{
    int x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}
//n! = a p^e -> a mod p
void make_fact()
{
    fact[1] = 1;
    for (int i = 2; i < MAX_P; i++)
    {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    return;
}
int mod_fact(int n, int p, int &e)
{
    e = 0;
    if (n == 0)
        return 1;
    int res = mod_fact(n / p, p, e);
    e += n / p;
    if (n / p % 2 != 0)
        return res * (p - fact[n % p]) % p;
    return res * fact[n % p] % p;
}
//nCk mod p
int mod_comb(int n, int k, int p)
{
    if (n < 0 || k < 0 || n < k)
        return 0;
    int e1, e2, e3;
    int a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);
    if (e1 > e2 + e3)
        return 0;
    return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

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

    make_fact();
    int n;
    cin >> n;
    vector<int> c(n);
    rep(i, n) cin >> c[i];
    sort(all(c));
    reverse(all(c));
    int ans = 0, num = 1;
    rep(i, n - 1)(num *= 4) %= mod;
    rep(i, n)(ans += (c[i] * (i + 2)) % mod) %= mod;
    (ans *= num) %= mod;
    cout << ans << endl;
}


Measured memory_bytes: 3328
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b, c] <- map strToInt . words <$> getLine
    -- 出力
    putStrLn $ if c `elem` [(a * k) `mod` b | k <- [1..b]] then "YES" else "NO"


Measured memory_bytes: 508
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<long long> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    long long sum=0;
    for(int i=0;i<n-1;i++){
        if(v[i]>v[i+1]){
            sum+=(abs(v[i]-v[i+1]));
            v[i+1]+=(abs(v[i]-v[i+1]));
        }
    }
    cout<<sum;
}


Measured memory_bytes: 4740
n,m = map(int,input().split())
x = sorted([int(i) for i in input().split()])
a = []
if n >= m:
    print(0)
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    ans = sum(sorted(a)[:m-n])
    print(ans)

Measured memory_bytes: 13832
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

signed main(void) {
    string s; cin>>s;
    int g=0, p=0;
    rep(i, s.size()) {
        if (s[i]=='g') g++;
        else p++;
    }
    int pp=s.size()/2;
    int gg=s.size()-pp;
//    cout << pp << "," << gg << endl;
    cout << g-gg << endl;
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>

template <typename T>
constexpr T abs(const T& x)
{
    return x > 0 ? x : -x;
}

template <typename T>
constexpr T max(const T& x, const T& y)
{
    return x > y ? x : y;
}

template <typename T>
constexpr T min(const T& x, const T& y)
{
    return x < y ? x : y;
}


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

    int n = 0, t = 0;
    long double ans = 0;
    std::vector <long double> vec;

    std::cin >> n;
    for (int i = 1; i <= n; ++i)
        std::cin >> t, vec.push_back(t);
    
   

    while (vec.size() > 1)
    {
        std::sort(vec.begin(), vec.end(), [](long double a, long double b) { return (a > b); });

        auto a = vec.back(); vec.pop_back();
        auto b = vec.back(); vec.pop_back();

        vec.push_back((a + b) / 2);
    }

    std::cout << vec[0] << std::endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

// int N = 2;
// string S = "ABCXYZ";

int N;
string S;

// string target[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
string target2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    cin >> N >> S;
    // cin >> S;
    string ans;
    for (int i = 0; i < S.size(); i++) {
        int index = target2.find(S[i]);
        int target_index = (index + N) % 26;
        // cout << target2[target_index] ;
        ans += target2[target_index];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>

typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用

int saiki(string, int, int);

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

	vector<int> s(3);
    cin>>s[0]>>s[1]>>s[2];
    sort(s.begin(),s.end());
    
    cout<<s[0]+s[1]<<endl;
    
    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll H,W;
  cin>>H>>W;
  vector<string> A(H);
  cin>>A;
  vector<vector<int>> dp(H,vector<int>(W,1));
  for(int i=1;i<H;i++){
    for(int j=0;j+1<W;j++){
      bool k1=A[i-1][j]==A[i-1][j+1];
      bool k2=A[i][j]==A[i][j+1];
      if(k1==k2){dp[i][j]=dp[i-1][j]+1;}
      else{dp[i][j]=1;}
    }
  }
  ll ans=H;
  for(int i=0;i<H;i++){
    stack<pll> S;
    S.push({-1,0});
    for(ll j=0;j+1<W;j++){
      ll mi=j;
      while(S.top().S>dp[i][j]){
        pll tp=S.top(); S.pop();
        ans=max(ans,(j-tp.F+1)*tp.S);
        mi=tp.F;
      }
      S.push({mi,dp[i][j]});
    }
    while(!S.empty()){
      pll tp=S.top(); S.pop();
      ans=max(ans,(W-tp.F)*tp.S);
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 20224
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main(void)
{
	string a,b;bool d=1;
	cin>>a>>b;
	for(int i=0;i<a.size();i++)
    {
        if(a[i]!=b[i])
        {
            d=0;break;
        }
    }
    cout<<(d?"Yes":"No");
	return 0;
}


Measured memory_bytes: 3628
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int n;

int main(){
  cin >> n;
  int i = 1 , sum = 0;
  for(;;++i) {
    sum += i;
    if(sum >= n) break;
  }
  int del = sum - n;
  rep(j,1,i+1) if(j != del)
    cout << j << endl;
  return 0;
}


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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef LOCAL
    #define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define debug(...) 42
    #define eprintf(...) 42
#endif

#define PI 3.1415926535897932384626433832795
#define INF 2e9
#define SINV(t) greater<t>()
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()

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; }

typedef long long ll;
#define vv(t) vector< t > 

#define CHC(mp, x) if(mp.end() != mp.find(x))
#define CHCV(mp, x) if(mp.end() != find(ALL(mp), x))

template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}

#pragma endregion

template<typename T>
void SV(vector<T> v){
    #ifdef LOCAL
        REP(i,v.size()){
                cout << i << " : " << v[i] << endl;
        }
    #endif
}

template<typename T>
void SV(map<int, T> v){
    #ifdef LOCAL
        FOREACH(i, v){
            cout << i.first << " : " << i.second << endl;
        }
    #endif
}
int bitCount(int bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >> 16);
}

int main(void){
    int N, P;
    cin >> N >> P;
    int a=0, b=0;
    REP(i, N){
        int tmp;
        cin >> tmp;
        ((tmp%2)?a:b)++;
    }
    ll all=1ll<<N;
    ll m=1ll<<(a+b-1);
    if(a==0){
        m<<=1;
    }
    if(P){
        m=all-m;
    }
    debug(all);
    cout << m << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

int n,m;
string s;
set<ull> st;
ull h;

const ull B = 1000000007ull;
const ull Binv = 13499267949257065399ull;

ull bs[311111];

int main(){
	cin.sync_with_stdio(false);
  cin>>n>>m;
  cin>>s;
  h=s[0];
  bs[0]=1;
  rep(i,300001)bs[i+1]=bs[i]*B;

  int l=0,r=0;
  rep(i,m){
    string q;
    cin>>q;
    if(q=="L++"){
      h-=s[l]*bs[r-l];
      l++;
    }
    if(q=="L--"){
      l--;
      h+=s[l]*bs[r-l];
    }
    if(q=="R++"){
      r++;
      h*=B;
      h+=s[r];
    }
    if(q=="R--"){
      h-=s[r];
      h*=Binv;
      r--;
    }
    st.insert(h);
  }
  cout<<st.size()<<endl;
	return 0;
}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> c(n, vector<int>(n, 0));
    int a, b;
    for(int im=0;im<m;im++) {
        cin >> a >> b; a--; b--;
        c.at(a).at(b)++;
        c.at(b).at(a)++;
    }

    int ans;
    for(int in=0;in<n;in++) {
        ans = 0;
        for(int jn=0;jn<n;jn++) {
            ans += c.at(in).at(jn);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
while True:
  S_1 = input()
  if S_1 == '.':
    break
  S_2 = input()
  
  if S_1 == S_2:
    print("IDENTICAL")
    continue
  
  A = [0]
  B = [0]
  for i, s in enumerate(S_1):
    if s == '"':
      A.append(i)
  for i, s in enumerate(S_2):
    if s == '"':
      B.append(i)
      
  if len(A) != len(B):
    print('DIFFERENT')
    continue
  
  A.append(len(S_1))
  B.append(len(S_2))
  cnt = 0
  
  for i in range(len(A) - 1):
    if i % 2 == 0 and S_1[A[i]:A[i + 1]] != S_2[B[i]:B[i + 1]]:
      print('DIFFERENT')
      break
    if i % 2 == 1 and S_1[A[i]:A[i + 1]] != S_2[B[i]:B[i + 1]]:
      cnt += 1
  else:
      print('DIFFERENT' if cnt > 1 else 'CLOSE')
    


Measured memory_bytes: 5588
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;

typedef unsigned long long ll;
ll n, X, s, mn = 1e18, x[N];
int main()
{
	int i, j, k;
	cin >> n >> X;
	for (i = 1; i <= n; i++) {
		scanf("%lld", &x[i]);
		x[i] += x[i - 1];
	}
	for (i = 1; i <= n; i++) {
		s = (x[n] - x[n - i]) * 2;
		for (j = n, k = 3; j > 0; j -= i, k += 2) {
			s += (x[j] - x[max(0, j - i)]) * k;
		}
		mn = min(mn, s + X * i);
	}
    cout << mn + X * n << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

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

int main(){
	ios::sync_with_stdio(false);

	string str, str_r;

	cin >> str;
	reverse(begin(str), end(str));

	cout << str << endl;
		
}

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

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

    int cnt[3] = {0};
    for(int i=0;i<s.size();++i){
        cnt[s[i]-'a']++;
    }

    sort(cnt, cnt+3);

    int a[3]={0};
    for(int i=0;i<s.size();++i){
        a[2-i%3]++;
    }

    bool flag = true;
    for(int i=0;i<3;++i){
        if(cnt[i] != a[i]){
            flag = false;
            break;
        }
    }

    if(flag)cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int so(const void *a,const void *b){
	
	
	
	
	
	return *(int *)a-*(int *)b;
}
int main(){
	int n;
	int i,j;
	int x;
	int z=0;
	int m[100];
	int temp;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		x=i;
		while(x%2==0){
		
			x/=2;
			z++;
	
		}
		m[i-1]=z;
		//printf("%d\n",m[i-1]);
		z=0;
	}
	qsort(m,n,sizeof(m[0]),so);
	
	for(i=0;i<n;i++){
		//printf("%d\n",m[i]);
	}
		for(i=1;i<=n;i++){
		x=i;
		while(x%2==0){
		
			x/=2;
			z++;
	
		}
if(m[n-1]==z){
	
	
	printf("%d\n",i);
	break;
	
	
}
		z=0;
	}
	
	
	return 0;
}

Measured memory_bytes: 128
while True:
    n=int(input())
    if n == 0:
        break
    else:
        li1=[0]*n
    
        #t=1
        for t in range(n):  
            li1[t]=int(input())
        s=int((sum(li1)-max(li1)-min(li1))/(n-2))
        print(s)


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

using namespace std;
long long mod = 1e9 + 7;
vector<int>g[2 * 100001];
map<int,int>visited;
    int v = 0;
        void dfs(int node){
            if(visited[node]++) return;
            v++;
            for(int x : g[node]){
                dfs(x);
            }
        }

int main(){
    int n, m;
   cin>>n>>m;
   for(int i = 0; i < m; ++i){
       int u, v;
       cin>>u>>v;
       g[u].push_back(v);
       g[v].push_back(u);

   }
   int last = 0;
   int best = 1;
   for(int i = 1; i <=n ; ++i){
       if(!visited[i]) dfs(i);
       best = max(best, v - last);
       last = v;
   }
   cout<<best<<endl;
    return 0;
}


Measured memory_bytes: 39360
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x,y; cin>>x>>y;
  if(x>=4) x=4;
  if(y>=4) y=4;
  int sk=(4-x)*100000+(4-y)*100000;
  if(x==1 && y==1) sk+=400000;
  cout<<sk;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = Long.parseLong(sc.next());
		long grad500 = x / 500L * 1000L;
		x -= x / 500L * 500L;
		long grad5 = x / 5L * 5L;
		long ans = grad500 + grad5;
		System.out.println(ans);
	}

}


Measured memory_bytes: 24916
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W, N; cin >> H >> W >> N;
	vector<int> a(N), b(N); rep(i, 0, N) { cin >> a[i] >> b[i]; }
	map<pair<int, int>, int>mp;
	int dx[]{ 1,1,0,-1,-1,-1,0,1 }, dy[]{ 0,1,1,1,0,-1,-1,-1 };
	vector<int>v(10, 0);
	v[0] = (H - 2)*(W - 2);
	rep(i, 0, N) {
		mp[make_pair(--a[i], --b[i])]++;
		rep(j, 0, 8) {
			int x = a[i] + dx[j], y = b[i] + dy[j];
			mp[make_pair(x, y)]++;
		}
	}
	for (auto &e : mp) {
		int x = e.first.first, y = e.first.second, z = e.second;
		if (1 <= x&&x <= (H - 2) && 1 <= y&&y <= (W - 2))v[0]--,v[z]++;
	}
	rep(i, 0, 10)cout << v[i] << endl;
	return 0;
}

Measured memory_bytes: 58112
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define inf (ll)1e18+1
#define endl "\n"
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    ll ar[n];
    ll sum=0;
    for(ll x=0;x<n;x++){
        cin>>ar[x];
        sum+=ar[x];
    }
    ll dp1[n][n];
    for(ll length=1;length<=n;length++){
        for(ll x=0;x<n;x++){
            ll upto=x+length-1;
            if(upto>=n){
                break;
            }
            // dp1[x][upto]=max(ar[x]+min(dp1[x+2][upto],dp1[x+1][upto-1]),ar[upto]+min(dp1[x][upto-2],dp1[x+1][upto-1]));
            ll sum1=0,sum2=0,sum3=0;
            if(x+2<=upto){
                sum1=dp1[x+2][upto];
            }
            if(x+1<=upto && upto-1>=x){
                sum2=dp1[x+1][upto-1];
            }
            if(upto-2>=x){
                sum3=dp1[x][upto-2];
            }
            dp1[x][upto]=max(ar[x]+min(sum1,sum2),ar[upto]+min(sum2,sum3));
        }
    }
    ll X=dp1[0][n-1];
    ll Y=sum-X;
    cout<<X-Y<<endl;
    return 0;
}

Measured memory_bytes: 70400
s = input()

'''
X:=A
Y:=BC
'''

s = s.replace('A', 'X').replace('BC', 'Y')

y = 0
buf = 0
ans = 0
for ss in reversed(s):
    if ss == 'Y':
        y += 1
    elif ss == 'X':
        buf += y
    else:
        # B or C
        ans += buf
        y = 0
        buf = 0
ans += buf
print(ans)


Measured memory_bytes: 3560
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
#define MAX 500100
//#define NIL -1

int n;
vector<vector<int>> a(200010);
vector<int> parent(200010, MAX);


void bfs(int s){
    queue<int> q;
    q.push(0);
    int u;
    while(!q.empty()){
        u=q.front();
        q.pop();
        for(int i=0; i<a[u].size(); i++){
            int v=a[u][i];
            if(parent[v]!=MAX){
                continue;
            }
            parent[v]=u+1;
            //cout << u+1 << " " << v+1 << " " << dist[v] << endl;
            q.push(v);
        }
    }
}


int main() {
    int m;

    cin >> n >> m;



    int tmp_a;
    int tmp_b;
    bool ok=true;

    for(int i=0; i<m; i++){
        cin >> tmp_a >> tmp_b;
        tmp_a--;
        tmp_b--;
        a[tmp_a].push_back(tmp_b);
        a[tmp_b].push_back(tmp_a);
    }
    parent[0]=-1;
    bfs(0);
    for(int i=0; i<n; i++){
        //cout << dist[i] << endl;
        if(parent[i]==MAX){
            ok=false;
            break;
        }
    }
    if(ok==true){
        cout << "Yes" << endl;
        for(int i=1; i<n; i++){
            cout << parent[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 12900
#include<iostream>
#include<algorithm>
#include <vector>
#include <numeric>
#include<string>
using namespace std;


int main(void) {
    int h, w;
    cin >> h >> w;
    string board[50];
    for (int i = 0; i < h; ++i){ 
        cin >> board[i];
    }
    const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
    
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (board[i][j] == '#') continue;

            int num = 0;
            for (int d = 0; d < 8; ++ d) {
                const int ni = i + dy[d];
                const int nj = j + dx[d];

                if (ni < 0 or h <= ni) continue;
                if (nj < 0 or w <= nj) continue;
                if (board[ni][nj] == '#') num++;
            }
        board[i][j] = char(num + '0');

        }
    }
    for (int i = 0; i < h; ++i) cout << board[i] << endl;
    return 0;
}


Measured memory_bytes: 256