akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,A[11111],B[11111],C[11111],dp[11111][11],m,x[555555],y[555555],id[11111],all,dist[11111],mn,mnp,toi[11111];
vector<int> g[11111];
void dijk(int msk)
{
	for (int i=1;i<=all;i++) dist[i]=dp[i][msk];
	priority_queue<pair<int,int> > pq;
	for (int i=1;i<=all;i++) pq.push(make_pair(-dist[i],i));
//	cout<<msk<<":"<<endl;
//	for (int i=1;i<=all;i++) cout<<dist[i]<<" ";
//	cout<<endl;
	while(!pq.empty())
	{
		int x=pq.top().second,y=-pq.top().first;
		pq.pop();
		if (dist[x]!=y) continue;
		for (int j=0;j<g[x].size();j++)
		{
			int to=g[x][j];
			if (dist[to]>dist[x]+1)
			{
				dist[to]=dist[x]+1;
				pq.push(make_pair(-dist[to],to));
			}
		}
	}
}
int main()
{
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for (int i=1;i<=n;i++) id[i]=i+3;
	for (int i=1;i<=a;i++)
	{
		scanf("%d",&A[i]);
		id[A[i]]=1;
	}
	for (int i=1;i<=b;i++)
	{
		scanf("%d",&B[i]);
		id[B[i]]=2;
	}
	for (int i=1;i<=c;i++)
	{
		scanf("%d",&C[i]);
		id[C[i]]=3;
	}
	scanf("%d",&m);
	for (int i=1;i<=m;i++)
	{
		scanf("%d%d",&x[i],&y[i]);
		g[id[x[i]]].push_back(id[y[i]]);
		g[id[y[i]]].push_back(id[x[i]]);
	}
	all=n+3;
	for (int i=1;i<=all;i++)
	{
		for (int j=0;j<8;j++) dp[i][j]=1e9;
		dp[i][0]=1;
	}
	dp[1][1]=dp[2][2]=dp[3][4]=1;
	for (int i=1;i<8;i++)
	{
		for (int k=1;k<=all;k++)
		{
			for (int h=0;h<8;h++)
			{
				if ((i&h)!=h) continue;
				for (int p=0;p<g[k].size();p++)
				{
					dp[k][i]=min(dp[k][i],dp[g[k][p]][h]+dp[k][i^h]);
				}
			}
		}
		dijk(i);
		for (int k=1;k<=all;k++) dp[k][i]=dist[k];
	}
	mn=1e9;
	for (int i=1;i<=3;i++)
	{
		for (int j=1;j<=n;j++)
		{
			if (id[j]==i) 
			{
				toi[i]=j;
				break;
			}
		}
	}
	for (int i=4;i<=all;i++) toi[i]=i-3;
	for (int i=1;i<=all;i++)
	{
		if (dp[i][7]<mn || (toi[i]<mnp && dp[i][7]==mn))
		{
			mn=dp[i][7];
			mnp=toi[i];
		}
	}
	printf("%d %d\n",mn-1,mnp);
	return 0;
}


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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    for (int i = 0; i < n; ++i) cin >> p[i];
    for (int i = 0; i < n; ++i) cin >> q[i];
    vector<int> permute = p;
	sort(permute.begin(), permute.end());
	int pos = 1;
	int left = -1, right = -1;
	do {
		if (equal(permute.begin(), permute.end(), p.begin()))
			left = pos;
		if (equal(permute.begin(), permute.end(), q.begin()))
			right = pos;
		++pos;
	} while(next_permutation(permute.begin(), permute.end()));
	cout << abs(left - right) << '\n';
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
a = int(input())
b = []

while a != 0:
    b.append(int(a % 10))
    a = int(a / 10)

if b[0] == b[1] and b[0] == b[2]:
    print("Yes")
elif b[3] == b[2] and b[3] == b[1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14140
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<< C <<endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a:b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;

LL W, H;
VL p, q;

int main(void) {
    cin >> W >> H;
    p.resize(W);
    q.resize(H);
    LL ans = 0;
    VPII WH;
    REP(i, W) {
        scanf("%d", &p[i]);
        WH.EB(MP(p[i], 1));
    }
    REP(i, H) {
        scanf("%d", &q[i]);
        WH.EB(MP(q[i], 0));
    }
    SORT(WH);
    FORE(el, WH) {
        if (el.second) {
            ans += el.first * (H + 1);
            W--;
        } else {
            ans += el.first * (W + 1);
            H--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3956
// $%U%$ $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

string s;
bool f(int n){
	if(n==1)return 1;
	if(n%2==0)return 0;
	for(int i=0; i<n; ++i){
		if(s[i]!=s[n-i-1])return 0;
	}
	n>>=1;
	for(int i=0; i<n; ++i){
		if(s[i]!=s[n-i-1])return 0;
	}
	return 1;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>s;
	if(f(s.size())) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
ll dp[3010][6010];
int main(){
    int n,t;
    cin >> n>>t;
    vector<P> a(n);
    ll res = 0;
    rep(i,n){
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin(),a.end());
    rep(i,n){
        rep(j,t){
            res = max(dp[i][j]+a[i].second,res);
            dp[i+1][j+a[i].first] = max(dp[i+1][j+a[i].first],dp[i][j]+a[i].second);
            dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
        }
    }
    cout << res <<endl;
    return 0;
}

Measured memory_bytes: 141568
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define pii 3.14
#define mod (ll)(1e9+7)
#define inf (ll)(1e18)
#define lim (ll)(1e10)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5 + 5)

void solve()
{
    ll n;
    cin>>n;

    if(n%1000)
        cout<<1000 - (n%1000);
    else
        cout<<0;
}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}


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



int main() {
    string s;
    cin>>s;
    
    int  i,ans=0,count=0;
    for(i=0;i<s.size();i++){
       if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C') count++;
      	else count=0;
      ans=max(ans,count );
     }
     	cout << ans << endl;
     

    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
using namespace std;

int main()
{
    int r,g,b;
    while(~scanf("%d%d%d",&r,&g,&b))
    {



    int ans=r*100+g*10+b;
    if(ans%4==0)
    {
        printf("YES\n");
    }
    else
        printf("NO\n");
    }
    return 0;

}


Measured memory_bytes: 128
n=int(input())
ac=0
wa=0
tle=0
re=0

for x in range(n):
  s=input()
  if s=='AC':
    ac+=1
  elif s=='WA':
    wa+=1
  elif s=='TLE':
    tle+=1
  else:
    re+=1
    
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

Measured memory_bytes: 9212
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main(){
	int n;
	int tbl[4][3][10];
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 3; ++j) {
			for (int k = 0; k < 10; ++k) {
				tbl[i][j][k]=0;
			}
		}
	}

	cin >> n;
	for (int i = 0; i < n; ++i) {
		int b,f,r,v;
		cin >> b >> f >> r >> v;
		tbl[b-1][f-1][r-1]+= v;
	}

	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 3; ++j) {
			for (int k = 0; k < 10; ++k) {
				cout << " " << tbl[i][j][k] ;
			}
			cout << endl;
		}
		if(i!=3) {cout << "####################" << endl;}
	}



	return 0;
}



Measured memory_bytes: 3052
#include<bits/stdc++.h> 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main(){
  ll l,r;
  cin >> l >> r;
  r = min(r,l+4038);
  ll ans = 100000;
  for(ll i=l;i<r;i++){
    for(ll j=i+1;j<=r;j++){
      ans = min(ans,i*j%2019);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long X = scn.nextLong();
		long Y = scn.nextLong();
		int ans = 0;
		while(X<=Y) {
			X*=2;
			ans++;
		}
		
		System.out.println(ans);

	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    string a[n];
    for(int i=0;i<n;i++)
     cin >> a[i];
    int w[n]={},b[n]={},r[n]={};
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(a[i][j]!='W') w[i]++;
            if(a[i][j]!='B') b[i]++;
            if(a[i][j]!='R') r[i]++;
        }
    }
    int mi=2500;
    for(int j=1;j<n-1;j++){
        for(int i=j+1;i<n;i++){
            int s=0;
            for(int x=0;x<j;x++)
                s+=w[x];
            for(int x=j;x<i;x++)
                s+=b[x];
            for(int x=i;x<n;x++)
                s+=r[x];
            mi=min(mi,s);
        }
    }
    cout << mi << endl;
    return 0;
}



Measured memory_bytes: 3172
#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <string.h>
 
using namespace std;
 
#define BUF_SIZE 1024
 
int count = 0;
 
void insertionSort(int array[],int n,int g){
    int v,j;
    for(int i = g;i < n; i++){
        v = array[i];
        j = i - g;
        while(j >= 0 && array[j] > v){
            array[j+g] = array[j];  //??°??????????????§???????????????
            j = j - g;
            count++;
        }
        array[j+g] = v;
    }
}
 
void shellSort(int array[],int n){
    int m = 0;
    int s = 1;
 
    while((n/s) > 0){
        s *= 2;
        m++;    //2^(mult-1)?????§?????????????????¨???????¨?
    }
 
    int G[20];
 
    for(int k = 0,t = 1; k < m; k++){
        G[k] = n/t;
        t *= 2;
    }
 
    for(int i = 0; i < m;i++){
        insertionSort(array,n,G[i]);
    }
 
    printf("%d\n",m);
    for(int i = 0; i < m; i++){
        if(i != m-1){
            printf("%d ",G[i]);
        }else{
            printf("%d\n",G[i]);
        }
    }
    printf("%d\n",count);
    for(int i = 0; i < n; i++){
        printf("%d\n",array[i]);
    }
 
}
 
int main(int argc,char* argv[]){
    char buf[BUF_SIZE];
    int n = atoi(fgets(buf,BUF_SIZE,stdin));
    int array[1000000];
 
    for(int i = 0; i < n; i++){
        cin >> array[i];
    }
 
    shellSort(array,n);
 
}


Measured memory_bytes: 7056
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
    ll N, x;
    cin >> N >> x;
    vector<ll> a(N);
    for(int i=0; i<N; ++i) {
        cin >> a[i];
    }
    ll ans = 0;
    for(int i=1; i<N; i++) {
        if(a[i-1] + a[i] > x) {
            ans += a[i-1] + a[i] - x;
            if(a[i-1] + a[i] - x > a[i]) {
                a[i-1] = x;
                a[i] = 0;
            } else {
                a[i] -= a[i-1] + a[i] - x;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(){
    int n;
    cin>>n;
    int ans = 0;

    for(int i=1; i<=n; i++){
        int keta=0;
        int num = i;
        while(num>0){
            num/=10;
            keta++;
        }
        if(keta%2)ans++;
    }
    cout<<ans;
    return 0;
}

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

int main() {
    int A, B, C, K; cin >> A >> B >> C >> K;

    int max_n = max({A, B, C});
    string res;
    if(max_n == A) {
        res = "A";
    } else if(max_n == B) {
        res = "B";
    } else {
        res = "C";
    }

    int cnt = 1;
    while(cnt <= K) {
        max_n = max_n * 2;
        cnt++;
    }

    if(res == "A") {
        cout << B + C + max_n << endl;
    } else if(res == "B") {
        cout << A + C + max_n << endl;
    } else {
        cout << A + B + max_n << endl;
    }
}

Measured memory_bytes: 384
n=int(input())  
h=list(map(int, input().split()))
count = 0
max_count = 0
for i in range(n-1):
    if h[i+1] <= h[i]:
        count = count + 1
    else:
        max_count = max(max_count,count)
        count = 0
print(max(max_count,count))

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll MOD = (ll)1e9 + 7;

ll f(ll n) {
	ld a = (sqrtl(24*n+1)-1)/6;
	return ll(a);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
    cout.precision(20);
    cout << fixed;

	string s;	cin>>s;
	puts(s=="ABC"?"ARC":"ABC");

}


Measured memory_bytes: 3752
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Competition
{
    public class Program
    {
        static void Main(string[] args)
        {
            var abk = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var c = new List<int>();
            for(var i = 1; i <= 100; i++)
            {
                if (abk[0] % i == 0 && abk[1] % i == 0) c.Add(i);
            }
            c = c.OrderByDescending(a => a).ToList();
            Console.WriteLine(c[abk[2]-1]);
        }

    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
//#define int long long  
#define mod 1000000007
#define am 998244353
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
int abs(int a,int b){ 
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){//最大公約数
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
bool IsPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for(int i=3;i<=sqrtNum;i+=2){
    if(num%i==0){
      return false;
    }
  }
}
int lcm(int a,int b){//最小公倍数
    return (a*b)/gcd(a,b);
}	    
signed main(){
// __builtin_ctz(N);      Nを２で何回割り切れるかを返す
//(n+1)*n/2;              １からNまでの総和を求める式
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d;
    int e,f;
    cin>>a>>b>>c>>d;
    e=a-c,f=b-d;
    cout<<c+f<<" "<<d-e<<" "<<a+f<<" "<<b-e<<"\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;

int main()
{
  int N; cin >> N;
  pair<pair<string,int>,int> ret[N];
  for (int i = 0; i < N; i++) {
    string S;
    int P;
    cin >> S >> P;
    ret[i] = {{S, -P}, i + 1};
  }

  // 昇順に sort されるので, P には - をつけて降順にしている
  sort(ret, ret + N);
  for (int i = 0; i < N; i++) {
    cout << ret[i].second << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int par[100005];
int get(int u){
	return par[u] == u ? u : par[u] = get(par[u]);
}
struct node{
	int l,r,ind;
	node(int a = 0,int b = 0,int c = 0){
		l = a;r = b;ind = c;
	}
	bool operator<(const node&e)const{
		if(l != e.l)return l < e.l;
		return r < e.r;
	}
};
set<node>st,rst;
int main(){
	//freopen("readin.txt","r",stdin);
	int n;
	scanf("%d",&n);
	for(int i = 0;i < n;i++)par[i] = i;
	for(int i = 0;i < n;i++){
		int l,r;
		scanf("%d%d",&l,&r);
		st.insert(node(l,r,i));
		rst.insert(node(r,l,i));
	}
	vector<node>v;
	set<node>::iterator i = st.begin();
	i++;
	for(set<node>::iterator j = st.begin();i != st.end();j++,i++)
		v.push_back(node(max(i->l,j->l) - min(i->l,j->l),i->ind,j->ind));
	//return 0;
	i = rst.begin();
	i++;
	for(set<node>::iterator j = rst.begin();i != rst.end();j++,i++)
		v.push_back(node(max(i->l,j->l) - min(i->l,j->l),i->ind,j->ind));
	sort(v.begin(),v.end());
	long long ans = 0;
	for(int i = 0;i < v.size();i++){
		if(get(v[i].r) == get(v[i].ind))continue;
		par[get(v[i].r)] = get(v[i].ind);
		ans+=v[i].l;
	}
	cout << ans << endl;
}

Measured memory_bytes: 17908
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  int a, b;
  char s[100], t[100], u[100];
  scanf("%s%s", s, t);
  scanf("%d%d", &a, &b);
  scanf("%s", u);
  if (strcmp(s, u) == 0) {
    printf("%d %d\n", a - 1, b);
  } else {
    printf("%d %d\n", a, b - 1);
  }
}

Measured memory_bytes: 128
using System;
class Program {
  static void Main(string[] args) {
    string[] line1 = Console.ReadLine().Split();
    string[] line2 = Console.ReadLine().Split();
    int N = int.Parse(line1[0]);
    int x = int.Parse(line1[1]);
    int[] A = new int[N];

    for (int i = 0; i < N; ++i) {
      A[i] = int.Parse(line2[i]);
    }

    Array.Sort(A);

    int ans = 0;
    int pos = 0;
    while (pos < N && x >= A[pos]) {
      x -= A[pos];
      ++ans;
      ++pos;
    }

    if (pos == N && x > 0) --ans;

    Console.WriteLine(ans);
    
  }
}


Measured memory_bytes: 11220
#include<iostream>
#include<cstdio>

using namespace std;

const int maxn=1e6+5;

int isprime[maxn];

int solve(int n)
{
    int p=0;
    for(int i=2;i<=n;i++){
        if(!isprime[i]){
            p++;
        }
        for(int j=2*i;j<=n;j+=i){
            isprime[j]=1;
        }
    }
    return p;
}

int main()
{
    int n;
    while(~scanf("%d",&n)){
        cout<<solve(n)<<endl;
    }
    return 0;
}



Measured memory_bytes: 7052
// Score: 200/200

#include <iostream>

using namespace std;

int main()
{
	int N;
	cin >> N;
	int count = 0;
	int prev_col = -1;
	int continue_count = 1;
	for (int i = 0; i < N; ++i)
	{
		int col;
		cin >> col;
		if (prev_col >= 0 && prev_col == col)
		{
			++continue_count;
		}
		else
		{
			count += continue_count / 2;
			continue_count = 1;
		}
		prev_col = col;
	}
	count += continue_count / 2;
	cout << count;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll a, b;
  cin >> a >> b;

  if((a * b) % 2 == 0)
    cout << "Even" << endl;
  else
    cout << "Odd" << endl;
  
  return 0;
}


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

int main() {
	int n , k , res = 0;
	scanf("%d%d",&n,&k);
	int num;
	while(n--){
		scanf("%d",&num);
		if(num >= k)++res;
	}
	printf("%d",res);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  char s[11];
  int a;
  int result=0, max=0;
 
  scanf("%s", s);
  for(a=0;a<11;a++)
  {
    if((s[a]=='A')||(s[a]=='T')||(s[a]=='C')||(s[a]=='G'))
         result++;
    else  {
         if(max < result){
           max = result;
           result=0;
         }
       }
   }
  printf("%d",max);
   return 0;
}

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






int main() {
  

  int n,m;
  cin>>n>>m;
  

  
  int  answer;
  
  answer=(100*n+1800*m);
  
  for (int i=0;i<m;i++){
    answer*=2;
  }
  
  
  cout<<answer<<endl;
  
  
      
  



  
}

Measured memory_bytes: 256
n = int(input())
s = [0] * n
for i in range(n):
    s[i] = input()
print('AC x ' + str(s.count('AC')))
print('WA x ' + str(s.count('WA')))
print('TLE x ' + str(s.count('TLE')))
print('RE x ' + str(s.count('RE')))

Measured memory_bytes: 16176
n, k = map(int, input().split())
a = list(map(lambda x: int(x) - 1, input().split()))

loop = [0]
s = {0}
while a[loop[-1]] not in s:
    s.add(a[loop[-1]])
    loop.append(a[loop[-1]])

idx = loop.index(a[loop[-1]])
# print(idx, loop)

if k < len(loop):
    ans = loop[k] + 1
else:
    ans = loop[(k - idx) % (len(loop) - idx) + idx] + 1
print(ans)


Measured memory_bytes: 32372
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define ll long long
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define Outerloop int q;cin>>q;while(q--)
#define Mod 1000000007
#define N 1e5

    int32_t main()
    {
    	int n,k;
    	cin >> n >> k;
    	int a[n],dp[n]={0};
    	
    	f(i,0,n) cin >> a[i];
    	dp[0]=0;
    	
    	
    	f(i,1,n)
    	{
    		int ans=INT_MAX;
    		for(int j=i-1;j>=0 && j>=i-k;j--)
    		{
    			ans=min(ans,dp[j]+abs(a[j]-a[i]));
    		}
    		dp[i]=ans;
    	}
    	if(n>0) cout<<dp[n-1];
    	else cout<<0;
    return 0;
    }

Measured memory_bytes: 1792
#include <stdio.h>

#define MAX 500000
#define INFTY 1000000001

void mergeSort(int A[], int, int);
void merge(int A[], int, int, int);

int S[MAX];
int n;
int cnt;

int main(void) {
  int left, right;

  scanf("%d", &n);

  left = 0; right = n;

  for(int i=0; i<n; ++i)
    scanf("%d", &S[i]);

  mergeSort(S, left, right);

  for(int i=0; i<n; ++i) {
    if(i != n-1) printf("%d ", S[i]);
    else printf("%d\n", S[i]);
  }
  printf("%d\n", cnt);

  return 0;
}

void mergeSort(int A[], int left, int right) {
  int mid;

  if(left+1 < right) {
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

void merge(int A[], int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1], R[n2];

  for(i=0; i<n1; ++i)
    L[i] = A[left + i];
  for(i=0; i<n2; ++i)
    R[i] = A[mid + i];
  L[n1] = R[n2] = INFTY;
  i = j = 0;
  for(k=left; k<right; ++k) {
    ++cnt;
    if (L[i] <= R[j]) {
      A[k] = L[i];
      ++i;
    }
    else {
      A[k] = R[j];
      ++j;
    }
  }

}



Measured memory_bytes: 5768
import java.util.Scanner;

/**
 * 解説通りに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long a = scanner.nextLong(), b = scanner.nextLong();
			System.out.println(result(a - 1) ^ result(b));
		}
	}

	/**
	 * @param input
	 * @return 0〜input の配列をXORした結果
	 */
	private static long result(long input) {
		long remainder = input % 4L;
		switch ((int) remainder) {
		case 0:
			return input;
		case 1:
			return 1L;
		case 2:
			return input + 1;
		case 3:
		default:
			return 0L;
		}
	}
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int q; cin >> q;
    map<string, int> M;
    rep(i,q){
        int query; cin >> query;
        if(query == 0){
            string key; int x;
            cin >> key >> x;
            M[key] = x;
        }else if(query == 1){
            string key; cin >> key;
            cout << M[key] << endl;
        }
    }
}


Measured memory_bytes: 27752
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    int d, S, i;
    while(scanf("%d" , &d) != EOF){
        S=0;
        for(i=1; i<600/d; i++){
            S = S + d * pow(i * d, 2);
        }
        cout << S << endl;
    }
    return 0;
}



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

int main() {
    int h,w;
    cin>>h>>w;
    
    char sc[h][w];
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin>>sc[i][j];
        }
    }
    
    int H,W;
    H=h+2;
    W=w+2;
    char ss[H][W];
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(i!=0 and j!=0 and i!=H-1 and j!=W-1){
                ss[i][j]=sc[i-1][j-1];
            }else{
                ss[i][j]='*';
            }
        }
    }
    
    string result ="Yes";
    
    for(int i=1; i<H-1; i++){
        for(int j=1; j<W-1; j++){
            if(ss[i][j]=='#'){
                if(ss[i-1][j]!='#' and ss[i+1][j]!='#' and ss[i][j-1]!='#' and ss[i][j+1]!='#'){
                    result ="No";
                }
            }
        }
    }
    
    cout<<result<<endl;
   
    return 0;
}


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

using namespace std;
typedef long long int ll;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	ll n,i,j;
	cin>>n;
	ll a[n];
	for(i=1;i<=n;i++){
	    cin>>j;
	    a[j-1]=i;
	}
	for(i=0;i<n;i++){
	    cout<<a[i]<<" ";
	}
	
    return 0;
}


Measured memory_bytes: 1664
#include <cstdio>
#include <algorithm>
using namespace std;
int n, m, a[100005];
int main() {
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d", &a[i]);
	sort(a, a+n);
	m = a[n-1] - a[0];
	for(i=1; i<n-1; i++) m += abs(a[i]);
	printf("%d\n", m);
	for(i=1; i<n-1; i++) {
		if(a[i]<0) printf("%d %d\n", a[n-1], a[i]), a[n-1] -= a[i];
		else printf("%d %d\n", a[0], a[i]), a[0] -= a[i];
	}
	printf("%d %d\n", a[n-1], a[0]);
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

ll h, w;
vector<string> s;
vector<vector<bool>> used;

pll dfs(ll x, ll y) {
	used[x][y] = true;
	pll ret = pll(0, 0);
	if(s[x][y] == '.') ret.first++;
	else ret.second++;
	ll dx[] = {1, 0, -1, 0};
	ll dy[] = {0, 1, 0, -1};
	REP(i, 4) {
		ll nx = x + dx[i], ny = y + dy[i];
		if(nx >= 0 && nx < h && ny >= 0 && ny < w && !used[nx][ny]) {
			if(s[nx][ny] == s[x][y]) continue;
			pll tmp = dfs(nx, ny);
			ret.first += tmp.first;
			ret.second += tmp.second;
		}
	}
	return ret;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> h >> w;
	s.resize(h);
	used.assign(h, vector<bool>(w, false));
	REP(i, h) cin >> s[i];
	ll ans = 0;
	REP(i, h) REP(j, w) {
		if(used[i][j]) continue;
		pll tmp = dfs(i, j);
		ans += tmp.first * tmp.second;
	}
	cout << ans << endl;
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 28032
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    ll n,k;
    cin>>n>>k;
    ll a[n];
    REP(i,n)cin>>a[i];
    ll ans=0;
    sort(a,a+n,greater<int>());
    for(int i=k;i<n;i++)
    {
        ans+=a[i];
    }
    cout<<ans<<"\n";   
  }
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N, K; cin >> N >> K;
		UL M = 0;
		rep(i, K) {
			UL a; cin >> a;
			M = max(M, a);
		}
		if ((N - M) * 2 + 1 >= N) cout << 0 << endl;
		else cout << N - ((N - M) * 2 + 1) << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,k,s;
  cin>>n>>k>>s;
  vector<int> ans;
  rep(i,k){
    ans.push_back(s);
  }
  rep(i,n-k){
    if(s!=1000000000) ans.push_back(1000000000);
    else ans.push_back(1);
  }
  rep(i,ans.size() ){
    cout<<ans[i];
    if(i!=n-1) cout<<" ";
  }
  cout<<endl;
		     

  return 0;
}


Measured memory_bytes: 2292
#include<stdio.h>
int main()
{
    int W,H,i,j;
    while(1)
    {
        scanf("%d %d",&W,&H);
        if(W==0 && H==0)
        {
            return 0;
        }
        else
        {
            for(i=1;i<=W;i++)
            {
                for(j=1;j<=H;j++)
                {
                    printf("#");
                }
                printf("\n");
            }
            printf("\n");
        }

    }
    return 0;
}



Measured memory_bytes: 2028
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

void addNums(vector<int> &nums, vector<int> &numList, int limit)
{
    queue<int> q;
    for(int i : numList)
    {
        if(i <= limit)
        {
            q.push(i);
        }
    }
    while(!q.empty())
    {
        long long int t = q.front();
        t *= 10;
        q.pop();
        for(int m : numList)
        {
            if(t+m <= limit)
            {
                nums.push_back(t+m);
                if(((t+m)*10+3) <= limit)
                {
                    q.push(t+m);
                }
            }
        }
    }
}

int cntTarget(vector<int> &nums, vector<int> &numList)
{
    int ans = 0;
    for(int n : nums)
    {
        vector<bool> checker(numList.size());
        while(n > 0)
        {
            int t = n % 10;
            n /= 10;
            for(int m = 0; m < (int)numList.size(); ++m)
            {
                if(t == numList[m])
                {
                    checker[m] = true;
                    break;
                }
            }
        }
        bool result = true;
        for(bool r: checker)
        {
            result &= r;
        }
        if(result)
        {
            ans += 1;
        }
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    vector<int> nums = {3,5,7};
    vector<int> numList = {3,5,7};
    addNums(nums,numList, n);
    cout << cntTarget(nums, numList) << endl;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

# code here
n = int(input().strip())
A = map(int, input().strip().split())

s = 1
c = 0

for a in A:
    if a == s:
        s += 1
    else:
        c += 1

if c == n:
    print(-1)
else:
    print(c)

Measured memory_bytes: 17976
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int d,t,s;
    cin>>d>>t>>s;
    if((d+s-1)/s <= t)cout << "Yes\n";
    else cout << "No\n";
    
}   

Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var n, q int
	fmt.Scan(&n)
	s := 0
	hash := map[int]int{}
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		if _, ok := hash[s]; !ok {
			hash[s] = 1
		}
	}
	ans := 0
	fmt.Scan(&q)
	t := 0
	for i := 0; i < q; i++ {
		fmt.Scan(&t)
		if val, ok := hash[t]; ok {
			ans += val
		}
	}
	fmt.Println(ans)
}



Measured memory_bytes: 6004
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<vector<int> > a(n);
    rep(i, 0, n){
        int t, d;
        cin >> t >> d;
        t--;
        a[t].push_back(d);
    }
    vector<int> b(n, -1);
    vector<int> c;
    rep(i, 0, n){
        if(a[i].size() == 0) continue;
        sort(a[i].rbegin(), a[i].rend());
        b[i] = a[i][0];
        rep(j, 1, a[i].size()){
            c.push_back(a[i][j]);
        }
    }
    sort(b.rbegin(), b.rend());
    sort(c.rbegin(), c.rend());
    int ans = 0;
    int now = 0;
    rep(i, 0, min((int)c.size(), k)){
        now += c[i];
    }
    rep(i, 1, k + 1){
        if(b[i - 1] == -1) break;
        now += b[i - 1];
        if(k - i < c.size()) now -= c[k - i];
        ans = max(ans, now + i * i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

/*Take for example divisor = 13 and S = 39262.

Reminder of 2 / 13 is 2, save it.
Reminder of 62 / 13 is 10, save it.
Reminder of 262 / 13 is 2, but we have already seen this reminder. What does it mean?
(262 - 2) % 13 = 260 % 13 = 0, so 260 is a multiple of 13. But we are interested only in 26. Turned out if x * (any power of 10) mod divisor = 0, then x % divisor = 0 if divisor isn't 2 or 5.

For 39262 / 13 reminder is again 2 and we have seen it two times: (39262 - 262) % 13 == 0 and (39262 - 2) % 13 == 0, so add them both.
*/

const int m = 2019;

void test_case(){
	string s; cin >> s;
	int n = s.size();
	reverse(s.begin(),s.end());
	int x = 1 , tot = 0;
	vector<int> cnt(m);
	ll ans = 0;
	for(int i = 0 ; i < n ; i++){
		cnt[tot]++;
		tot += (s[i]-'0')*x;
		tot%=m;
		ans += cnt[tot];
		x = x*10%m;
	}
	cout<<ans<<"\n";
	
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<"\n";
vector<vector<int>>v(1e5+1,vector<int>(3));
vector<vector<int>>dp(1e5+1,vector<int>(4,-1));
int n;
int cal ( int idx, int d){
    if(idx==n-1)
        return v[idx][d];
    if(dp[idx][d]+1)
        return dp[idx][d];

    int mx=-1e8;
    if(d==0)
        mx=v[idx][d]+max(cal(idx+1,1),cal(idx+1,2));
    else if(d==1)
        mx=v[idx][d]+max(cal(idx+1,0),cal(idx+1,2));
    else mx=v[idx][d]+max(cal(idx+1,1),cal(idx+1,0));
    return dp[idx][d]=mx;



}

int main()
{
    cin >> n;


    for(int x=0;x<n;x++){
        for(auto &f: v[x])
            cin>>f;

    }
    cout << max ( cal(0,0),max(cal(0,1),cal(0,2)));

    return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
using namespace std;
const int M = 1e5 + 10;
vector<int> vc[M];
int dfs(int pos , int pre) {
    int len = vc[pos].size();
    int res = 0;
    for(int i = 0 ; i < len ; i++) {
        int v = vc[pos][i];
        if(v != pre) {
            res += dfs(v , pos);
        }
    }
    if(res >= 2) {
        printf("First\n");
        exit(0);
    }
    else if(res == 0) return 1;
    else return 0;
}
int main() {
    int n , u , v;
    scanf("%d" , &n);
    for(int i = 1 ; i < n ; i++) {
        scanf("%d%d" , &u , &v);
        vc[u].push_back(v);
        vc[v].push_back(u);
    }
    int ans = dfs(1 , -1);
    if(ans) {
        printf("First\n");
    }
    else {
        printf("Second\n");
    }
    return 0;
}

Measured memory_bytes: 5888
#include<string>
#include<stack>
#include<iostream>
using namespace std;
int main(){
	string s;
	while(getline(cin,s),!(s[0]=='.'&&s.size()==1)){
		int a=0,b=0;
		stack<int> t;
		bool flag=true;
		for(int i=0;i<s.size();i++){
			if(s[i]=='('){
				t.push(s[i]);
			}else if(s[i]==')'){
				if(t.empty()||t.top()!='('){
					flag=false;
				}else
				t.pop();
			}else if(s[i]=='['){
				t.push(s[i]);
			}else if(s[i]==']'){
				if(t.empty()||t.top()!='['){
					flag=false;
				}else
				t.pop();
			}
		}
		
		
		if(flag&&!t.size())
		cout<<"yes"<<endl;
		else
		cout<<"no"<<endl;
	}
	return 0;
}

Measured memory_bytes: 904
import math

nums = [int(i) for i in input().split()]
a = nums[0]
b = nums[1]
x = nums[2]
h = x/(a**2)

if(h>=b/2):
    print(math.degrees(math.atan((b-h)/(a/2))))

else:
    print(math.degrees(math.atan(b/(2*h*a/b))))


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

bool ok(int P,int k,int w[], int n){
    int wn = 0, tn = 1;
    //cout << "P: " << P << endl;
    for(int i = 0; i < n; i++){
        if(w[i] > P)
            return false;
        if(wn + w[i] <= P){
            wn = wn + w[i];
            //cout << "<wn: " << wn << endl;
        }else{
            tn += 1;
            wn = w[i];
            //cout << ">wn: " << wn << endl;
        }
    }
    //cout << "tn: " << tn << endl;
    if(tn <= k){
        return true;
    }else{
        return false;
    }
}

int main(){
    int n,k;
    cin >> n >> k;
    int w[n];
    for(int i = 0; i < n; i++){
        cin >> w[i];
    }
    int l = 0, h = n*10000+1;
    while(l+1 < h){
        int m = (l+h)/2;
        if(ok(m,k,w,n)){
            h = m;
            //cout << "h: " << h << endl;
        }else{
            l = m;
            //cout << "l: " << l << endl;
        }
    }
    cout << h << endl;
}

Measured memory_bytes: 3464
#include <stdio.h>

int main(void)
{
  int A, B, C;

  scanf("%d %d %d\n", &A, &B, &C);

  if(A == B){
    printf("%d", C);
  }else if(A == C){
    printf("%d", B);
  }else if(B == C){
    printf("%d", A);
  }
  
}

Measured memory_bytes: 128
import Data.List
import Data.Ord

main = interact $ unlines . map (unwords . map show . flying_jenny . map read . words) . lines

flying_jenny ns = fst $ head $ sortBy (comparing snd) $ sortBy (comparing fst) $
 [(p,w) | p <- take 8 $ map (take 8) $ tails $ cycle [4,1,4,1,2,1,2,1],
          let w = sum $ zipWith (\x y -> max 0 (x-y)) ns p]

Measured memory_bytes: 4188
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int[] numArray = new int[10];
        String str = "No";
        Map<Integer,Integer> numMap = new HashMap<>();
        while(sc.hasNext()){
            int N = Integer.parseInt(sc.next());
            numArray[N]++;
        }
        for(int i=1;i<10;i++){
            if(numArray[i] == 2)str = "Yes";
        }
        System.out.println(str);
    }
}


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

#define INF 1000000000

int X;

int main(){
	cin >> X;
	int ans =1;
	for(int i=2;i < sqrt(X);i++){
		int n=2;
		while(pow(i,n) <=X){
			int tmp = pow(i,n);
			ans = max(tmp,ans);
			n++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1e9 + 7;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ll a[N];
ll p[1000005];

void Solve(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        int m = a[i];
        for(int j = 2; j * j <= a[i]; j++){
            ll k = 0;
            while(m % j == 0) m /= j, k++;
            p[j] = max(p[j], k);
        }
        p[m] = max(p[m], 1LL);
    }
    ll lcm = 1;
    for(int i = 2; i <= 1e6; i++)
        if(p[i]) lcm = (lcm * Powmod(i, p[i])) % MOD;
    ll res = 0;
    for(int i = 1; i <= n; i++){
        res = (res + lcm * Powmod(a[i], MOD - 2)) % MOD;
    }
    cout << res;
}

int main(){
    Speed;
    int query = 1;
//    cin >> query;
    while(query--) Solve();
}













Measured memory_bytes: 8192
using System;
class aoj
{
    static void Main()
    {
        while (true)
        {
            int a = int.Parse(Console.ReadLine()), c = 0;
            if (a == 0) break;
            a = 1000 - a;
            int[] b = { 500, 100, 50, 10, 5, 1 };
            for (int i = 0; i < 6; i++)
            {
                while (a >= b[i])
                {
                    c++;
                    a -= b[i];
                }
            }
            Console.WriteLine(c);
        }
    }
}

Measured memory_bytes: 9124
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)



        
def main(): #startline--------------------------------------------
    n = int(input())
    abc = [list(map(int,input().split())) for i in range(n)]
    dp = [[0]*3 for i in range(n+1)]
    for i in range(n):
        for j in range(3):
            for k in range(3):
                if j == k:continue
                dp[i+1][k] = max(dp[i+1][k],dp[i][j]+abc[i][k])
    print(max(dp[n]))


if __name__ == "__main__":
    main() #endline===============================================
    

Measured memory_bytes: 49576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,ans=2;
	cin>>n;
	if(n==2) ans=1;
	for(ll k=2,i=n;k*k<=n;k++,i=n){
		while(i>=k) i%k?i%=k:i/=k;
		if(i==1) ans++;
		if((n-1)%k==0&&k*k!=(n-1)) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define loop(n) for (ll i = 0; i < n; i++)
#define loopy(n) for (ll j = 0; j < n; j++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define oo 1e18
#define fr first
#define se second
#define in(x) scanf("%d",&x)
using namespace std;
const int N = 2e4 + 10;
const int M = 1e7 + 10;
const ll mod = 1e9 + 7;
int main(){ 
    ll r , d , x ;
    cin >> r >> d >> x ; 
    for( int i = 0 ; i < 10; i ++ ){
        x = r * x - d ; 
        cout<<x<<endl ;
    }  


    return 0;
}
 

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

#define lli long long int
#define ii pair<int, int>
#define ll pair<lli, lli>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second

using namespace std;

int main() {
	int n, m, p, cnt[100005], ac = 0, wa = 0;
	char s[5];
	scanf("%d %d", &n, &m);
	memset(cnt, 0, sizeof cnt);
	while (m--) {
		scanf("%d %s", &p, s);
		if (cnt[p] != -1) {
			if (strcmp(s, "AC") == 0) {
				ac++;
				wa += cnt[p];
				cnt[p] = -1;
			}
			else
				cnt[p]++;
		}
	}
	printf("%d %d\n", ac, wa);
	return 0;
}

Measured memory_bytes: 640