akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 105;
int n,m;
char a[maxn][maxn];
int xx[4]={0,0,-1,1};
int yy[4]={1,-1,0,0};
int num;
int sx,sy;
char ch;
void dfs(int x,int y)
{
    a[x][y]='.';
    for(int ii=0;ii<4;ii++)
    {
        int nx=x+xx[ii];
        int ny=y+yy[ii];
        if(nx>=0&&nx<n&&ny>=0&&ny<m&&a[nx][ny]==ch&&a[nx][ny]!='.')
        {
            dfs(nx,ny);
        }
    }
    return ;
}
int main()
{

    while(~scanf("%d%d",&n,&m)&&n&&m)
    {
        for(int i=0;i<n;i++)
        {
            scanf("%s",a[i]);
            getchar();
        }
        num=0;
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
        {
            if(a[i][j]=='#'||a[i][j]=='*'||a[i][j]=='@')
            {
                 ch=a[i][j];
                 //sx=i;sy=j;
                dfs(i,j);num++;
            }
        }
        printf("%d\n",num);
         /*for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
        {
            printf("%c",a[i][j]);
        }
        cout<<endl;
        }*/
    }
    return 0;
}

Measured memory_bytes: 3492
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {Main instance = new Main();sc = instance.new Scanner();instance.solve();}
    private class Scanner {String[] s = new String[0];String regex = " ";int i = 0;BufferedReader br = new BufferedReader(new InputStreamReader(System.in));public String next() {try {if (i < s.length) { return s[i++];}String st = br.readLine();while ("".equals(st)) { st = br.readLine(); }s = st.split(regex, 0);i = 0;return s[i++];} catch (IOException e) { return null; }}public int nextInt(){return Integer.parseInt(next());}}        
    private static Scanner sc;

    private void solve() {
        int ab = Integer.parseInt(sc.next() + sc.next());
        int sqrt = (int)Math.sqrt(ab);
        System.out.println(ab==sqrt*sqrt ? "Yes" : "No");
    }
}


Measured memory_bytes: 20564
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//??\???
		int a, b;
		a = sc.nextInt();
		b = sc.nextInt();
        //???????????????
		if(a < b) {
		System.out.println("a < b");
		}else if(a > b) {
		System.out.println("a > b");
	    }else if(a == b) {
		System.out.println("a == b");	
	    }
	}
}

Measured memory_bytes: 26168
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int n, k;
	cin >> n >> k;

	vector<double>p(n);
	
	REP(i, n) cin >> p[i];

	vector<double>num(n + 1, 0);

	REP(i, n) {
		num[i + 1] = num[i] + (1 + p[i]) / 2;
	}

	double ans = 0;
	for (int i = k; i <= n; i++) {
		ans = max(ans, num[i] - num[i - k]);
	}

	cout << setprecision(7) << ans << endl;


	return 0;

}

Measured memory_bytes: 3328
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True



MOD = 10**9 + 7
class ModInt:

    def __init__(self, x):
        self.x = x.x if isinstance(x, ModInt) else x % MOD

    __str__ = lambda self:str(self.x)
    __repr__ = __str__
    __int__ = lambda self: self.x
    __index__ = __int__

    __add__ = lambda self, other: ModInt(self.x + ModInt(other).x)
    __sub__ = lambda self, other: ModInt(self.x - ModInt(other).x)
    __mul__ = lambda self, other: ModInt(self.x * ModInt(other).x)
    __pow__ = lambda self, other: ModInt(pow(self.x, ModInt(other).x, MOD))
    __mod__ = lambda self, other: ModInt(self.x % ModInt(other).x)
    __truediv__ = lambda self, other: ModInt(self.x * pow(ModInt(other).x, MOD - 2, MOD))
    __floordiv__ = lambda self, other: ModInt(self.x // ModInt(other).x)
    __radd__ = lambda self, other: ModInt(other + self.x)
    __rsub__ = lambda self, other: ModInt(other - self.x)
    __rpow__ = lambda self, other: ModInt(pow(other, self.x, MOD))
    __rmod__ = lambda self, other: ModInt(other % self.x)
    __rmul__ = lambda self, other: ModInt(other * self.x)
    __rtruediv__ = lambda self, other: ModInt(other * pow(self.x, MOD - 2, MOD))
    __rfloordiv__ = lambda self, other: ModInt(other // self.x)

    __lt__ = lambda self, other: self.x < ModInt(other).x
    __gt__ = lambda self, other: self.x > ModInt(other).x
    __le__ = lambda self, other: self.x <= ModInt(other).x
    __ge__ = lambda self, other: self.x >= ModInt(other).x
    __eq__ = lambda self, other: self.x == ModInt(other).x
    __ne__ = lambda self, other: self.x != ModInt(other).x


def main():
    S = input()
    N = len(S)-1
    dp = [[0] * 13  for _   in range(N)]
    dp[0] = [0 for _ in range(13)]
    
    if S[0] == '?':
        for i in range(10):
            dp[0][i] = 1
    else:
        dp[0][int(S[0])] = 1

    for i in range(1,N):
        if S[i] == '?':
            for j in range(13):
                for k in range(10):
                    dp[i][(j * 10 + k) % 13 ] = (dp[i][(j * 10 + k) % 13 ] + dp[i-1][j]) % MOD
        else:
            for j in range(13):
                dp[i][ (j* 10 + int(S[i])) % 13 ] = (dp[i][ (j* 10 + int(S[i])) % 13 ]  + dp[i-1][j]) % MOD
        

    print(dp[len(S)-2][5])









    pass
if __name__ == '__main__':
    main()

Measured memory_bytes: 61404
#include<bits/stdc++.h>
using namespace std;
int qry(long long x)
{
	char ch[2];
	printf("? %lld\n",x);
	fflush(stdout);
	scanf("%s",ch);
	if(ch[0]=='Y') return 1;
	return 0;
}
int main()
{
	int l=1;
	long long pw=1;
	for(;l<=11;l++,pw*=10)if(!qry(pw))break;
	if(l==12)
	{
		long long mx=9,res=1;
		for(;;mx=mx*10+9,res*=10)
		{
			if(qry(mx))
			{
				printf("! %I64d\n",res);
				fflush(stdout);
				return 0;
			}
		}
	}
	else l--;
	long long lf=1,rg=1,md,res;
	for(int i=1;i<l;i++)lf*=10;
	rg=lf*10-1;
	while(lf<=rg)
	{
		md=(lf+rg)/2;
		if(qry(md*10ll))
		{
			res=md;
			rg=md-1;
		}
		else
			lf=md+1;
	}
	printf("! %I64d\n",res);
	fflush(stdout);
	return 0;
}

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

long long modpow(long long a, long long n, long long m) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % m;
		a = a * a % m;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

int main() {
	const long long M = 1000000007;
	long long n, a, b;
	cin >> n >> a >> b;
	long long power_n = modpow(2, n, M);

	long long a_bunshi = n;
	for (long long i = 1; i <= a - 1; i++) a_bunshi = a_bunshi * (n - i) % M;
	long long a_bunbo = a;
	for (long long i = 1; i <= a - 1; i++) a_bunbo = a_bunbo * (a - i) % M;
	long long b_bunshi = n;
	for (long long i = 1; i <= b - 1; i++) b_bunshi = b_bunshi * (n - i) % M;
	long long b_bunbo = b;
	for (long long i = 1; i <= b - 1; i++) b_bunbo = b_bunbo * (b - i) % M;

	long long nCa = a_bunshi * modinv(a_bunbo, M) % M;
	long long nCb = b_bunshi * modinv(b_bunbo, M) % M;

	long long ans = power_n - nCa - nCb - 1;
	while (ans < 0) ans += M;
	cout << ans % M << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    string s; cin>>s;
    string hoge=s.substr(0,4);
    if(hoge=="YAKI")return puts("Yes")*0;
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef struct { char suit, value; } Card;
void bubble(Card A[], int N) {
  int i,j;
  Card t;
  for(i = 0; i<N; i++) {
    for(j = N-1; j >= i; j--) {
      if(A[j].value < A[j-1].value) {
        t = A[j]; A[j] = A[j-1]; A[j-1] = t;
      }
    }
  }
}
void selection(Card A[], int N) {
  int i,j,minj;
  Card t;
  for(i=0;i<N;i++) {
    minj = i;
    for(j=i; j<N; j++) {
      if(A[j].value < A[minj].value) minj = j;
    }
    t = A[i]; A[i] = A[minj]; A[minj] = t;
  }
}
void print(Card A[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(i>0) printf(" ");
      printf("%c%d",A[i].suit,A[i].value);
  }
  printf("\n");
}
int isStable(Card C1[], Card C2[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
}
void str2Card(Card *t,char str[]) {
    t->suit  = str[0];
    t->value = str[1] - '0';
}
int main(void) {
  Card C1[100], C2[100];
  int N,i;
  char str[3];

  scanf("%d",&N);
  for(i=0;i<N; i++) {
    scanf("%s",str);
    str2Card(&C1[i],str);
  }
  for(i=0; i<N; i++) C2[i] = C1[i];
  bubble(C1,N);
  selection(C2,N);
  print(C1,N);
  printf("Stable\n");
  print(C2,N);
  if(isStable(C1,C2,N)) {
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }
  return 0;
}


Measured memory_bytes: 2148
// atcoder.jp/contests/tdpc/tasks/tdpc_game
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define rep(i, s, n) for (ll i = s; i < n; ++i)
#define repd(i, s, n) for (ll i = s; n < i; --i)
#define repa(e, vec) for (auto &&e : (vec))
#define repv(e, vec) for (auto e : (vec))
#define dump(x) cerr << #x << " = " << (x) << " | ";
#define _mp make_pair
#define _pb push_back
#define _lb lower_bound
#define _ub upper_bound
#define _sz(x) (int)x.size()
#define _count(arr, target) count(arr, arr + (sizeof(arr)), target)
#define _all(x) (x).begin(), (x).end()

const int INF = 2 * 1e9;
const int MOD = 1e9 + 7;

using namespace std;

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

ll solve(ll n, vector<ll> va, vector<ll> vb, vector<ll> vc) {
    ll ans = 0;
    ll u = 0;
    ll l = 0;

    rep(i, 0, n) {
        l = lower_bound(_all(va), vb[i]) - va.begin();
        u = vc.end() - upper_bound(_all(vc), vb[i]);
        ans += u * l;
    }

    return ans;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    vector<ll> va(n), vb(n), vc(n);
    rep(i, 0, n) cin >> va[i];
    rep(i, 0, n) cin >> vb[i];
    rep(i, 0, n) cin >> vc[i];

    sort(_all(va));
    sort(_all(vb));
    sort(_all(vc));

    ll ans = solve(n, va, vb, vc);
    cout << ans << "\n";
}


Measured memory_bytes: 7872
import java.util.*;
public class Main {
	public static class Res{
		private String S;
		private int P;
		private int index;
		
		public Res(String S, int P, int i) {
			this.S = S;
			this.P = P;
			this.index = i;
		}
		
		public String getS() {
			return S;
		}
		public int getP() {
			return P;
		}
		public int getIndex() {
			return index;
		}
	}
	
	public static class Comp implements Comparator<Res> {
	    public int compare(Res x1, Res x2) {
	        if(x1.getS().equals(x2.getS())) {
	        	if(x1.getP() < x2.getP()) {
	        		return 1;
	        	}
	        	else {
	        		return -1;
	        	}
	        }
	        else{
	        	return x1.getS().compareTo(x2.getS());
	        }
	    }
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Res> restaurants = new ArrayList<Res>();
		
		for(int i = 0; i < N; i++) {
			String S = stdIn.next();
			int P = stdIn.nextInt();
			Res res = new Res(S, P, i+1);
			restaurants.add(res);
		}
		
		Collections.sort(restaurants, new Comp());
		
		Iterator iterator = restaurants.iterator();
		while(iterator.hasNext()){
			Res res = (Res)iterator.next();
			System.out.println(res.getIndex());
		}

	}

}

Measured memory_bytes: 21204
#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(string& s, string& t) {
    vector<vector<int>> dp(s.size()+1, vector<int>(t.size()+1, 0));

    REP(i,1,s.size()+1) {
        REP(j,1,t.size()+1) {
            if (s[i-1] == t[j-1]) {
                dp[i][j] = dp[i-1][j-1] + 1;
            } else {
                dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
            }
        }
    }

    string answer = "";
    int l = s.size(), r = t.size(), len = dp[s.size()][t.size()];
    while (len > 0) {
        while (max(dp[l-1][r], dp[l][r-1]) == len) {
            if (dp[l-1][r] == len) l--;
            else r--;
        }
        answer = s[l-1] + answer;
        len--;
        l--; r--;
    }

	stringstream ss;
    ss << answer;
	cout << ss.str() << '\n';

    return;
}

signed main() {
    string s, t;
    cin >> s >> t;


//    vector<int> w(N);
//    vector<int> v(N);
//    REP(i,0,N) {
//        cin >> w[i];
//        cin >> v[i];
//    }
    solve(s, t);
    
    return 0;
}



Measured memory_bytes: 35584
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
  /******input******/
  int N;
  cin >> N;
  int t[N+1];
  int x[N+1];
  int y[N+1];
  for(int i = 0; i < N+1; i++){
    if(i == 0){
      t[0] = 0;
      x[0] = 0;
      y[0] = 0;
    }else{
      cin >> t[i] >> x[i] >> y[i];
    }
  }
  /******input******/


  /******check the plan******/
  int time;
  int xway,yway;
  bool flag = true; // available or disavailable
  for(int i = 1; i < N+1; i++){
    time = t[i]-t[i-1];
    xway = abs(x[i]-x[i-1]); 
    yway = abs(y[i]-y[i-1]);
    if((xway + yway > time) || (xway + yway) %2 != time%2){
      flag = false;
      break;
    }
  }
  /******check the plan******/


  if(flag == true) cout << "Yes" << "\n";
  else cout << "No" << "\n";


  return 0;
}


Measured memory_bytes: 1408
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf8");

const range = (n: number) => Array.from(Array(n), (_, i) => i);

const N = BigInt(input);

const getNo = (n: bigint): string => {
  const alphabets: string[] = Array.from(Array(26), (_, i) => String.fromCharCode("a".charCodeAt(0) + i));

  const getNo = (n: bigint, l: bigint): string => {
    const m = 26n ** l;

    return n <= m
      ? range(Number(l)).reduce(
          ({ num, str }, _) => ({
            num: num / 26n,
            str: alphabets[Number(num % 26n)] + str,
          }),
          { num: n - 1n, str: "" }
        ).str
      : getNo(n - m, l + 1n);
  };

  return getNo(n, 1n);
};

console.log(getNo(N));


Measured memory_bytes: 29680
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<String> list = new LinkedList<String>();
		Map<String, Long> map = new HashMap<String, Long>();
		while (in.hasNext()) {
			int n = in.nextInt();
			if (n != 0) {
				list.clear();
				map.clear();
				for (int i = 0; i < n; i++) {
					String num = in.next();
					long l = in.nextLong() * in.nextLong();
					if (!list.contains(num)) {
						list.add(num);
						map.put(num, l);
					} else {
						map.put(num, map.get(num) + l);
					}
				}
				boolean has = false;
				for (String st : list) {
					if (map.get(st).compareTo(Long.valueOf(1000000)) >= 0) {
						has = true;
						System.out.println(st);
					}
				}
				if (!has) {
					System.out.println("NA");
				}
			}
		}
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#define INF 12345678901234ll
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int N, Q, A, B;
LL D[202020], Sum, ans;

struct SegTree{
    LL Min[808080];

    void update(int id, int s, int e, int t, LL v){
        if (e < t || t < s) return;
        if (s == e){
            Min[id] = v;
            return;
        }
        int mid = (s+e)/2;
        update(id*2, s, mid, t, v);
        update(id*2+1, mid+1, e, t, v);
        Min[id] = min(Min[id*2], Min[id*2+1]);
    }

    LL query(int id, int s, int e, int ts, int te){
        if (e < ts || te < s) return INF;
        if (ts <= s && e <= te) return Min[id];
        int mid = (s+e)/2;
        return min(query(id*2, s, mid, ts, te), query(id*2+1, mid+1, e, ts, te));
    }
} Pj, Mj;

int main(){
    scanf("%d %d %d %d", &N, &Q, &A, &B);
    fill(D, D+N+1, INF);
    D[B] = 0;
    for (int i=1; i<=N; i++){
        Pj.update(1, 1, N, i, D[i]+i);
        Mj.update(1, 1, N, i, D[i]-i);
    }
    while (Q--){
        scanf("%d", &B);
        LL k = min(Mj.query(1, 1, N, 1, B)+B, Pj.query(1, 1, N, B, N)-B) + Sum;
        Sum += abs(A-B);
        if (D[A]+Sum > k) D[A] = k-Sum;
        Mj.update(1, 1, N, A, D[A]-A);
        Pj.update(1, 1, N, A, D[A]+A);
        A = B;
    }
    ans = INF;
    for (int i=1; i<=N; i++) ans = min(ans, D[i]+Sum);
    printf("%lld\n", ans);
    return 0;
}


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

int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    int A,B;

    cin>>A>>B;

    cout<<6 - A - B<<endl;


    return 0;
}


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

/*int main(){
    string S,T;
    cin>>S>>T;
    int c=0;
    for(int i=0;i<S.size();i++){
        if(S.at(i)==T.at(i)) c++;
    }
    cout<<c<<endl;
    return 0;
}*/

int main() {
    int A,B;
    cin>>A>>B;
    int c=1;
    int a=A;
    if(B==1) c=0;
    else{
        while(A<B){
            A+=a-1;
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    map<string, int> mp;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ans += mp[s];
        mp[s]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11136
n,k,s=map(int,input().split())
INF=10**9
if s<10**9:
  for i in range(k):
    print(s)
  for i in range(n-k):
    print(INF)
else:
  for i in range(k):
    print(INF)
  for i in range(n-k):
    print(1)

Measured memory_bytes: 4340
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;


int main() {
    ll N, M;
    cin >> N >> M;
    if(N >= M/2) {
        cout << M/2 << '\n';
        return 0;
    }
    ll X = N*2 + M;
    cout << X/4 << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(void)
{
	int n;

	while (true)
	{
		int s[1000] = {};
		double sum = 0;
		double average = 0;
		cin >> n;
		if (n == 0) break;
	
		for (int i = 0; i < n; i++)
		{
			cin >> s[i];
			sum += s[i];
		}
		average = sum / (double)n;
		sum = 0;
		for (int i = 0; i < n; i++)
		{
			sum += (s[i] - average) * (s[i] - average) / n;
		}
		printf("%.5f\n",sqrt(sum));
	}
	return 0;
}


Measured memory_bytes: 3236
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  string s, t;
  readf("%s %s\n", &s, &t);
  int a, b;
  readf("%s %s\n", &a, &b);
  auto u = readln.chomp;
  if (s == u) {
    a--;
  } else {
    b--;
  }
  writefln("%s %s", a, b);
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
	char str[1024];
	scanf("%s",str);
	char *ptr = str;
	while(*ptr != '\0'){
		if(*ptr >= 'D'){
			*ptr -= 3;
		}else{
			*ptr = 'X' + (*ptr - 'A');
		}
		ptr++;
	}
	
	printf("%s\n",str);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
main()
{
    string a;
    cin>>a;
    int len=a.size();
    bool ck1=false,ck2=false;
    for(int i=0; i<len; i++)
    {
        if(a[i]=='C')ck1=true;
        if(a[i]=='F'&&ck1==true){ck2=true;break;}

    }
    if(ck2)cout<<"Yes";
    else cout<<"No";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N, T;
    cin >> N >> T;

    V(P) AB(N);
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        AB[i] = P(a, b);
    }
    SORT(AB);

    /*vvi dp(N+1, vi(T+1, 0));

    rep(i, N) {
        for(int j=T-1; j>=0; j--) {
            if(j+AB[i].fi>=T) {
                dp[i+1][T] = max(dp[i][T], dp[i][j]+AB[i].se);
            } else {
                dp[i+1][j+AB[i].fi] = max(dp[i][j+AB[i].fi], dp[i][j]+AB[i].se);
            }
        }
    }

    cout << dp[N][T] << endl;*/

    vi dp(T+1, 0);
    rep(i, N) {
        for(int j=T-1; j>=0; j--) {
            int t = min(j+AB[i].fi, T);
            dp[t] = max(dp[t], dp[j]+AB[i].se);
        }
    }

    cout << dp[T] << endl;

    return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll N,D; cin >> N >> D;
    double S[11][11];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < D; j++) {
            cin >> S[i][j];
        }
    }
    ll cnt = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            double ans = 0;
            for (int k = 0; k < D; k++) {
                ans += (S[i][k]-S[j][k]) * (S[i][k]-S[j][k]);
            }
            ans = sqrt(ans);
            if(floor(ans) == ans){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
//C
int main() {
	// your code goes here
	int n,i,a,b[100005];
	cin >> n;
	for(i=1;i<=n;i++){
		cin >> a;
		b[a]=i;
	}
	for(i=1;i<=n;i++) cout << b[i] << endl;
 	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int T1 = A / D, T2 = C / B;
    if (A % D > 0) {
        ++T1;
    }
    if (C % B > 0) {
        ++T2;
    }
    cout << ((T1 >= T2) ? "Yes" : "No") << '\n';
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>

int main(void) {

	int k;

	std::cin >> k;

	int odd, even;

	even = k / 2;
	odd = std::ceil(k / 2.0);

	std::cout << even * odd << std::endl;

	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        Arrays.sort(h);
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < n - k + 1; i++) {
            int min = h[i];
            int max = h[i + k - 1];
            int sa = max - min;
            if (ans > sa) {
                ans = sa;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 49500
import math
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    x = 1
    y = n
    for i in range(int(math.sqrt(n)), 0, -1):
        if n%i == 0:
            x = i
            y = n//i
            break
    ans = x + y -2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9068
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  vl vec={1,10,9,12,3,4};
  ll dp[6][13];
  rep(i,6){
    rep(j,13)dp[i][j]=0;
  }
  string s;cin>>s;
  reverse(s.begin(),s.end());
  dp[5][0]=1;
  rep(i,s.size()){
    ll num=i%6;
    ll back=(i+6-1)%6;
    rep(j,13)dp[num][j]=0;
    if(s[i]=='?'){
      rep(j,13){
        rep(k,10){
          dp[num][(j+vec[num]*(k))%13]+=dp[back][j]%MOD;
          dp[num][(j+vec[num]*(k))%13]%=MOD;
        }
      }
    }
    else {
      rep(j,13){
        dp[num][(j+vec[num]*(s[i]-'0'))%13]+=dp[back][j]%MOD;
        dp[num][(j+vec[num]*(s[i]-'0'))%13]%=MOD;
      }
    }
  }
  ll MAX=0;
  ll t=(s.size()-1)%6;
  cout<<dp[t][5]<<endl;
}
  

Measured memory_bytes: 512
#include <iostream>

using namespace std;

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

    int b_width = 0;
    int tmp = b;
    while (tmp > 0) {
        ++b_width;
        tmp /= 10;
    }

    int num = a;
    for (int i = 0; i < b_width; ++i)
        num *= 10;
    num += b;

    for (int i = 1; i < num; ++i) {
        if (i * i == num) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	a, b := make([]int, n+1), make([]int, n)

	for i := 0; i < n+1; i++ {
		a[i] = nextInt()
	}
	for i := 0; i < n; i++ {
		b[i] = nextInt()
	}

	c := 0
	for i := 0; i < n; i++ {
		if a[i] < b[i] {
			c += a[i]
			b[i] -= a[i]
			a[i] = 0
		} else {
			c += b[i]
			continue
		}

		if a[i+1] < b[i] {
			c += a[i+1]
			a[i+1] = 0
		} else {
			c += b[i]
			a[i+1] -= b[i]
		}
	}

	fmt.Println(c)
}


Measured memory_bytes: 5376
#include<iostream>
#include<vector>

using namespace std;

int result[5];

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

int main(void){
	while(cin>>result[0],result[0]){
		bool d = 0;
		bool	hand[3] = {false};
		loop(i,1,5)cin>>result[i];
		rep(i,5)hand[result[i]-1]=true;
		if(!hand[0]&&!hand[1]) d = true;
		else if(!hand[1]&&!hand[2]) d = true;
		else if(!hand[0]&&!hand[2]) d = true;
		if(hand[0]&&hand[1]&&hand[2]||d)
			rep(i,5)cout<<3<<endl;
		else if(!hand[0])
			rep(i,5)
				if(result[i]==2)cout<<1<<endl;
				else cout<<2<<endl;
		else if(!hand[1])
			rep(i,5)
				if(result[i]==3)cout<<1<<endl;
				else cout<<2<<endl;
		else if(!hand[2])
			rep(i,5)
				if(result[i]==1)cout<<1<<endl;
				else cout<<2<<endl;
	}
}

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

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"
#include "profile.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define profile(X) LOG_DURATION(X)
#else
#define debug(...) 42
#define profile(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
//const ll MOD = 924844033;
const ld PI = 3.141592653589793;
const int maxn = 600001;
const ll MOD = 1e9 + 7;
using cd = complex<double>;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    profile("all");
    auto solve = [](int _) {
        ll h, w;
        cin >> h >> w;
        ll ans = 1e18;
        for (int i = 0; i < 2; ++i, swap(h, w)) {
            if (w >= 3) {
                if (w % 3 == 0) {
                    ans = 0;
                } else {
                    ans = min(ans, h);
                }
            }
            for (int j = 1; j < w; ++j) {
                int rest = w - j;
                ll mx = max(j * h, (h + 1) / 2 * rest);
                ll mn = min(j * h, (h - (h + 1) / 2) * rest);
                ans = min(ans, mx - mn);
            }
        }
        cout<<ans;
    };


    fast_io();
    cout.precision(9);
    cout << fixed;

    solve(1);


}


Measured memory_bytes: 256
import copy
S = list(input())
N = len(S)
ReS = copy.copy(S)
o = 1
for i in S:
    ReS[N-o] = i
    o += 1
if S == reversed(S):
    print("Yes")
if S == ReS:
    if S[0:int((N-1)/2)] == ReS[int((N+1)/2): N]:
        if S[int((N+1)/2): N] == ReS[0:int((N-1)/2)]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
        print("No")


Measured memory_bytes: 3444
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vll vector <ll>
#define fi first
#define se second
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 5e5+100;
const ll INF = 1e9;
const ll kek=998244353;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    if (a+b+c>=22)
        cout<<"bust";
    else
        cout<<"win";}








Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int a,b,c;
  
  scanf("%d %d %d",&a,&b,&c);
  
  if(a+b+c==17){
    if(a+b==10 || a+b==12){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }else{
    printf("NO\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Stack;

class Main
{
    public static void main(String[] args)throws Exception
    {
        Scanner sc = new Scanner(System.in);
        Stack <Integer> st = new Stack<Integer>();
        String [] arr = sc.nextLine().split(" ");
        int n = arr.length;
        for(int i = 0; i<n; i++)
        {   
            String s; 
            if(arr[i].compareTo("+")==0||arr[i].compareTo("-")==0||arr[i].compareTo("*")==0)
            {
                int res=0;
                switch(arr[i])
                {
                    case "+":
                        res= st.pop()+st.pop();
                        break;
                    case "-":
                        res=  -1 *  st.pop() + st.pop();
                        break;
                    case "*":
                        res= st.pop()* st.pop();    
                        break;
                }
                st.push(res);
            }
            else   st.push(Integer.parseInt(arr[i]));
        }
        System.out.println(st.peek());
    }
}
       





Measured memory_bytes: 26284
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
int A, B;
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>A>>B;

    ll ans = LLINF;

//    if(abs(A) < abs(B)){
//        if(0 <= A && 0 <= B){  //正負が反転
//            ans = B - A;
//        }else if(0 > A && 0 > B){
//            ans = abs(B) - abs(A) + 2;
//        }else{
//            ans = abs(B) - abs(A) + 1;
//        }
//    }else if(abs(A) > abs(B)){
//        if(0 <= A && 0 < B){  //正負が反転
//            ans = abs(A) - abs(B) + 2;
//        }else if(0 > A && 0 > B){
//            ans = abs(A) - abs(B);
//        }else if(A < 0 && B == 0){
//            ans = abs(A);
//        }else{
//            ans = abs(A) - abs(B) + 1;
//        }
//    }else{
//        ans = 1;    //A,Bは相異なるため、必ず正負が逆
//    }

    REP(i,0,2){
        REP(j,0,2){
            ll x = A;
            ll y = B;

            ll t = 0;

            if(i == 1){
                x *= (-1);
                t++;
            }

            if(j == 1){
                y *= (-1);
                t++;
            }

            if(x <= y){
                t += (y - x);
                ans = min(ans, t);
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
S=input()
x=int(S[0:2])
y=int(S[2:4])
if (0<x<13) & (0<y<13): print('AMBIGUOUS')
elif (0<x<=12) & ((y>=13) | (y==0)): print('MMYY')
elif (0<y<=12) & ((x>=13) | (x==0)): print('YYMM')
else: print('NA')

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
ll n, k;
int a[200005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k;
  REP(i, n) cin >> a[i + 1];

  bool used[n + 5] = { false };
  int count[n + 5] = { 0 };

  int s = 1, c = 0;
  int w, h_c, r_c;
  REP(i, n + 1) {
    if(!used[s]) {
      used[s] = true;
      count[s] = c;
      s = a[s];
    } else {
      w = s, h_c = count[s], r_c = c - count[s];
      break;
    }
    c++;
  }

  ll c_k;
  if(k < h_c) {
    c_k = k;
    s = 1;
  } else {
    c_k = k;
    c_k -= h_c;
    c_k %= r_c;
  }

  REP(i, c_k) {
    s = a[s];
  }

  cout << s << endl;
}


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

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N ;
  cin >> N ;

   int sum = findSumOfDigits(N); // i の各桁の和
    if (N%sum==0) { //  i の各桁の和が A 以上 B 以下かどうか
    cout << "Yes" << endl; }else{ cout << "No" << endl; }
  }


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n;
const int N = 200000;
int ai[N], bi[N], as[N], bs[N];
int vis[N], cc[N];
vector <int> bb[N];
int ans;
void dfs(int t)
{
    vis[t] = 1;
    for (int i = 0; i < bb[t].size(); ++ i)
        if (!vis[bb[t][i]]) dfs(bb[t][i]);
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &ai[i]);
        ai[0] ^= ai[i];
    }
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &bi[i]);
        bi[0] ^= bi[i];
    }
    for (int i = 0; i <= n; ++ i)
        as[i] = ai[i], bs[i] = bi[i];
    sort(as, as + n + 1);
    sort(bs, bs + n + 1);
    for (int i = 0; i <= n; ++ i)
        if (as[i] != bs[i]) {puts("-1"); return 0;}
    for (int i = 0; i <= n; ++ i)
        ai[i] = lower_bound(as, as + n + 1, ai[i]) - as,
        bi[i] = lower_bound(bs, bs + n + 1, bi[i]) - bs;
    for (int i = 0; i <= n; ++ i)
        if (ai[i] != bi[i] || i == 0)
        {
            if (i) ans ++;
            cc[ai[i]] ++; cc[bi[i]] ++;
            bb[ai[i]].push_back(bi[i]);
            //bb[bi[i]].push_back(ai[i]);
        }
    for (int i = 0; i <= n; ++ i)
        if (!vis[i] && cc[i])
            dfs(i), ans ++;
    ans --;
    ans = max(ans, 0);
    printf("%d\n", ans);
}

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

typedef long long ll;
typedef pair<int, int> P;

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    int n; cin >> n;
    cout << n/3;
}


Measured memory_bytes: 256
// 2020-08-11 17:19:01
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll n;
  cin >> n;
  ll ans = 0;
  REPC(u, 1, n) {
    ans += u * (n-u+1);
  }
  rep(i, n-1) {
    ll u, v;
    cin >> u >> v;
    if(u > v) swap(u, v);
    ans -= u * (n-v+1);
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

int main(){
char a[10][10];
cin>>a[0][0]>>a[0][1]>>a[0][2];
cin>>a[1][0]>>a[1][1]>>a[1][2];
cin>>a[2][0]>>a[2][1]>>a[2][2];
  
cout<<a[0][0]<<a[1][1]<<a[2][2]<<endl;
}

Measured memory_bytes: 256
N = int(input())

Line_A = list(map(int, input().split()))

def insertionSort(A, N):
    print(*A)
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        
        print(*A)

insertionSort(Line_A, N)



Measured memory_bytes: 5984
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
const int MAXN = 2e5 + 10;
int n , ans , a[MAXN];
int32_t main()
{
	cin >> n;
	for(int i = 0 ; i < n ; i ++)
		cin >> a[i];
	if(a[0])
		return cout << -1 << endl , 0;
	for(int i = 0 ; i < n - 1 ; i ++)
	{
		if(a[i] + 1 < a[i + 1])
			return cout << -1 << endl , 0;
		if(a[i] + 1 == a[i + 1])
			ans ++;
		else 
			ans += a[i + 1];
	}
	return cout << ans << endl , 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef priority_queue<P,vector<P>,greater<P> > PQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

ll mod_pow(ll a, ll x, ll n){
    ll res = 1,index = 0;
    ll pow_list[30] = {};
    ll temp = x;
    pow_list[0] = a;

    while(temp){
        if(temp % 2) res = (res * pow_list[index]) % n; 

        pow_list[index+1] = (pow_list[index] * pow_list[index]) % n;
        index++;
        temp /= 2;
    }

    return res;
}

bool check_p(ll a, ll n, ll t, ll u){
    ll x = mod_pow(a,u,n);
    ll y = (x * x) % n;

    rep(i,0,t){
        if(y == 1 && x != 1 && x != (n-1)){
            return true;
        }
        x = y;
    }
    return y != 1;
}

bool miller_rabin(ll n){
    if(n <= 1) return false;
    else if(n == 2) return true;
 
    ll a[3] = {2,7,61};
    ll t = 1;
    ll u = n >> 1;
    while(u & 1 == 0){
        t++;
        u >>= 1;
    }

    rep(i,0,3){
        if(a[i] < n && check_p(a[i],n,t,u)){
            return false;
        }
    }    
    
    return true;
}



int main(){
    ll n,cnt = 0;
    cin >> n;

    rep(i,0,n){
        ll a;
        cin >> a;
        if(miller_rabin(a)) cnt++;
    }

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



Measured memory_bytes: 3108
import sys
input = sys.stdin.readline

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

votes = list(map(int, input().rstrip().split()))
ans = []

for i in range(len(votes)):
  if votes[i] >= sum(votes) / (4*M):
    ans.append(votes[i])

if len(ans) >= M:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 9184
#many requirement
n,m,q=map(int,input().split())
que=[]
for _ in range(q):
    a,b,c,d=map(int,input().split())
    que.append((a,b,c,d))
from itertools import combinations_with_replacement as cwr
ans=0
raw=[i+1 for i in range(m)]
data=list(cwr(raw,n))
for some in data:
    base=0
    for q in que:
        a,b,c,d=q
        if some[b-1]-some[a-1]==c:
            base+=d
    ans=max(ans,base)
print(ans)

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,k,h,x,y,xcmp=0,ycmp=0;

string s,w;

vector<int> z;

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
int i=1;
       cin >> a;
       while(cnt<a){
           
           cnt+=i;
           i++;
           ans++;
           //out(i);
           //Cout(cnt);
       }
       Cout(ans);
return 0;
}


Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long long LL;

int main() {
	LL n, ans = 1;
	cin >> n;
	vector<LL> a(n);
	for (LL i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (LL i = 0; i < n; ++i) {
		if (log10(ans) + log10(a[i]) > 18) {
			ans = -1;
			break;
		}
		ans *= a[i];
		if (ans > 1000000000000000000LL) {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4048
#include <cstdio>
#include <list>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    list<int> A(N);
    for(auto itr = A.begin(); itr != A.end(); ++itr){
        cin >> *itr;
    }
    while(N > 1){
        A.sort();
        while(*A.begin() == 0){
            A.pop_front();
        }
        auto itr = A.begin();
        int f = *itr++;
        for(; itr != A.end(); ++itr){
            if(*itr) {
                *itr %= f;
                if(!*itr) N--;
            }
        }
    }
    cout << *A.begin();
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long H, W;
  cin >> H >> W;
  if (H == 1 || W == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (H * W % 2 == 1) {
    cout << H * W / 2 + 1 << endl;
  } else {
    cout << H * W / 2 << endl;
  }
}

Measured memory_bytes: 256