akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        Stack<Long> st = new Stack<Long>();
        while (input.hasNext()) {
            String s = input.next();
            if ("+".equals(s)) {
                long y = Long.valueOf(st.pop());
                long x = Long.valueOf(st.pop());
                st.push(x + y);
            } else if ("-".equals(s)) {
                long y = Long.valueOf(st.pop());
                long x = Long.valueOf(st.pop());
                st.push(x - y);
            } else if ("*".equals(s)) {
                long y = Long.valueOf(st.pop());
                long x = Long.valueOf(st.pop());
                st.push(x * y);
            } else {
                st.push(Long.valueOf(s));
            }
        }
        System.out.println(st.pop());
    }
    
    private void print(Object[] xs) {
        StringBuilder sb = new StringBuilder();
        for (Object x : xs) sb.append(x.toString()).append(' ');
        System.out.println(sb.toString().trim());
    }
}

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

int main() {
  map<int, int> v;
  vector<int> w;
  for(int i = 0; i < 9; i++) {
    int a;
    cin >> a;
    v.emplace(a, 0);
    w.push_back(a);
  }

  int N;
  cin >> N;

  vector<int> b;
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if(v.count(a) == 1) {
      v[a]++;
    }
  }

  bool flag = false;
  for(int i = 0; i < 3; i++) {
    if(v[w[3*i]] != 0 && v[w[3*i+1]] != 0 && v[w[3*i+2]] != 0 ) {flag = true; break;}
    if(v[w[i]] != 0 && v[w[i+3]] != 0 && v[w[i+6]] != 0 ) {flag = true; break;}
  }
  if(v[w[0]] != 0 && v[w[4]] != 0 && v[w[8]] != 0 ) flag = true;
  if(v[w[2]] != 0 && v[w[4]] != 0 && v[w[6]] != 0 ) flag = true;

  if(flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
n,m = map(int, input().split())
import numpy as np
KS = [np.array(list(map(int, input().split()))) for _ in range(m)]
P = list(map(int, input().split()))

import itertools
cond = np.array([np.array(i) for i in itertools.product([0,1],repeat=n)])

light = 0
for ks,p in zip(KS,P):
  cond = [i for i in cond if sum(i[ks[1:]-1])%2 == p]
  
print(len(cond))

Measured memory_bytes: 12664
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
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; }
const Int INF = (1<<20);
int gcd(Int a, Int b) {
 return b != 0 ? gcd(b, a % b) : a;
}//gcd

int lcm(Int a, Int b) {
 return a / gcd(a, b)*b;
}//lcm
int main(){
    int n,m;cin >> n >> m;
    vector<int> A(n);
    auto ni = [](int v){
        int res = 0;
        while(v%2==0){
            v/=2;
            res++;
        }
        return res;
    };
    rep(i,n){
        cin >> A[i];
        if(A[i]&1){cout << 0 << endl;return 0;}
        A[i]/=2;
    }
    int t = ni(A[0]);
    rep(i,n){
        if(t!=ni(A[i])) {cout << 0 << endl;return 0;}
        A[i]>>=t;
    }
    m>>=t;
    Int l = 1;
    rep(i,n){
        l = lcm(l,A[i]);
        if(l>m){
            cout << 0 << endl;
            return 0;
        }
    }
    m/=l;
    Int ans = (m+1)/2;
    cout << ans << endl;
    
}

Measured memory_bytes: 640
#include<iostream>


#define ll long long
using namespace std;

int h,n;
int num[10005];
int main(){
	cin>>h>>n;
	int sum = 0;
	for(int i=0;i<n;i++){
		int temp;
		cin>>temp;
		sum+=temp;
	}
	
	if(sum>=h){
		cout<<"Yes\n";
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 81;
const int mod = 1000000007;

const int maxm = maxn * maxn + maxn;
bool f[maxn][maxn][maxm];
int a[maxn][maxn], b[maxn][maxn];
int n, m;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin >> n >> m;
  for (int i = 0; i < n; i++)for (int j = 0; j < m; j++)cin >> a[i][j];
  for (int i = 0; i < n; i++)for (int j = 0; j < m; j++)cin >> b[i][j];
  f[0][0][abs(a[0][0] - b[0][0])] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      for (int k = 0; k < maxm; k++) {
        if (!f[i][j][k])continue;
        if (i + 1 < n) {
          int tt1 = abs(k + a[i + 1][j] - b[i + 1][j]);
          if (tt1 < maxm)f[i + 1][j][tt1] = 1;
          tt1 = abs(k - a[i + 1][j] + b[i + 1][j]);
          if (tt1 < maxm)f[i + 1][j][tt1] = 1;
        }
        if (j + 1 < m) {
          int tt1 = abs(k + a[i][j + 1] - b[i][j + 1]);
          if (tt1 < maxm)f[i][j + 1][tt1] = 1;
          tt1 = abs(k - a[i][j + 1] + b[i][j + 1]);
          if (tt1 < maxm)f[i][j + 1][tt1] = 1;
        }
      }
  int ret = maxm;
  for (int j = 0; j < maxm; j++)
    if (f[n - 1][m - 1][j]) {
      ret = j;
      break;
    }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 42112
l = [i+1 for i in range(9)]

N = int(input())

end = 0

for i in range(9):
    if N % l[i] == 0:
        q = N / l[i]
        if 0 < q < 10:
            print('Yes')
            end = 1
            break

if not end:
    print('No')

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

int main() {
    //
    long long num;
    long long cnt = 0;
    cin >> num;

    for (int i = 1; i <= num; i++) {
        for (int j = 1; j <= num; j++) {
            if (i * j >= num) break;

            cnt++;
        }
    }

    cout << cnt;

    //
}


Measured memory_bytes: 3632
#include<stdio.h>
int main(void)
{
	int h,m,s,x;
	scanf("%d",&x);
	h=x/3600;
	x=x%3600;
	m=x/60;
	s=x%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	resolve()
}

func resolve() {
	ans := []int{}
	for true {
		n, x := scanInt(sc), scanInt(sc)
		if n == 0 && x == 0 {
			break
		}
		ans = append(ans, _resolve(n, x, 0, 1, 0))
	}
	for _, a := range ans {
		fmt.Println(a)
	}
	return
}

func _resolve(n, x, sum, idx, selectedNum int) int {
	if selectedNum == 3 {
		if sum == x {
			return 1
		}
		return 0
	}
	ans := 0
	for i := idx; i <= n; i++ {
		if sum+i > x {
			continue
		}
		ans += _resolve(n, x, sum+i, i+1, selectedNum+1)
	}
	return ans
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}



Measured memory_bytes: 1096
#include<bits/stdc++.h>
using namespace std;
int n,i,a[100009],f;
int main(){
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	for(i=n-1;i>=1;i--){
    	if(a[i]<a[i-1]) a[i-1]--;
    	if(a[i]<a[i-1]){
			f=1; break;
		}
	}
	if(f==1) printf("No");
	else printf("Yes");	
}

Measured memory_bytes: 4116
#include <stdio.h>

int main(void)
{
int a,b;
scanf("%d %d", &a,&b);
if(a < b){
printf("a < b\n");
} else if(a > b){
printf("a > b\n");
} else if(a == b){
printf("a == b\n");
}

return 0;

}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
const int maxn=200010;
int n;
vector<int>G[maxn];
int a[maxn];
vector<int>pre[maxn];
int cur[maxn],top;
int g[maxn];
int dp[maxn];
bool vis[maxn];
void dfs(int x,int pr){
	cur[++top]=a[x];
	int j=lower_bound(g+1,g+n+1,cur[top])-g;
	dp[x]=j;
	pre[j].pb(g[j]);
	g[j]=cur[top];
	// add[j]++;
	// cout<<"dfs: "<<x<<' '<<pr<<' '<<dp[x]<<' '<<cur[top]<<' '<<g[j]<<endl;
	vis[x]=1;
	for(auto to:G[x])if(to!=pr&&!vis[to])dfs(to,x);
	cur[top--]=0;
	// add[j]--;
	g[j]=pre[j].back();
	pre[j].pop_back();
	// if(!add[j])g[j]=INF;
}
void dfs2(int x,int pr){
	for(auto to:G[x])if(to!=pr){
		dp[to]=max(dp[to],dp[x]);
		dfs2(to,x);
	}
}
int main(){
	memset(g,INF,sizeof g);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<n;i++){
        int x,y;
        cin>>x>>y;
        G[x].pb(y);
        G[y].pb(x);
    }
	dfs(1,-1);
	dfs2(1,-1);
	for(int i=1;i<=n;i++)cout<<dp[i]<<endl;
    return 0;
}


Measured memory_bytes: 40308
#include <iostream>
#include <fstream>
#include <vector>

typedef long long ll;

ll n;
bool hasSolution;
std::vector<ll>v;

void Read(){
    
    std::cin >> n;
    v.resize(n + 5);
    
    for(ll i = 1;i <= n;++i){
        std::cin >> v[i];
        if(v[i] == 1)
            hasSolution = true;
    }
}

void Solve(){
    
    ll k{ 1 };
    ll left{ 1 };
    ll cnt{};
    
    for(ll i = 1;i <= n;++i){
        
        if(v[i] == k)
            k++;
        else
            cnt++;
        
    }
    
    std::cout << (hasSolution == true ? cnt : -1);
}

int main(){
    
    Read();
    Solve();
    
    return 0;
}


Measured memory_bytes: 1792
S=input()
N=len(S)
A,B=-1,-1
for i in range(N-1):
    if S[i] == S[i+1]:
        A,B=i+1,i+2
for i in range(N-2):
    if S[i] == S[i+2]:
        A,B=i+1,i+3
print(A,B)

Measured memory_bytes: 3188
from collections import *
from copy import *
H,W = map(int,input().split())
S = [(W+2)*["#"]]+[["#"]+list(input())+["#"] for h in range(H)]+[(W+2)*["#"]]
D = [[1,0],[-1,0],[0,1],[0,-1]]
ans = 0
P = deque([])
Q = deque([])

for h in range(1,H+1):
  for w in range(1,W+1):
    if S[h][w]==".":
      P+=[[h,w]]

while P:
  T = deepcopy(S)
  sx,sy = P.popleft()
  T[sx][sy] = 0
  Q = deque([[sx,sy]])
  while Q:
    x,y = Q.popleft()
    for dx,dy in D:
      if T[x+dx][y+dy]==".":
        T[x+dx][y+dy] = T[x][y]+1
        Q+=[[x+dx,y+dy]]
        ans = max(ans,T[x+dx][y+dy])

print(ans)

Measured memory_bytes: 9508
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, A, B;
  string S;
  cin >> N >> A >> B >> S;
  int pass = 0;
  int passB = 1;

  for(int i = 0 ; i < N ; i++){
    if(S[i] == 'a'){
      if(pass < A + B){
        pass ++;
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
    }else if(S[i] == 'b'){
      if(pass < A+B && passB <= B){
        passB++;
        pass++;
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
    }else if(S[i] == 'c'){
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;

class Main {
  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();

    if(a<b) System.out.println("a < b");
    else if(a>b) System.out.println("a > b");
    else System.out.println("a == b");


  }
}



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


using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/


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

    ll n;
    cin>>n;
    int maxx = 100;
    int minn = 1;
    vector<int> a;
    while (n)
    {
        if (n%2==1)
        {
            a.push_back(maxx);
            maxx--;
            n = (n-1)/2;
        }
        else
        {
            a.push_back(minn);
            minn++;
            n--;
        }
    }
    reverse(a.begin(), a.end());
    cout<<a.size() + 100<<endl;
    for (int i = 1; i<=100; i++) cout<<i<<' ';
    for (auto it: a) cout<<it<<' ';

}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		
		while(true){
			final int n = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			int start = -1;
			int before = -1;
			StringBuilder be = new StringBuilder();
			for(int i = 0; i < n; i++){
				int in = sc.nextInt();
				
				if(i == n - 1){
					if(start != -1 && before + 1 == in){
						before = in;
					}
					
					if(be.length() != 0){
						be.append(" ");
					}
					
					if(start != before){
						be.append(start + "-" + before);
					
						if(before != in){
							be.append(" " + in);
						}
					}else{
						if(start == -1){
							be.append(in);
						}else if(before != in){
							be.append(before + " " + in);
						}else{
							be.append(before + "-" + in);
						}
					}
				}else if(start == -1){
					start = in;
					before = in;
				}else if(before + 1 == in) {
					before = in;
				}else {
					if(be.length() != 0){
						be.append(" ");
					}
					be.append(start == before ? start : start + "-" + before);
					start = in;
					before = in;
				}
			}
			
			
			
			System.out.println(be);
		
		}
	}

}

Measured memory_bytes: 12000
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload :cl-debug-print))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (inline read-line-into))
(defun read-line-into (buf-str &optional (in *standard-input*) (terminate-char #\Newline))
  (declare (simple-base-string buf-str))
  (loop for ch of-type base-char =
           #-swank (code-char (read-byte in nil #\Newline))
           #+swank (read-char in nil #\Newline)
        for idx = 0 then (1+ idx)
        until (char= ch #\Newline)
        do (setf (aref buf-str idx) ch)
        finally (setf (aref buf-str idx) terminate-char)
                (return buf-str)))

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

(deftype uint nil `(integer 0 ,(expt 10 9)))
(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (k (read))
         (table (make-array (list n) :element-type 'uint))
         (buf (make-string 11 :element-type 'standard-char :initial-element #\Newline)))
    (declare (uint k)
             ((simple-array uint (*)) table))
    (dotimes (idx n)
      (setf (aref table idx)
            (parse-integer (read-line-into buf *standard-input* #\Newline) :junk-allowed t)))
    (setf table (stable-sort table #'<))
    (println
     (loop for begin-idx from 0
           for end-idx from (- (min k (length table)) 1) below (length table)
           minimize (- (aref table end-idx) (aref table begin-idx))))))

#-swank(main)


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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int L=A+B-C-D;
  if(L>0){
    cout << "Left" << endl;
  }else if(L==0){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
long long a[5];
long long f[5],n,ss;
int main()
{
  cin>>a[1]>>a[2]>>a[3]>>a[4]>>n;
  f[4]=1;
  ss=a[4];
  a[1]*=4,a[2]*=2,a[4]/=2;
  for(int i=1;i<4;i++)
    for(int j=i;j<=4;j++)
      if(a[j]<a[i]){swap(a[i],a[j]);swap(f[i],f[j]);}
  if(f[1]==1)
    cout<<ss*(n/2)+(n%2)*a[2]<<endl;
  else
    cout<<a[1]*n<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
const int N = 16;

int n;
int a[N][N];
ll dp[1 << N], score[1 << N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < (1 << n); i++) {
    for (int k = 0; k < n; k++) {
      if (!(i & (1 << k))) continue;
      for (int l = k+1; l < n; l++) {
        if (!(i & (1 << l))) continue;
        score[i] += a[k][l];
      }
    }
  }
  for (int i = 1; i < (1 << n); i++) {
    dp[i] = -INFLL;
    for (int j = i; j; j = (j-1) & i) {
      dp[i] = max(dp[i], score[j] + dp[i ^ j]);
    }
  }
  cout << dp[(1 << n) - 1] << nl;
  return 0;
}


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

int a, b;

int main()
{
	cin >> a >> b;
	if(a == 0 || b == 0 || a <= 0 && b >= 0) cout << "Zero" << endl;
	else if(a > 0) cout << "Positive" << endl;
	else if(b < 0) 
	{
		int t = b - a + 1;
		if(t % 2 == 0) cout << "Positive" << endl;
		else cout << "Negative" << endl;
	}
	
	return 0;
}


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

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

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

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))

int main()
{
	string b, s;
	cin >> b;
	for(char x : b)
	{
		switch (x)
		{
		case 'A':
			s += 'T';
			break;
		case 'T':
			s += 'A';
			break;
		case 'C':
			s += 'G';
			break;
		case 'G':
			s += 'C';
			break;
		}
	}
	cout << s << endl;
}



Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <cmath>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mp make_pair
#define all(a) (a).begin(), (a).end()

template<typename T>
void vdeb(vector<T> &da){
    int size=da.size();
    for(int i=0;i<size;i++){
        if(i==size-1){
            cout << da[i] << endl;
        }
        else{
            cout << da[i] << ' ';
        }
    }
}

void dfs(int now,vector<vector<P>> &da, vector<int> &ans, vector<int> &ed){
    int n = da[now].size(), num = 1;
    rip(i,n,0){
        if(num == ed[now]){
            num ++;
        }
        if(ed[da[now][i].first] == -1){
            ed[da[now][i].first] = num;
            ans[da[now][i].second] = num;
            num ++;
            dfs(da[now][i].first, da, ans, ed);
        }
    }
    return;
}

int main(){
    int n;
    cin >> n;
    vector<vector<P>> da(n,vector<P>(0));
    int a,b;
    rip(i,n-1,0){
        cin >> a >> b;
        a--;b--;
        da[a].push_back(mp(b,i));
        da[b].push_back(mp(a,i));
    }
    vector<int> ans(n-1),ed(n,-1);
    ed[0] = 0;
    dfs(0, da, ans, ed);
    int ma = 0;
    rip(i,n-1,0){
        ma = max(ma, ans[i]);
    }
    printf("%d\n",ma);
    rip(i,n-1,0){
        printf("%d\n",ans[i]);
    }
}

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

int main(){ 
    int r, c;
    cin >> r >> c;
    vector <vector <bool>> grid(r, vector<bool>(c));

    for (int i=0; i<r; i++){
        string s; cin >> s;
        for (int j=0; j<c; j++){
            if (s[j]=='.') grid[i][j] = true;
            else grid[i][j] = false;
        }
    }

    vector <vector <ll>> dp (r+1, vector <ll>(c+1));

    for (int i = 0; i< r+1; i++) dp[i][c] = 0;
    for (int j = 0; j< c+1; j++) dp[r][j] = 0;

    for (int i=r-1; i>=0; i--){
        for (int j=c-1; j>=0; j--){
            if (i == r-1 && j == c-1) dp[i][j] = 1;
            else {
                if (!grid[i][j]) dp[i][j] = 0;
                else dp[i][j] = (dp[i+1][j] + dp[i][j+1])% MOD;
            }
        }
    }

    cout << dp[0][0] << endl;
    return 0;
} 

Measured memory_bytes: 8320
import java.util.*

fun main(args: Array<String>) {
    val s = readLine()!!.toInt()
    var series = ArrayList<Int>()
    series.add(s)
    while(!series.contains(myFunc(series.get(series.lastIndex)))){
        series.add(myFunc(series.get(series.lastIndex)))
    }
    println(series.lastIndex+2)
}
fun myFunc(n: Int): Int{
    return when(n % 2){
        0 -> n / 2
        else -> 3 * n + 1
    }
}


Measured memory_bytes: 33644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll hpow(ll x,ll y){
    ll ans=1;
    ll i=x;
    if(y==0)return 1;
    while(y>0){
        if(y%2==1){
            ans=(ans*i)%i_7;
        }
        i=(i*i)%i_7;
        y=y/2;
        
    }
    return ans;
}

int main(){fastio
    ll n,k;cin>>n>>k;
    ll dp[k+1];
    dp[k]=1;
    ll ans=mod(k);
    for(ll i=k-1;i>=1;i--){
        dp[i]=hpow((ll)(k/i),n);
        rep(j,2,k){
            if(i*j>k){
                break;
            }
            dp[i]-=dp[i*j];
        }
        dp[i]=mod(dp[i]);
        ans=mod(ans+dp[i]*i);
    }
    cout<<ans<<endl;
    
    
    return 0;
}





Measured memory_bytes: 4436
import java.io.*;
import java.util.*;
 
public class Main{
	
 
	public void solve(){
		int N = nextInt();
		StringBuilder build = new StringBuilder(N);
		for(int i = 0; i < N; i++){
			build.append(next());
		}
		
		for(int i = 0; i <= 10000; i++){
			if(build.indexOf(Integer.toString(i)) == -1){
				out.println(i);
				return;
			}
		}
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

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

const int M=1e9+7;
const int NM=2e5+7;
const ll oo=1e18;

char a[1<<10][1<<10];
int dp[1<<10][1<<10];

int main()
{   int n,m;
    cin>>n>>m;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++)
            cin>>a[i][j];
    dp[1][1]=1;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++)
            if(a[i][j]=='.')
                dp[i][j]+=(dp[i-1][j]%M+dp[i][j-1]%M)%M;
    cout<<dp[n][m];
    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int ans;
  if (A > B) {
  ans = A + (A - 1);
  }
  else if (A < B) {
  ans = B + (B - 1);
  }
  else {
    ans = A + B;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=1000000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int n,a[N],fac[N],pw[N];
char s[N];

int calc(int n,int m)
{
    int tmp=fac[n]-fac[m]-fac[n-m];
    return tmp;
}

int main()
{
    n=read();
    scanf("%s",s+1);
    rep(i,1,n) a[i]=s[i]-'1';
    rep(i,1,n)
    {
        int x=i;
        while (x%2==0) {x/=2;pw[i]++;}
    }
    int ok=1;
    rep(i,1,n) 
        if (a[i]==1) {ok=0;break;}
    if (ok)
    {
        rep(i,1,n) a[i]/=2;
    }
    //rep(i,1,n) cout << pw[i] <<" ";cout << endl;
    rep(i,1,n) fac[i]=fac[i-1]+pw[i];
    int ans=0;
    rep(i,1,n)
    {
        int odd=calc(n-1,i-1);
        if ((!odd) && (a[i]&1)) ans^=1;
    }
    if (ok) ans*=2;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 16492
#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define prDouble(x) cout<<fixed<<setprecision(10)<<x;
li dp[3001][3001];
li solve(li i,li j, li *a)
{
    if(i>j)
    {
        return 0;
    }
    if(dp[i][j]!=-1)
    {
        return dp[i][j];
    }
    li ans;
    li op1=a[i]+min(solve(i+2,j,a),solve(i+1,j-1,a));
    li op2=a[j]+min(solve(i,j-2,a),solve(i+1,j-1,a));
    ans=max(op1,op2);
    dp[i][j]=ans;
    return ans;
}

int main()
{
    li j,i,n;
    cin>>n;
    memset(dp,-1,sizeof(dp));
    li a[n],s=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    cout<<2*solve(0,n-1,a)-s;
    return 0;
}


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

void solver() {
  long long a;
  string b;
  cin >> a >> b;
  string b1 = b.substr(0, 1);
  string b2 = b.substr(2, 2);
  int b3 = atoi(b1.c_str())*100 + atoi(b2.c_str());
  long long ans = (a * b3)/100;
  cout << ans << "\n";
}

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


Measured memory_bytes: 3624
fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val numbers = readLine()!!.split(" ").map { it.toLong() }
    val step = (0 until  n).map { 0 }.toMutableList()
    for(i in (1 until n)) {
        if(numbers[i] <= numbers [i-1]) {
            step[i] = step[i-1] + 1
        }
    }
    println(step.max())

}


Measured memory_bytes: 59108
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<int> c(n-1), s(n-1), f(n-1);
	rep(i, n-1) cin >> c[i] >> s[i] >> f[i];
	rep(i, n)
	{
		int t = 0;
		for (int j = i; j < n-1; j++)
		{
			int t_wait = t < s[j] ? s[j] - t :
				t % f[j] ? f[j] - t % f[j] : 0;
			t += t_wait + c[j];
		}
		co(t);
	}
	return 0;
}

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

int main(){
	int a,b;cin>>a>>b;
	if(a+b==15){
		cout<<"+"<<endl;
	}else if(a*b==15){
		cout<<"*"<<endl;
	}else{
		cout<<"x"<<endl;
	}
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll z = 0;
  cout<<max(z,b*(n-1)+a-(b+a*(n-1))+1);
  return 0;
}


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

int n;
const int max_n = 8;


int main(){
  

  cin >> n;
  vector<int> q(n);
  vector<int> p(n);
  for(int i = 0; i < n; i++) cin >> p[i], p[i]--;
  for(int i = 0; i < n; i++) cin >> q[i], q[i]--;

  map<vector<int>,long long> order;
  long long iter = 0;

  vector<int> v(n);
  for(int i = 0; i < n; i++) v[i] = i;

  // while(next_permutation(v.begin(), v.end())){
  //   order[v] = iter++;
  // }

  do{
    order[v] = iter++;
  }while(next_permutation(v.begin(), v.end()));

  cout << abs(order[p] - order[q]) << endl;


  return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
//↓,→,↑,←


#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/
struct Timer {
    int64_t start;
    const int64_t CYCLES_PER_SEC = 2800000000;
    Timer() { reset(); }
    void reset() { start = getCycle(); }
    inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
    inline int64_t getCycle() {
        uint32_t low, high;
        __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
        return ((int64_t)low) | ((int64_t)high << 32);
    }
};


bool multicase = false;

ll n, m, k, w, a, b, c, d, e, h, q, ans, sum, l;

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

void solve() {
    cin >> n;
    ll sum = 0;
    ll sqsum = 0;
    for(int i=0;i<n;i++){
        cin >> a;
        sum += a;
        sqsum += a * a;
        sum %= mod;
        sqsum %= mod;
    }
    ll ans = sum * sum - sqsum;
    ans %= mod;
    ans *= mypow(2, mod - 2, mod);
    ans %= mod;
    p(ans);
    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}



Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb push_back
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

char In[200020];
vector <int> p;

int main() {
	scanf("%s", In+1);
	int N = (int)strlen(In+1);
	for(int i=1;i<=N;) {
		if(In[i] == 'A') p.pb(0), ++i;
		else if(In[i] == 'B' && In[i+1] == 'C') p.pb(1), i += 2;
		else p.pb(2), ++i;
	}
	ll ans = 0, now = 0;
	for(int e : p) {
		if(e == 0) ++now;
		else if(e == 1) ans += now;
		else now = 0;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1528
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;

constexpr int MAX_N = 1e5+100;
int dp[MAX_N];

int main(){
    int N;
    cin >> N;
    REP(i,MAX_N){
        dp[i] = i;
    }
    REP(i,N+1){
        for(int pow=1;i+pow<=N;pow*=6) dp[i+pow] = min(dp[i+pow],dp[i]+1);
        for(int pow=1;i+pow<=N;pow*=9) dp[i+pow] = min(dp[i+pow],dp[i]+1);
    }
    cout << dp[N];
}



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

int n;
int A[200000];

inline void swap(int *a, int *b){
  int z;
  z = *a;
  *a = *b;
  *b = z;
}

int kth(int *A, int n, int k){
  int ll, rr;
  ll = 0;
  rr = n;
  while(1){
    int i, l, r, pivot;
    swap(A+ll, A+(ll+rr)/2);
    pivot = A[ll];
    l = ll;
    r = rr;
    i = ll+1;
    while(i < r){
      if(A[i] < pivot) swap(A+l++, A+i++);
      else if(A[i] > pivot) swap(A+--r, A+i);
      else i++;
    } 
    if(k < l) rr = l;
    else if(k >= r) ll = r;
    else return pivot;
  }
}

int main(){
  int i, m;
  long long int r;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", A+i);
    A[i] -= i+1;
  }
  m = kth(A, n, n/2);
  r = 0;
  for(i=0;i<n;i++) r += abs(A[i] - m);
  printf("%lld\n", r);
  return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
bool check();
vector<int> fl,tl;
int main(){
string str;
cin>>str;
fl.resize(str.size()+1);
fl[0]=0;
for(int i=1;i<=fl.size()-1;++i){
fl[i]=fl[i-1]+(str[i-1]=='A'?2:1);
}
cin>>str;
tl.resize(str.size()+1);
tl[0]=0;
for(int i=1;i<=tl.size()-1;++i){
tl[i]=tl[i-1]+(str[i-1]=='A'?2:1);
}
int time;
cin>>time;
for(int i=0;i<time;++i){
cout<<(check()?"YES":"NO")<<endl;
}
return 0;
}

bool check(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int num=abs(fl[b]-fl[a-1]-tl[d]+tl[c-1]);
return num%3==0;
}

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

public class Main {
	public static void main(String[] Args)throws IOException{
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));

		for(int i = 1; i <= 10000; i++){
			int inputValue = Integer.parseInt(br.readLine());

			if(inputValue != 0){
				System.out.println("Case " + i + ": " + inputValue);
			}else{
				break;
			}
		}
	}

}

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

int main() {
  string n;
  cin >> n;
  string ok = "No";
  for (char x : n) {
    if (x == '7') {
      ok = "Yes";
      break;
    }
  }
  cout << ok << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N;
    cin >> N;
    bool yes = true;
    REP (i, N) {
        int A;
        cin >> A;
        if (A % 2 == 0) {
            if (A % 3 == 0 || A % 5 == 0) continue;
            else yes = false;
        }
    }
    cout << (yes ? "APPROVED" : "DENIED") << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }


void main() {
    int n, m, x; readf("%d %d %d\n", &n, &m, &x);
    int[] a = readints();

    int l, r;
    foreach (i; a) {
        (i < x ? l : r) += 1;
    }

    writeln(min(l, r));

    auto _ = readln(); // dbg
}

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

string s;
int n, g, p, ans;

int main() {
  cin >> s;
  n = s.size();

  for (int i = 0; i < n; ++i) {
    if (g == p) {
      if (s[i] == 'g') {
	// nothing
      }
      else ans--;
      g++;
    }
    else {
      if (s[i] == 'g') {
	ans++;
	p++;
      }
      else {
	p++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
    int r;
    cin >> r;
    if(r<1200){
        cout << "ABC" << endl;
    }else if(r<2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
}


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

int main() {
    int sx, sy, tx, ty;
    scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
    cout << string(ty-sy,'U') << string(tx-sx,'R') << string(ty-sy,'D') << string(tx-sx,'L');
    cout << "L" << string(ty-sy+1,'U') << string(tx-sx+1,'R') << "DR" << string(ty-sy+1,'D') << string(tx-sx+1,'L') << "U" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

LL change_div_mul_mod(LL divisor, LL mod_minus_2, LL mod){
    if(mod_minus_2 == 0) return 1;
    else if(mod_minus_2 % 2 == 0){
        LL d = change_div_mul_mod(divisor, mod_minus_2/2, mod);
        return (d * d) % mod;
    }else{
        return (divisor * change_div_mul_mod(divisor, mod_minus_2-1, mod)) % mod;
    }
}

//#define int long long

/*************** using variables ***************/
string s;
/**********************************************/

signed main(){
    cin >> s;
    REP(i, s.size()){
        if(i % 2 == 0) cout << s[i];
    }
    cout << endl;
}


Measured memory_bytes: 512
#include <stdio.h>


// キューの構造体
typedef struct {
    char name[11];
    int time;
} Queue;


int main()
{
    //入力
    int n, q;
    scanf("%d%d", &n, &q);

    int size = 2 * n; //キューのサイズ
    Queue Queue[size];
    int pre = 0, rear = 0, cnt = 0; //pre:enqueue, rear:inqueue, cnt:経過時間
    for( rear = 0; rear < n; ++rear )
        scanf("%s %d", Queue[rear].name, &Queue[rear].time);


    //処理と出力
    while( pre != rear ){
        if( Queue[pre].time <= q ){ // if( Queue[pre].time == q ){ inqueueしない }
            cnt += Queue[pre].time;
            printf("%s %d\n", Queue[pre].name, cnt);
        } else {
            cnt += q;
            Queue[pre].time -= q;
            Queue[rear] = Queue[pre]; //inqueue
            rear = (rear + 1) % size; //次のinqueue先
        }

        //次のdequeue先
        pre = (pre + 1) % size;
    }


    return 0;
}


Measured memory_bytes: 4136
#include<cstdio>
#include<algorithm>
const int N=1e5+2;
int i,n,m,a[N];
long long ans=1e12,k[N],b[N];
void wk(int s,int t)
{
	if(s<t)b[1]+=t-s,b[s+1]+=s+1,b[t+1]-=s+1,--k[s+1],++k[t+1];else
	b[1]+=t+1,b[t+1]+=m-s-1,b[s+1]+=s+1,--k[1],++k[t+1],--k[s+1];
}
int main()
{
	for(scanf("%d%d",&n,&m);i++<n;scanf("%d",a+i));
	for(i=0;++i<n;wk(a[i],a[i+1]));
	for(i=0;i++<m;)
	{
		k[i]+=k[i-1],b[i]+=b[i-1];
		ans=std::min(ans,k[i]*i+b[i]);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 2048
n=gets.to_i
base=100000

n.times{
        base*=1.05
        base=base.to_i
        c=base.to_s
        while true
                if c.length<=3
                        base=(base-c.to_i+1000) if c.to_i != 0
                        break
                end
                c.slice!(0)

        end
}
puts base

Measured memory_bytes: 8592
import fractions

n = int(input())
a = list(map(int, input().split()))
ans = 0

l_gcd = [0]
for i in range(n):
    l_gcd.append(fractions.gcd(l_gcd[-1], a[i]))
# print(l_gcd)

r_gcd = [0]
for i in range(n):
    r_gcd.append(fractions.gcd(r_gcd[-1], a[-(i+1)]))
r_gcd.reverse()
# print(r_gcd)

for i in range(n):
    ans = max(ans, fractions.gcd(l_gcd[i], r_gcd[i+1]))
print(ans)

Measured memory_bytes: 16120
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

//func readLine(reader *bufio.Reader) string {
//	str, _, err := reader.ReadLine()
//	if err == io.EOF {
//		return ""
//	}
//	return string(str)
//}
func readLine() []string {
	reader := bufio.NewReaderSize(os.Stdin, 1)
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return []string{}
	}
	return strings.Split(string(str), " ")
}

func round(f float64) float64 {
	return math.Floor(f + .5)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	defer out.Flush()
	sc.Split(bufio.ScanWords)
	a := nextInt()
	b := nextInt()
	_ = nextInt()
	k := nextInt()

	sum := 0
	if k > a {
		sum = a * 1
		k = k - a
		if k > b {
			k = k - b
			if k > 0 {
				sum -= k
			}
		}
	} else {
		sum = k
	}
	fmt.Fprintln(out, sum)
}


Measured memory_bytes: 1760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;cin>>S;
  string A="CODEFESTIVAL2016";
  int cnt=0;
  for(int i=0;i<16;i++){
    if(A[i]!=S[i])cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<ll> Pr;

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

Pr divisor(ll n) {
    Pr ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push(i);
            if(i * i != n) ret.push(n / i);
        }
    }
//sort(begin(ret), end(ret));
    return (ret);
}

bool is_prime(ll n){
    for(ll i = 2; i * i <= n; i ++){
        if(n % i == 0) return false;
    }
    return n != 1;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B;
    cin >> A >> B;
    ll smaller = min(A, B);
    ll larger = max(A, B);
    Pr K = divisor(smaller);
    Pr G;
    while(!K.empty()){
        if(larger % K.top() == 0)G.push(K.top());
        K.pop();
    }
    ll ans = 0;
    while(!G.empty()){
        if(is_prime(G.top())) ans ++;
        G.pop();
    }
    cout << ans + 1 << endl;
}


Measured memory_bytes: 384