akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

i64 A, B, C;

i64 solve(i64 a, i64 b, i64 c)
{
	if (c % 2 == 0) return 0;
	return a * b;
}

int main()
{
	scanf("%lld%lld%lld", &A, &B, &C);
	i64 ans = 1LL << 62LL;
	ans = min(ans, solve(A, B, C));
	ans = min(ans, solve(B, C, A));
	ans = min(ans, solve(A, C, B));
	printf("%lld\n", ans);
	return 0;
}


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

int main()
{
	int N;
	cin >> N;
	
	vector<int> W(N);
	for(int i = 0; i < N; i++)
	{
		cin >> W[i];
	}
	
	vector<int> x(N + 1, 0);
	for(int i = 0; i < N + 1; i++)
	{
		x[i + 1] = x[i] + W[i];
	}
	
	vector<int> y(N - 1);
	for(int i = 1; i < N; i++)
	{
		y[i - 1] = abs(x[i] - abs(x[x.size() - 1] - x[i]));
	}
	
	cout << *min_element(y.begin(), y.end()) << endl;
	
	return 0;
}

Measured memory_bytes: 256
def show(nums):
    for i in range(len(nums)):
        if i!=len(nums)-1:
            print(nums[i],end=' ')
        else:
            print(nums[i])

def selection_sort(A, N):
    num = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            num += 1

    show(A)
    print(num)



if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split(' ')))
    selection_sort(A, N)



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


 int main(){
     int a,b;
     cin>>a>>b;
     std::string a_str=to_string(a);
     std::string b_str=to_string(b);
     
     std::string str_num=a_str+b_str;
     //cout<<typeid(str_num).name<<endl;
     int number=stoi(str_num);
     
     bool check=false;
     //cout<<typeid(number).name<<endl;
     for(int i;i<number;i++){
         if(i*i==number){
             cout<<"Yes"<<endl;
             check=true;
             break;
         }

             
         }
     if(! check){
         cout<<"No"<<endl;
     }
     }

Measured memory_bytes: 256
s = input()
n = len(s)
dp = [1] + [0]*2019
now = 0
i = 1

for c in reversed(s):
    now = (now+i*int(c))%2019
    dp[now] += 1
    i *= 10
    i %= 2019

ans = sum([i*(i-1)/2 for i in dp])
print(int(ans))


Measured memory_bytes: 9280
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;

int field[64][64];
char visit[1 << 24];
int w, h;
int tx, ty, kx, ky;

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

void trymove(int &y, int &x, int d){
	if(!field[y + dy[d]][x + dx[d]]){
		y += dy[d];
		x += dx[d];
	}
}

void solve(){
	memset(visit, 0, sizeof visit);
	memset(field, 1, sizeof field);

	for(int y = 1; y <= h; ++y){
		for(int x = 1; x <= w; ++x){
			scanf("%d", &field[y][x]);
		}
	}

	queue<int> q;
	int st = ty << 18 | tx << 12 | ky << 6 | kx;
	q.push(st);
	visit[st] = 1;
	q.push(-1);
	for(int ans = 0; ans < 100; ){
		st = q.front();
		q.pop();
		if(st == -1){
			q.push(-1);
			++ans;
		}
		else{
			int y1 = st >> 18, x1 = st >> 12 & 63;
			int y2 = st >> 6 & 63, x2 = st & 63;
			if(y1 == y2 && x1 == x2){
				printf("%d\n", ans);
				return;
			}

			for(int i = 0; i < 4; ++i){
				int ny1 = y1, nx1 = x1, ny2 = y2, nx2 = x2;
				trymove(ny1, nx1, i);
				trymove(ny2, nx2, (i + 2) & 3);
				st = ny1 << 18 | nx1 << 12 | ny2 << 6 | nx2;
				if(!visit[st]){
					visit[st] = 1;
					q.push(st);
				}
			}
		}
	}

	puts("NA");
}

int main(){
	while(scanf("%d%d%d%d%d%d", &w, &h, &tx, &ty, &kx, &ky) == 6){
		solve();
	}
}

Measured memory_bytes: 17548
def check(c):
	if(48<=ord(c)<=57):
		return True
	return False

S=input()

if( (not check(S[0])) or (not check(S[1])) or (not check(S[2])) or (not check(S[3]))):
	print("NA")
else:
	v1=int(S[:2])
	v2=int(S[2:])

	y1=(v1>=0)
	m1=(12>=v2>0)
	b1=(y1 and m1)

	m2=(12>=v1>0)
	y2=(v2>=0)
	b2=(y2 and m2)

	if(b1 and b2):
		print("AMBIGUOUS")
	elif(b1):
		print("YYMM")
	elif(b2):
		print("MMYY")
	else:
		print("NA")





Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    long N, A, B, ans = 0;
    cin >> N >> A >> B;

    if (A > 0)
    {
        if (N > A)
        {
            ans = N / (A + B) * A;
            ans += N % (A + B) > A ? A : N % (A + B);
            printf("%ld", ans);
        }
        else
        {
            printf("%ld", N);
        }
    }
    else
    {
        printf("0");
    }
    return 0;
}

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;
typedef unsigned long long ull;




int main() {
    int a,b;
    cin >> a>>b;
    int ans =  a*b;


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



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CCYES cout<<"Yay!"<<endl
#define CCNO cout<<":("<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  bool hu=false,sei=false;
  rep(i,n){
    cin >> a[i];
    if(a[i]<=0) hu=true;
    if(a[i]>=0) sei=true;
  }
  sort(all(a));
  if(hu){
    if(sei){
      int m=0;
      rep(i,n) m+=abs(a[i]);
      cout << m << endl;
      int sum = a[0];
      int aa = a[n-1];
      repp(i,1,n-1){
        if(a[i]>0){
          cout << sum SP a[i] << endl;
          sum-=a[i];
        }else{
          cout << aa SP a[i] << endl;
          aa-=a[i];
        }
      }
      cout << aa SP sum << endl;
    }else{
      int m=a[n-1];
      rep(i,n-1){
        m+=abs(a[i]);
      }
      cout << m << endl;
      int sum = a[n-1];
      rep(i,n-1){
        cout << sum SP a[i] << endl;
        sum-=a[i];
      }
    }
  }else{
    int m=-a[0];
    repp(i,1,n){
      m+=abs(a[i]);
    }
    cout << m << endl;
    int sum=a[0];
    repp(i,2,n){
      cout << sum SP a[i] << endl;
      sum-=a[i];
    }
    cout << a[1] SP sum << endl;
  }
  return 0;
}


Measured memory_bytes: 2304
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner sn = new Scanner(System.in);
		double max = Double.MIN_NORMAL, min = Double.MAX_VALUE;
		while(sn.hasNext()){
			double n = sn.nextDouble();
			max = Math.max(max, n);
			min = Math.min(min, n);
		}
		System.out.println(max-min);
	}
}

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

int main() {
  int N, ans = 1;
  cin >> N;
  string S;
  cin >> S;
  if (N > 1) {
    for (int i=0; i<N-1; i++) {
      if (S.at(i+1) != S.at(i)) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace
trace a b = b

data Tile = Horiz Int Int | Vert Int Int
  deriving (Eq, Show)

solve :: Int -> Int -> Int -> Int -> Maybe String
solve n m a b = answer
  where
  a0 | odd  n = a - aB
     | even n = a
  b0 | odd  m = b - bR
     | even m = b
  (a0D, a0M) = divMod a0 2
  (b0D, b0M) = divMod b0 2
  aB = min a m2d
  bR = min b n2d
  bottom | odd  n = [Horiz (n-1) (2*i) | i <- [0..aB-1]]
         | even n = []
  right  | odd  m = [Vert (2*j+p) (m-1) | j <- [0..bR-1]]
         | even m = []
    where p | odd n = 1
            | even n = 0
  (m2d, m2m) = divMod m 2
  (n2d, n2m) = divMod n 2
  addcell = odd n && odd m
  answer
    | a0 + b0 <= 2 * m2d * n2d - 1
      || ((a0 + b0 == 2 * m2d * n2d) && (even a0 || addcell))
    = Just str
    | otherwise = Nothing
  str = brd2str $ spec

  spec = trace ("spec " ++ show spec0) spec0
  spec0 = brd ++ rem a0M b0M ++ bottom ++ right

  brd = trace ("brd " ++ show brd0) brd0
  brd0 = concat $ zipWith f [(j,i) | j <- [n2d-1,n2d-2..0], i <- [0..m2d-1]]
                           (replicate a0D 'H' ++ replicate b0D 'V')
    where f (j,i) 'H' = [Horiz (2*j) (2*i), Horiz (2*j+1) (2*i)]
          f (j,i) 'V'  = [Vert  (2*j) (2*i), Vert  (2*j) (2*i+1)]
  rem 0 0 = []
  rem 1 0 = [Horiz 0 xTR]
  rem 0 1 = [Vert  0 xTR]
  rem 1 1 | addcell =   [Vert 0 xTR, Horiz 0 (xTR+1)]
          | otherwise = [Vert 0 xTR, Horiz 0 (xTR-2)]
  xTR = 2 * (m2d - 1)  

  brd2str spec = unlines $ unfoldr f $ VU.toList $ VU.create $ act spec
    where f "" = Nothing
          f s = Just (splitAt m s)

  enc j i = (j * m) + i

  act spec = do
    vec <- VUM.replicate (n*m) '.'
    mapM_ (f vec) spec
    return vec
    where
    f vec (Horiz j i) = do
      VUM.write vec (enc j i) '<'
      VUM.write vec (enc j (i+1)) '>'
    f vec (Vert j i) = do
      VUM.write vec (enc j i) '^'
      VUM.write vec (enc (j+1) i) 'v'

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Maybe String
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n,bs_m,bs_a,bs_b]:remLines1 = remLines0
      n = readBInt bs_n
      m = readBInt bs_m
      a = readBInt bs_a
      b = readBInt bs_b
  in solve n m a b

outAnswer :: Maybe String -> IO ()
outAnswer Nothing = putStrLn "NO"
outAnswer (Just s) = putStr ("YES\n" ++ s)

main :: IO ()
main = outAnswer . tmain =<< B.getContents


Measured memory_bytes: 10364
def f(n, count=0, i=0, s=""):
    global ans
    if count == n:
        ans.append(s)
        return
    if i == 0:
        f(n, count + 1, i=i+1, s=s+"a")
    else:
        for j in range(i + 1):
            f(n, count + 1, i=max(i, j + 1), s=s+chr(ord("a") + j))

import sys
sys.setrecursionlimit(10000)
n = int(input())
ans = []
f(n)
ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 12680
#include <string>
#include <iostream>
#include <map>
#include <cstdio>
 
using namespace std;
 
int main(){
    string s;
	map<char, int> m;
	m['I'] = 1;
	m['V'] = 5;
	m['X'] = 10;
	m['L'] = 50;
	m['C'] = 100;
	m['D'] = 500;
	m['M'] = 1000;
 
    while(cin >> s){
		int sum = 0;
		s += 'I';
		for(int i = 0; i < s.size()-1; i++){
			if(m[s[i+1]] > m[s[i]]) sum-=m[s[i]];
			else sum+=m[s[i]];
		}
		cout << sum << endl;
	}
 
 
    return 0;
}

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



int main(){
  int A,B,C;
  cin>>A>>B>>C;
  
  vector<int> vec(3);
  vec.at(0)=A;
  vec.at(1)=B;
  vec.at(2)=C;
  sort(vec.begin(),vec.end());
  
  int sum=0;
  while(vec.at(0)<=vec.at(2)-2){
    sum++;
    vec.at(0)+=2;
  }
  while(vec.at(1)<=vec.at(2)-2){
    sum++;
    vec.at(1)+=2;
  }
  if(vec.at(0)==vec.at(2)-1&&vec.at(1)==vec.at(2)) sum+=2;
  else if(vec.at(0)==vec.at(2)&&vec.at(1)==vec.at(2)-1) sum+=2;
  else if(vec.at(0)==vec.at(2)-1&&vec.at(1)==vec.at(2)-1) sum+=1;
  
  cout<<sum<<endl;
    
  
}

Measured memory_bytes: 3632
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        int[] p;
        {
            bool[] a = new bool[N+1];
            List<int> pp = new List<int>();
            int j = 2;
            for(int i=0;i<N+1;i++){
                a[i] = true;
            }
            while(j<=N){
                if(a[j]){
                    pp.Add(j);
                    for(int i=j;i*j<=N;i++){
                        a[i*j] = false;
                    }
                }
                j++;
            }
            p = pp.ToArray();
        }
        long count = 1;
        for(int i=0;i<p.Length;i++){
            int prime = p[i];
            long c = 0;
            int n = N;
            while(n > 0){
                c += n/prime;
                n /= prime;
            }
            count = count * (c+1) % Define.mod;
        }
        sb.Append(count+"\n");
    }
}
public static class Define{
    public const long mod = 1000000007;
}

Measured memory_bytes: 11092
(d, n) = [int(e) for e in input().split()]
if d == 0:
    ge = int(n / 100)
    print(n + ge)
elif d == 1:
    ge = int(n / 100)
    print((n + ge) * 100)
elif d == 2:
    ge = int(n / 100)
    print((ge + n) * 10000)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#define MH 100
#define MW 100
using namespace std;
char f[MH][MW];
bool u[MH][MW];

void move(int x, int y) {
	if (u[y][x] == true) cout << "LOOP" << endl;
	else {
		u[y][x] = true;
		if (f[y][x] == '.') cout << x << " " << y << endl;
		else {
			if (f[y][x] == '<') move(x - 1, y);
			if (f[y][x] == '^') move(x, y - 1);
			if (f[y][x] == '>') move(x + 1, y);
			if (f[y][x] == 'v') move(x, y + 1);
		}
	}
	return;
}

int main() {
	int h, w;

	while (cin >> h >> w, !(h == 0 && w == 0)) {
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				cin >> f[i][j];
			}
		}
		fill(u[0], u[MH], false);
		move(0, 0);
	}
	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k; cin >> n >> k;
    vector<double> v(n);
    rep(i,n) {
        cin >> v[i];
        v[i] = (v[i]+1.0)/2.0;
    }

    vector<double> rui(n+1);
    rui[0] = 0;
    REP(i,1,n+1) rui[i] = rui[i-1]+v[i-1];
    double ans = 0;
    for(int i = 0; i+k<=n; i++) {
        ans = max(ans,rui[i+k]-rui[i]);
    }
    cout << setprecision(12) << ans << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

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

  vector<int> num(n+1,1);
  vector<bool> red(n+1,0);

  red[1] = true;

  ll x, y;
  rep(i,m) {
    cin >> x >> y;
    if (red[x]) red[y] = true;
    num[x] = num[x] - 1, num[y] = num[y] + 1;
    if (num[x] == 0) red[x] = false;
  }

  ll ans = 0;
  rep(i,n+1) {
    if (red[i]) ans++;
  }

  cout << ans << endl;
}


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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int n;
double x[310], y[310];
double eps = 1e-9;

double pow(double a) {
    return a * a;
}

double dist2(double ax, double ay, double bx, double by) {
    return pow(ax - bx) + pow(ay - by);
}

double dist2(int i, int j) {
    return dist2(x[i], y[i], x[j], y[j]);
}

int count(double cx, double cy) {
    int ret = 0;
    for (int i = 0; i < n; ++i) {
        if (dist2(x[i], y[i], cx, cy) < 1 + eps)
            ++ret;
    }
    return ret;
}

int main(){
    while (true) {
        cin >> n;
        if (!n) return 0;
        for (int i = 0; i < n; ++i) {
            cin >> x[i] >> y[i];
        }
        int ans = 1;
        for (int i = 0; i < n; ++i) {
            for (int j = i + 1; j < n; ++j) {
                double d2 = dist2(i, j);
                double d = sqrt(d2);
                if (d > 2)
                    continue;
                
                double dis2 = 1 - d2 / 4;
                double dis = sqrt(dis2);
                double cx = (x[i] + x[j]) / 2;
                double cy = (y[i] + y[j]) / 2;
                double dx = (y[i] - y[j]) / d * dis;
                double dy = (x[i] - x[j]) / d * dis;
                ans = max(ans, max(count(cx + dx, cy - dy), count(cx - dx, cy + dy)));
            }
        }
        cout << ans << "\n";
    }
}

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

using namespace std;

int lst = 0, N, a[100009];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N);
for (int i=1; i<=N; i++)
    scanf ("%d", &a[i]);
sort (a + 1, a + N + 1);
long long curr = 0;
for (int i=1; i<N; i++)
{
    curr += a[i];
    if (2LL * curr < a[i + 1]) lst = i;
}
printf ("%d\n", N - lst);
return 0;
}


Measured memory_bytes: 640
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < m; i++) {
            a[s.nextInt() - 1]++;
            a[s.nextInt() - 1]++;
        }
        for (int i = 0; i < n; i++) {
            System.out.println(a[i]);
        }
    }
}

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

int main()
{   int a=0,b=0,n,m,k;
    char s[16];
    scanf("%s",s);
    for(int i=0;i<strlen(s);i++){
        if(s[i]=='x')a++;
    }
    if(a<=7)
    printf("YES");
    else printf("NO");
    return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
#define binsrch binary_search
int main() 
{sevensins
ll t,i,j,k,m,l,n;
    
    cin>>n>>m;
    
    ll a[m],sum=0;
    
    for(i=0;i<m;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    
    if(sum>n)
    cout<<"-1\n";
    else
    cout<<n-sum<<"\n";

return 0;
}

Measured memory_bytes: 3772
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{

    class Program
    {

        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            if (S[0] == 'A')
            {
                Console.WriteLine("T");
            }
            else if (S[0] == 'C')
            {
                Console.WriteLine("G");
            }
            else if (S[0] == 'G')
            {
                Console.WriteLine("C");
            }
            else
            {
                Console.WriteLine("A");
            }



        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
vector<int> G[100000];
long DPB[100000];
long DPW[100000];
void Calc(){
	int N = rei();
	for(int i=0;i<N-1;i++){
		int x = rei()-1;
		int y = rei()-1;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	stack<pair<int,int>> sp;
	sp.push({0,-1});
	while(!sp.empty()){
		int v = sp.top().first;
		int f = sp.top().second;
		sp.pop();
		if(v >= N){
			v -= N;
			DPB[v] = 1;
			DPW[v] = 1;
			for(int i=0;i<G[v].size();i++){
				if(G[v][i] != f){
					int t = G[v][i];
					DPB[v] *= DPW[t];
					DPB[v] %= mod;
					DPW[v] *= DPW[t] + DPB[t];
					DPW[v] %= mod;
				}
			}
		}
		else{
			sp.push({v+N,f});
			for(int i=0;i<G[v].size();i++){
				if(G[v][i] != f){
					sp.push({G[v][i],v});
				}
			}
		}
	}
	cout << (DPW[0] + DPB[0]) % mod << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 8568
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int f(const vector<int>& v, int n, int index) {
	int b = index, e = v.size() - 1;
	if (index >= v.size() || v[index] >= n) return 0;
	while (b < e) {
		int m = (b + e) / 2 + 1;
		if (v[m] >= n) {
			e = m - 1;
		} else {
			b = m;
		}
	}
	return b - index + 1;
}

int main() {
	int n;
	cin >> n;
	vector<int> v(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	long long int res = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			res += f(v, v[i] + v[j], j + 1);
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>

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

typedef long long ll;

using namespace std;

int INF = 1e9;

int main(){
  string s;
  cin >> s;
  if(s == "SUN") cout << 7 << endl;
  else if(s == "SAT") cout << 1 << endl;
  else if(s == "MON") cout << 6 << endl;
  else if(s == "TUE") cout << 5 << endl;
  else if(s == "WED") cout << 4 << endl;
  else if(s == "THU") cout << 3 << endl;
  else if(s == "FRI") cout << 2 << endl;
  return 0;
}  


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc095/tasks/abc095_b
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x;
    cin >> n >> x;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    sort(ALL(v));
    cout << n + (x - accumulate(ALL(v), 0)) / v.front() << endl;

    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
grid = [input() for i in range(H)]
grid2 = []
grid3 = []

for j in range(len(grid[0])):
    is_all_white = True
    column = []
    for i in range(len(grid)):
        column.append(grid[i][j])
        if grid[i][j] != ".":
            is_all_white = False
    if(not is_all_white):
        grid2.append(column)

for j in range(len(grid2[0])):
    is_all_white = True
    column = []
    for i in range(len(grid2)):
        column.append(grid2[i][j])
        if grid2[i][j] != ".":
            is_all_white = False
    if(not is_all_white):
        grid3.append(column)

for i in grid3:
    print("".join(i))

Measured memory_bytes: 3188
#include <iostream>
#include <bitset>
#include <vector>

int N,M;
using namespace std;

vector<int> v[10];
int p[10];

int main(){
    cin >> N >> M;
    int k,l;
    for(int i=0;i<M;i++){
        cin >> k;
        for(int j=0;j<k;j++){
            cin >> l;
            v[i].push_back(l-1);
        }
    }
    for(int i=0;i<M;i++) cin >> p[i];
    int count = 0;
    for(int i=0;i<(1<<N);i++){
        bitset<10> bt(i);
        bool flag = true;
        for(int j=0;j<M;j++){
            int bs = 0;
            for(int k=0;k<v[j].size();k++){
                if(bt[v[j][k]]) bs++;
            }
            if(bs%2 != p[j]){
                flag = false;
                break;
            }
        }
        if(flag) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<sstream>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
typedef long long int ll;
typedef long double ld;
const ll inf = (1LL << 60);
const int MOD = 1000000007;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
int main() {
    string s;cin >> s;
    if(s == "ARC") cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

Measured memory_bytes: 3628
S = input()
N = len(S)
ans1 = 0
ans2 = 0
for i in range(N):
  x = S[i]
  if i % 2 == 0:
    if x == '0':
      ans1 += 1
    else:
      ans2 += 1
  else:
    if x == '1':
      ans1 += 1
    else:
      ans2 += 1
ans = min(ans1,ans2)
print(ans)

Measured memory_bytes: 3188
a, b, c, d = map(int, input().split())

if b >= 0:
    if d >= 0:
        print(max(b*d, a*c))
    else:
        print(max(a*d, a*c))
else:
    if c >= 0:
        print(b*c)
    else:
        print(a*c)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string s;cin>>s;
    map<char,int> mp;
    mp['N']=0;
    mp['W']=1;
    mp['S']=2;
    mp['E']=3;
    int cnt[4]={};
    REP(i,s.size()) cnt[mp[s[i]]]++;
    bool ok=true;
    if(cnt[0]&&!cnt[2]) ok=false;
    if(cnt[2]&&!cnt[0]) ok=false;
    if(cnt[1]&&!cnt[3]) ok=false;
    if(cnt[3]&&!cnt[1]) ok=false;
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

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

buff = [0 for i in range(10**5)]

for i in range(N):
    buff[A[i]] += 1


ans = 0
# print(buff)
for i in range(N-2):
    ans = max(ans,buff[i]+buff[i+1]+buff[i+2])

ans = max(ans, buff[N-2])
ans = max(ans, buff[N-1])
print(ans)

Measured memory_bytes: 56132
import java.util.*;

public class Main {

	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		int tle=0,ac=0,wa=0,re=0;
		for(int i=0;i<t;i++)
		{
			String ar=sc.next();
			
			if(ar.equals("TLE")) tle++;
			else if(ar.equals("WA")) wa++;
			else if(ar.equals("RE")) re++;
			else if(ar.equals("AC")) ac++;
			
			
			
		}
		System.out.println("AC x "+ac);
		System.out.println("WA x "+wa);
		System.out.println("TLE x "+tle);
		System.out.println("RE x "+re);
	}

}


Measured memory_bytes: 58740
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = to - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int x;

  cin >> x;

  int ans;

  if(x < 600) {
    ans = 8;
  } else if (x < 800) {
    ans = 7;
  } else if (x < 1000) {
    ans = 6;
  } else if (x < 1200) {
    ans = 5;
  } else if (x < 1400) {
    ans = 4;
  } else if(x < 1600) {
    ans = 3;
  } else if(x < 1800) {
    ans = 2;
  } else if(x < 2000) {
    ans = 1;
  }

  cout << ans << endl;
}


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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

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; }

int main(){
    string S;
    cin >> S;
    int N = S.length();
    string now;
    REP(i, N){
        now += 'x';
    }
    print(now);
}

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

#define MAX 500000
#define SENTINEL 2000000000

using namespace std;

int L[MAX/2+2], R[MAX/2+2];
int cnt;

//[left, right)
void Merge(int A[], int n, int left, int mid, int right)
{
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0; i<n1; i++)
        L[i]=A[left+i];
    for(int i=0; i<n2; i++)
        R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    int i=0, j=0;
    for(int k=left; k<right; k++){
        cnt++;
        if(L[i]<=R[j])
            A[k]=L[i++];
        else
            A[k]=R[j++];
    }
}

void MergeSort(int A[], int n, int left, int right)
{
    if(left+1<right){
        int mid=(left+right)/2;
        MergeSort(A, n, left, mid);
        MergeSort(A, n, mid, right);
        Merge(A, n, left, mid, right);
    }
}

int main()
{
    int A[MAX], n, i;
    cnt=0;

    cin>>n;
    for(int i=0; i<n; i++)
        cin>>A[i];

    MergeSort(A, n, 0, n);

    for(int i=0; i<n; i++){
        if(i)
            cout<<" ";
        cout<<A[i];
    }
    cout<<endl;

    cout<<cnt<<endl;

    return 0;
}



Measured memory_bytes: 6952
from sys import stdin
import sys

A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
# N, M = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
x=min(B-1,N)
ans = int((A*x)/B)-A*int(x/B)
print(ans)
# if N >= B:

Measured memory_bytes: 79732
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var s = cin.Read;
            if (a >= 3200)
            {
                Console.WriteLine(s);
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<string>
#include<cstdio>
#include<deque>
#include<list>
#include<queue>
#include<stack>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
#include<complex>
#include<cmath>
#include<limits>
#include<cassert>
#include<bitset>
#include<numeric>
#include<functional>

using namespace std;

using lint = long long;
const lint MOD = 1000000007;

bool kaibun(string s) {
  int n = s.size();
  for(int i = 0; i < n; i++) {
    if(s[i] != s[n - i - 1]) return false;
  }
  return true;
}

lint modpow(lint a, lint n) {
  lint res = 1;
  while (n > 0) {
    if( n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }

  return res;
}

int main(){

  string zaki;
  string o;
  lint H;

  cin >> zaki;
  cin >> o;
  cin >> H;
  
  lint Z = zaki.size();
  lint O = o.size();



  if(O <= H) {
    string hoge = "";
    hoge = o;
    reverse(hoge.begin(), hoge.end());
    
    string center = zaki + hoge;
    lint ans = 0;
    if(kaibun(center)) {
      lint rest = H - O;
      ans = 1;
      ans = modpow(26, (rest + 1) / 2);
    }

    cout << ans << endl;
  } else {
    string hoge = "";
    for(lint i = 0; i < H; i++) {
      hoge = hoge + o[O - 1 - i];
    }
    
    string str = hoge + zaki + hoge + o;
    if(kaibun(str)) cout << 1 << endl;
    else cout << 0 << endl;
  }

  return 0;
}




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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

std::vector<std::pair<ll,ll>> prime_factorization(ll n){
  std::vector<std::pair<ll,ll>> factor;
  for(ll p=2;p*p<=n;++p){
    if(n%p!=0)continue;
    ll num=0;
    while(n%p==0){
      num++;
      n/=p;
    }
    factor.emplace_back(p,num);
    if(n==1)return factor;
  }
  if(n!=1)factor.emplace_back(n,1);
  return factor;
}

signed main(){

  ll n;
  cin>>n;
  auto pf = prime_factorization(n);

  auto f = [](ll a){return (a*(a+1))/2;};
  ll ans = 0;
  for(auto [p,c]:pf){
    for(ll i=1;;++i){
      if(f(i)>c){
        ans += i-1;
        break;
      }
    }
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 3632
num_cell = int(input())

heights = [int(x) for x in input().split(' ')]

heights[0] -= 1

for i in range(1, num_cell):
    if heights[i-1] < heights[i]:
        heights[i] -= 1
    elif heights[i-1] > heights[i]:
        break
else:
    print("Yes")
    exit(0)

print("No")
exit(0)


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int dp[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if (i == 0)
        {
            dp[i] = 0;
        }
        else
        {
            if (i == 1)
            {
                dp[i] = abs(arr[i] - arr[i - 1]);
            }
            else
            {
                dp[i] = std::min((dp[i - 2] + abs(arr[i - 2] - arr[i])), dp[i - 1] + abs(arr[i - 1] - arr[i]));
            }
        }
    }
    cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 4424
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
class Simple
{
    long N, M;
    void Solve() {
        //input
        N = io.Long;
        M = io.Long;
        //cal
        var create = Math.Min(N, M / 2);        
        var leftC = M - 2 * create;
        var add = leftC / 4;//S=c*2,c,c
        var ans = create + add;
        //ret
        Console.WriteLine(ans);
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //System.Console.SetIn(exStdIn);
        Solve();
        io.writeFlush();
    }
}
class SimpleIO
{
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


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

int main(){
    string s, t;
    cin>>s>>t;
    
    int ls = s.length(), lt = t.length(), i, j, k, c, maxval=0;
    for(i=0; i<=(ls-lt); i++){
        for(j=i, k=0, c=0; j<i+lt && k<lt; j++, k++){
            if(t[k]==s[j]) c++;
        }
        maxval = max(maxval, c);
    }
    cout<<lt-maxval;
}

Measured memory_bytes: 3592
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    }

    public static boolean binarySearch(int[] arr, int target, int left, int right) {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    }
}

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

int main()
{
    long N;
    cin >> N;
    long p;
    long count[100002]={0};
    long max1=0;
    for(int i=1;i<=N;i++){
        cin >> p;
        count[p]++;
        count[p+1]++;
        if(p!=0)count[p-1]++;
    }
    for(int t=0;t<=100001;t++){
        max1=max(max1,count[t]);
    }
    cout << max1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


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

	if (a <= b / k * k && b / k * k <= b) {
		cout << "OK" << endl;
	}
	else cout << "NG" << endl;
} 

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main() {
  int a = 0, b = 0;
  cin >> a >> b;
  
  if((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }else{
     cout << "IMPOSSIBLE" << endl;
    
  }
  

}



Measured memory_bytes: 764
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		String str = scan.next();
		char alp[] = new char[str.length()];
		for(int i=0;i<str.length();i++) {
			alp[i] = str.charAt(i);
			if(alp[i] + n >= 91) {
				alp[i] += n-26;
			}else {
				alp[i] += n;
			}
			System.out.print(alp[i]);
		}
		
		
		

	}

}


Measured memory_bytes: 25428
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <map>
#include <numeric>
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define alles(obj) obj.begin(), obj.end()
#define elif else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo std::cout <<
#define read std::cin >>
#define endl std::endl
#define fin << '\n'
#define bash push_back
#define makePair std::make_pair
#define _ << ' ' <<
// type-define
#define Stack std::stack
#define Queue std::queue
#define Set std::set
#define PQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
#define Greater std::greater
using String = std::string;
using llong = long long;
using boolean = bool;
using Pii = Pair<int, int>;
using Vi = Vector<int>;
using Vii = Vector<Pii>;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    boolean isMovable ( int x, int y, int w, int h ) { 
        return ( x >= 0 && y >= 0 && x < w && y < h ); }
    llong abs ( llong n ) { return n < 0 ? -n : n; }
}

#define int long long

constexpr int MOD = 1000000007;

namespace Rlyeh {

    int h, w;
    char mp[1010][1010];
    int dp[1010][1010];

    signed call_of_Cthulhu( signed datum ) {

        read h >> w;
        for ( int i = 1; i <= h; i++ ) {
            String hori;
            read hori;
            for ( int j = 1; j <= w; j++ ) {
                mp[i][j] = hori[j-1];
            }
        }
        dp[1][1] = 1;
        for ( int i = 1; i <= h; i++ ) {
            for ( int j = 1; j <= w; j++ ) {
                if ( mp[i][j] != '#' ) {
                    dp[i][j] += ( dp[i-1][j] + dp[i][j-1] ) % MOD;
                }
            }
        }

        echo dp[h][w] fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 9216
#include <stdio.h>

void NA( void ) {
  printf( "NA\n" );
}

void A_B_NA( char snake[ ] ) {
  int i = 0;

  if( snake[ i++ ] != '>' ) { NA( ); return; }

  if( snake[ i ] == 39 ) {
    /* snake type A*/
    int fc = 1, sc = 1;

    i++;

    if( snake[ i++ ] != '=' ) { NA( ); return; }
    for( ; snake[ i ]; fc++ ) {
      if( snake[ i ] == '#' ) { i++; break; }
      if( snake[ i++ ] != '=' ) { NA( ); return; }
    }

    if( snake[ i++ ] != '=' ) { NA( ); return; }
    for( ; snake[ i ] && ( fc != sc ); sc++ )
      if( snake[ i++ ] != '=' ) { NA( ); return; }

    if( snake[ i++ ] != '~' ) { NA( ); return; }
    if( snake[ i   ] != 0 ) { NA( ); return; }

    printf( "A\n" );
  } else if( snake[ i ] == '^' ) {
    /* snake type B*/

    i++;

    if( snake[ i++ ] != 'Q' ) { NA( ); return; }
    if( snake[ i++ ] != '=' ) { NA( ); return; }

    for( ; snake[ i ]; ) {
      if( snake[ i ] == '~' ) { i++; break; }
      if( snake[ i++ ] != 'Q' ) { NA( ); return; }
      if( snake[ i++ ] != '=' ) { NA( ); return; }
    }

    if( snake[ i++ ] != '~' ) { NA( ); return; }
    if( snake[ i   ] != 0 ) { NA( ); return; }

    printf( "B\n" );
  } else NA( );
}

int main( void ) {
  int n;

  scanf( "%d", &n );

  while( n-- ) {
    char snake[ 201 ];

    scanf( "%s", snake );

    A_B_NA( snake );
  }

  return ( 0 );
}

Measured memory_bytes: 0
s = input()
n = len(s)
t = 0
for i in range(0,(n-1)//2):
    if s[i] != s[n-i-1]:
        t = t + 1
if t > 0:
    print("No")
else:
    if ((n-1)//2)%2==0:
        for i in range(0,(n-1)//4):
            if s[i] != s[(n-1)//2-i-1]:
                t = t + 1
        if t >0:
            print("No")
        else:
            print("Yes")
    else:
        for i in range(0,(((n-1)//2 - 1)//2)):
            if s[i] != s[(n-1)//2-i-1]:
                t = t + 1
        if t >0:
            print("No")
        else:
            print("Yes")

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

int main() {
  
  int N;
  cin >> N;
  
  vector<int> p(N);
  
  int num = -1e9;
  int num2 = 0;
  
  for(int i = 0;i < N;++i){
    cin >> p[i];
  }
  
  for(int i = 0;i < N;++i){
    num = max(p[i],num);
  }
  
  num = num / 2;
  
  for(int i = 0;i < N;++i){
    num2 = num2 + p[i];
  }
  
  int num3 = num2 - num;
  
  cout << num3 << endl;
  
  
}




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

int main(){
    int n,q; cin >> n >> q;
    string s; cin >> s;
    vector<int> t(n+1,0);
    for(int i=0;i<n;++i){
        if(i+1 < n && s[i]=='A' && s[i+1]=='C'){
            t[i+1] = t[i] + 1;
        }
        else t[i+1] = t[i];
    }
    for(int j=0;j<q;++j){
        int l,r; cin >> l >> r;
        l--;
        r--;
        cout << t[r] - t[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408