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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	// scanf("%d", &x);
	cin >> x;
	return x;
}

using Node = array<int, 26>;

struct Trie {
	vector<Node> a;
	vector<Node> counts;

	Trie() {
		a.push_back({});
		counts.push_back({});
	}

	int create() {
		a.push_back({});
		counts.push_back({});
		return (int)a.size() - 1;
	}

	int proceed(const string& s) {
		int v = 0;
		for (char c : s) {
			if (!a[v][c - 'a']) {
				int nw = create();
				a[v][c - 'a'] = nw;
			}
			v = a[v][c - 'a'];
		}
		return v;
	}

	void add(const string& s) {
		vector<int> path = {0};
		for (char c : s) {
			if (!a[path.back()][c - 'a']) {
				int nw = create();
				a[path.back()][c - 'a'] = nw;
			}
			int nw = a[path.back()][c - 'a'];
			path.push_back(nw);
		}
		set<char> S;
		for (int i = (int)s.length() - 1; i >= 0; --i) {
			path.pop_back();
			int v = path.back();
			S.insert(s[i]);
			for (char c : S) {
				counts[v][c - 'a'] += 1;
			}
		}
	}
};

void solve() {
	int n = nxt();
	vector<string> a(n);
	for (auto& s : a) {
		cin >> s;
		reverse(all(s));
	}
	sort(all(a), [](const string& x, const string& y) {
		return x.length() > y.length();
	});
	Trie t;
	long long ans = 0;
	for (const auto& s : a) {
		int v = t.proceed(s.substr(0, (int)s.length() - 1));
		ans += t.counts[v][s.back() - 'a'];
		t.add(s);
	}
	cout << ans << "\n";
}

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

	int t = 1; // nxt();
	while (t--) {
		solve();
	}

	return 0;
}


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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

const int N = 200005;
LL ara[N] , n , k;
vector<LL>pos,neg;

bool check(LL mid)
{
    LL positive = 0,negative = 0,both = 0;
    if(mid >= 0){
        for(int i = 0;i < pos.size();i++){
            LL upto = 1e18;
            if(pos[i] != 0)upto = mid/pos[i];

            LL howmany = upper_bound(pos.begin(),pos.end(),upto) - pos.begin();
            if(SQR(pos[i]) <= mid)howmany--;
            positive += howmany;
        }
        positive/=2;

        for(int i = 0;i < neg.size();i++){
            LL upto = mid/neg[i];

            LL howmany = upper_bound(neg.begin(),neg.end(),upto) - neg.begin();
            if(SQR(neg[i]) <= mid)howmany--;
            negative += howmany;
        }
        negative/=2;
        both = (LL)neg.size() * (LL)pos.size();
    }
    else{
        for(int i = 0;i < neg.size();i++){
            LL need = -mid/neg[i];
            if((-mid) % neg[i] != 0)need++;

            LL howmany = pos.end() - lower_bound(pos.begin(),pos.end(),need);
            both += howmany;
//            cout << ": " << neg[i] << " " << howmany << " " << need << endl;
        }
    }
//    cout << mid << " " << positive << " " << negative << " " << both << endl;
    if(positive + negative + both >= k)return 1;
    else return 0;
}
int main()
{
    FastRead
    cin >> n >> k;
    for(int i = 1;i <= n;i++)cin >> ara[i];

    for(int i = 1;i <= n;i++){
        if(ara[i] >= 0)pos.push_back(ara[i]);
        else neg.push_back(-ara[i]);
    }
    SORT(pos);
    SORT(neg);
//    check(-8);
    LL lo = -1e18 , hi = 1e18,mid,ans;

    while(lo <= hi){
        mid = (lo + hi)/2;
        if(check(mid)){
            ans = mid;
            hi = mid - 1;
        }else{
            lo = mid + 1;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 4084
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader scan = new FastReader();
        //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("taming.out")));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        Task solver = new Task();
        //int t = scan.nextInt();
        int t = 1;
        for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
        out.close();
    }
    static class Task {
        public void solve(int testNumber, FastReader sc, PrintWriter pw) {
        	int[] x = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        	pw.println(x[sc.nextInt()-1]);
        }

    }
    static class tup implements Comparable<tup>{
        int a, b,c;
        tup(){};
        tup(int a, int b, int c){
            this.a=a;
            this.b=b;
            this.c=c;
        }

        @Override
        public int compareTo( tup o2) {
            return o2.b!=b?Integer.compare(o2.b,b):Integer.compare(o2.a,a);
        }
    }
    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

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

int main() {
  int n,m;
  cin >> n >> m;
  
  vector<int> l(n,0);
  
  for(int i; i<m; i++){
    int a,b;
    cin >> a >> b;
    l.at(a-1)+=1;
    l.at(b-1)+=1;
  }
  
  for(int i; i<n; i++){
    cout << l.at(i) << endl;
  }
}

Measured memory_bytes: 256
from bisect import bisect_left


while True:
	N, Q = map(int, input().split(' '))
	if N == 0:
		break

	era = {} # Like {1877: ('Meiji', 10)}

	years = [] # 西暦
	for _ in range(N):
		name, j, w = input().split(' ')
		j, w = int(j), int(w)
		era[w] = (name, j)
		years.append(w)
	years.sort()

	for _ in range(Q):
		q = int(input())
		i = bisect_left(years, q)
		if i >= len(years):
			print('Unknown')
			continue
		y = years[i]
		name, length = era[y]
		if q - y + length <= 0:
			print('Unknown')
		else:
			print(name + ' ' + str(q-y+length))



Measured memory_bytes: 5780
def bubbleSort(A, N):
    flag = True
    cnt = 0
    while flag:
        flag = False
        for j in reversed(range(1, N)):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = True
                cnt += 1
    print(*A)
    print(cnt)


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

bubbleSort(A, N)



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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b+c <= 21) cout << "win" << endl;
  else cout << "bust" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(void) {
  int n; cin>>n;
  vector<tuple<string, int, int>> t;
  Fr(i, n) {
    string s; int p;
    cin>>s>>p;
    t.push_back(make_tuple(s, -p, i));
  }
  sort(t.begin(), t.end());
  for (tuple<string, int, int> a : t) {
    string x;
    int y, z;
    tie(x, y, z) = a;
    cout << z << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    string s, t; cin >> s >> t;
    ll ans = 0;
    rep(i, s.size()){
        if(s[i] != t[i]){
            ans++;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int main() {
	fastio;
	int a[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int K;
	cin >> K;

	cout << a[K - 1];

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, i, j, minj, A[100], temp, cnt=0;
	scanf("%d",&n);
	for(i=0; i<n; i++) {
		scanf("%d",&A[i]);
	}
	for (i=0; i<n; i++) {
		minj = i;
		for (j=i; j<n; j++) {
			if(A[j] < A[minj]) {
				minj = j;
			}
		}
		if(i != minj) {
			temp = A[i];
			A[i] = A[minj];
			A[minj] = temp;
			cnt++;
		}
	}
	for (i=0; i<n-1; i++) {
		printf("%d ",A[i]);
	}
	printf("%d\n%d\n",A[n-1],cnt);
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
int divisor(int n)
{
	int i, x=0;
	for(i=1; i<=n; i++)
	{
		if(n%i==0)
		x++;
	}
	return x;
}

int main()
{
	int n, x, p=0, i;
	scanf("%d",&n);
	for(i=10; i<=n; i++)
	{
		x=divisor(i);
		if(i%2!=0 && x==8)
		p++;
	}
	printf("%d\n",p);
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll h,w; cin >> h >> w;
    ll count = 0;

    if((h==1) || (w==1))    count = 1;
    else if( ((h%2==0) && (w%2==0)) || (h%2!=0) && (w%2==0) || (h%2==0) && (w%2!=0))
    {
        count = h*w/2;
    }
    else if(h >= w)
    {
        count = (ll)ceil((double)h/2)*w -(ll)floor((double)w/2);
    }
    else if(h < w)
    {
        count = (ll)ceil((double)w/2)*h -(ll)floor((double)h/2);
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
from math import sqrt

n = int(input())

if n == 1:
    print(0)
    exit()

n_sqrt = int(sqrt(n))

dp = [-1] * (n_sqrt+2)

for i in range(2, n_sqrt+2):
    if dp[i] == -1:
        dp[i] = 1
        for j in range(i*2, n_sqrt+2, i):
            dp[j] = 0

prime = []

for i in range(2, n_sqrt+2):
    if dp[i] == 1:
        prime.append(i)

prime.append(n)

memo = []
for p in prime:
    cnt = 0
    while n%p==0:
        n //= p
        cnt += 1

    if cnt:
        memo.append(cnt)

if n > 1:
    memo.append(1)

ans = 0

for j in memo:
    k = 1
    while True:

        if k*(k+1)//2 <= j <= k*(k+3)//2:
            ans += k
            break
        k += 1

print(ans)

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

using namespace std;

int main() {
    int k = 0;
   while(true){
       k++;
       int a; cin >> a;
       if(a == 0) {
           break;
        }else{
            cout << "Case" << " " << k << ":" << " " << a << endl;
        }
    }
}


Measured memory_bytes: 3088
<?php

while ($n = trim(fgets(STDIN))) {
    $score = array('a' => 0, 'b' =>0);
    for ($i = 0; $i < $n; $i++) {
        list($a_card, $b_card) = explode(' ', trim(fgets(STDIN)));
        if($a_card == $b_card) {
            $score['a'] += $a_card;
            $score['b'] += $b_card;
        } elseif($a_card > $b_card) {
            $score['a'] += $a_card + $b_card;
        } else {
            $score['b'] += $a_card + $b_card;
        }
    }
    echo $score['a'] . ' ' . $score['b'].PHP_EOL;
}


Measured memory_bytes: 9252
#include <iostream>
#include <limits>
#include <cfenv>
#include <cmath>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <tuple>
#include <queue>
#include <vector>
#include <cmath>
#include <random>
#include <math.h>
#include <random>
#include <functional>


#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

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

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



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


std::vector<int> A;

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); REP(i, n) scanf("%d", &A[i]);
    
    lli cnt = A.front() - 1;
    int takashi = 2;

    for(int x = 1; x < n; ++x){
        if(A[x] == takashi){takashi++; continue;}
        if(A[x] % takashi == 0){A[x] -= (takashi + 1); cnt++;}
        cnt += A[x] / takashi;
    }
    printf("%lld\n", cnt);

    
    return 0;
}

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

using namespace std;

int main(){
	int n, m, ac = 0, wa = 0; cin >> n >> m;
	vector<int> p(m);
	vector<string> s(m);
	vector<bool> a(n);
	vector<int> b(n);
	for(int i = 0; i < m; ++i) cin >> p[i] >> s[i];
	for(int i = 0; i < m; ++i){
		if(!a[p[i]-1] && s[i] == "WA") b[p[i]-1]++;
		else if(s[i] == "AC") a[p[i]-1] = true;
	}
	for(int i = 0; i < n; ++i) ac += a[i];
	for(int i = 0; i < n; ++i) wa += a[i] * b[i];
	cout << ac << " " << wa << endl;
}

Measured memory_bytes: 6528
/* _  */ 

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream> //stringstream
#include <cstring> // getline
#include <cmath>
#include <unordered_set>
#include <limits>
#include <unordered_map>


#define go(i,init ,n) for(int  i=init ;i<n ;i++) 
#define X first 
#define Y second
#define ll long long 
#define ALL arr.begin() ,arr.end()
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define FI freopen("input.txt", "r", stdin);
#define FO freopen("output.txt", "w", stdout);
#define OO 1000000000000
#define oo 1e9
#define N 200100

using namespace std;


ll int MOD = 1e9 + 7;
ll int memo[100005];
ll int prime[1000000];
ll int fac[N], ifac[N];
ll int inv[N];
vector<ll int>primes;

ll int gcd(ll int a, ll int b){ if (b == 0) return a; return gcd(b, a%b); }
bool IsPrime(ll int x){ if (x == 1) return false; for (ll int i = 2; i*i <= x; i++){ if (x%i == 0) return false; } return true; }
void seive(ll int n){ prime[0] = prime[1] = 1; for (ll int i = 2; i*i <= n; i++) if (!prime[i]){ for (ll int j = i*i; j <= n; j += i) prime[j] = 1;} }
bool sortMa7boub(const pair<int, int> &a, const pair<int, int> &b) { if (a.first == b.first) return (a.second < b.second); return(a.first >b.first); }
bool IsVowel(char c){ return(c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o'||c=='y' || c == 'A' || c == 'E' || c == 'I' || c == 'U' || c == 'O'||c=='Y'); }
bool IsEqual(string s1, string s2){ if (s1.length() != s2.length())return 0; go(i, 0, s1.length()) if (s1[i] != s2[i])return 0; return 1; }
ll int  powMod(ll int  base, ll int  pw) { ll int ret = 1; while (pw) { if (pw & 1) ret = (ret * base) % MOD; base = (base * base) % MOD; pw >>= 1; }return ret; }

/*should use makeFact before useing C or P */
void makeFact(){ fac[0] = ifac[0] = 1; for (ll int i = 1; i<N; i++) { fac[i] = (fac[i - 1] * i) % MOD; ifac[i] = powMod (fac[i], MOD - 2); } }
inline void Init(){ inv[1] = 1; for (int i = 2; i < N; ++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;}
ll int  C(ll int  a, ll int  b) { if (a < b) return 0; return (((fac[a] * ifac[b]) % MOD) * ifac[a - b]) % MOD; }
ll int P(ll int a, ll int b){ if (a < b) return 0; return(fac[a] * ifac[a - b]) % MOD; }


int a = -1;

string AL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vector<ll int>vec; ll int n, k;

bool isValid(int i) { return i >= 0 && i < n; }

ll int mini(int indx )
{
	
	ll int &ret = memo[indx];

	if (indx == n-1)
		return 0;
	
	if (~ret)
		return ret;

	ll int arr[101];
	for (int i = 0; i < 101; i++)
	{
		arr[i] = OO;
	}

	for (int i = 1; i <= k; i++)
	{

	    if (isValid(indx + i))
		    arr[i] = mini(indx + i) + abs(vec[indx] - vec[indx + i]);

	}

	ll int ans = arr[1];

	for (int i = 1; i <= k; i++)
		ans = min(ans, arr[i]);
	

	return ret = ans;
}

int main()
{
	IO;
	/*freopen("txt.in", "r", stdin);
	freopen("txt.out","w",stdout);*/
	
	cin >> n>>k;
	vec.resize(n);
	go(i, 0, n)
		cin >> vec[i];

	
	memset(memo, -1, sizeof memo);
	ll int ans = mini(0);

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



Measured memory_bytes: 87808
#include <algorithm>
#include <cstdio>

const int N = 505;
const int m = 100;

int main() {
  int A, B;
  scanf("%d%d", &A, &B);
  printf("%d %d\n", m, m);
  for (int i = 0; i < m / 2; ++i) {
    for (int j = 0; j < m; ++j)
      putchar((~i & ~j & 1) && ((i >> 1) * (m / 2) + (j >> 1) < B - 1) ? '#' : '.');
    putchar('\n');
  }
  for (int j = 0; j < m; ++j) putchar('#');
  putchar('\n');
  for (int i = m / 2 + 1; i < m; ++i) {
    for (int j = 0; j < m; ++j)
      putchar((~i & ~j & 1) && (((i - m / 2 - 2) >> 1) * (m / 2) + (j >> 1) < A - 1) ? '.' : '#');
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 128
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String N = scan.next();

        long sum = 0;
        for(int i = 0; i < N.length(); i++) {
            sum += Integer.valueOf(N.charAt(i)-'0');
        }

        if(sum % 9 == 0)
            os.println("Yes");
        else
            os.println("No");

    }
}

Measured memory_bytes: 31132
n = gets.to_i
a = gets.split(' ').map(&:to_i)
 
a.sort!.reverse!
 
Alice = 0
Bob = 0
 
n.times{|i|
  if i.even?
    Alice += a[i]
  else
    Bob += a[i]
  end
}
 
puts Alice - Bob

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  auto b = a;
  sort(b.begin(), b.end());
  assert(a == b);
  a.erase(unique(a.begin(), a.end()), a.end());
  for(int i = 0; i < (int)a.size(); ++i) cout << a[i] << " \n"[i==(int)a.size()-1];

  return 0;
}



Measured memory_bytes: 3640
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first = s.substring(0,1);
    String last = s.substring(2,3);

    if (first.equals(last)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }

}


Measured memory_bytes: 21844
#include<iostream>
#include<stdio.h>

using namespace std;

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

  if(n=="SUN")cout<<7<<endl;
  if(n=="MON")cout<<6<<endl;
  if(n=="TUE")cout<<5<<endl;
  if(n=="WED")cout<<4<<endl;
  if(n=="THU")cout<<3<<endl;
  if(n=="FRI")cout<<2<<endl;
  if(n=="SAT")cout<<1<<endl; 
  return 0;
}


Measured memory_bytes: 256
import sys
N,M = map(int,input().split())
array = list(map(int,input().split()))

if not ( 1 <= N <= 10 ** 6 and 1 <= M <= 10 ** 4 ): sys.exit()
if not ( 1 <= min(array) and max(array) <= 10 ** 4 ): sys.exit()

ans = N - sum(array)

print(ans) if ans >= 0 else print(-1)

Measured memory_bytes: 10160
#include <stdio.h>

int main(void) {

	int i,j, k;
	int a[3][3];
	int N;
	int b[10];

	for ( i = 0; i < 3; i++ ) {
		scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
	}
	scanf("%d", &N);
	for ( i = 0; i < N; i++ ) {
		scanf("%d", &b[i]);
	}

	for ( k = 0; k < N; k++ ) {
		for ( i = 0; i < 3; i++ ) {
			for ( j = 0; j < 3; j++ ) {
				if ( a[i][j] == b[k] ) {
					a[i][j] = 0;
				}
			}
		}
	}

	// Judge
	if ( (a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0) ||
		 (a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0) ||
		 (a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0) ||
		 (a[0][0] == 0 && a[1][0] == 0 && a[2][0] == 0) ||
		 (a[0][1] == 0 && a[1][1] == 0 && a[2][1] == 0) ||
		 (a[0][2] == 0 && a[1][2] == 0 && a[2][2] == 0) ||
		 (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) ||
		 (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) ) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;

}


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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(long long N, std::vector<long long> L) {
  sort(all(L));
  ll tot = 0LL;
  rep(i,N-1){
    tot += L[i];
  }
  bool ok = tot>L[N-1];
  yesno(ok);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  std::vector<long long> L(N);
  for (int i = 0; i < N; i++) {
    std::cin >> L[i];
  }
  solve(N, std::move(L));
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    int maxim = 0;
    int minim = 1000;
    int a;
    for (int i = 0; i<n; i++){
        cin >> a;
        maxim = max(maxim,a);
        minim = min(minim,a);
    }

    cout << maxim - minim << endl;
}


Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
vector<vector<ll>> calcNext(const string &S)
{
    int n = (int)S.size();
    vector<vector<ll>> res(n + 1, vector<ll>(26, n));
    for (int i = n - 1; i >= 0; --i)
    {
        for (int j = 0; j < 26; ++j)
            res[i][j] = res[i + 1][j];
        res[i][S[i] - 'a'] = i;
    }
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V vec(n);
    rep(i, n) cin >> vec[i];
    V vec2;
    rep(i,(1<<n)){
        ll res = 0;
        rep(j,n){
            if(i&(1<<j)){
                res += vec[j];
            }
        }
        vec2.push_back(res);
    }
    sort(all(vec2));
    ll q;
    cin>>q;
    rep(i,q){
        ll x;
        cin >> x;
        if(binary_search(all(vec2),x)){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }
}



Measured memory_bytes: 11104
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e4+5;

int main() {
    int t,n,m;
    scanf("%d",&n);
    int a[n],b[n],r=-1;
    for(int i = 0;i < n;i++ ){
        scanf("%d",&a[i]);
        if(a[i]&1) continue;
        b[++r]=a[i];
    }
    int i;
    for(i= 0;i <= r;i++){
        if(b[i]%3&&b[i]%5) {
            break;
        }
    }
    printf("%s\n",i!=r+1?"DENIED":"APPROVED");
    return 0;
}


Measured memory_bytes: 256
use std::io;

fn is_combinable(vec: &Vec<u32>, target: u32) -> bool {
    dfs(0, vec, 0, target)
}

fn dfs(idx: usize, vec: &Vec<u32>, sum: u32, target: u32) -> bool {
    if idx < vec.len() {
        dfs(idx+1, vec, sum+vec[idx], target) 
            || dfs(idx+1, vec, sum, target)
    } else {
        sum == target
    }
}

fn main() {
    let sin = io::stdin();

    let mut buf = String::new();
    sin.read_line(&mut buf).ok();
    let _n: usize = buf.trim().parse().unwrap();

    let mut buf = String::new();
    sin.read_line(&mut buf).ok();
    let a: Vec<u32> = buf.split_whitespace()
        .map(|v| v.parse().unwrap())
        .collect::<Vec<u32>>();

    let mut buf = String::new();
    sin.read_line(&mut buf).ok();
    let _q: usize = buf.trim().parse().unwrap();

    let mut buf = String::new();
    sin.read_line(&mut buf).ok();
    let m: Vec<u32> = buf.split_whitespace()
        .map(|v| v.parse().unwrap())
        .collect::<Vec<u32>>();
    
    for v in m {
        if is_combinable(&a, v) {
            println!("yes");
        } else {
            println!("no");
        }
    }
    
}



Measured memory_bytes: 5024
#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define bs inline bool scan
ii(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
ii() {return in(gcu());}
bs(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bs(char &c){c=gcu();gcu();return c!=EOF;}
// bs(string &s){int c; s = "";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#undef bs
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
// vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
vo(head&& h, tail&&... t){out(h);out(move(t)...);}
#undef vo

struct P {int x, y;};

int main() {
	vector<int> dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};
	for (int n; (n = in());) {
		vector<P> t = {{0, 0}};
		for (int i = 1; i < n; i++) {
			P p = t[in()];
			int d = in();
			t.push_back({p.x + dx[d], p.y + dy[d]});
		}
#define mme(o, xy) minmax_element(o.begin(), o.end(), [](const P &a, const P &b) {return a.xy < b.xy;})
#define diff(xy) (*xy.second).xy - (*xy.first).xy + 1
		auto x = mme(t, x);
		auto y = mme(t, y);
		out(diff(x), " ", diff(y), '\n');
	}
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
ll s;
int a, b, c, d;

int main() {
	scanf("%lld", &s);
	// 定一顶点在(0, 0), 构造向量(a, b)和(c, d)
	// 叉积求面积: s = ad - bc
	a = d = (int)sqrt(s);
	while(s > 1ll * a * d) {
		if(a < d) a++;
		else d++;
	}
	ll chk = 1ll * a * d - s;
	for(int i = 1; i <= sqrt(chk); i++) {
		if(!(chk % i)) {
			if(i <= 1e9 && chk / i <= 1e9) {
				b = i;
				c = chk / i;
				break;
			}
		}
	}
	printf("0 0 %d %d %d %d\n", a, b, c, d);
	return 0;
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(max(c-a,a-c)<=d) cout <<"Yes";
  else if( (max(b-a,a-b)<=d) && (max(c-b,b-c)<=d) ) cout <<"Yes";
  else cout <<"No";
}

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

int main() {
  char A, B;
  cin >> A >> B;
  if (A == 'H') return cout << B << "\n", 0;
  else if (B == 'H') return cout << 'D' << "\n", 0;
  else return cout << 'H' << "\n", 0;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <sstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define np(v) next_permutation(v.begin(), v.end())
#define pll pair < long long, long long>
#define all(a) a.begin(), a.end()
#define ull unsigned long long
#define pii pair < int, int >
#define sz(a) (int)a.size()
#define sqr(x) ((x) * (x))
#define y1 stupid_cmath
#define vi vector <int>
#define pb push_back
#define mp make_pair
#define ll long long
#define f first
#define s second

const int inf = (int)3e6;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

string s;

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >>s;
    if(s[0] == s[2]) return cout << "Yes" << endl, 0;
    cout << "No" << endl;
}


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

using namespace std;

typedef pair<int, int> P;

int maze[60][60];
int dist[60][60];

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

int bfs(int w, int h)
{
  queue<P> que;
  memset(dist, -1, sizeof(dist));
  que.push(P(0, 0));
  dist[0][0] = 1;
  while(!que.empty()){
    P p = que.front(); que.pop();
    int x = p.first, y = p.second;
    for(int i = 0; i < 4; i++){
      int nx = x + dx[i], ny = y + dy[i];
      if(nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
      if(maze[ny][nx] == 1 || dist[ny][nx] != -1) continue;
      que.push(P(nx, ny));
      dist[ny][nx] = dist[y][x] + 1;
    }
  }
  return dist[h-1][w-1];
}

int main()
{
  int w, h;
  while(cin >> w >> h, w || h){
    w = 2*w - 1;
    h = 2*h - 1;
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
	if(i % 2 == 1 || j % 2 == 1) maze[i][j] = 1;
	else maze[i][j] = 0;
      }
    }
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
	if(i % 2 == 0 && j % 2 == 0) continue;
	if(i % 2 == 1 && j % 2 == 1) continue;
	cin >> maze[i][j];
      }
    }
    cout << (bfs(w, h) + 1) / 2 << endl;
  }
  return 0;
}

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

long long mod=1000000007,ara[1000009],tra[1000009],nra[1000009],xra[1000009];

long long bigmod(long long n,long long p)
{
     if(p==0)return 1;
     if(p%2==0)
     {
         long long ret=bigmod(n,p/2);
         return ((ret%mod)*(ret%mod))%mod;
     }
     else
        return ((n%mod)*(bigmod(n,p-1)%mod))%mod;
}

int main()
{


        long long n,m,a,b,c,d,e=2,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        scanf("%lld",&n);

        if(n==1)printf("0\n");
        else
        {
            ara[0]=1; tra[0]=1; nra[0]=1;

            for(i=1;i<=n;i++)
            {
                ara[i]=(ara[i-1]*i)%mod;

                tra[i]=(tra[i-1]*2)%mod;
                nra[i]=(nra[i-1]*8)%mod;
            }


            for(i=2;i<=n;i++)
            {
                fr=tra[i];

                if(fr>=e){ g=fr-e;   }
                else{  g=(mod-e)+fr;    }

                sc=nra[n-i];

                r=(g*sc)%mod;


                c=xra[i];

                if(c==0)
                {

                p=(ara[i]*ara[n-i])%mod; tr=bigmod(p,mod-2);

                c=(ara[n]*tr)%mod;

                xra[i]=c;  xra[n-i]=c;


                }



                q=(r*c)%mod;


                ans=(ans+q)%mod;


            }



            printf("%lld\n",ans);


        }















    return 0;
}





Measured memory_bytes: 34840
open Base
open Stdio

let read_line () =
    In_channel.(input_line_exn stdin)

let mapt2 ~f (a, b) = (f a, f b)

let array_replace arr i ~f = arr.(i) <- f (arr.(i))

let n = Int.of_string @@ read_line ()

let sums = Array.create ~len:(n+1) 0
let neg_res = Array.create ~len:(n+1) 0L
let g_hd = Array.create ~len:(n+1) 0
let g_nx = Array.create ~len:(2*n) 0
let g_to = Array.create ~len:(2*n) 0
let g_len = ref 0
let g_add u v =
    g_len := !g_len + 1;
    g_nx.(!g_len) <- g_hd.(u);
    g_to.(!g_len) <- v;
    g_hd.(u) <- !g_len
let g_adj_iter cur x0 f =
    let rec loop e acc = if e = 0 then acc else
        let ch = g_to.(e) in
        loop g_nx.(e) (f ch acc)
    in
    loop g_hd.(cur) x0

let colors = read_line () |> String.split ~on:' ' |> List.map ~f:Int.of_string
    |> List.cons 0 |> Array.of_list

let rec dfs ?(cur=1) ?(par=0) () =
    let memo = sums.(colors.(par)) in
    let tree_size = g_adj_iter cur 1 (fun ch acc ->
        acc + if ch = par then 0 else dfs ~cur:ch ~par:cur ())
    in

    array_replace sums colors.(cur) ((+) 1);
    let component_size = Int64.of_int @@ tree_size - (sums.(colors.(par)) - memo) in
    array_replace neg_res colors.(par) (fun x -> Int64.(x + component_size * (component_size + 1L) / 2L));
    sums.(colors.(par)) <- tree_size + memo;
    tree_size

let () =
    for i = 0 to n - 2 do
        let a, b = read_line () |> String.lsplit2_exn ~on:' ' |> mapt2 ~f:Int.of_string in
        g_add a b;
        g_add b a
    done

let () =
    ignore (dfs ());
    for i = 1 to n do
        let component_size = Int64.of_int @@ n - sums.(i) in
        let n64 = Int64.of_int n in
        let res = Int64.(n64 * (n64 + 1L) / 2L - component_size * (component_size + 1L) / 2L - neg_res.(i)) in
        printf "%Ld\n" res
    done


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

int main(){
  int n; cin>>n;
  int ans=INT_MAX;
  for(int i=0;i<n;i++){
    int a; cin>>a;
    int cnt=0;
    while(a%2==0){
      a/=2;
      cnt++;
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}

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

using namespace std;

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

    int l[50] = {};
    for (int i = 0; i < n; ++i) cin >> l[i];
    sort(l, l + 50, greater<int>());

    int ans = 0;
    for (int i = 0; i < k; ++i) ans += l[i];
    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<int> > v(10, vector<int>(10, 0));
  for (int a = 1; a <= n; ++a) {
    string s = to_string(a);
    int i = s.front() - '0';
    int j = s.back() - '0';
    ++v[i][j];
  }

  long long ans = 0;
  for (int a = 1; a <= n; ++a) {
    string s = to_string(a);
    int i = s.front() - '0';
    int j = s.back() - '0';
    ans += v[j][i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }

//素因数分解
template <typename T>
vector<pair<T, T>> prime_factor(T n) {
    vector<pair<T, T>> ret;
    T tmp=0;
    if(n%2==0){
        tmp=0;while(n%2==0){tmp++;n/=2;}
        ret.push_back(make_pair(2, tmp));
    }
    if(n%3==0){
        tmp=0;while(n%3==0){tmp++;n/=3;}
        ret.push_back(make_pair(3, tmp));
    }
    for (T i=5;i*i<=n;i+=4) {
        if(n%i==0){
            tmp=0;while(n%i==0){tmp++;n/=i;}
            ret.push_back(make_pair(i,tmp));
        }
        i+=2;
        if(n%i==0){
            tmp=0;while(n%i==0){tmp++;n/=i;}
            ret.push_back(make_pair(i,tmp));
        }
    }
    if(n!=1)ret.push_back(make_pair(n,1));
    return ret;
}

int main(){
    ll a,b;
    in(a,b);
    ll gcdv=__gcd(a,b);
    vector<pair<ll,ll>> prime=prime_factor(gcdv);
    out(prime.size()+1);
}


Measured memory_bytes: 3660
#include <stdio.h>
int main()
{
    int i, j, n;
    char c;
    while (1)
    {
        scanf("%c", &c);
        if (c >= 'a' && c <= 'z')
        {
            c = c - 32;
        }
        else if (c >= 'A' && c <= 'Z')
        {
            c = c + 32;
        }
        printf("%c", c);
        if (c == '\n')
        {
            break;
        }
    }
    return (0);
}


Measured memory_bytes: 2040
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

ll a[52];

vector<pair<int,int>> ops;

int main() {
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int maxind = (max_element(a, a + n) - a);
	int minind = (min_element(a, a + n) - a);
	if (a[maxind] > a[minind]*-1) {
		for (int i = 0; i < n; i++) {
			a[i] += a[maxind];
			ops.push_back({ maxind,i });
		}
		for (int i = 1; i < n; i++) {
			if (a[i - 1] > a[i]) {
				ops.push_back({ i - 1,i });
				a[i] += a[i - 1];
			}
		}
	}
	else {
		for (int i = 0; i < n; i++) {
			a[i] += a[minind];
			ops.push_back({ minind,i });
		}
		for (int i = n - 1; i > 0; i--) {
			if (a[i] < a[i - 1]) {
				ops.push_back({ i,i - 1 });
				a[i - 1] += a[i];
			}
		}
	}
	cout << ops.size() << '\n';
	for (auto it : ops)
		cout << it.first + 1 << " " << it.second + 1 << '\n';
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
function solve()
  n = parse(Int, readline())
  ac, wa, tle, re = 0, 0, 0, 0
  for i = 1:n
    s = readline()
    if s == "AC"
      ac += 1
    elseif s == "WA"
      wa += 1
    elseif s == "TLE"
      tle += 1
    elseif s == "RE"
      re += 1
    end
  end
  Dict("AC" => ac, "WA" => wa, "TLE" => tle, "RE" => re)
end

ans = solve()
println("AC x $(ans["AC"])")
println("WA x $(ans["WA"])")
println("TLE x $(ans["TLE"])")
println("RE x $(ans["RE"])")

Measured memory_bytes: 164212
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n;
	while(cin >> n) {
		if (n == 0) {
			break;
		}
		vector< vector<int> > d(n, vector<int>(n));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> d[i][j];
			}
		}
		vector< vector<int> > cc(n, vector<int>(n, 0));
		for (int i = 0; i < n; i++) {
			int MIN = d[i][0];
			for (int j = 1; j < n; j++) {
				MIN = min(MIN, d[i][j]);
			}
			for (int j = 0; j < n; j++) {
				if (d[i][j] == MIN) {
					cc[i][j]++;
				}
			}
		}
		for (int i = 0; i < n; i++) {
			int MAX = d[0][i];
			for (int j = 1; j < n; j++) {
				MAX = max(MAX, d[j][i]);
			}
			for (int j = 0; j < n; j++) {
				if (d[j][i] == MAX) {
					cc[j][i]++;
				}
			}
		}
		int a = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (cc[i][j] == 2) {
					a = d[i][j];
				}
			}
		}
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e5 + 5;
int n , a[N];
int main() {
    abdelrahman010
    cin >> n;
    int cnt = 0;
    for(int i = 1;i <= n;i++) {
        int x;
        cin >> x;
        if(i != x)
            cnt++;
    }
    if(cnt == 2 || cnt == 0)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    string s,t;
    char ch;
    i32 n,m,p,q,r;
    cin >> s;

    bool can = 0;
    if(s[0] == '7') can = 1;
    if(s[1] == '7') can = 1;
    if(s[2] == '7') can = 1;

    if(can) cout <<   "Yes"      << '\n';
    else cout << "No" << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3676
/*g++ file.cpp -o file.out*/
/*./file.out*/

#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define Mod 1000000007
#define L_Mod 17100000013

int main()
{
    int a;
    scanf("%d",&a);
    if(a>=1200)
        printf("ARC\n");
    else 
        printf("ABC\n");
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long 
#define MAX 25 * 1e13


using namespace std;

int main(){
  int n;
  cin >> n;
  string a,b;
  cin >> a >> b;
  string ret = "";
  for( int i = 0 ; i < n ; i++ ){
    ret += a[i];
    ret += b[i];
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import math
X = int(input())

def sosu(num):
  cnt = 0
  for i in range(2, int(math.sqrt(num))+1):
    if num % i == 0:
      cnt += 1
      break;
  if cnt == 0:
    return True
  
while True:
  if sosu(X):
    print(X)
    break;
  else:
    X += 1

Measured memory_bytes: 9036
sx,sy,tx,ty = map(int,input().split())
w = abs(tx-sx)
h = abs(ty-sy)
ans = ""
ans += (("R" * w) + ("U" * h) + ("L" * w) + ("D" * h) + "D" + ("R" * (w+1)) + ("U" * (h+1)) + "LU" + ("L" * (w+1)) + ("D" * (h+1)) + "R")
print(ans)

Measured memory_bytes: 3064