akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

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

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

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

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

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

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	h := readInt()
	_ = readInt()
	for i := 0; i < h; i++ {
		s := readString()
		println(s)
		println(s)
	}

}


Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
#define set(x) cout<<fixed<<setprecision(x);
using namespace std;
//**********************************************DO IT NO****************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1,x1=1;
    //cin>>t;
    while(t--)
    {  
      int n,p,i,z=1;
      cin>>n>>p;
      for( i=2;i*i<=p;i++){
        int l=0;
        if(n==1){
            cout<<p<<endl;
            return 0;
        }
        while(p%i==0)l++,p/=i;
        for(int j=1;j*n<=l;j++)
        z*=i;
    }
    cout<<z<<endl;
    }
}
// 🍪 🍪 🍪


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    char s[12],t[12];
    int A,B;
    char u[12];
    scanf("%s%s%d%d%s",s,t,&A,&B,u);
    if(!strcmp(s,u))
    {
        A--;
    }
    else
    {
        B--;
    }
    printf("%d %d",A,B);
    return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define Rep(i,s,f) for(int i=(int)s;i<(int)f;i++)
#define INF 1e5
using ll=long long;
using namespace std;


int div_two(ll x)
{
	int ret=0;
	while(x>0&&x%2==0)
	{
		x/=2;
		ret++;
	}
	return ret;
}
int main()
{
	int N;
	cin>>N;
	int ans=INF;
	rep(i,N)
	{
		ll a;
		cin>>a;
		ans=min(ans,div_two(a));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3608
import numpy as np
n, max_w = map(int, input().split())

dp = [0]*(max_w+1)
dp = np.array(dp)

for _ in range(n):
    w, v = map(int, input().split())
    np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])

print(max(dp))



Measured memory_bytes: 14020
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0, 0,-1,1,-1, 1,-1};
int dy[]={0,1,-1, 0,1,-1,-1, 1};


int main(){
    int n;cin >> n;
    string s;cin >> s;
    int ans = 0;
    for (int i = 2; i < n; i++) {
        if(s[i] == 'C' && s[i-1] == 'B' && s[i-2] == 'A') ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>

#define REP(i,n) for(i=0; i < (n); i++)
#define REPONE(i, n) for(i=1; i <= (n); i++)
#define LOOP(n) for(int loopCount=1; loopCount <= (n); loopCount++)
#define ITER(c) __typeof((c).begin())
#define EACH(c,it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define SZ(c) ((int) (c).size())
#define ALL(c) c.begin(), c.end()
#define SUM(c) accumulate(ALL(c), 0)
#define EXIST(c,v) (find(ALL(c), (v)) != (c).end())
#define PB push_back
#define MP make_pair

using namespace std;
static const double EPS = 1e-9;
static const double PI = 3.141592653589793238462643383279;
typedef long long ll;

int main(){
    vector<int> hs;
    int x;
    LOOP(10){
        scanf("%d", &x);
        hs.PB(x);
    }
    sort(ALL(hs), greater<int>());
    printf("%d\n", hs[0]);
    printf("%d\n", hs[1]);
    printf("%d\n", hs[2]);
    return 0;
}

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

int a,b,c,ans; 

inline int read(){
  	int X=0,w=0; 
	char ch=0;
  	while (ch<'0' || ch>'9'){
		w|=ch=='-';
		ch=getchar();
	}
  	while (ch>='0' && ch<='9') 
	    X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
  	return w?-X:X;
}

int main(){
	a=read();b=read();c=read();
	ans=min(abs(b-a)+abs(c-b),abs(c-a)+abs(b-c));
	ans=min(ans,abs(b-a)+abs(c-a));
	ans=min(ans,abs(c-b)+abs(a-c));
	ans=min(ans,abs(a-c)+abs(b-a));
	ans=min(ans,abs(b-c)+abs(a-b));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,count=0;
    cin>>n;
    for (int i=1;i<=n;i++) {
        string s=to_string(i);
        if (s.size()%2==1) {
            count++;
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()

H, W = map(int, input().split())

ch, cw = map(int, input().split())
ch -= 1
cw -= 1
dh, dw = map(int, input().split())
dh -= 1
dw -= 1

maze = []
for i in range(H):
    a = list(input())
    maze.append(a)

queue = deque([(ch, cw, 0)])

dist = [[float("inf") for _ in range(W)] for _ in range(H)]
dist[ch][cw] = 0

while queue:
    y, x, cnt= queue.popleft()

    for a, b in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        new_y, new_x = y+a, x+b
        if 0 <= new_y < H and 0 <= new_x < W and maze[new_y][new_x] != '#':
            if dist[new_y][new_x] == float("inf") or dist[new_y][new_x] > cnt:
                queue.appendleft((new_y, new_x, cnt))
                dist[new_y][new_x] = cnt

    for a in range(-2, 3):
        for b in range(-2, 3):
            new_y, new_x = y + a, x + b
            if 0 <= new_y < H and 0 <= new_x < W and maze[new_y][new_x] != '#':
                if dist[new_y][new_x] == float("inf") or dist[new_y][new_x] > cnt + 1:
                    queue.append((new_y, new_x, cnt+1))
                    dist[new_y][new_x] = cnt + 1

print(-1 if dist[dh][dw] == float("inf") else dist[dh][dw])

Measured memory_bytes: 183708
bottom = -1
s = input()
n = len(s)
res = [0] * n
cum = [1, 0]
for i in range(1, n):
    if s[i-1] == 'R' and s[i] == 'L':
        bottom = i-1
    elif s[i-1] == 'L' and s[i] == 'R':
        res[bottom] = cum[bottom % 2]
        res[bottom + 1] = cum[1 - (bottom % 2)]
        cum = [0, 0]
    cum[i % 2] += 1
res[bottom] = cum[bottom % 2]
res[bottom + 1] = cum[1 - (bottom % 2)]
print(*res)

Measured memory_bytes: 7668
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
using namespace std;
int main(){
 int h,w;
 cin>>h>>w;
 int masu[h][w];
 for(int i=0;i<h;i++){
 for(int j=0;j<w;j++){
 char c ;
 cin>>c;
 if(c=='#')masu[i][j]=1;
 else masu[i][j]=0;
 }
 }
 
 int flag=0;
 
 for(int i=0;i<h;i++){
 for(int j=0;j<w;j++){
 if(masu[i][j]==1){
 if(masu[i][j+1]==1||masu[i][j-1]==1){
 
 }else if(masu[i-1][j]==1||masu[i+1][j]==1){
 
 }else{
 //cout<<masu[i-1][j]<<masu[i+1][j]<<endl;
 //cout<<i<<j<<endl;
 flag=1;break;}
 
 }
 }
 if(flag==1){break;
 
 }
 }
 cout<<(flag==1?"No":"Yes")<<endl;
 
 
 return 0;
 }
/*int main(){
    int h,w;
    cin>>h>>w;
    int masu[h+2][w+2];
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            char c ;
            cin>>c;
            if(c=='#')masu[i][j]=1;
            else masu[i][j]=0;
        }
    }
    
    int flag=0;
    
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            if(masu[i][j]==1){
                if(masu[i][j+1]==1||masu[i][j-1]==1){
                    
                }else if(masu[i-1][j]==1||masu[i+1][j]==1){
                   
                }else{
                    //cout<<masu[i-1][j]<<masu[i+1][j]<<endl;
                    //cout<<i<<j<<endl;
                    flag=1;break;}
              
            }
        }
        if(flag==1){break;
            
        }
    }
    cout<<(flag==1?"No":"Yes")<<endl;


return 0;
}*/


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n;
    while (cin >> n) {
        int res = 0;
        for (int i = 0; i < n; i++) {
            int m;
            cin >> m;
            res = res + m - 1;
        }
        cout << res << endl;
    }
    return 0;
}


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

int partition(int A[], int p, int r) {
  int x = A[r];
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      std::swap(A[i], A[j]);
    }
  }
  std::swap(A[i + 1], A[r]);
  return i + 1;
}

int main() {
  int n;
  scanf("%d", &n);

  int A[n];
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);

  int q = partition(A, 0, n - 1);
  for (int i = 0; i < n; i++) {
    if (i != 0) printf(" ");
    if (i == q) printf("[%d]", A[i]);
    else printf("%d", A[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 3064
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B, T] = string_to_int(inputs[0])
    return B * (T // A)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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

def find_parent(x):
    y=parent[x]
    if y<0:
        return x
    parent[x]=find_parent(y)
    return parent[x]

def connect(a,b):
    c=find_parent(a)
    d=find_parent(b)
    if c==d:
        return
    if parent[c]<parent[d]:
        parent[c]+=parent[d]
        parent[d]=c
    else:
        parent[d]+=parent[c]
        parent[c]=d
    return

N=int(input())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append([x,i])
    Y.append([y,i])
inf=float("inf")

X.sort()
Y.sort()
edge=[]
for i in range(1,N):
    edge.append([X[i][0]-X[i-1][0],X[i-1][1],X[i][1]])
    edge.append([Y[i][0]-Y[i-1][0],Y[i-1][1],Y[i][1]])
edge.sort()
parent=[-1]*N

ans=0
for l,a,b in edge:
    if find_parent(a)==find_parent(b):
        continue
    else:
        ans+=l
        connect(a,b)

print(ans)

Measured memory_bytes: 122204
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (s.length() <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0,k) + "..." << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
if 1 not in A:
    print(-1)
    exit()

target = 1
idx = 0
ans = 0
while idx < len(A):
    if A[idx] == target:
        target += 1
        ans += 1
    idx += 1
print(N - ans)

Measured memory_bytes: 77516
# C - Attack Survival
import math
from operator import add


def main():
    n, k, q = map(int, input().split())
    p = [k]*n
    a_l = [0]*n

    for _ in range(q):
        a = int(input())
        a_l[a-1] = a_l[a-1] + 1
    
    com = map(add, p, a_l)
    ans = ['Yes' if i > q else 'No' for i in com ]
    print(*ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 12276
n=int(input())
s=list(input())
v=[0]
for i in range(1,n):
    if s[i]==s[i-1]:
        del(v[-1])
        v.append(1)
        
    else:
        v.append(0)


if v[0]==0:
    ans=3
else:
    ans=6
for i in range(1,len(v)):
    if v[i-1]==0:
        ans*=2
    elif v[i]==1:
        ans*=3
    else:
        continue
    

mod = 1000000007

print(ans%mod)
        

        
    


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int V; cin >> V;
  if(V&1){
    int N = ((((V - 1) - 2) * (V - 1)) / 2) + (V - 1);
    cout << N << endl;
    for(int i = V; i >= 1; --i){
      for(int j = i - 1; j >= 1; --j){
	if(i + j == V)continue;
	cout << i << ' ' << j << endl;
      }
    }
  }
  else{
    int N = ((V - 2) * V) / 2;
    cout << N << endl;
    for(int i = 1; i <= V; ++i){
      for(int j = i + 1; j <= V; ++j){
	if(j == V - i + 1)continue;
	cout << i << ' ' << j << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        StringBuilder ans = new StringBuilder();
        while (N > 0) {
            N--;
            ans.append((char)('a'+N%26));
            N /= 26;
        }
        System.out.println(ans.reverse());
    }
}



Measured memory_bytes: 35480
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 逆元事前処理ver
# nが小さい場合に
lim = 10 ** 6 + 1
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
mod = 998244353

for i in range(2, lim + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    # 累計
    factinv.append((factinv[-1] * inv[-1]) % mod)

def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod

N, M, K = getNM()

# 隣会うブロックの組みがk個の塗り方の通りの数
# 2つ目以降の塗り方について
# 前の色と違う色を塗る M - 1通り
# 前の色と同じ色を塗る 1通り

# dp[i][j]: iまで塗り進めた時、同じ色の組みがj組のもの
# 今回の問題は対称性があるので、dp使わなくてもいける

# N = 3の時、隣り合うブロックの組であって同じ色で塗られている組が1組以下である通りは
# M * (M - 1) * 1 +
# M * 1 * (M - 1)

ans = 0
for k in range(K + 1):
    opt = M * cmb(N - 1, N - k - 1) * pow(M - 1, N - k - 1, mod)
    ans += opt
print(ans % mod)

Measured memory_bytes: 220888
/*  ***  In The Name of God ... ***  */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll n , q , h , s , d;

int main ()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> q >> h >> s >> d >> n;
	ll a[4];
	a[0] = 8 * q;
	a[1] = 4 * h;
	a[2] = 2 * s;
	a[3] = d;
	ll b[4];
	for(ll i = 0 ; i < 4 ; i++)
		b[i] = a[i] ;
	sort(a , a + 4);
	ll res = 0;
	res += (n / 2) * a[0];
	if(n % 2 == 1)
	{
		res += min({b[0] / 2 , b[1] / 2 , b[2] / 2});
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
input = sys.stdin.readline


def main():
    k = int(input())
    result = 0

    memory = [[0 for j in range(k)] for i in range(k)]
    for i in range(1, k + 1):
        for j in range(i, k + 1):
            gcd = math.gcd(i, j)
            memory[i-1][j-1] = gcd
            memory[j-1][i-1] = gcd

    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                result += memory[a-1][memory[b-1][c-1]-1]

    print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9496
use std::cmp::max;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    loop {
        let a:i64 = read();
        let op:String = read();
        let b:i64 = read();
        if op == "?" {
            break;
        } else if op == "+" {
            println!("{}", a+b);
        } else if op == "-" {
            println!("{}", a-b);
        } else if op == "*" {
            println!("{}", a*b);
        } else if op == "/"{
            println!("{}", a/b);
        }
    }
}


Measured memory_bytes: 5032
#include<stdio.h>

int main(void)
{
  int i = -1, j, k, H[300], W[300], cnt = 0;

  do {
    i++;
    scanf("%d %d", &H[i], &W[i]);
    cnt++;
  } while(H[i] != 0 && W[i] != 0);

  for(k = 0; k < cnt - 1; k++) {
    for(i = 0; i < H[k]; i++) {
      for(j = 0; j < W[k]; j++) {
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    bool f = true;
    rep(i, n) {
        if (a[i] % 2 == 1) continue;
        if ((a[i] % 3 != 0) && (a[i] % 5 != 0)) {
            f = false;
            break;
        }
    }
    if (f) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			String s = sc.next();

			if (3200 <= a) {
				System.out.println(s);
			} else {
				System.out.println("red");
			}
		}
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	if (N/100 == N%10){
		cout << "Yes\n";
	}
	else
		cout << "No\n";
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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

static void dump(std::vector<int> const& vec) {
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        if (it != vec.begin()) {
            std::cout << ' ';
        }
        std::cout << *it;
    }
    std::cout << '\n';
}

int main() {
    int n;
    std::cin >> n;
    std::vector<int> vec(n);

    std::copy_n(std::istream_iterator<int>{std::cin}, vec.size(), vec.begin());
    dump(vec);

    for (std::size_t i = 1; i < vec.size(); ++i) {
        auto v = vec[i];

        auto j = i;
        for (; j-- != 0 && vec[j] > v;) {
            vec[j + 1] = vec[j];
        }
        vec[j + 1] = v;

        dump(vec);
    }
}

// vim:sw=4:



Measured memory_bytes: 3072
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
inline void addV(int &x, int v) { x+=v;if(x>=MOD)x-=MOD;}
struct BIT {
  int n;
  vector<int> xs;
  BIT (int n) : n(n) {
    xs.resize(n+1);
  }
  void add(int i, int v) {
    for (int x=i+1; x<=n; x+=x&-x) addV(xs[x],v);
  }
  int sum(int i) {
    int s = 0;
    for (int x=i+1; x>0; x-=x&-x) addV(s,xs[x]);
    return s;
  }
};


int N, M;
int X[100000];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  rep(i, N) cin >> X[i];
  vector<int> ys;
  rep(i, M) {
    int x; cin >> x;
    ys.pb(x);
  }
  vector<P> ps;
  rep(i, N) {
    auto it = lower_bound(all(ys), X[i]);
    if (it == ys.begin() || it == ys.end()) continue;
    int right = *it-X[i];
    int left = X[i]-*(--it);
    //cout<<left<<"<->"<<right<<"\n";
    ps.pb(P(left, -right));
  }
  if (ps.empty()) {
    cout << 1 << "\n";
    return 0;
  }
  sort(all(ps)); uniq(ps);
  vector<int> seq;
  for (auto p : ps) seq.pb(-p._2);
  vector<int> values;
  for (int x : seq) values.pb(x);
  sort(all(values)); uniq(values);
  for (int &x : seq) x = index(values, x);
  //for (int x : seq)cout<<x<<",";cout<<"\n";
  BIT dp(values.size()+1);
  dp.add(0, 1);
  for (int x : seq) dp.add(x+1, dp.sum(x));
  cout << dp.sum(values.size()) << "\n";
  return 0;
}


Measured memory_bytes: 3188
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int b, f, r, v;;
    int house[5][4][11];
    int i, n;
 
    for (b = 1; b <= 4; b++) {
        for (f = 1; f <= 3; f++) {
            for (r = 1; r <= 10; r++) house[b][f][r] = 0;
        }
    }
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d%d%d%d", &b, &f, &r, &v);
        house[b][f][r] += v;
    }
 
    for (b = 1; b <= 4; b++) {
        for (f = 1; f <= 3; f++) {
            for (r = 1; r <= 10; r++) printf(" %d", house[b][f][r]);
            putchar('\n');
        }
        if (b < 4) puts("####################");
    }
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int N; cin >> N;
    vector<int> L(N);
    rep(i,N) cin >> L[i];
    sort(L.begin(),L.end());
    ll ans = 0;
    for(int i = N-1; i >= 2; i--){
        for(int j = i-1; j >= 1; j--){
            int d = upper_bound(L.begin(),L.end(),L[i]-L[j])-L.begin();
            if(d < j){
                ans += j-d;
                continue;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define  all(v)     (v).begin(),(v).end()
#define  rall(v)    (v).rbegin(),(v).rend()
#define  pb         push_back
#define  eb         emplace_back
#define  mp         make_pair
#define  ff         first
#define  ss         second
#define  pf         push_front
#define  bs         binary_search
#define  lb         lower_bound
#define  ub         upper_bound
#define  dec(x)   fixed<<setprecision(x)
#define  lcm(a,b)   (a*b/__gcd(a,b))
const ll inf=LLONG_MAX;
const ll mod=1e9+7;
const ld pi=acos(-1);
                    
void solution(){
    ll n;
    cin>>n;
    ll ans=n+n*n+n*n*n;
    cout<<ans;
    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solution();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n;
    cin>>n;
    string before="ABCDYEAFAFAFAFAEFA";
    set<string> tyohuku;
    string ans="Yes";
    
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        int pre=tyohuku.size();
        tyohuku.insert(s);
        if(tyohuku.size()==pre){
            ans="No";
            break;
        }
        
        if(i!=0){
            if(before.at(before.size()-1)!=s.at(0)){
                ans="No";
                break;
            }
        }
        
        before=s;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

int main() {
    int n, C, k; cin >> n >> C >> k;
    vector<int> t(n);
    rep(i, n) {
        cin >> t[i];
    }
    sort(t.begin(), t.end());
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int start = i;
        ans++;
        while (i-start < C&& t[i] <= t[start]+k && i < n) {
            i++;
        }
        i--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3676
#coding:utf-8

while True:
	buff = [int(x) for x in input().split()]
	n = buff[0]
	m = buff[1]
	if n==m==0:
		break
	ans=0
	for i in range(1,n-1):
		for j in range(i+1, n):
			for k in range(j+1, n+1):
				if (i+j+k)==m:
					ans+=1
	print(ans)

Measured memory_bytes: 7736
#include <cstdio>

const int M = 50 * 50 + 1;

long long ways[M + M];

int main()
{
    int n, a;
    scanf("%d%d", &n, &a);
    ways[M] = 1;
    for (int i = 0, x; i < n; ++ i) {
        scanf("%d", &x);
        x -= a;
        if (x >= 0) {
            for (int j = M + M - 1; j >= x; -- j) {
                ways[j] += ways[j - x];
            }
        } else {
            for (int j = 0; j - x < M + M; ++ j) {
                ways[j] +=ways[j - x];
            }
        }
    }
    printf("%lld\n", ways[M] - 1);
}


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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#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 REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
	int n, q;
	cin >> n >> q;

	VI xs(n);
	xs[0] = 2;
	xs[1] = 1;

	int pos = 0;

	rep(i, q) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		swap(xs[a], xs[b]);

		if (xs[a] == 2) pos = a;
		if (xs[b] == 2) pos = b;

		for (int t : {pos - 1, pos + 1}) {
			if (RANGE(t, 0, n - 1)) {
				MAXUD(xs[t], 1);
			}
		}
	}

	int ans = 0;
	rep(i, n) ans += xs[i] > 0;

	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 768
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int N;
  int a[100000];
  cin >> N;
  for(int i = 0; i < N; i++)
    cin >> a[i];
  
  int count_4 = 0;
  int count_odd = 0;
  int count_even = 0;

  for(int i = 0; i < N; i++) {
    if(a[i] % 4 == 0) {
      count_4++;
      continue;
    }
    if(a[i] % 2 == 1) count_odd++;
    else count_even++;
  }


  if(count_even == 0) {
     if(count_4 >= count_odd - 1) {
      cout << "Yes" << endl;
      return 0;
    }
    cout << "No" << endl;   
    return 0;
  }
  if(N - count_even % 2 == 0) {
    if(count_4 >= count_odd) {
      cout << "Yes" << endl;
      return 0;
    }
    cout << "No" << endl;
    return 0;
  } else {
   if(count_4 >= count_odd) {
      cout << "Yes" << endl;
      return 0;
    }
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize
    }
    println!("{}", if n == 7 || n == 5 || n == 3 { "YES" } else { "NO" });
}


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

#define N 500000
#define INFTY (1000000001)

typedef struct {
    char c[3];
    int n;
} Card;

void swap(Card *, Card *);
int partition(Card *, int, int);
void quickSort(Card *, int, int);

void merge(Card *, int, int, int);
void mergeSort(Card *, int, int);
Card *makeArray(int);
void copyArray(Card *, Card *, int, int);

int main() {
  Card card[N];
  Card m[N];
  int n, i, flg;

  scanf("%d", &n);

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

  for (i = 0; i < n; i++) {
    m[i] = card[i];
  }

  quickSort(card, 0, n-1);
  mergeSort(m, 0, n);

  flg = 0;
  for (i = 0; i < n; i++) {
    if (m[i].c[0] != card[i].c[0]) {
        flg = 1;
    }
  }
  if (flg == 0) {
      printf("Stable\n");
  }
  else {
      printf("Not stable\n");
  }

  for (i = 0; i < n; i++) {
    printf("%s %d\n", card[i].c, card[i].n);
  }

  return 0;
}

void swap(Card *a, Card *b) {
  Card temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

int partition(Card *A, int p, int r) {
  int x = A[r].n;
  int i = p - 1;
  int j;

  for (j = p; j < r; j++) {
    if (A[j].n <= x) {
      i++;
      swap(&A[i], &A[j]);
    }
  }
  swap(&A[i + 1], &A[r]);

  return i + 1;
}

void quickSort(Card *A, int p, int r) {
  int q;
  if (p < r) {
    q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r);
  }
}

void mergeSort(Card *A, int left, int right) {
  int mid;

  if (left + 1 < right) {
    mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }

}

void merge(Card *A, int left, int mid, int right) {
  int i, j, k;

  int nl = mid - left;
  int nr = right - mid;

  Card *L = makeArray(nl + 1);
  Card *R = makeArray(nr + 1);

  copyArray(L, A, nl, left);
  copyArray(R, A, nr, mid);
  L[nl].n = R[nr].n = INFTY;

  j = i = 0;
  for (k = left; k < right; k++) {
    if (L[i].n <= R[j].n) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }

  free(L);
  free(R);
}

Card *makeArray(int size) {
  return (Card *)malloc(size * sizeof(Card));
}

void copyArray(Card *A, Card *B, int n, int m) {
  int i;
  for (i = 0; i < n; i++) {
    A[i] = B[m + i];
  }
}



Measured memory_bytes: 3760
#include<cstdio>
char str[100001];
int main() {
	int n, i, j, a[4] = { 0,1,2,3 }; //2bit, S<=>0, W<=>1
	scanf("%d%s", &n, str);
	for (i = 0; i < n; i++) {
		if (str[i] == 'o') {
			for (j = 0; j < 4; j++) {
				if (a[j] == 1)a[j] = 3;
				else if (a[j] == 2)a[j] = 1;
				else if (a[j] == 3)a[j] = 2;
			}
		}
		else {
			for (j = 0; j < 4; j++) {
				if (a[j] == 0)a[j] = 1;
				else if (a[j] == 1)a[j] = 2;
				else if (a[j] == 2)a[j] = 0;
			}
		}
	}
	for (j = 0; j < 4; j++) {
		if (a[j] == j) {
			if (a[j] & 1) {
				printf("W");
			}
			else {
				printf("S");
			}
			for (i = 0; i < n-1; i++) {
				if (str[i] == 'o') {
					if (a[j] == 1)a[j] = 3;
					else if (a[j] == 2)a[j] = 1;
					else if (a[j] == 3)a[j] = 2;
				}
				else {
					if (a[j] == 0)a[j] = 1;
					else if (a[j] == 1)a[j] = 2;
					else if (a[j] == 2)a[j] = 0;
				}
				if (a[j] & 1) {
					printf("W");
				}
				else {
					printf("S");
				}
			}
			return 0;
		}
	}
	printf("-1");
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer x;
  for(x = nil->next;x!=nil;x=x->next){
  if(x->key==key)return x;
  }
  return NULL;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){


  t->next->prev=t->prev;
  t->prev->next=t->next;

  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if (t==nil)return;
  deleteNode(t);
}

void delete(int key){
  NodePointer t=listSearch(key);
  if(t==NULL)return;
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;


}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
 }
  

 



Measured memory_bytes: 33040
#include <bits/stdc++.h>
using namespace std;
  
int main () {
    int K,A,B;
    cin >> K >> A >> B;
    for(int i = A ; i <= B; i++) {
        if(i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
 
int main () {
int N ;
cin >> N ;
string S, T;
cin >> S >> T;
string newstring ;
rep (i, N) {
  newstring.push_back(S[i]);
  newstring.push_back(T[i]);}
cout << newstring << endl;
return 0;
}

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

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

using namespace std;

int dp[4000][3];

int toInt(int c) {
  string s = "RGB";
  REP(i, 3) if (s[i] == c) return i;
  return -1;
}

int rem(char a, char b) {
  string s = "RGB";
  REP(i, 3) if (s[i] != a && s[i] != b) return i;
}

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

  for (int i = N - 1; i >= 0; --i) {
    int c = toInt(S[i]);
    REP(j, 3) {
      dp[i][j] = (i == N - 1 ? 0 : dp[i + 1][j]) + (c == j ? 1 : 0);
    }
  }
  long long ans = 0;
  REP(i, N) {
    for (int j = i + 1; j + 1 < N; ++j) {
      if (S[i] == S[j]) {
        continue;
      }
      int c = rem(S[i], S[j]);
      int cnt = dp[j + 1][c];
      int k = j + (j - i);
      if (k < N && toInt(S[k]) == c) {
        --cnt;
      }
      ans += cnt;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define ff first
#define ss second
#define MAXI 1000001

ll MAX = 1e10;


void solve(){
    ll n;
    cin >> n;
    string s = "ACL";
    rep(i,0,n) cout << s;
    cout << br;
}
	
 
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
 
	ll t = 1;
	// cin >> t;
	rep(i,0,t){
		solve();
	}
 
}	

Measured memory_bytes: 3648
/** I can do this all day **/

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"

//void add(int I, int value){seg[I += MAXN] = value;for (I >>= 1; I; I >>= 1){seg[I] = __gcd(seg[I << 1], seg[I << 1 | 1]);}}

//int query(int l, int r){int ans = seg[l + MAXN];for (l += MAXN, r += MAXN + 1; l < r; l >>= 1, r >>= 1){if(l & 1) ans = __gcd(ans, seg[l ++]);if(r & 1) ans = __gcd(ans, seg[-- r]);}return ans;}

const int MAXN = 1e6 + 10;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 8e18;
const int LOG = 22;

ll pw(ll a , ll b, ll mod)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % mod, b / 2, mod)) % mod : pw(a * a % mod, b / 2, mod))); }

int main(){
    fast_io;
    //cout << fixed << setprecision(15);
    //scanf("%d %d %f %lld %s %c", &x);
    //printf("%d %d %f %lld %s %c", x);
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)998244353
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll N=200005, inf=1e18;
void solve(){
	ll dp[4000];
	dp[0]=100;
	ll n;
	cin>>n;
	rep(i,1,3761){
		ll interest = ((ld)(0.01) * (ld)(dp[i-1]));
		dp[i]=(dp[i-1]+interest);
		if(dp[i]>=n){
			cout<<i;
			return;
		}
	}
}	
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;

string a = "CODEFESTIVAL2016";

int main(int argc, char *argv[]) {
    string s; cin >> s;
    if (s == a) {cout << 0 << endl; return 0;}
    int ret = 0;
    rep(i, s.size()) {
        if (s[i] != a[i]) ret++;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    bool ans=false;
    int cnt=0;
    for(int i=0;i<n;i++){
        int x,y;
        cin >> x >> y;    
        if(x==y)cnt++;
        else cnt=0;
        if(cnt==3) ans=true;
    }
    if(ans) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define int long long int

signed main(){
    int h;
    cin >> h;
    int r = log2(h);
    int result = pow(2,r+1) - 1;
    cout << result << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,a,b,c,m=0;
    cin>>a>>b;
    if(b==100)b=101;
    if(a==0)c=1;
    if(a==1)c=100;
    if(a==2)c=10000;
    cout<<b*c<<endl;
    return 0;
}


Measured memory_bytes: 256
N,K = (int(i) for i in input().split())
S = list(input())

cnt = 0
x = 1
tmp = S[0]
while cnt < K and x <= N-1:
    if S[x] != tmp:
        S[x] = tmp
        x += 1
        if x > N-1:
            break
        while S[x] != tmp and x <= N-1:
            S[x] = tmp
            x += 1
            if x > N-1:
                break
        cnt += 1
        if x > N-1:
            break

    else:
        x += 1


ans = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        ans += 1

print(ans)


Measured memory_bytes: 4084
#include <cstdio>
#include <algorithm>
using namespace std;



int main()
{
	int x;
	scanf("%d",&x);
	long long ans =0 ;
	ans += 1ll * x / 500 * 1000;
	x %= 500;
	ans += x / 5 * 5;
	printf("%lld\n",ans);
}

Measured memory_bytes: 128