akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;

int c[10][10];
int sp[10];

void dijkstra() {
    bool used[10];
    fill(used, used + 10, false);
    fill(sp, sp + 10, INF);
    sp[1] = 0;
    while (true) {
        int v = -1, min_p = INF;
        for (int i = 0; i < 10; i++) {
            if (used[i] == false && sp[i] < min_p) {
                v = i;
                min_p = sp[i];
            }
        }
        if (v == -1)
            return;

        for (int i = 0; i < 10; i++) {
            if (used[i] == false) {
                sp[i] = min(sp[i], c[i][v] + sp[v]);
            }
        }
        used[v] = true;
    }
}

int main() {
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> c[i][j];
        }
    }

    dijkstra();
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int a;
            cin >> a;
            if (a == -1)
                continue;
            ans += sp[a];
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll a,b,n,temp; cin>>a>>b;
    while(b){
        temp=b;
        b=a%b;
        a=temp;
    }
    n=a;
    set<ll> me;
    me.insert(1);
    for(ll i=2;i*i<=n;i++){
        while(a%i==0){
            a/=i;
            me.insert(i);
        }
    }
    me.insert(a);
    cout<<me.size()<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int i,n,R[200000],min,max;

	scanf("%d",&n);

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

	min=R[0];
	max=R[1]-R[0];

	for(i=1;i<n;i++){
		if(max<R[i]-min) max=R[i]-min;
		if(min>R[i]) min=R[i];
	}

	printf("%d\n",max);

	return 0;
}

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

int main() {
   int N;
   cin >> N;
   vector<string> v(N);
   for(int i=0; i<N; i++) cin >> v[i];

   int M;
   cin >> M;
   vector<string> w(M);
   for(int i=0; i<M; i++) cin >> w[i];

   int div = 0;

   for(string s : v) {
      int v_n = count(v.begin(), v.end(), s);
      int w_n = count(w.begin(), w.end(), s);
      div = max(div, v_n - w_n);

   }
   cout << div << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int n;
	cin>> n;

	if(n%10==0) cout<< "pon" << endl;
	if(n%10==1) cout<< "pon" << endl;
	if(n%10==6) cout<< "pon" << endl;
	if(n%10==8) cout<< "pon" << endl;
	if(n%10==2) cout<< "hon" << endl;
	if(n%10==4) cout<< "hon" << endl;
	if(n%10==5) cout<< "hon" << endl;
	if(n%10==7) cout<< "hon" << endl;
	if(n%10==9) cout<< "hon" << endl;
	if(n%10==3) cout<< "bon" << endl;
 
	return 0;
}

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

int main() {
	long int n;
	cin>>n;
	long long int sum=0;
	long int i=0;
	while(i<=n)
	{
	    if(i%3!=0 && i%5!=0)
	    {
	        sum=sum+i;
	    }
	    i++;
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>

typedef struct pair{
	int x;
	int y;
}pair;

int cmpx(const void *a,const void *b){
	pair *c1 = (pair *)a;
	pair *c2 = (pair *)b;
	return c1->x - c2->x;
}
int main(void){
	int sx,sy,gx,gy, n, m, count, i, j;
	pair t[5000];
	scanf("%d%d",&n,&m);
	for(i = 0;i < n;i++)
		scanf("%d%d",&t[i].x,&t[i].y);
	qsort(t,n,sizeof(t[0]),cmpx);
	for(i = 0;i < m;i++){
		scanf("%d%d%d%d",&sx,&sy,&gx,&gy);
		count = 0;
		for(j = 0;j < n && t[j].x <= gx;j++)
			if(sx <= t[j].x && sy <= t[j].y && gx >= t[j].x && gy >= t[j].y) count++;
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 1144
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    d,t,s = LI()
    if t*s < d:
        print("No")
    else:
        print("Yes")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 65732
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
#define rREP(i,b,n) for(int i = n; i >= b; i--)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string lowercase = "abcdefghijklmnopqrstuvwxyz";
const string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int gcd(int a, int b){return b ? gcd(b, a % b): a;}

int main()
{
    int x;
    cin >> x;
    if (x == 3 || x == 5 || x == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

int X;

int main()
{
    cin >> X;

    int n = X / 100;
    int r = X % 100;

    int pc = r / 5;
    int r2 = r % 5;
    if (n - pc >= 0 && r2 == 0)
    {
        cout << 1 << endl;
        return 0;
    }
    else if (n - pc >= 1)
    {
        cout << 1 << endl;
        return 0;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007 //1000000000000000003
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int N;
  cin>>N;

  list<int> li;

  rep(i,N){
    int aa;
    cin>>aa;

    if((N-i)%2==0){
      li.push_back(aa);
    }
    else{
      li.push_front(aa);
    }
  }

  rep(i,N){
    cout<< li.front() <<" ";
    li.pop_front();
  }
  cout<<"\n";


}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 8448
using System;

namespace _080_ThirdRoot
{
	class Program
	{
		static void Main ( string[] args )
		{
			string inputStr;

			while ((inputStr = Console.ReadLine ()) != "-1")
			{
				decimal original = decimal.Parse (inputStr);
				decimal limit = 0.00001m * original;

				decimal value = original / 2;
				decimal tmp;

				do
				{
					decimal numerator = value * value * value - original;
					decimal denominator = 3m * value * value;

					value = value - numerator / denominator;

					tmp = Math.Abs (value * value * value - original);

				} while (limit <= tmp);

				Console.WriteLine (value);
			}
		}
	}
}

Measured memory_bytes: 9356
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=2999;

int n;
double p[MAXN];

const int ZERO=MAXN;
double dp[2*MAXN+1];
double ndp[2*MAXN+1];

double solve() {
	dp[ZERO]=1;
	REP(i,n) {
		FORE(j,-(i+1),+(i+1)) ndp[ZERO+j]=0;
		FORE(j,-i,+i) {
			ndp[ZERO+j+1]+=dp[ZERO+j]*p[i];
			ndp[ZERO+j-1]+=dp[ZERO+j]*(1-p[i]);
		}
		FORE(j,-(i+1),+(i+1)) dp[ZERO+j]=ndp[ZERO+j];
		//printf("after %d:",i); FORE(j,-(i+1),+(i+1)) printf(" %.2lf",dp[ZERO+j]); puts("");
	}
	double ret=0; FORE(j,-n,-1) ret+=dp[ZERO+j]; return 1-ret;
}

void run() {
	scanf("%d",&n);
	REP(i,n) scanf("%lf",&p[i]);
	printf("%.15lf\n",solve());
}

int main() {
	run();
	return 0;
}


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

#define rep(i, N) for (long long i = 0; i < N; i++)
using ll = long long;

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

void solve(std::string S) {
    string revS = S;
    reverse(revS.begin(), revS.end());
    if (S == revS) {
        string S2 = "";
        for (ll i = 0; i < (S.length() - 1) / 2; i++) {
            S2.push_back(S[i]);
        }
        string S3 = "";
        for (ll i = (S.length() + 3) / 2 - 1; i < S.length(); i++) {
            S3.push_back(S[i]);
        }
        string revS2 = S2;
        string revS3 = S3;
        reverse(revS2.begin(), revS2.end());
        reverse(revS3.begin(), revS3.end());
        if (S2 == revS2 && S3 == revS3) {
            cout << YES << endl;
            return;
        }
    }
    cout << NO << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can
// remove this line by using your custom template)
int main() {
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <climits>
#include <unordered_map>
#include <numeric>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<int,int> pii;
ll a[3000];
ll dp[3000][3000];
ll dfs(int x,int y){
    if(x>y)return dp[x][y] = 0;
    if(dp[x][y] != -1)return dp[x][y];
    return dp[x][y] = max(a[x] - dfs(x+1,y), a[y] - dfs(x,y-1));
}
int main(){
    int n;
    cin >> n;
    rep(i,n)cin >> a[i];
    rep(i,n)rep(j,n)dp[i][j] = -1;
    cout << dfs(0,n-1) << endl;
}


Measured memory_bytes: 70784
from fractions import gcd
n = int(input())
A = list(map(int, input().split()))

left = [0] * n
right = [0] * n

ans = 0

for i in range(1, n):
    left[i] = gcd(left[i-1], A[i-1])
    right[n-1-i] = gcd(right[n-i], A[n-i])

for i in range(n):
    tmp = gcd(left[i], right[i])
    ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 16148
function Main(input) {
    var N = parseInt(input.trim(),10);
    var abc = 'abcdefghijklmnopqrstuvwxyz';
    var x = 0;
    var sum = 0;
    var ary_ans = [];
    var str;
    checkXmax_loop:
    while (true){
        if (N > (sum + Math.pow(26, (x+1)))){
          	sum += Math.pow(26, (x+1));
            x++;
        } else {
            break checkXmax_loop;
        }
    }
    N -= (sum + 1);

    for (var i = x; i > 0; i--){
        str = abc.substr(Math.floor(N / Math.pow(26, i)) , 1);
        ary_ans.push(str);
        N -=  (Math.floor(N / Math.pow(26, i))* Math.pow(26, i));
    }
    ary_ans.push(abc.substr(N, 1));           
    console.log(ary_ans.join(''));
}   


Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define x first
#define y second

const int maxn = 3013, maxt = 3013;

int n, t;
int dp[maxn][maxt];
pair < int, int > d[maxn];

void ckmax (int &a, int b) {
	a = max(a, b);
}

signed main () {
	cin >> n >> t;
	for (int i = 1; i <= n; ++i)
		cin >> d[i].x >> d[i].y;
	sort(d + 1, d + n + 1);
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < t; ++j) {
			ckmax(dp[i][j], dp[i - 1][j]);
			ckmax(dp[i][min(t, j + d[i].x)], dp[i - 1][j] + d[i].y);
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= t; ++j)
			ckmax(ans, dp[i][j]);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 35584
from copy import deepcopy
n=int(input())
x=list(map(int, input().split()))
x1=deepcopy(x)
x.sort()
median1 = int(n//2)
median2 = int(n//2-1)
median=(x[median1]+x[median2])/2
for i in x1:
  if i<=median:
    print(x[median1])
  else:
    print(x[median2])

Measured memory_bytes: 121464
a=int(input())
b=sum([10**i*9 for i in range(0, len(str(a))-1) if not i%2])
if len(str(a))%2:
    print()
    if len(str(a))==1:
        print(a)
    else:
        print(b+(a-10**(len(str(a))-1)+1))
else:
    print(b)

Measured memory_bytes: 3060
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    
    let mut iter = buf.split_whitespace();
    
    let n: usize = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse().unwrap();
    let xors: Vec<usize> = iter.map(|a| a.parse::<usize>().unwrap())
        .collect();
        
    let mut base = k.next_power_of_two();
    let mut x = 0;
    let thresh = n / 2;
    
    while base > 0 {
        let mut count = 0;
        for i in 0..n {
            if xors[i] & base == 0 {
                count += 1;
            }
        }
        if count > thresh && x + base <= k {
            x += base;
        }
        base >>= 1;
    }
    println!("{}", xors.iter().fold(0, |acc, a| acc + (x^a)));
}

Measured memory_bytes: 8444
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    a, b = map(int, input().split())
    uf.union(a - 1, b - 1)

ans = 0
for i in range(N):
    # print(uf.size(i))
    # print(uf.members(i))
    ans = max(ans, uf.size(i))
print(ans)

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

int main(){
    int A, B;
    cin >> A >> B;
    int res = 0;
    while(1 + res * (A-1) < B) res++;
    cout << res << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,ans=0; cin>>n;
    vector<vector<pp>> s;
    rep(i,n){
        int a; cin>>a;
        s.push_back(vector<pp>(a));
        rep(j,a){
            int x,y; cin>>x>>y;
            x--;
            s.back()[j]=(mk(x,y));
        }
    }
    rep(i,(1<<n)){
        int cnt=0;
        int ch=1;
        rep(j,n){
            if(!(i&(1<<j))) continue;
            cnt++;
            for(auto q:s[j]){
                if(q.second){
                    if(!(i&(1<<q.first)))
                    ch=0;
                }
                else{
                    if(i&(1<<q.first))
                    ch=0;
                }
            }
        }
        if(ch) ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0; i<(lli)(n); i++)
#define repf(i, n) for(lli i=1; i<(lli)(n+1); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    if(s == "ARC") cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

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

signed main(void)
{
	int n, m;
	cin >> n;
	m = n * (n - 1) / 2;
	m -= n / 2;
	cout << m << endl;
	for(int i = 1; i <= n - 1; i++)
	{
		for(int j = i + 1; j <= n; j++)
		{
			if (n % 2 == 1)
			{
				if (i + j != n)
					cout << i << " " << j << endl;
			}
			else
			{
				if (i + j != n + 1)
					cout << i << " " << j << endl;
			}
		}
	}
}


Measured memory_bytes: 256
// Problem : D - Friends
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、 
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
  vi adj[MX];
 vi vis(MX),siz(MX);
 void dfs(int S)
 {
 	vis[S]=1;
 	siz[S]=1;
 	F0R(x,sz(adj[S]))
 	{
 		int val=adj[S][x];
 		if(!vis[val])
 		{
 			dfs(val);
 			siz[S]+=siz[val];
 		}
 	}
 }
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N,M;
	cin>>N>>M;
	F0R(x,M)
	{
		int a,b;
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	int mx=0;
	FOR(x,1,N+1)
	{
		if(!vis[x])
		{
			dfs(x);
			ckmax(mx,siz[x]);
		}
	}
	cout<<mx;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 25036
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0;i<(int)n;i++)
ll mod=1e9+7;
#define PI acos(-1)


int main(){
    int n;
    cin>> n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<1000;i++){
        int V[3]={i/100, (i/10)%10, i%10};
        int cnt=0;
        for(int j=0;j<n;j++){
            if(s[j]==('0'+V[cnt])) cnt++;
            if(cnt==3) break; 
        }
        if(cnt==3) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0];
    
    let before  = "";
    let current = "";
    let list   = [];
    
    for(let i=0; i<S.length; i++) {
        current += S[i];
        
        if(current === before) {
            continue;
        }
        
        before = current;
        list.push(current);
        
        current = "";
    }
    
    console.log(list.length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}

int a[Sz];
             
int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> a[i];             

  ll ans = 0;
  int sum = 0;
  int r = 0;

  for (int i = 1; i <= n; i++) {
    while ((sum & a[r + 1]) == 0 && r + 1 <= n) {
      sum |= a[r + 1];
      r++;
    }
    if (i <= r)
      ans += r - i + 1;
    sum ^= a[i];
  }
  cout << ans;


  return 0;
}






// Coded by Z..



Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		char[] line = string.toCharArray();

		char c = ' ';
		for (int i = 0; i < line.length; i++) {
			if (Character.isUpperCase(line[i])) {
				c = Character.toLowerCase(line[i]);
			}
			else if (Character.isLowerCase(line[i])) {
				c = Character.toUpperCase(line[i]);
			} else {
				c = line[i];
			}
			System.out.print(c);
		}
System.out.println();

	}

}

Measured memory_bytes: 26812
import java.util.*;

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

        n = scan.nextInt();

        for (int i = 1; i <= n; i++){
            int div = i;
            if (i % 3 == 0){
                System.out.print(" " + i);
                continue;
            }
            while(div > 0){
                if (div % 10 == 3){
                    System.out.print(" " + i);
                    break;
                }
                div /= 10;
            }
        }

        System.out.println();
    }
}

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

int n, m, cnt[35], ans;

int main(){
  scanf("%d %d", &n, &m);
  for(int i = 0 ; i < n; i++){
    int k;
    scanf("%d", &k);
    for(int j = 0; j < k; j++){
      int x;
      scanf("%d", &x);
      x--;
      cnt[x]++;
      if(cnt[x]==n) ans++;
    }
  }

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

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

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

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

  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }

  ll ans = 10000000000;
  ll v = a[0];
  for (ll i = 1; i < n; ++i) {
    ans = min(gcd(v, a[i]), ans);
    v = a[i];
  }

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

Measured memory_bytes: 1024
while True:
	h, w = map(int, input().split())
	if h == 0 and w == 0:
		exit(0)
	for i in range(0, h):
		for j in range(0, w):
			# 奇数行 #.#.#.#.#.#.
			if (i + 1) % 2 == 0:
				if (j + 1) % 2 == 0:
					print('#', end='')
				else:
					print('.', end='')
			# 偶数行 #.#.#.#.#.#.
			else:
				if (j + 1) % 2 == 0:
					print('.', end='')
				else:
					print('#', end='')
		print()
	print()



Measured memory_bytes: 7000
#include<stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY (1<<21)
int prim(void);
int n,A[N][N];

int main()
{
  int i,j,x;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&x);
      if(x==-1)A[i][j]=INFTY;
      else A[i][j]=x;}
                  }
  printf("%d\n",prim());
  return 0;
}
int prim(void)
{
  int color[N],d[N],p[N],s,i,j,mini,u;
  for(s=0;s<n;s++){
    color[s]=WHITE;
    d[s]=INFTY;
    p[s]=-1;
  }
  d[0]=0;
  while(1)
    {mini=INFTY;
      u=-1;
      for(i=0;i<n;i++){
	if(color[i]!=BLACK && d[i]<mini){
	  u=i;
	  mini=d[i];                  	}
                     }
      if(u==-1)break;

      color[u]=BLACK;

      for(i=0;i<n;i++){
	if(color[i]!=BLACK && A[u][i]!=INFTY)
	  if(A[u][i]<d[i]){
	    d[i]=A[u][i];
	    p[i]=u;
	    color[i]=GRAY;}}
   }
  int sum=0;
  for(i=0;i<n;i++){
    if(p[i]!=-1)sum+=A[i][p[i]];}
  
  return sum;
}



Measured memory_bytes: 2108
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int n, K;
    cin >> n >> K;

    vector<pair<int,int>> P;
    vector<int> X;
    vector<int> Y;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        P.emplace_back(x, y);
        X.emplace_back(x);
        Y.emplace_back(y);
    }

    sort(X.begin(), X.end());
    X.resize(unique(X.begin(), X.end()) - X.begin());
    sort(Y.begin(), Y.end());
    Y.resize(unique(Y.begin(), Y.end()) - Y.begin());

    int h = X.size();
    int w = Y.size();

    for (auto& p : P) {
        int& x = p.first;
        int& y = p.second;
        x = lower_bound(X.begin(), X.end(), x) - X.begin();
        y = lower_bound(Y.begin(), Y.end(), y) - Y.begin();
    }

    auto area = [&](long long l, long long r, long long t, long long b) {
        return (r - l) * (b - t);
    };

    long long res = 1LL << 62;
    vector<int> cnts(w, 0);

    for (int l = 0; l < h; ++l) {
        for (int r = l; r < h; ++r) {
            for (int i = 0; i < w; ++i) {
                cnts[i] = 0;
            }
            for (int i = 0; i < n; ++i) {
                int x = P[i].first, y = P[i].second;
                if (l <= x && x <= r) {
                    cnts[y] += 1;
                }
            }
            for (int t = 0, b = 0, cnt = 0; t < w; ++t) {
                while (cnt < K && b < w) {
                    cnt += cnts[b++];
                }
                if (cnt >= K) {
                    res = min(res, area(X[l], X[r], Y[t], Y[b - 1]));
                }
                cnt -= cnts[t];
            }
        }
    }


    cout << res << '\n';


    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=n-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    int n;
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];

    sort(all(a));

    ll ans=a[n-1];

    int idx=n-2,used=0;
    rep(i,n-2){
        ans+=a[idx];
        if(used==0)used++;
        else{
            used=0;
            idx--;
        }
    }

    cout<<ans<<"\n";

    return 0;

}

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

using namespace std;

int main()
{
		int n;
		cin >> n;
		
		while(n--)
		{
			int x;
			cin >> x;
			
			if (x%2 == 0)
				{
					if (x%3 != 0 && x%5 !=0)
						{
							cout << "DENIED";
							return 0;
						}
				}
		}
		cout << "APPROVED";
		return 0;
} 


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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif
	
	for(int a,b,c;cin>>a>>b>>c;){
		cout<<(a<=c&&c<=b?"Yes":"No")<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int H,W,i,j;
    while(1){
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                if(i==0||i==H-1||j==0||j==W-1){
                    cout<<'#';    
                }
                else{
                    cout<<'.';
                }
            }
            cout<<endl;
        }
        cout<<endl;
        
    }
}



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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  for(int i=0; i<100; i++){
    c-=b;
    if(c<=0){
      cout << "Yes";
      break;
    }
    a-=d;
    if(a<=0){
      cout << "No";
      break;
    }
  }
}

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;
 
 //lcs
ll c[3005][3005];
string s,t;

ll lcs(ll m, ll n) {//m,nはstring x,yのサイズ
	ll maxv = 0;
	for (int i = 0; i <m; ++i) {
		for (int j = 0; j <n; ++j) {
			if (s[i] == t[j])c[i+1][j+1] = c[i][j] + 1;
			else c[i+1][j+1] = max(c[i][j+1], c[i+1][j]);
			maxv = max(maxv, c[i+1][j+1]);
		}
	}
	return maxv;
}
void solve(){
    cin>>s>>t;
    int m=s.size(),n=t.size();
    int len=lcs(m,n);
    string ans="";
    while(m>0&&n>0){
        if(c[m][n]==c[m-1][n])--m;
        else if(c[m][n]==c[m][n-1])--n;
        else if(c[m][n]==c[m-1][n-1]+1){
            ans+=string{s[m-1]};
            --m;--n;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<"\n";
}
 
signed main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}

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

using namespace std;

int a[222];

int main() {
  int n;
  scanf("%d", &n);
  n += n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  sort(a, a + n);
  reverse(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; i += 2) {
    if (i + 1 < n) {
      ans += a[i + 1];
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
import copy
k = int(input())
ans = ["a"]
for i in range(k-1):
  b = []
  for j in ans:
    t = max(j)
    for m in range(ord(t) - ord("a")+2):
      b.append(j + chr((ord("a")+m)))
  ans = b
for i in ans:
  print(i)

Measured memory_bytes: 18964
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
row3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for n in range(N)]

col1 = [row1[0], row2[0], row3[0]]
col2 = [row1[1], row2[1], row3[1]]
col3 = [row1[2], row2[2], row3[2]]

diagonal1 = [row1[0], row2[1], row3[2]]
diagonal2 = [row1[2], row2[1], row3[0]]

all = row1 + row2 + row3

x = []
for i in b:
    if i in all:
        x.append(i)
    
if len(list(set(row1) & set(x))) == 3 or\
    len(list(set(row2) & set(x))) == 3 or\
    len(list(set(row3) & set(x))) == 3 or\
    len(list(set(col1) & set(x))) == 3 or\
    len(list(set(col2) & set(x))) == 3 or\
    len(list(set(col3) & set(x))) == 3 or\
    len(list(set(diagonal1) & set(x))) == 3 or\
    len(list(set(diagonal2) & set(x))) == 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c;
int l[8];
int dfs(int t,int x,int y,int z){
    if(t==n){
      if(x!=0&&y!=0&&z!=0){
        return abs(x-a)+abs(y-b)+abs(z-c)-30;
      }
      else{
        return 1e9;
      }
    }
    int r0=dfs(t+1,x,y,z);
    int r1=dfs(t+1,x+l[t],y,z)+10;
    int r2=dfs(t+1,x,y+l[t],z)+10;
    int r3=dfs(t+1,x,y,z+l[t])+10;
    return min({r0,r1,r2,r3});
}
int main(){
  cin >> n >> a >> b >> c;
  for(int i=0;i<n;i++){
    cin >> l[i];
  }
  cout << dfs(0,0,0,0) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define N 100010
ll n,a[N],d[N];
ll solve(ll k){//cout<<k<<endl;
  d[0]=k;
  for(int i=0;i<n-1;i++){
    d[i+1]=a[i]-d[i];
  }
  if(d[n-1]+d[0]>a[n-1])return 0;
  if(d[n-1]+d[0]==a[n-1])return 1;
  if(d[n-1]+d[0]<a[n-1])return 2;
  return 114514;
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  ll l=-1,r=1e12,mid;
  while(l<r-1){
    mid=(l+r)>>1;
    ll res=solve(mid);
    if(res==1){
      for(int i=0;i<n;i++)cout<<d[i]*2<<endl;
      return 0;
    }
    if(res==0)r=mid;
    else l=mid;
  }
  return 0;
}


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


int main()
{
	int i, x;
	
	for (i = 1; i < 10001; i++)
	{

		cin >> x;
		if (x == 0)break;
		cout << "Case " << i << ": " << x << "\n";
		
	
	
	}
    return 0;
}




Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    vl vec(n);
    map<ll,int> ma;
    ll ans=0;
    ll sum=0;
    ma[0]=1;
    REP(i,n){
        cin>>vec[i];
        sum+=vec[i];
        ans+=ma[sum];
        ma[sum]++;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
 string s1,s2,s3;
 int a,b ;
  cin >> s1 >> s2 >>a >> b  >>s3 ;
  
  if(s3==s1)
    a--;
  if(s3 == s2)
    b--;
  
  cout << a << " " <<b ;


}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>


using namespace std;

const int N = 1299709+100;
vector<int> sosuu(N);

void ini(){
	for(int i=2;i<N;i++) sosuu[i] = i;
	for(int i=2;i*i<N;i++){
		if(sosuu[i]){
			for(int j=i*i;j<=N;j+=i){
				sosuu[j] = 0;
			}
		}
	}
}

bool solve(int n){
	int a, b;
	for(int i=n;i>=1;i--){
		if(sosuu[i]){
			a = i;
			break;
		}
	}
	for(int j=n;j<=N;j++){
		if(sosuu[j]){
			b = j;
			break;
		}
	}
	
	cout<< b-a << endl;
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	
	ini();
	int n;
	while(cin>>n, n!=0){
		solve(n);
	}
	return 0;
}

 

Measured memory_bytes: 6220
import java.util.Arrays;
import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;

//Everlasting...?
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int N = 1000001;
		boolean[] p = new boolean[N];
		Arrays.fill(p, true);
		p[0]=p[1]=false;
		for(int i=2;i<N;i++){
			if(p[i])for(int j=i+i;j<N;j+=i)p[j]=false;

		}
		while(true){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if((a|b)==0)break;
			SortedSet<Integer> sa = new TreeSet<Integer>();
			SortedSet<Integer> sb = new TreeSet<Integer>();
			int k = 2;
			while(a>1){
				if(p[k]&&a%k==0){
					a/=k;
					sa.add(k);
				}
				else k++;
			}
			k = 2;
			while(b>1){
				if(p[k]&&b%k==0){
					b/=k;
					sb.add(k);
				}
				else k++;
			}
			int pa = sa.last();
			sa.remove(pa);
			int pb = sb.last();
			sb.remove(pb);
			for(int x:sa)pa-=x;
			for(int x:sb)pb-=x;
			System.out.println(pa>pb?"a":"b");
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int l=sc.nextInt();
			String[] s=new String[n];
			for(int i=0;i<n;i++) s[i]=sc.next();
			Arrays.sort(s);
			String res="";
			for(int i=0;i<n;i++) res+=s[i];
			System.out.println(res);
		}
	}
}

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

int main(){
  char a,b,c,d,e,f;
  string ans;
  cin >> a >> b >> c >> d >> e >> f;
  if(a==f && b==e && c==d){
    ans = "YES";
  }
  else {
    ans = "NO";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            if(input[1] % input[0] == 0)
            {
                Console.WriteLine(input[0] + input[1]);
            }
            else
            {
                Console.WriteLine(input[1] - input[0]);
            }
        }
    }
}


Measured memory_bytes: 13268
from collections import deque
n=int(input())
a=deque(list(map(int,input().split())))
c=deque([1 if i%2==0 else -1 for i in range(n)])

ans=[]
for loop in range(n):
    if loop==0:
        t=sum([i*j for i,j in zip(a,c)])
    else:
        t=2*a[loop-1]-t
    ans.append(str(t))


print(" ".join(ans))

Measured memory_bytes: 19292
BIG_NUM = 2000000000


N = int(input())
x = 0

for i in range(1,N+1):

    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()



Measured memory_bytes: 5868
#include <bits/stdc++.h>
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
using namespace std;


//

//

void solve()
{
	float pi= 3.141592653589793238;
	int r;	cin>>r;
	cout<<2*pi*r<<endl;
}


int main()
{
	    solve();
        return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 
#define A (x[1] - x[0])
#define B (y[1] - y[0])
#define C ((x[1]*x[1] - x[0]*x[0] + y[1]*y[1] - y[0]*y[0])/2)
#define D (x[2] - x[1])
#define E (y[2] - y[1])
#define F ((x[2]*x[2] - x[1]*x[1] + y[2]*y[2] - y[1]*y[1])/2)

int main(void){  
  double x[4],y[4];
  int n;
  cin >> n;
  while(n--){
    REP(i,3)
      cin >> x[i] >> y[i] ;
    x[3] = (C*E - B*F)/(A*E - B*D);
    y[3] = (C*D - A*F)/(B*D - A*E);
    printf("%.3f %.3f %.3f\n",x[3],y[3],sqrt((x[3]-x[0])*(x[3]-x[0]) + (y[3] -y[0])*(y[3]-y[0])));
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu long long unsigned
int main()
{
    int t,a,b,x,y,z,n,mx,mn,tmp;
        int cnt=0,ans=0;
        string s="";
        vector<int>vc;
        map<int,int>mp;
        map<char,int>mc;
        scanf("%d %d %d",&a,&b,&x);
        char ch,ch2;
        for(int j=a;j<=b;j++){
            if(j%x==0) ans++;
        }
        printf("%d",ans);


    return 0;
}







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

#define MAX 1001
#define max(a,b) ((a<b)?b:a)

char s[MAX], t[MAX];
int p[MAX][MAX];
int kei(void);

int kei() {
  int n = strlen(s);
  int m = strlen(t);
  int i,j,maxi=0;
  
  memset(p,0,sizeof p);
  for(i=0;i<n;i++) {
    for(j=0;j<m;j++) {
      if( i ) p[i][j] = max(p[i][j],p[i-1][j]);
      if( j ) p[i][j] = max(p[i][j],p[i][j-1]);
      if( s[i] == t[j] ) {
	p[i+1][j+1] = max(p[i+1][j+1],p[i][j]+1);
	maxi = max(maxi,p[i+1][j+1]);
      }
    }
  }
  return maxi;
}

int main() {
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++) {
  scanf(" %s",&s[0]);
  scanf(" %s",&t[0]);
  printf("%d\n",kei());
  }
  return 0;
}


Measured memory_bytes: 5704
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5+10;
typedef long long ll;
int a[maxn],rt[maxn];
int lc[maxn*40],rc[maxn*40],tol;
ll sum[maxn*40];
map<int,int>vis;
void init(){
	tol=1;
	vis.clear();
}
void update(int &u, int x, int y, int p, ll v)
{
    sum[tol] = sum[u]+v,lc[tol] = lc[u],rc[tol] = rc[u];
    u = tol++;
    if(x == y) return;
    int m = (x+y)>>1;
    if(p <= m) update(lc[u],x,m,p,v);
    else update(rc[u],m+1,y,p,v);
}
ll query(int u, int x, int y, int ql, int qr)
{
    if(ql <= x && y <= qr) return sum[u];
    int m = (x+y)>>1;
    ll ans = 0;
    if(ql <= m) ans += query(lc[u],x,m,ql,qr);
    if(qr > m) ans += query(rc[u],m+1,y,ql,qr);
    return ans;
}
int main(){
	int n,q;
	init();
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++){
		rt[i]=rt[i-1];
		if(vis.find(a[i])!=vis.end())
		{
			int tmp=rt[i-1];
			update(tmp,1,n,vis[a[i]],-1);
			rt[i]=tmp;
			update(rt[i],1,n,i,1);
		}
		else 
		{
			rt[i] = rt[i-1];
            update(rt[i],1,n,i,1);
        }
        vis[a[i]]=i;
	}
	while(q--){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%lld\n",query(rt[r],1,n,l,r));
	}
	return 0;
}


Measured memory_bytes: 319584
#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;

int main(void){
    int n,x,i,max,min;
    long sum;

    cin >> n;
    sum = 0;
    max = -1000000;
    min = 1000000;

    for (int i = 0; i < n; ++i)
    {
        cin >> x;
        sum += x;
        if (max < x) max = x;
        if (x < min) min = x;
    }
    cout << min << " " << max << " " << sum << endl;

}

Measured memory_bytes: 1164
def C():
    n = int(input())
    ret = [None]*12
    q = n
    for i in range(12):
        q,mod = divmod(q,26)
        if mod == 0:
            ret[i] = "z"
            q -= 1
        else:
            ret[i] = chr(mod+96)
        if q == 0:
            break
    ret = ret[:i+1]
    ret.reverse()
    print("".join(ret))
C()

Measured memory_bytes: 9192
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int a, b, c;
    cin >> a >> b >> c;

    if (a + b + c > 21) print("bust");
    else print("win");
    
}


Measured memory_bytes: 3616