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

#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
int dxx[] = {0,-1,0,1};
int dyy[] = {1,0,-1,0};
bool isSafe(int x,int y,int h,int w)
{
    if(x<0 or x>=h or y<0 or y>=w)
        return false;
    return true;
}
int main(){
	fast;
    int h,w,rowmax=0,colmax=0;
    cin>>h>>w;
    vector<int> row(h+1,0),col(w+1,0);
    map<pair<int,int>,int> mp;
    int tar;
    cin>>tar;
    for(int i=0;i<tar;i++)
    {
        int x,y;
        cin>>x>>y;
        row[x]++;
        rowmax=max(rowmax,row[x]);
        col[y]++;
        colmax=max(colmax,col[y]);
        mp[{x,y}]++;
    }
    vector<int> rows,cols;
    for(int i=1;i<=h;i++)
        if(row[i]==rowmax)
            rows.push_back(i);
    for(int j=1;j<=w;j++)
        if(col[j]==colmax)
            cols.push_back(j);
    for(int i=0;i<rows.size();i++)
        for(int j=0;j<cols.size();j++)
            if(mp.find({rows[i],cols[j]})==mp.end())
            {
                cout<<rowmax+colmax<<endl;
                return 0;
            }
    cout<<rowmax + colmax - 1<<endl;
	return 0;
}



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

template <typename _Tp> inline _Tp read(_Tp&x){
	char c11=getchar(),ob=0;x=0;
	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();
	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;
}

const int N=101000;
int a[N],ps,n;
ll L,len;

int main(){
	read(n),read(L);read(a[1]);
	for(int i=2;i<=n;++i){
		read(a[i]);
		if(a[i-1]+a[i]>=L)ps=i;
	}
	if(!ps)puts("Impossible");
	else {
		puts("Possible");
		--ps;
		for(int i=1;i<ps;++i)
			printf("%d\n",i);
		for(int i=n-1;i>=ps;--i)
			printf("%d\n",i);
	}return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;
	public class Main{
		public static void main(String args[]){
			Scanner sc = new Scanner(System.in);
			int cap[] = {1,0,0};
			int temp;
			int n1;
			int n2;
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] ch = str.split(",");
				if(ch[0].equals("A")){
					 n1 = 0;
				}else if(ch[0].equals("B")){
					 n1 = 1;
				}else{
					 n1 = 2;
				}
				if(ch[1].equals("A")){
					 n2 = 0;
				}else if(ch[1].equals("B")){
					 n2 = 1;
				}else{
					 n2 = 2;
				}
				temp = cap[n1];
				cap[n1]=cap[n2];
				cap[n2]=temp;
			}
			for(int i=0;i<3;i++){
				if(cap[i]==1){
					if(i==0 ){
						System.out.println("A");
					}else if(i == 1){
						System.out.println("B");
					}else{
						System.out.println("C");
					}
					break;
				}
			}
		}
	}		

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  for (int i = 1; i <= 5; ++i) {
    int x;
    cin >> x;
    if (x == 0) {
      cout << i << '\n';
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 3608
// C.

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

using namespace std;

int main(int argc, char *argv[]) {
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<int> kind(q), dir(q);
	for (int i = 0; i < q; ++i) {
		string t, d;
		cin >> t >> d;
		kind[i] = t[0];
		dir[i] = d[0] == 'L' ? -1 : 1;
	}
	int left = 0, right = n;
	while ((right - left) > 1) {
		int mid = (left + right) / 2;
		int pos = mid;
		bool f = true;
		for (int i = 0; i < q; ++i) {
			if (s[pos] == kind[i]) {
				pos += dir[i];
				if (pos >= n) {
					break;
				}
				if (pos < 0) {
					f = false;
					break;
				}
			}
		}
		if (f) {
			right = mid;
		} else {
			left = mid;
		}
	}
	int leftmost = right;

	left = 0, right = n;
	while ((right - left) > 1) {
		int mid = (left + right) / 2;
		int pos = mid;
		bool f = true;
		for (int i = 0; i < q; ++i) {
			if (s[pos] == kind[i]) {
				pos += dir[i];
				if (pos < 0) {
					break;
				}
				if (pos >= n) {
					f = false;
					break;
				}
			}
		}
		if (f) {
			left = mid;
		} else {
			right = mid;
		}
	}
	int rightmost = left;

	int ans = rightmost - leftmost + 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
typedef pair<int, int> P;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    string s; cin >> s;
    int N = s.size(), MOD = 1000000007;
    long long dp[100010][4] = {};
    for(int i = N; i >= 0; --i){
        for(int j = 3; j >= 0; --j){
            if(i == N){
                dp[i][j] = (j == 3 ? 1:0);
            } else {
                dp[i][j] = dp[i+1][j]*(s[i] == '?' ? 3LL : 1LL);
                if(j < 3 && (s[i] == '?' || s[i] == "ABC"[j])){
                    dp[i][j] += dp[i+1][j+1];
                } 
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[0][0] << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
 
using tpl = tuple<char, int>;
typedef pair<int,int> pii;
typedef long long ll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


int xs[100010];
int ys[100010];
char cs[100010];


struct rec {
    int minx;
    int miny;
    int maxx;
    int maxy;
};



bool unite(rec r1, rec r2, rec &res){
    // rとvecの共通部分を求める　
    if(r1.maxx < r2.minx || r2.maxx < r1.minx ||
       r1.maxy < r2.miny || r2.maxy < r2.miny ) return false;
    res = rec{max(r1.minx, r2.minx), max(r1.miny, r2.miny), min(r1.maxx, r2.maxx), min(r1.maxy, r2.maxy)};
    return true;
}


int dp[3010][3010];

int main(){

    int N, K;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> xs[i] >> ys[i] >> cs[i];
    }

    for(int i = 0; i < N; i++){
        int xx = xs[i] % K;
        int yy = ys[i] % K;

        int minx = xx;
        int maxx = xx + K*2-1;
        int miny = yy;
        int maxy = yy + K*2-1;
        
        vector<rec> v;
        if((((xs[i] / K) % 2 == 0) ^ ((ys[i] / K) % 2 == 0)) ^ (cs[i] == 'W')){
            rec res;
            for(int j = 0; j < 3; j++){
                for(int k = 0; k < 3; k++){
                    if(!((j % 2 == 0) ^ (k % 2 == 0))){
                        if(unite(rec{0 + k * K, 0 + j * K, k*K + K - 1, j*K + K - 1}, rec{minx, miny, maxx, maxy}, res)){
                            res.minx -= minx;
                            res.miny -= miny;
                            res.maxx -= minx;
                            res.maxy -= miny;
                            v.push_back(res);
                        }
                    }
                }
            }
        }
        else{
            rec res;
            for(int j = 0; j < 3; j++){
                for(int k = 0; k < 3; k++){
                    if(((j % 2 == 0) ^ (k % 2 == 0))){
                        if(unite(rec{0 + k * K, 0 + j * K, k*K + K - 1, j*K + K - 1}, rec{minx, miny, maxx, maxy}, res)){
                            res.minx -= minx;
                            res.miny -= miny;
                            res.maxx -= minx;
                            res.maxy -= miny;
                            v.push_back(res);
                        }
                    }
                }
            }
        }
        for(rec res : v){
            dp[res.minx][res.miny]++;
            dp[res.maxx+1][res.maxy+1]++;
            dp[res.minx][res.maxy+1]--;
            dp[res.maxx+1][res.miny]--;
        }
    }

    for(int i = 0; i < K*2; i++){
        for(int j = 0; j < K*2; j++){
            dp[i][j+1] += dp[i][j];
        }
    }
    for(int j = 0; j < K*2; j++){
        for(int i = 0; i < K*2; i++){
            dp[i+1][j] += dp[i][j];
        }
    }

    int ans = 0;
    for(int i = 0; i < K*2; i++){
        for(int j = 0; j < K*2; j++){
            ans = max(ans, dp[i][j]);
        }
    }

    cout << ans << endl;

    

    return 0;
}


Measured memory_bytes: 25728
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S, W = list(map(int, sys.stdin.buffer.readline().split()))
if S <= W:
    print('unsafe')
else:
    print('safe')



Measured memory_bytes: 27136
import java.io.*;

public class Main {


    private static double solver(String input) {
        String[] inputArray = input.split(" ");
        double dValue = Double.parseDouble(inputArray[0]);

        if(inputArray[1].equals("JPY")){
            return dValue;
        }else{
            return dValue * 380000;
        }


    }


    public static void main(String[] args) {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);

        String inputNumStr = "";
        int inputNum=0;
        try {
            inputNumStr = br.readLine();
            inputNum = Integer.parseInt(inputNumStr);
        } catch (Exception e) {
            e.printStackTrace();
        }

        double ans=0;
        for (int i = 0; i < inputNum; i++) {
            String input = "";
            try {
                input = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            ans += solver(input);
        }
        System.out.println(ans);

    }
}

Measured memory_bytes: 20948
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.BitSet;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D2017LikeNumber solver = new D2017LikeNumber();
        solver.solve(1, in, out);
        out.close();
    }

    static class D2017LikeNumber {
        static final int MAX = 100_000;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Primes primes = new Primes(MAX);

            long[] odds = new long[MAX + 1];
            for (int i = 1; i <= MAX; i++) {
                odds[i] = odds[i - 1];
                if (i % 2 == 1 && primes.isPrime(i) && primes.isPrime((i + 1) / 2)) {
                    odds[i]++;
                }
            }

            int q = in.nextInt();
            for (int i = 0; i < q; i++) {
                int l = in.nextInt(), r = in.nextInt();
                out.println(odds[r] - odds[l - 1]);
            }
        }

    }

    static class Primes {
        public final BitSet isPrime;
        public final int[] primes;

        public Primes(int N) {
            if (N <= 1) {
                isPrime = new BitSet();
                primes = new int[0];
                return;
            }
            isPrime = new BitSet(N);
            isPrime.set(2, N + 1);
            for (int p = isPrime.nextSetBit(0); p * p <= N; p = isPrime.nextSetBit(p + 1)) {
                for (int composite = p * 2; composite <= N; composite += p) {
                    isPrime.clear(composite);
                }
            }

            primes = new int[isPrime.cardinality()];
            int p = isPrime.nextSetBit(0);
            for (int i = 0; i < primes.length; i++) {
                primes[i] = p;
                p = isPrime.nextSetBit(p + 1);
            }
        }

        public boolean isPrime(int p) {
            return isPrime.get(p);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 47712
from itertools import accumulate
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
black = [[0] * (2*K+1) for _ in range(2*K+1)]
white = [[0] * (2*K+1) for _ in range(2*K+1)]
for _ in range(N):
    x, y, c = input().split()
    x = int(x) % (2*K) + 1
    y = int(y) % (2*K) + 1
    if c == 'B':
        black[x][y] += 1
    else:
        white[x][y] += 1

for i in range(1, 2*K+1):
    black[i] = list(accumulate(black[i]))
    white[i] = list(accumulate(white[i]))
    for j in range(2*K+1):
        black[i][j] += black[i-1][j]
        white[i][j] += white[i-1][j]

ans = 0
for i in range(K):
    for j in range(K):
        cnt = 0
        for k in [-1, 0, 1]:
            for l in [-1, 0, 1]:
                r = i + K*k
                c = j + K*l
                color = black if (k + l) % 2 == 0 else white
                s1 = color[min(r+K, 2*K)][min(c+K, 2*K)]
                s2 = color[min(r+K, 2*K)][max(c, 0)]
                s3 = color[max(r, 0)][min(c+K, 2*K)]
                s4 = color[max(r, 0)][max(c, 0)]
                cnt += s1 - s2 - s3 + s4
        ans = max(ans, cnt, N - cnt)
print(ans)


Measured memory_bytes: 154248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	string a = "",b = "";
	for(int i = 1;i <= n;++i) a += (char)(m+'0');
	for(int i = 1;i <= m;++i) b += (char)(n+'0');

	if(a < b) cout << a;
	else cout << b;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
int main(void)
{
	int a[5]={0};
	for(int i=0;i<5;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]<40){
			a[i]=40;
		}
	}
	printf("%d\n",(a[0]+a[1]+a[2]+a[3]+a[4])/5);
	return 0;
}


Measured memory_bytes: 3220
#include <iostream>
#define rep(i,s,e)for(int i=s;i<=e;i++)
#define out(a)cout << a << endl;
using namespace std;

int main(){
    int a, b, c, i;
    int count=0;
    cin >> a >> b >> c;
    rep(i, a, b){
        if(c%i == 0) count++;
    }
    out(count);
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  vlin(a,3);
  sort(all(a));
  cout<<a[0]+a[1];
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(*args):
    print(*args,file=sys.stderr)

def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
     
#input
from collections import deque
import sys
def resolve():
    S=deque(input())
    Q,=pin()
    ans=""
    turn=0
    for i in range(Q):
        q=sys.stdin.readline().rstrip().split()
        if q[0]=="1":turn=(turn+1)%2
        else:
            f=int(q[1])%2
            if f!=turn:
                S.appendleft(q[2])
            else:
                S.append(q[2])
    if turn==1:S.reverse()
    for s in S:
        ans+=s
    print(ans)
    #print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
#if __name__=="__main__":resolve()

"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """a
4
2 1 p
1
2 2 c
1"""
        output = """cpa"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """a
6
2 2 a
2 1 b
1
2 2 c
1
1"""
        output = """aabc"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """y
1
2 1 x"""
        output = """xy"""
        self.assertIO(input, output)

if __name__=="__main__":resolve()

Measured memory_bytes: 10516
from collections import deque
H, W = map(int, input().split())
X = [1] * (W + 2)
for _ in range(H):
    X += [1] + [1 if a == "#" else 0 for a in input()] + [1]
X += [1] * (W + 2)
H, W = H+2, W+2

def BFS(i0=0):
    Q = deque([i0])
    D = [-1] * (H * W)
    D[i0] = 0
    while Q:
        x = Q.popleft()
        for y in (x+W, x-W, x+1, x-1):
            if X[y] == 0:
                if D[y] == -1:
                    D[y] = D[x] + 1
                    Q.append(y)
    return D

ma = 0
for i in range(H):
    for j in range(W):
        if X[i*W+j] == 0:
            ma = max(ma, max(BFS(i*W+j)))
print(ma)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
	int n;
	cin >> n;
	vector<int> t(n);
	ll s = 0;
	for (int i = 0; i < n; i++){
		cin >> t[i];
		s += t[i];
	}
	int m;
	cin >> m;
	int p, x;
	for (int i = 0; i < m; i++){
		cin >> p >> x;
		cout << s-t[p-1]+x << '\n';
	}
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}


Measured memory_bytes: 3624
// Copyright 2020 yaito3014
#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int o = count(cbegin(S), cend(S), 'o');
  cout << (700 + 100 * o) << endl;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
typedef vector<vm> vvm;
//
#define MOD (long)(1e9 + 7)

long long modPow(long long x, long long n){
  if(n == 0) return 1;
  if(n % 2 == 0) {
    long long sqrtX = modPow(x,n/2);
    return sqrtX * sqrtX % MOD ;
  }else{
    return x * modPow(x,n-1) % MOD;
  }
}

long long kaizyou(long long x){
  long long res = 1;
  for(int i = 1; i <= x; i++){
    res = (res * i) % MOD;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;


  ll prev = 0;
  mint ans = 1;
  rep(i,2*n){

    if(s[i] == 'B'){
      if(prev % 2 == 0){
        // ans *= max<ll>(prev,1);
        prev++;
      }
      else{
        ans *= max<ll>(prev,1);
        prev--;
      }
    }else{

      if(prev % 2 == 1){
        // ans *= max<ll>(prev,1);
        prev++;
      }
      else{
        ans *= max<ll>(prev,1);
        prev--;
      }
    }
    if(prev < 0 || prev > n){
      cout << 0 << "\n";
      return 0;
    }

  }
  if(prev != 0){
    cout << 0 << "\n";
    return 0;
  }
  ans *= kaizyou(n);
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
    long long x;
	cin >> x;
    cout<<(x/500)*1000+(x-x/500*500)/5*5;
	return 0;
}

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

#define M 1046527
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  else if(ch == 'C') return 2;
  else if(ch == 'G') return 3;
  else if(ch == 'T') return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for(i = 0; i < strlen(str); i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1 + (key % (M-1));}

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i = 0; ; i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i = 0; ; i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i, n;
  char str[L], com[9];
  for(i = 0; i < M; i++) H[i][0] = '\0';

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s %s", com, str);

    if(com[0] == 'i'){
      insert(str);
    }else{
      if(find(str)){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }
  }

  return 0;
}



Measured memory_bytes: 16084
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
    int n,m;
    scanf("%d %d",&n,&m);
    if (n > 0 && n < 10 && m > 0 && m < 10) printf("%d\n",n*m);
    else printf("%d\n",-1);
}

Measured memory_bytes: 256
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>

using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

int main()
{
    using namespace std;

    int a, b, c;
    cin >> a >> b >> c;

    cout << min({b / a, c}) << endl;


    return 0;
}

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

typedef long long ll;

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<ll> sum(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        ll p;
        cin >> p;
        sum[i] = p + 1 + sum[i - 1];
    }
    ll mx = -1e18;
    for (int i = 0; i <= n - k; i++) {
        mx = max(mx, sum[i + k] - sum[i]);
    }
    double ans = mx;
    ans /= 2;
    printf("%.6f\n", ans);
    return 0;
}


Measured memory_bytes: 1792
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD


A,B = imn()

for i in range(1, 4):
    if A*B*i % 2 == 1:
        print('Yes')
        break
else:
    print('No')



Measured memory_bytes: 5420
#include <stdio.h>
#include <string.h>

int main(void){

  char s[5];
  scanf("%s", s);
  int count = 0;

  for(int i= 0; i<4;i++){
    for(int j=i+1;j<4;j++){
    	if(s[i]==s[j]){
          count=count+1;
        }
    }
  }
  if(count ==2) printf("Yes");
  else printf("No");
  
  return 0;
}

  

Measured memory_bytes: 1704
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iomanip>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	int R, G;
	cin >> R >> G;
	cout << 2 * G - R << endl;
	return 0;
}

Measured memory_bytes: 256
def solve(n):
    tbl = [0] * 100
    for i in range(1, n + 1):
        st = str(i)
        tbl[int(st[0] + st[-1])] += 1

    ans = 0
    for i in range(1, n + 1):
        st = str(i)
        ans += tbl[int(st[-1] + st[0])]
    return ans


n = int(input())
print(solve(n))


Measured memory_bytes: 3060
// finish date: 2018/02/02
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    string s;
    cin >> s;
    bool con1 = (s[0] == s[s.length() - 1]);
    bool con2 = (s.length() % 2 == 1);
    if (con1^con2) cout << "First" << endl;
    else cout << "Second" << endl;

    return 0;
}



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

using namespace std;

const long long N = 1e5 + 100 , mod = 1e9 + 7;
long long a , cnt[N] , ans = 1 , n;

int main()
{
	cin >> n;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> a;
		cnt[a]++;
	}
	if(n % 2 == 0 && cnt[0] > 0)
	{
		cout << 0;
	//	cout << "##";
		return 0;
	}
	if(n % 2)
	{
		for(int i = 1 ; i < n ; i++)
		{
			if(cnt[i] == 2)
			{	
				ans *= 2;
				ans %= mod;
			}
			else if(cnt[i] != 0)
			{
				cout << 0;
				return 0;
			}
		}
	}
	else
	{
		for(int i = 1 ; i < n ; i++)
		{
			if(cnt[i] == 2)
			{
				ans *= 2;
		//		cout << "# " << i << endl;
				ans %= mod;
			}
			else if(cnt[i] != 0)
			{
				cout << 0;
				return 0;
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;

int main(){
    long N, K;
    cin >> N >> K;

    if(N % K == 0){
        cout << 0 << endl;
        return 0;
    }

    long p = N/K;
    long ans = N - p*K;
    ans = min(ans, abs(ans-K));

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

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int A,B,i,judge;
    char S[12];

    scanf("%d %d",&A,&B);
    scanf("%s",S);

    judge=1;

    if(S[A]=='-'){
        for(i=0;i<A;i++){
            if(!(S[i]>='0'&&S[i]<='9')){
                judge = 0;
            }
        }
        for(i=A+1;i<A+B+1;i++){
            if(!(S[i]>='0'&&S[i]<='9')){
                judge = 0;
            }
        }
    }else{
        judge=0;
    }

    if(judge==0){
        printf("No\n");
    }else{
        printf("Yes\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

const int maxn=3e3+10;

string s,t,st;

int  dp[maxn][maxn];

void f(int a,int b)
{
    if((a==0)||(b==0))
    return ;
    if(dp[a][b]==dp[a][b-1])
        f(a,b-1);
    else if(dp[a][b]==dp[a-1][b])
            f(a-1,b);
    else
    {
        f(a-1,b-1);
        st+=s[a-1];
    }
    return ;
}
/*
bool mark[maxn][maxn];

string f(int a,int b)
{
   mark[a][b]=1;
   if((a==0)||(b==0))
   {
       return ;
   }
   if(s[a]==t[b])
   {
       if(mark[a-1][b-1]==0)
       {
           f(a-1,b-1);
       }
       dp[a][b]=dp[a-1][b-1]+s[a];
   }
   if(dp[a][b].size()<dp[a-1][b].size())
   {
       if(mark[a-1][b]==0)
       {
           f(a-1,b);
       }
       dp[a][b]=dp[a-1][b];
   }
   if(dp[a][b].size()<dp[a][b-1].size())
   {
       if(mark[a][b-1]==0)
       {
           f(a,b-1);
       }
       dp[a][b]=dp[a][b-1];
   }
}
*/

int main()
{
    cin>>s>>t;
    dp[0][0]=0;
    dp[0][1]=0;
    dp[1][0]=0;
    for(int i=1;i<=s.size();i++)
    {
        for(int j=1;j<=t.size();j++)
        {
           if(s[i-1]==t[j-1])
             dp[i][j]=dp[i-1][j-1]+1;
           dp[i][j]=max(dp[i][j],dp[i-1][j]);
           dp[i][j]=max(dp[i][j],dp[i][j-1]);
        }
    }
    f(s.size(),t.size());
    cout<<st;
	return 0;
}


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

int main() {
	string s;
	cin >> s;
	int size = s.size();
	vector<char> vec (size + 1);
	int pointer = 0;
	for(int i = 0;i <= size;i++){
		vec.at(i) = 'n';
	}
	for(int i = 0;i < size;i++){
		if(s.at(i) == 'B'){
			if(pointer > 0){
				vec.at(pointer - 1) = 'n';
				pointer--;
			}
		}
		else{
			vec.at(pointer) = s.at(i);
			pointer++;
		}
	}
	for(int i = 0;vec.at(i) != 'n';i++){
		cout << vec.at(i);
	}
	cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int hsh[200003],cnt[2019],pw[200003];
long long ans;
int main(){
	cin>>s;cnt[0]=1;pw[0]=1;
	for(int i=0;i<s.size();i++)pw[i+1]=pw[i]*10%2019;
	for(int i=0;i<s.size();i++)hsh[i+1]=(hsh[i]+(s[i]-'0')*pw[s.size()-i-1])%2019,cnt[hsh[i+1]]++;
	for(int i=0;i<2019;i++)
		ans+=cnt[i]*(cnt[i]-1)/2;
	cout<<ans;
}

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

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


Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def r_sort(a) a.sort{|a,b|b<=>a} end

n =gets.to_i
t = []
n.times do
  t.push(gets.to_i)
end
max2 = max = 0
t.each do |d|
  if(d > max)
    max2 = max
    max = d
    next
  end
  if(d > max2)
    max2 = d
  end
end
t.each do |d|
  puts (d==max)? max2:max
end


Measured memory_bytes: 5172
#include<iostream>
using namespace std;
int main() {
	int n, k, sum = 0; cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		if (x <= k - x) {
			sum += x * 2;
			continue;
		}
		sum += (k - x) * 2;
	}
	cout << sum << endl;
}

Measured memory_bytes: 3628
import math
def p(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1
n=int(input())
ans=0
for i in range(n):
	x=int(input())
	if p(x):
		ans+=1
print(ans)


Measured memory_bytes: 5676
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    ll n, a, b, c, d, e; cin >> n >> a >> b >> c >> d >> e;
    ll mn = min({a, b, c, d, e});
    cout << (n - 1ll) / mn + 5ll << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n,k; cin>>n>>k;
    vector<int> cnt(n);
    rep(i,k) {
        int d; cin>>d;
        rep(j,d) {
            int a; cin>>a; --a;
            cnt[a]++;
        }
    }
    int ans=0;
    rep(i,n) {
        if (cnt[i]==0) {
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3512
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]

res=False
for dh in range(N-M+1):
    for dw in range(N-M+1):
        tres=True
        for h in range(M):
            for w in range(M):
                if B[h][w]!=A[h+dh][w+dw]:
                    tres=False
        res|=tres
print("Yes"if res else "No")


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#include"atcoder/all"


#ifdef _MSC_VER
#include <intrin.h>

#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using namespace atcoder;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << endl
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;



void solve() {
	int N, Q; cin >> N >> Q;
	dsu uf(N);
	REP(_, Q) {
		int t, u, v; cin >> t >> u >> v;
		if (t == 0)uf.merge(u, v);
		else {
			if (uf.same(u, v))print(1);
			else print(0);
		}
	}
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 3928
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000

int main() {
    string s;
    cin >> s;
    int i=1;
    string ans = "";
    for (auto c: s) {
        if (i) ans.push_back(c);
        i++;
        i %= 2;
    }
    printf("%s\n", ans.c_str());
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define TCI int t;cin>>t;while(t--)
#define cinl for(int i=0;i<n;i++)
#define ln "\n"
#define vpair vector< pair <ll , ll > >
#define fr first 
#define sc second 
#define pb emplace_back
#define vll vector<ll>
using namespace std;

const int N=1e5;

void solve()
{
    ll n;
    cin>>n;
    ll ans=0;
    ll cnt=0;
   	while(1)
   	{
   		ans++;
   		cnt+=n;
   		if(cnt%360==0)
   		break;
   	}
   	cout<<ans<<ln;
    
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}


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

int main() {
	// your code goes here
	int N, K;
	string S;
	cin >> N >> K >> S;
	if(S[K-1]=='A'){
		S[K-1]='a';
		cout<<S;
	} else if(S[K-1]=='B'){
		S[K-1]='b';
		cout<<S;
	}
	else if(S[K-1]=='C'){
		S[K-1]='c';
		cout<<S;
	}
	return 0;
}

Measured memory_bytes: 3588
#include <cstdlib>
#include <string>
#include <vector>
#include <iostream>

using namespace std;

//関数名：sum_digit
//用途：引数に与えたnum_strの各桁の数値の合計を返す
//注意：num_strは全て数字で構成される文字列であること
int sum_digit(string num_str)
{
	int str_size = num_str.length();
	long sum = 0;

	for(int  i = 0; i < str_size; i++)
	{
		sum += num_str[i] - '0';
	}

	return sum;
}

int main(void)
{
	int ele_num;
	string input_str;
	vector<string> data_set;

	//0が入力されるまで，数値を格納する
	do{
		cin >> input_str;
		data_set.push_back(input_str);
	}while(input_str != "0");

	//要素数を取得　
	ele_num = data_set.size()-1;

	for(int i = 0; i < ele_num; i++)
	{
		cout << sum_digit(data_set[i]) << endl;
	}
	
	return 0;
}




Measured memory_bytes: 3140
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		int counter = 0;
		int[] divisors = new int[10000];
		for(int i = a; i <= b && i <= c; i++ ) {
			if(c % i == 0) {
				divisors[counter] = i;
				counter++;
				
			}
		}
		
		System.out.println(counter);
	}
}

Measured memory_bytes: 17400
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}

int main(){
    int n = nxt();
    string s;
    cin >> s;
    ll count = 0;
    ll cR = 0, cB = 0, cG = 0;
    REP(i, n){
        if(s[i] == 'R'){
            cR++;
        }else if(s[i] == 'G'){
            cB++;
        }else{
            cG++;
        }
    }
    count = (ll)cR * cB * cG;
    REP(i, n){
        for(int j = i+1; j < n; j++){
            if(s[i] == s[j]) continue;
            int diff = j - i;
            if(j+diff >= n) continue;
            if(s[j+diff] == s[i] || s[j+diff] == s[j]) continue;
            count--;
        }
    }
    printf("%lld\n", count);
    return 0;
}



Measured memory_bytes: 3748
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 1000000000
using namespace std;
typedef long long ll;
const int MAXN=1e9+10;
const int MAX=1e5+10;
const double eps=1e-6;

int n,d,x;

int main(){
    #ifdef ONLINE_JUDGE
    #else

    //freopen("output.txt","w",stdout);
    #endif

    int ans=0;
    cin>>n>>d>>x;
    for(int i=1;i<=n;i++){
        int temp;
        scanf("%d",&temp);
        int cnt=0;
        while((temp*cnt+1)<=d){
            ans++;
            cnt++;
        }
    }
    cout<<ans+x<<endl;

    return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, b, c;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>b;
    if(n==b){
        return yes,0;
    }
    no;
    
}



Measured memory_bytes: 256
import java.util.Scanner;

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


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

int main()
{
    set<string> S;
    int N;
    cin >> N;
    for(int i=1; i<=N; ++i){
        string str;
        cin >> str;
        S.insert(str);
    }
    cout << S.size() << endl;
}

Measured memory_bytes: 19216
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

long long gcd ( long long a, long long b ) {
  if ( b == 0 ) return a;
  else return gcd ( b, a%b );
}

long long lcm ( long long a, long long b ) {
  return a * b / gcd(a, b);
}

int main (void) {
  int N; std::cin >> N;
  std::vector<int> a(N); for(int i=0; i<N; i++) std::cin >> a[i];

  ll sum = 0;
  for(int i=0; i<N; i++) sum += (a[i] - 1 );
  
  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256