akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main () {
	int t, p, r;
	while (cin >> t >> p >> r, t || p || r) {
		pair<int, pair<int, int> > team[t];
		int fail[t][p];
		memset(fail, 0, sizeof(fail));
		for (int i = 0; i < t; i++) {
			team[i].first = 0;
			team[i].second.first = 0;
			team[i].second.second = i;
		}
		for (int i = 0; i < r; i++) {
			int tid, pid, time;
			string msg;
			cin >> tid >> pid >> time >> msg;
			tid--; pid--;
			if (msg == "WRONG") {
				fail[tid][pid]++;
			}
			else {
				team[tid].first--;
				team[tid].second.first += time + 1200 * fail[tid][pid];
			}
		}
		sort(team, team + t);
		for (int i = 0; i < t; i++) {
			cout << team[i].second.second + 1 << ' ' << -team[i].first << ' ' << team[i].second.first << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <algorithm>
using namespace std;
long n, all, a[100010];

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  cin >> n;
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
    all ^= a[i];
  }
  for(int i = 0; i < n; ++i) a[i] &= ~all;

  for(int i = 0; i < n; ++i) {
    int idx = max_element(a + i, a + n) - a;
    if(a[idx] == 0) break;
    swap(a[i], a[idx]);
    long msb = 1;
    while(msb << 1 <= a[i]) msb <<= 1;
    for(int j = 0; j < n; ++j) if(i != j && a[j] & msb) a[j] ^= a[i];
  }

  long ans = 0;
  for(int i = 0; i < n; ++i) ans = max(ans, ans ^ a[i]);
  cout << ans * 2 + all;
  return 0;
}

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

int isInt(float x){
	return (floor(x) == ceil(x));
}

int main(){
	int n,d;	cin >> n >> d;
	int x[n+1][d+1];
	for(int i=1; i<=n; i++){
		for(int j=1; j<=d; j++){
			cin >> x[i][j];
		}
	}
	float dis[n+1][d+1]; int count=0;
	for(int i=1; i<n; i++){
		for(int j=i+1; j<=n; j++ ){
			float ans=0;
			for(int k=1; k<=d;k++)	ans+=(x[i][k] - x[j][k])*(x[i][k]- x[j][k]);
			if(isInt(sqrt(ans)))	count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

if m % 2 == 1:
    print(-1)
    exit()

ans = []

depth = [-1] * n
deg = [0] * n
def dfs(v, pr):
    for nv in g[v]:
        if nv == pr:
            continue
        if depth[nv] != -1:
            # 全域木以外のところを処理する
            # 重複して辺を繋げるのを防ぐ
            if depth[nv] < depth[v]:
                ans.append((v, nv))
                deg[v] += 1
        else:
            depth[nv] = depth[v] + 1
            dfs(nv, v)
            if deg[nv] % 2 == 0:
                ans.append((v, nv))
                deg[v] += 1
            else:
                ans.append((nv, v))
                deg[nv] += 1

depth[0] = 0
dfs(0, -1)

for i, j in ans:
    print(i + 1, j + 1)






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

using namespace std;

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

  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      for (int k = 0; k <= K; k++) {
        int a = A * (1 << i);
        int b = B * (1 << j);
        int c = C * (1 << k);
        if (i + j + k <= K && a < b && b < c) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3572
s=input()
if s[0]!="A":
    print("WA")
else:
    cnt=0
    for i in range(min(2,len(s)-2),max(2,len(s)-2)+1):
        if s[i]=="C":
            cnt+=1
    if cnt!=1:
        print("WA")
    else:
        for i in range(1,len(s)):
            if s[i]!="C":
                if ord("a")>ord(s[i]) or ord("z")<ord(s[i]):
                    print("WA")
                    break
        else:
            print("AC")

Measured memory_bytes: 9072
str_list = []
n = int(input())
a = {}
name_list = []
for i in range(n):
    name = input()
    a[name] = 0
    name_list.append(name)
    
    
#a = {}
for i in name_list:
    a[i] += 1
    
    
max_val = max(a.values())
a = sorted(a.items())
for i in range(len(a)):
    if a[i][1] == max_val:
        print(a[i][0])

Measured memory_bytes: 43912
#include<iostream>
using namespace std;
long long o,n;
int main(){
  int i,j,k;
  long long d[4][4001]={{}};
  for(i=0;i<=1000;i++) d[0][i]=1;
  for(j=1;j<4;j++){
    for(i=0;i<=4001;i++) d[j][i]=0;
    for(i=0;i<=4000;i++){
      for(k=0;k<=1000;k++){
	if(i+k>4000) break;
	
	d[j][i+k]+=d[j-1][i];
	//if(i+k==4000) cout << k << ":" << d[j][4000] << endl;
      }
    }
  }
  //cout << d[1][0] << d[2][0]<<endl;
  while(cin>>n) {
    cout << d[3][n] << endl;
  }
}

Measured memory_bytes: 1288
n = int(input())
l = list(map(int, input().split()))
 
max_step = 0
cur_step = 0
cur_high = 0
for i, h in enumerate(l):
    if i == 0:
        cur_high = h
    else:
        if cur_high >= h:
            cur_high = h
            cur_step += 1
        else:
            if max_step < cur_step:
                max_step = cur_step
            cur_high = h
            cur_step = 0
else:
    if max_step < cur_step:
        max_step = cur_step
print(max_step)

Measured memory_bytes: 15020
/*************************************************************************
    > File Name: C.cpp
    > Author: Roundgod
    > Mail: wcysai@foxmail.com 
    > Created Time: 2018-12-22 19:58:47
 ************************************************************************/

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll n,p;
int main()
{
    scanf("%lld%lld",&n,&p);
    if(n==1)
    {
        printf("%lld\n",p);
        return 0;
    }
    else if(n>=40)
    {
        printf("%lld\n",1LL);
        return 0;
    }
    else
    {
        bool f=true;
        ll ans=-1;
        for(ll i=1;i<=1000000;i++)
        {
            ll s=1;
            for(ll j=1;j<=n;j++)
            {
                s=s*i;
                if(s>p) {f=false; break;}
            }
            if(!f) break;
            if(p%s==0) ans=i;
        }
        printf("%lld\n",ans);
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	string ch[4];
	ch[0]="dream";
	ch[1]="dreamer";
	ch[2]="erase";
	ch[3]="eraser";
	for(ll i=0;i<4;i++){
		reverse(ch[i].begin(),ch[i].end());
	}
	ll now=0;
	while(now!=s.size()){
		string t;
		for(ll i=0;i<5;i++){
			t.push_back(s[i+now]);
		}
		if(t==ch[0]||t==ch[2]){
			now+=5;
			continue;
		}
		t.push_back(s[now+5]);
		if(t==ch[3]){
			now+=6;
			continue;
		}
		t.push_back(s[now+6]);
		if(t==ch[1]){
			now+=7;
			continue;
		}
		cout << "NO";
		return 0;
	}
	cout << "YES";
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#define deque_valtype char

typedef struct dq_node_sub{
	deque_valtype val;
	struct dq_node_sub *prev;
	struct dq_node_sub *next;
}dq_node;

typedef struct {
	int N;
	dq_node *first;
	dq_node *last;
}deque;

deque *make_deque(){
	deque *dq = (deque *)malloc(sizeof(deque));
	dq->N = 0;
	dq->first = NULL;
	dq->last = NULL;
	return dq;
}

void add_first_data_deque(deque_valtype val, deque *dq){
	dq_node *first = (dq_node *)malloc(sizeof(dq_node));
	first->val = val;
	first->prev = NULL;
	first->next = dq->first;
	dq->first = first;
	dq->N++;
	if(dq->N == 1){
		dq->last = first;
	}
	else{
		first->next->prev = first;
	}
}

void add_last_data_deque(deque_valtype val, deque *dq){
	dq_node *last = (dq_node *)malloc(sizeof(dq_node));
	last->val = val;
	last->prev = dq->last;
	last->next = NULL;
	dq->last = last;
	dq->N++;
	if(dq->N == 1){
		dq->first = last;
	}
	else{
		last->prev->next = last;
	}
}

deque_valtype take_first_data_deque(deque *dq){
	if(dq->N == 0){
		printf("In function 'take_first_data_deque':\nThere is no data in the deque");
	}
	deque_valtype ans = dq->first->val;
	dq->N--;
	if(dq->N == 0){
		free(dq->first);
		dq->first = NULL;
		dq->last == NULL;
	}	
	else{
		dq->first = dq->first->next;
		free(dq->first->prev);
		dq->first->prev = NULL;
	}
	return ans;
}

deque_valtype take_last_data_deque(deque *dq){
	if(dq->N == 0){
		printf("In function 'take_last_data_deque':\nThere is no data in the deque");
	}
	deque_valtype ans = dq->last->val;
	dq->N--;
	if(dq->N == 0){
		free(dq->last);
		dq->first = NULL;
		dq->last == NULL;
	}	
	else{
		dq->last = dq->last->prev;
		free(dq->last->next);
		dq->last->next = NULL;
	}
	return ans;
}

deque_valtype look_first_data_deque(deque *dq){
	if(dq->N == 0){
		printf("In function 'look_first_data_deque':\nThere is no data in the deque");
	}
	return dq->first->val;
}

deque_valtype look_last_data_deque(deque *dq){
	if(dq->N == 0){
		printf("In function 'look_last_data_deque':\nThere is no data in the deque");
	}
	return dq->last->val;
}

int element_num_deque(deque *dq){
	return dq->N;
}

void out_all_deque(deque *dq){
	dq_node *now = dq->first;
	while(now != NULL){
		printf("%c\n", now->val);
		now = now->next;
	}
}

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

int main(){
	int N, K, i, is_reverse;
	char head;
	scanf("%d%d", &N, &K);
	char *S = (char *)malloc(sizeof(char) * (N + 1));
	scanf("%s", S);
	K = min(K, 2 * N + K % 2);
	deque *dq = make_deque();
	for(i = 0; i < N; i++){
		add_last_data_deque(S[i], dq);
	}
	for(i = 0, is_reverse = 0; i < K; i++){
		head = take_first_data_deque(dq);
		if(is_reverse == 0){
			if(head == 'A'){
				add_first_data_deque('B', dq);
			}
			else{
				add_last_data_deque('B', dq);
				is_reverse = 1;
			}
		}
		else{
			if(head == 'B'){
				add_first_data_deque('A', dq);
			}
			else{
				add_last_data_deque('A', dq);
				is_reverse = 0;
			}
		}
	}
	while(element_num_deque(dq) > 0){
		head = take_first_data_deque(dq);
		if(is_reverse == 0){
			printf("%c", head);
		}
		else{
			if(head == 'A'){
				printf("B");
			}
			else{
				printf("A");
			}
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cstring>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using ll = long long;

int main() {
  std::string s;

  cin >> s;

  for (int i = 2; i <= s.size(); i+=2) {
    int n = s.size() - i;
    std::string l = s.substr(0, n / 2),
                r = s.substr(n / 2, n / 2);

    if (l == r) {
      cout << n << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    int flag=false;
    int cnt=0,cnt1=0;
    for(int i=0; i<n; i++)
    {
        if(a[i]%2==0)
        {
            cnt++;
            if(a[i]%3==0 or a[i]%5==0)
                cnt1++;
        }
    }
    if(cnt==cnt1)
        cout<<"APPROVED";
    else
        cout<<"DENIED";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;

const int N=200005;
const int mod=1000000007;

struct E{
	int to,next;
}mem[N<<1];
int h,t,num,n,x,y,m,ans,res,sum,ns,siz,ssr;
int dp[N],sz[N],head[N],tp[N],q[N],fac[N],inv[N],d[N];
bool vis[N];

void addedge(int x,int y){
	num++;
	mem[num].to=y; mem[num].next=head[x];
	head[x]=num; d[x]++;
}

int quickpow(int x,int y){
	int s=1;
	for (;y;y>>=1,x=1ll*x*x%mod)
		if (y&1) s=1ll*s*x%mod;
	return s;
}

void init(int n){
	int i; fac[0]=fac[1]=inv[0]=inv[1]=1;
	for (i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=quickpow(fac[n],mod-2);
	for (i=n-1;i>=1;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
}

int C(int x,int y){
	if (x<y) return 0;
	return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;
}

void add(int &x,int y){
	x+=y;
	(x>=mod)?x-=mod:0;
}

void bfs(int st){
	int k,u,j;
	h=t=0; q[++t]=st;
	while (h<t){
		k=q[++h]; vis[k]=1;
		for (j=head[k];j;j=mem[j].next){
			u=mem[j].to;
			if (!vis[u]){
				q[++t]=u; vis[u]=1;
			}
		}
	}
}

void topsort(){
	int k,u,j;
	while (h<t){
		k=tp[++h];
		for (j=head[k];j;j=mem[j].next){
			u=mem[j].to; d[u]--;
			if (d[u]==1) tp[++t]=u;
		}
	}
}

void dfs(int k,int pre,int rt){
	int u,j;
	for (j=head[k];j;j=mem[j].next){
		u=mem[j].to;
		if (u==pre||u==rt) continue;
		dfs(u,k,rt);
	}
	dp[k]=1; sz[k]=0;
	for (j=head[k];j;j=mem[j].next){
		u=mem[j].to;
		if (u==pre||u==rt) continue;
		if (u<pre){
			dp[k]=1ll*dp[k]*dp[u]%mod*C(sz[k]+sz[u],sz[u])%mod;
			sz[k]+=sz[u];
		}
		else{
			ssr=1ll*ssr*dp[u]%mod*C(siz+sz[u],sz[u])%mod;
			siz+=sz[u];
		}
	}
	sz[k]++;
}

void solve(int x,int &res,int &ns){
	int i,j,k,st=0;
	ns=0; res=0;
	bfs(x);
	ns=t; m=0; h=t=0;
	for (i=1;i<=ns;i++){
		k=q[i];
		for (j=head[k];j;j=mem[j].next) m++;
		if (d[k]==1) tp[++t]=k;
	}
	if (m/2!=ns) return;
	topsort(); t=0;
	for (i=1;i<=ns;i++)
		if (d[q[i]]>1&&q[i]>st) st=q[i];
	for (j=head[st];j;j=mem[j].next)
		if (d[mem[j].to]>1) tp[++t]=mem[j].to;
	for (i=1;i<=t;i++){
		k=tp[i]; ssr=1; siz=0;
		dfs(st,k,st);
		ssr=1ll*ssr*C(siz+sz[st],sz[st])%mod*dp[st]%mod;
		add(res,ssr);
	}
}

int main(){
	int i;
	scanf("%d",&n);
	for (i=1;i<=2*n;i++){
		scanf("%d%d",&x,&y);
		addedge(x,y+n); addedge(y+n,x);
	}
	init(n*2);
	ans=1;
	for (i=1;i<=n;i++)
		if (!vis[i]){
			solve(i,res,ns);
			ans=1ll*ans*C(sum+ns,ns)%mod*res%mod;
			sum+=ns;
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 13184
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int N=nextInt();
		int L[]=new int[N];
		int ans=0;
		for(int i=0;i<N;i++){
			L[i]=nextInt();
		}
		Arrays.sort(L);
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				for(int k=j+1;k<N;k++){
					if(L[i]+L[j]>L[k]&&L[i]!=L[j]&&L[j]!=L[k]&&L[k]!=L[i])
						ans++;
				}
			}
		}
		System.out.println(ans);
	}
	public static long lmod(long i, long j) {
	     return (i%j)<0?(i%j)+0+(j<0?-j:j):(i%j+0);
	 }
	static boolean isOK(int index,int key,int[]a){
		if (a[index]>=key) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}



Measured memory_bytes: 33276
#include <stdio.h>
int main(void)
{
      int a[100];
      int i,n;
      scanf("%d",&n);
       for(i=0;i<n;i++){
            scanf("%d",&a[i]);
          }
       for( i=n-1; i>0; i--){
            printf("%d ",a[i]);
          }

           printf("%d\n",a[0]);
        return 0;
}




Measured memory_bytes: 2076
#include<bits/stdc++.h>
using namespace std;
//#define endl "\n"
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vi vector<ll>
#define pb push_back
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
#define pii pair<ll,ll>
#define vii vector<pii>
#define MOD 1000000007LL
#define calc_fact(n) tgamma(n+1)

ll binpow(ll a, ll b)
{
    if(b==0)return 1;
    ll res=binpow(a, b/2);
    res = (res*res)%MOD;
    if(b%2){
        res = (res*a)%MOD;
    }
    return res;
}
ll inv(ll n)
{
    return binpow(n, MOD-2);
} 
bool compare(const pair<ll,ll>&i,const pair<ll,ll>&j)
{
    if(i.F!=j.F)
    return i.F<j.F;             //sort the first element of vector pair in ascending order
    else
    return i.S>j.S;            //sort the second element of vector pair in descending order
}
vi v;
void sieve(ll n)     // number upto which prime number we want
{
    vector<bool> PRIME(n+1,true);
    PRIME[0]=false;PRIME[1]=false;
    for(ll p=2;p*p<=n;p++)
    {
        if(PRIME[p]==true)
        {
            for(ll i=p*p;i<=n;i+=p)
            {
                PRIME[i]=false;    // mark multiples of number as composite
            }
        }
    }
         // PRIME[i]==true then prime number
    for(ll i=2;i<PRIME.size();i++)
    {
        if(PRIME[i])
        v.pb(i);
    }
}



signed main()
{
    FIO;
    ll x,y;
    cin>>x>>y;
    if(y%2==0 and y>=2*x and y<=4*x)
    cout<<"Yes";
    else
    cout<<"No";
}

Measured memory_bytes: 3652
N=int(input())
arr=[]

a=N
while a>0:
    arr.append(a%10)
    a=a//10

keta=len(arr)

ans=0
for i in range(1,keta):
    if i%2==1:
        ans+=9*10**(i-1)
if keta%2==0:
    print(ans)
else:
    print(ans+N-(10**(keta-1)-1))


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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

void solve(){
    ll k,x;
    cin>>k;
    queue<ll> q;
    for(int i=1;i<10;i++)q.emplace(i);
    for(int i=0;i<k;i++){
        x=q.front();
        if(x%10!=0)q.emplace(10*x+(x%10)-1);
        q.emplace(10*x+(x%10));
        if(x%10!=9)q.emplace(10*x+(x%10)+1);
        q.pop();
    }
    cout<<x<<endl;    
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    li h,n;
    cin>>h>>n;
    li sum=0;
    rin{
        li a;
        cin>>a;
        sum+=a;
    }
    cout<<(sum>=h?"Yes":"No")<<endl;

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

// グリッド上の縦横移動
constexpr std::array<std::pair<int, int>, 4> dxdy = {
    std::pair<int, int>( 1,  0),
    std::pair<int, int>(-1,  0),
    std::pair<int, int>( 0,  1),
    std::pair<int, int>( 0, -1)
};

void VintOut(std::vector<int>& A){
    const int n = A.size();
    if(n == 0){putchar('\n'); return;}
    printf("%d", A[0]);
    for(int i = 1; i < n; ++i) printf(" %d", A[i]);
    putchar('\n');
}
void VintOut(std::vector<long long int>& A){
    const int n = A.size();
    if(n == 0){ putchar('\n'); return;}
    printf("%lld", A[0]);
    for(int i = 1; i < n; ++i) printf(" %lld", A[i]);
    putchar('\n');
}

template <typename T>
inline bool chmin(T& a, T b){
    if(b < a){ a = b; return true;}
    return false;
}

template <typename T>
inline bool chmax(T& a, T b){
    if(a < b){ a = b; return true;}
    return false;
}

inline bool isIn(int x, int y, int H, int W){
    return 0 <= x and x < H and 0 <= y and y < W;
}
inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}

// z-algorithm
template <class T> std::vector<int> z_algorithm(const T &str) {
    const int n = str.size();
    std::vector<int> resOfCP(n); resOfCP[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n and str[j] == str[i + j]) ++j;
        resOfCP[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i + k < n and k + resOfCP[k] < j) resOfCP[i + k] = resOfCP[k], ++k;
        i += k; j -= k;
    }
    return resOfCP;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


char S[100];

int main(void){
    int a, b; scanf("%d%d", &a, &b);
    if(a > b) std::swap(a, b);
    REP(i, b) S[i] = '0' + a; S[b] = '\0';
    puts(S);
    
    return 0;
}

Measured memory_bytes: 760
/* 十 聖イシドールスよ、迷えるプログラマを導き給え！ 十 */
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <deque>

#define rep(i, n) for(int i = 0; i < n; i++)

//const long long INF = 1LL << 60;
const int INF = 1e9;
using ll = long long;

int main()
{
	int N, Q;
	std::cin >> N >> Q;
	std::vector<int> ACGT(N, 0);	// AGCT[i]文字目までに何個現れたか
	std::string S;
	std::cin >> S;

	// 前処理...ACの数を数えておく 
	char pre = S[0];
	for( int i = 1; i < N; i++ )
	{
		char now = S[i];
		//printf( "%c:%c", pre, now );
		ACGT[i] = ACGT[i-1];
		if( pre == 'A' )
		{
			if( now == 'C')
			{
				//printf("now!");
				ACGT[i] = ACGT[i-1] + 1;
			}
		}
		//printf("\n");
		pre = now;
	}

//	printf("===\n");
//	rep( i, N )
//	{
//		printf( "%d\n", ACGT[i]);
//	}
//	printf("===\n");
	
	// 問題をとく 
	for( int i = 0; i < Q; i++ )
	{
		int l, r;
		std::cin >> l >> r;
		l--; r--;

		int ans = ACGT[r] - ACGT[l];

		if( ( S[l] == 'A' ) && ( S[r] == 'C' ) )
		{
			//ans++;
		}	

		std::cout << ans << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3912
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題163

            int n = int.Parse(Console.ReadLine());

            string[] line = Console.ReadLine().Split(' ');

            //int[] a = new int[n];
            List<int> a = new List<int>();

            a.Add(0);

            for (int i = 0; i < n-1; i++)
            {
                a.Add(int.Parse(line[i]));
            }

            a.Sort();



            int j = 1;
            int count = 0;
            for (int i = 1; i < n; i++)
            {
                if (j == a[i])
                {
                    count++;
                }
                else
                {
                    Console.WriteLine(count);
                    count = 0;

                    while (++j != a[i])
                    {
                        Console.WriteLine(0);
                    }
                    //count = 0;
                    //j = a[i];
                    count = 1;



                }

            }

            

            Console.WriteLine(count);


            while (++j <= n )
            {
                Console.WriteLine(0);
            }


        }


    }
}


Measured memory_bytes: 43248
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  vector<int> v(5);
  rep(i,5)cin>>v[i];
  int mn=1000;
  int k;
  rep(i,5){
    mn=min(mn,(v[i]-1)%10);
    if(mn==(v[i]-1)%10) k=i;
  }
  int ans=0;
  rep(i,5){
    if(i!=k&&v[i]%10==0)ans+=v[i];
    else if(i!=k)ans+=(v[i]+9)/10*10;
    else ans+=v[i];
  }
  cout<<ans<<endl;
  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);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        if((a+b) % 3 == 0) {
            System.out.println("Possible");
        } else if(a % 3 == 0) {
            System.out.println("Possible");
        } else if (b % 3 ==0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}


Measured memory_bytes: 20560
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  rep(i, n) {
    int num;
    cin >> num;
    l.at(i) = num;
  }
  int sum = 0;
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());
  rep(i, k) {
    sum += l.at(i);
  }
  cout << sum << endl;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

unsigned __euclidean_gcd( unsigned a, unsigned b )
{
  a = a % b;
  return a == 0 ? b : __euclidean_gcd( b, a );
}

unsigned euclidean_gcd( unsigned a, unsigned b )
{
  return a < b ? __euclidean_gcd( b, a ) : __euclidean_gcd( a, b );
}
LL gcd(LL n, LL m){
    
    while(n%m!=0){
        LL temp = n;
        n%=m;
        m= temp;
    }
    return m;
}
LL lcm(LL n, LL m){
    return n*m/euclidean_gcd(n,m);
}


void solve(long long A, long long B){
    // debug(gcd(456,123));
    cout<<lcm(max(A,B), min(A,B))<<endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <climits>
#include <set>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::string;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {

	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";

    return out;

}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int a, b;
	cin >> a >> b;

	cout << a * b - b - a + 1 << "\n";

	return 0;

}

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

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

 
int main() {
  int N;
  cin >> N;
  int sum = findSumOfDigits(N);
  
 if (N % sum ==0 ){ cout << "Yes" << endl;}
  else {cout << "No"<< endl;}
  
}
    
  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin >>s;
	int len=s.length();
	string last;
	string now;
	last+=s[0];
	int cnt=1;
	for(int i=1;i<len;i++)
	{
		now+=s[i];
		if(now!=last)
		{
			last=now;
			cnt++;
			now="";
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int n,sum=0;
    scanf("%d",&n);
    int shu[n];
    for(int i=0;i<n;i++){
        scanf("%d",&shu[i]);
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<n;j++){
            if(i<j){
                sum=sum+shu[i]*shu[j];
            }
        }
    }
    printf("%d",sum);
}


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

using namespace std;

int main(){
    int N;
    long long int ans=0;
    cin >> N;
    vector<long long int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }

    for(int i=0;i<N-1;i++){
        if(A[i+1]<A[i]){
            ans += A[i]-A[i+1];
            A[i+1] += (A[i]-A[i+1]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4760
#include<stdio.h>
int main(){
  int n,i,b=0,c=0;
  scanf("%d",&n);
  int a[n+1];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]%2==1)
      b++;
    if(a[i]%4==0)
      c++;
  }
  if((b-1<=c && n%2==1) || (b<=c && n%2==0))
    puts("Yes");
  else
    puts("No");
  return 0;
}


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

using namespace std;

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

using ll = long long;
using ull = unsigned long long;

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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int n;
  string s;
  cin >> n >> s;

  if (n == 1 || n & 1) {
    cout << "No" << endl;
    return 0;
  }

  bool ok = true;

  for (auto i = 0; i < n / 2; ++i) {
    if (s[i] != s[n / 2 + i]) {
      ok = false;
      break;
    }
  }

  puts(ok ? "Yes" : "No");

  return 0;
}

Measured memory_bytes: 3544
#-------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# ------------------- fast io --------------------

from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi

def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y


def solve(N):
    a = 0
    for i in N:
        a += int(i)
    return "Yes" if a % 9 == 0 else "No"

N = input()
print(solve(N))


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	rep(i,n-1){
		if(s[i] == 'A' && s[i+1] == 'C'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N;
    cin >> N;
    vector<vector<int>> F(N, vector<int>(10));
    REP(i, N) REP(j, 10) cin >> F[i][j];
    vector<vector<int>> P(N, vector<int>(11));
    REP(i, N) REP(j, 11) cin >> P[i][j];

    ll ans = -INF64;
    REP(bit, (1 << 10)) {
        ll sum = 0;
        vector<int> cnt(N);
        REP(i, 10) {
            if (bit & (1 << i)) {
                REP(j, N) {
                    if (F[j][i] == 1)
                        cnt[j]++;
                }
            }
        }
        if (*max_element(ALL(cnt)) == 0)
            continue;
        REP(i, N) { sum += P[i][cnt[i]]; }
        chmax(ans, sum);
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */

ll memohLen[51];
ll memopLen[51];

ll hLen(ll n) {
    if(n == 0)return 1;
    if(memohLen[n] == 0)memohLen[n] =  2 * hLen(n - 1) + 3;
    return memohLen[n];
}

ll pLen(ll n) {
    if(n == 0)return 1;
    if(memopLen[n] == 0)memopLen[n] =  2 * pLen(n - 1) + 1;
    return memopLen[n];
}

ll solve(ll n, ll x) {
    ll height =  hLen(n);
    if(x == 1 && n == 0)return 1;
    else if(height == x)return 2 * pLen(n - 1) + 1;
    else if(x == 1)return 0;
    else if(x <= height / 2){
        return solve(n - 1, x - 1);
    }
    else if(x == (height + 1) / 2) {
        return 1 + pLen(n - 1);
    }else{
        return 1 + pLen(n - 1) + solve(n - 1, x - (height + 1) / 2);
    }
}

int main() {
    ll N, X; cin >> N >> X;
    cout << solve(N, X) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int S = sc.nextInt();
		int h = S/3600;
		int m = (S%3600)/60;
		int s = (S%3600)%60;

		System.out.println(h + ":" + m + ":" +s);
	}
}


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

int main() {
  int N, s=0;
  cin >> N;
  for (int i=1; i<=N; i*=10) s += N/i%10;
  if (N%s == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
def solve():
    while True:
        worm = input()
        if worm == '0':
            break
        
        q = [worm]
        m = {('r', 'g'): 'bb', ('g', 'r'): 'bb', ('r', 'b'): 'gg',
             ('b', 'r'): 'gg', ('g', 'b'): 'rr', ('b', 'g'): 'rr'}
        d = {worm: True}
        ans = 0
        
        while q:
            nq = []
            for w in q:
                flag = True
                for i, t in enumerate(zip(w, w[1:])):
                    s1, s2 = t
                    if s1 != s2:
                        flag = False
                        nw = w[:i] + m[t] + w[i+2:]
                        if nw not in d:
                            d[nw] = True
                            nq.append(nw)
                if flag:
                    print(ans)
                    break
            else:
                q = nq[:]
                ans += 1
                continue
            break
        else:
            print('NA')

solve()


Measured memory_bytes: 7456
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim s As String = NextString()
        Dim t As String = NextString()

        Dim arrS As Char() = String2CharArr(s)
        Dim arrT As Char() = String2CharArr(t)

        Array.Sort(arrS)

        Array.Sort(arrT)
        Array.Reverse(arrT)

        For i As Integer = 0 To Math.Min(arrS.Length, arrT.Length) - 1
            If arrS(i) < arrT(i) Then
                WriteLine("Yes")
                Exit Sub
            ElseIf arrS(i) > arrT(i) Then
                WriteLine("No")
                Exit Sub
            End If
        Next

        If arrS.Length < arrT.Length Then
            WriteLine("Yes")
        Else
            WriteLine("No")
        End If
    End Sub

    Function String2CharArr(s As String) As Char()
        Dim result As Char() = New Char(s.Length - 1) {}
        Dim i As Integer = 0
        For Each c As Char In s
            result(i) = c
            i += 1
        Next
        Return result
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 20560
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define int long long
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define P pair<int,int>
#define  sc(a) scanf("%lld",&a)
#define pf(a) printf("%lld ",a)
using namespace std;
string q;
int w[2000005];
signed main()
{       
	int a, b;
	cin >> a >> b;
	int maxx = 0;
	int last;
	int temp;
	sc(last);
	int y = last;
	rep(i, 2, b)
	{
		sc(temp);
		maxx = max(temp - last, maxx);
		last = temp;
	}
	maxx = max(a - last+y, maxx);
	cout << a - maxx;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
    long long int num,n,k,i;
    scanf("%lld %lld",&n,&k);
    i = 0;
    while(n!=0)
    {
        // num += pow(k,i)*(n%10);
        i++;
        n=n/k;
    }
    // i = 0;
    // while(num!=0)
    // {
    //     num = num/10;
    //     i++;
    // }
    printf("%lld",i);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    vector<long double> p(6), q(6);
    for (int i = 0; i < 6; ++i) {
        cin >> p[i];
        p[i] /= 100;
    }
    for (int i = 0; i < 6; ++i) {
        cin >> q[i];
        q[i] /= 100;
    }
    long double l = 0, r = 1;
    long double a = 0, b = 0;
    for (int i = 0; i < 100; ++i) {
        long double x = (l*2+r)/3, y = (l+2*r)/3;
        a = 0, b = 0;
        for (int j = 0; j < 6; ++j) {
            a += max(x*p[j], (1-x)*q[j]);
            b += max(y*p[j], (1-y)*q[j]);
        }
        if(a < b) r = y;
        else l = x;
    }
    printf("%.15Lf", min(a, b));
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  int N;
  int Q;
  char string[100001];
  int l[100001];
  int r[100001];
  int i; /* index */

  scanf("%d %d", &N, &Q);
  scanf("%s", string);
  for (i = 0; i < Q; ++i) {
      scanf("%d %d", &l[i], &r[i]);
  }

  int count_ans[100001];
  int count = 0;
  for (i = 0; i < N; ++i) {
    if (string[i] == 'A' && string[i+1] == 'C') {
      ++count;
    }
    count_ans[i] = count;
  }

  for(i = 0; i < Q; ++i) {
    if (l[i] != 1) {
      printf("%d\n", count_ans[r[i] - 2] - count_ans[l[i] - 2]);
    } else {
      printf("%d\n", count_ans[r[i] - 2]);
    }
  }
  return 0;
}

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

int main() {
	bool is_prime[1000000];

	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i < 1000000; i++) {
		is_prime[i] = true;
	}

	for (int i = 2; i*i < 1000000; i++) {
		if (is_prime[i]) {
			for (int j = i*i; j < 1000000; j += i) {
				is_prime[j] = false;
			}
		}
	}

	int n_prime[1000000];

	while (true) {
		int n;
		cin >> n;

		if (cin.eof())
			break;
		if(n==0)
			break;

		int c=0;

		for(int i=0;i<=n/2;i++){
			if(is_prime[i]&&is_prime[n-i])
				c++;
		}

		cout << c << endl;
		
	}
	return 0;

}

Measured memory_bytes: 4048