akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
  int D;
  cin >> D;
  if(D==25){
    cout << "Christmas" << endl;
  }
  else if(D==24){
    cout << "Christmas Eve" << endl;
  }
  else if(D==23){
    cout << "Christmas Eve Eve" << endl;
  }
  else{
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
fun main() {
    val n = nextInt()
    val a = nextIntList()
    var current = a[0]
    var result = 0L
    (1 until n).forEach {
        if (current > a[it]) {
            result += current - a[it]
        } else {
            current = a[it]
        }
    }
    println(result)
}
// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)
// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }
// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

Measured memory_bytes: 65100
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int H,W,x,y,r;
	cin >>W >>H >>x >>y >>r;
	if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){
		cout <<"Yes\n";
	}
	else{
		cout <<"No\n";
	}
	return 0;
}

Measured memory_bytes: 1128
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    double a, b, x;
    cin >> a >> b >> x;
    double s = x / a;
    double c = (double)2*s/b;
    double d = (double)(2*s-a*b)/a;
    double res;
    // cout << c << ' ' << d << endl;
    if (c < a)
        res = atan(b/c) * 180 / M_PI;
    else
        res = atan((b-d)/a) * 180 / M_PI;

    printf("%.8f\n", res);

    // cout << M_PI << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
char s[51];
int n,k;
scanf("%d %d",&n,&k);

scanf("%s",&s);


if(s[k-1]=='A')s[k-1]='a';
else if(s[k-1]=='B')s[k-1]='b';	
else if(s[k-1]=='C')s[k-1]='c';


printf("%s",s);

return 0;
}

Measured memory_bytes: 128
a, b, k  = map(int, input().split())
c = 0
ans = []
if a > b:
  c = b
else:
  c = a

for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
  else:
    continue


print(ans[-k])

Measured memory_bytes: 3060
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        if(a >= 13){
            System.out.println(b);
        }else if(a <= 5){
            System.out.println(0);
        }else{
            System.out.println(b / 2);
        }
    }
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int i = 0;
        int min = 1001;
        int sum = 0;
        int prev;
        int ans = N;
        while(i < N){
            prev = sc.nextInt();
            sum += prev;
            if(prev < min){
                min = prev;
            }
            i++;
        }
        X -= sum;
        ans += X/min;
        System.out.println(ans);

    }
}


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

#define ll long long 
#define MAXN 100010
#define mod 1000000007

using namespace std;

int ans, n;

int main(){
	scanf("%d%d", &ans, &n);
	if (ans == n) cout << "Yes" <<endl;
	else cout <<"No" <<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<cstdio> 
#include<cstring>
char s[1000086] ; 
int main() { 
	int w ; 
	scanf("%s%d",s + 1,&w); 
	int len = strlen(s + 1); 
	for(int tmp = w,i = 1;i <= len;++ i) { 
		if(tmp % w == 0) printf("%c",s[i]); 
		tmp ++; 
	} 
	return 0; 
} 

Measured memory_bytes: 128
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]


N = int(input())

C = [0]*(N)
S = [0]*(N)
F = [0]*(N)
for i in range(1, N):
    C[i], S[i], F[i] = map(int, input().split())

dp = [0]*N
for i in range(1, N):
    dp[i] = S[i] + C[i]
    for x in range(1, i):
        sec = dp[x]
        if sec <= S[i]:
            dp[x] = S[i] + C[i]
        else:
            vol = (sec // F[i])
            if sec % F[i] > 0:
                vol += 1
            dp[x] = vol*F[i] + C[i]
for i in range(1, N):
    print(dp[i])
print(0)


Measured memory_bytes: 42224
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(43);

int x, n, ans = 1;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("rps2.in", "r", stdin);
	//freopen("rps2.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> x;
  ll t = 0;
  for(int i = 0; i < n; i++)
  {
    ll d;
    cin >> d;
    t += d;
    ans += (t <= x);
  }
  cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	int n, m;
	cin >> n >> m;
	int h[n + 1];
	for(int i = 1; i <= n; i++)
		cin >> h[i];
	map < int, set < int > > mp;
	for(int i = 0; i < m; i++)
	{
		int u, v;
		cin >> u >> v;
		mp[u].insert(v);
		mp[v].insert(u);
	}	
	int ans = 0;
	for(int i = 1; i <= n; i++)
	{
		bool o = true;
		for(auto z : mp[i])
		{
			if(h[i] <= h[z])
			{
				o = false;
				break;
			}
		}
		if(o)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 23156
A,B = map(int,input().split())
 

def getXOR(x):
  if x%4 == 0:
    return x
  elif x%4 == 1:
    return 1
  elif x%4 == 2:
    return x+1
  else:
    return 0


print(getXOR(A-1)^getXOR(B))



Measured memory_bytes: 3064
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	A = list(rli())
	currsum = sum(A)
	F = Counter(A)
	for _ in range(int(rl())):
		b, c = rli()
		sub, add = F[b]*b, F[b]*c
		F[c] += F[b] 
		F[b] = 0
		currsum += add - sub 
		print(currsum)
		
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 95080
T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    S = list(map(int, input()))
    
    for i in range(N-1, -1, -1):
        ai = A[i]
        if ai==0:
            continue
        top = ai.bit_length() - 1
        assert ai & 1<<top
        for j in range(i-1, -1, -1):
            if A[j] >> top & 1:
                A[j] ^= ai
    for a, c in zip(A[::-1], S[::-1]):
        if c==1 and a:
            break
    else:
        print("0")
        continue
    print("1")


Measured memory_bytes: 9148
#include<iostream>
#include<string>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)


int n, a, b, d1[100009], d2[100009]; vector<int> g[100009];
void dfs(int pos, int pre, int m) {

	//初回以外は距離を加算する。
	//両端からやる操作で使いまわすためmで管理。
	if (pre != -1) {
		if (m == 0) d1[pos] = d1[pre] + 1;
		if (m == 1) d2[pos] = d2[pre] + 1;
	}

	//隣接リストが空なら勝手に次にいけないので、あえて指定しなくても勝手に止まる。

	//posから行ける頂点へ
	for (int i : g[pos]) {

		//逆流防止
		if (i == pre) continue;


		dfs(i, pos, m);
	}
}
int main() {
	
	//入力
	cin >> n;

	//無向グラフなので両方に辺を張る
	for (int i = 1; i < n; i++) {
		cin >> a >> b; a--, b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	//フェネック側から探索
	dfs(0, -1, 0);

	//すぬけ側から探索
	dfs(n - 1, -1, 1);

	//全部の頂点について
	//どっちからいったほうが近いか数える。
	int c1 = 0, c2 = 0;
	for (int i = 0; i < n; i++) {
		if (d1[i] <= d2[i]) c1++;
		else c2++;
	}
	cout << (c1 > c2 ? "Fennec" : "Snuke") << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
//int 2×10の9乗
 
int main() {
  int n, l;
  cin >> n >> l;
  int ans=0;
  if(l<1-n){
      for(int i=1; i<n; i++) ans += i+l-1; 
  }
  else if(l>0){
      for(int i=2; i<=n; i++) ans += i+l-1;
  }
  else{
      for(int i=1; i<=n; i++) ans += i+l-1;
  }
  cout << ans << endl;
}

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



int32_t main()
{
    int n,h;
    cin>>n>>h;
    vector<int> a,b;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        a.push_back(x);
        b.push_back(y);
    }
    sort(rbegin(a),rend(a));
    vector<int> power;
    int ans=0;
    for(auto i:b)
    if(i>=a[0])power.push_back(i);
    int i=0;
    sort(rbegin(power),rend(power));
    while(h>0)
    {
        
        if(i>=int(power.size()))
        {
            ans+=(h+a[0]-1)/a[0];
            cout<<ans<<endl;
            return 0;
        }
        else
        {
            h-=power[i];
            ans++;
            if(h<=0)
            {
             cout<<ans<<endl;
             return 0;
            }
            i++;
        }
    }
}

Measured memory_bytes: 4832
n,m = map(int,input().split())
flag = [0]*(n+1)
for i in range(m):
  a = int(input())
  flag[a] = 1
num = 10**9+7
count = [0]*(n+1)
count[0] = 1
count[1] = 1 if flag[1]==0 else 0
for i in range(2,n+1):
  if flag[i]==0: count[i] = count[i-1] + count[i-2]
  count[i] = count[i]%num
print(count[n])


Measured memory_bytes: 7668
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cassert>
using namespace std;

int N;
vector<string> vec;
string s;

int solve() {

    std::sort(vec.begin(), vec.end());
    vec.erase(std::unique(vec.begin(), vec.end()), vec.end());

    return vec.size();
}

int main() {

    cin >> N;
    vec.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }
    
    cout << solve() << endl;


    return 0;
}

Measured memory_bytes: 9572
#include <stdio.h>

int main(void){

    int H = 0;
    int W = 0;
    int N = 0;

    scanf("%d", &H);
    scanf("%d", &W);
    scanf("%d", &N);

    if (H > W) {

        if (N % H == 0){

            N = N / H;
        } else {

            N = N / H + 1;
        }
    } else {

        if (N % W == 0){

            N = N / W;
        } else {

            N = N / W + 1;
        }
    }
    printf("%d\n", N);

    return 0;
}

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

typedef long long ll;

int n,mod;
ll ans;
char s[200005];
int pw[200005];
int suf[200005];
map<int,ll> mp;

int main(){

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

    cin>>n>>mod;
    cin>>s+1;
    pw[n]=1;
    mp[0]++;
    for(int i=n;i>=1;i--){
        pw[i-1]=pw[i]*10%mod;
        suf[i]=((s[i]-'0')*pw[i]+suf[i+1])%mod;
        mp[suf[i]]++;
    }
    if(mod==2||mod==5){
        for(int i=1;i<=n;i++){
            if((s[i]-'0')%mod==0)ans+=i;
        }
        cout<<ans<<endl;
        return 0;
    }
    for(int i=0;i<mod;i++){
        ans+=mp[i]*(mp[i]-1)/2;
    }
    cout<<ans<<endl;

    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

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

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


int main() {

    string s, t;
    cin >> s >> t;
    if (s[0] == t[2] && s[1] == t[1] && s[2] == t[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(_) for _ in input().split()]
dis = [0] * (n+1)
dis[0] = abs(a[0])
for i in range(1, n):
    dis[i] = abs(a[i] - a[i-1])
dis[n] = abs(a[n-1])
#print(dis)

total = 0
for i in dis:
    total += abs(i)
#print(total)

ans = [0] * n
ans[0] = total - (dis[0] + dis[1]) + abs(a[1])
for i in range(1, n-1):
    ans[i] = total - (dis[i] + dis[i+1]) + abs(a[i+1] - a[i-1])
ans[n-1] = total - (dis[n-1] + dis[n]) + abs(a[n-2])
#print(ans)
for i in ans:
    print(i)

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


int main(){
    ll n,k;
    cin >> n >> k;
    ll a[n];
    for(ll i=0;i<n;i++) cin >> a[i];
    for(ll i=0;i<n-k;i++){
        if(a[i]<a[i+k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 5192
let list_of_str s = let rec f i = if i >= String.length s then [] else s.[i] :: f (i+1) in f 0
let rec for_iter a b f = if a > b then [] else let x = f a in x :: for_iter (a+1) b f
let () =
  let s = Scanf.scanf "%s" list_of_str in
  for_iter 97 (97+25) (fun i -> s |> List.filter ((=) (char_of_int i)) |> List.length)
  |> List.fold_left (fun a b -> a + b mod 2) 0
  |> (fun x -> Printf.printf "%d\n" (x / 2))


Measured memory_bytes: 2520
package main

import "fmt"

func main() {
  var N int
  fmt.Scan(&N)
  
  n1 := N%10
  n10 := ((N-n1)%100)/10
  n100 := ((N-n1-n10*10)%1000)/100
  
  if n1 == 7|| n10 == 7 || n100 ==7 {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
}
  

Measured memory_bytes: 1756
#include<stdio.h>
#include<string.h>
#define MAX 100000
#define LEN 14
#define NIL -1

typedef struct{
  int parent;
  int left; //自分の子供かつ一番左のやつ
  int right; //すぐ右隣の兄弟
  char state[LEN]; //節点の種類
  int depth; //深さ
}node;

void setDepth(int, int);
void printChildren(int);

node t[MAX];

int main(){
  int n, k, c[MAX], index, root; //kは子供の数, cは子供の節点番号, indexは節点番号
  int i, j;

  scanf("%d", &n);

  //初期化
  for(i=0;i<n;i++){
    t[i].parent = t[i].left = t[i].right = NIL;
  }
  
  for(i=0;i<n;i++){
    scanf("%d", &index);

    scanf("%d", &k);
    if(k == 0) c[0] = NIL; //子供いないなら一番左の子をNILに
    for(j=0;j<k;j++){
      scanf("%d", &c[j]);
    }
    

    for(j=0;j<k;j++){
      /*
      if(j == k-1) printf("%d\n", c[j]);
      else printf("%d ", c[j]);
      */
      t[c[j]].parent = index; //親の設定
      if(j != k-1) t[c[j]].right = c[j+1]; //一番右の子じゃないならすぐ右隣の兄弟設定。c[k-1]が最右
    }

    t[index].left = c[0]; //一番左の子はc[0]
  }

  /*
  for(i=0;i<n;i++){
    printf("%2d: parent %2d: left %2d: right %2d\n", i, t[i].parent, t[i].left, t[i].right);
  }
  */
  for(i=0;i<n;i++){
    if(t[i].parent == NIL) root = i;
  }

  setDepth(root, 0);
  
  for(i=0;i<n;i++){
    if(t[i].parent == NIL) strcpy(t[i].state, "root"); //親がいないnodeがroot
    else if(t[i].left == NIL) strcpy(t[i].state, "leaf"); //左の子がいないnodeがleaf
    else strcpy(t[i].state, "internal node"); //それ以外中間node
    printf("node %d: parent = %d, depth = %d, %s, ", i, t[i].parent, t[i].depth, t[i].state);
    printChildren(i);
  }
  
  return 0;
}

//uは節点番号, dはuの深さ
void setDepth(int u, int d){
  t[u].depth = d;
  if(t[u].right != NIL) setDepth(t[u].right, d); //節点uが一番右じゃないとき、節点右にずらして深さそのまま
  if(t[u].left != NIL) setDepth(t[u].left, d+1); //節点uに子がいるとき、深さ1つ更新して下に
}

void printChildren(int u){
  int c; 
  c = t[u].left; //最初に一番左の子をcに設定

  printf("[");
  //子がいる間
  while(c != NIL){
    printf("%d", c);
    if(t[c].right != NIL) printf(", ");
    c = t[c].right;
  }
  printf("]\n");
}



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

int N, x;
bool rs[200000];

int main() {
  cin >> N >> x;
  if (x == 1 || x == 2*N-1) {
    cout << "No\n";
    return 0;
  }

  vector<int> a;
  if (N == 2) {
    a.push_back(1);
    a.push_back(2);
    a.push_back(3);
  }
  else {
    if (x != 2*N-2) {
      // (x+2) (x-1) x (x+1)
      rs[x] = rs[x-1] = rs[x+1] = rs[x+2] = true;
      int h = 1;
      for (int i=0; i<N-3; i++) {
        while (rs[h]) h++;
        a.push_back(h++);
      }
      a.push_back(x+2);
      a.push_back(x-1);
      a.push_back(x);
      a.push_back(x+1);
      for (int i=0; i<N-2; i++) {
        while (rs[h]) h++;
        a.push_back(h++);
      }
    }
    else {
      // (x-2) (x) (x+1) (x-1)
      rs[x] = rs[x+1] = rs[x-1] = rs[x-2] = true;
      int h = 1;
      for (int i=0; i<N-3; i++) {
        while (rs[h]) h++;
        a.push_back(h++);
      }
      a.push_back(x-2);
      a.push_back(x);
      a.push_back(x+1);
      a.push_back(x-1);
      for (int i=0; i<N-2; i++) {
        while (rs[h]) h++;
        a.push_back(h++);
      }
    }
  }
  cout << "Yes\n";
  for (int x : a) cout << x << "\n";
  return 0;
}


Measured memory_bytes: 2420
A = 'abcdefghijklmnopqrstuvwxyz'
S = input();
if len(S)<26:
    print(S+sorted(set(A)-set(S))[0])
elif S==A[::-1]:
    print(-1); exit()
else:
    _S = S; ans = []
    while len(S)>0:
        ans.append(S[-1]); S = S[:-1]
        ans.sort()
        for a in ans:
            if S[:-1] + a > _S:
                print(S[:-1] + a); exit()

Measured memory_bytes: 9060
#include<iostream>
using namespace std;
int main()
{
	int a,b,s=0;
	cin>>a>>b;
	for(int i=1;i<=b;i++)
	{
		int c;
		cin>>c;
		s+=c;
	}
	if(s>=a)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
 } 

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

seen = set()

kago = [False for _ in range(1000001)]
double = set()
for i in range(N):
    if a[i] in seen:
        double.add(a[i])
        continue
    seen.add(a[i])
    if kago[a[i]] == True:
        continue
    
    now = a[i]*2
    while now<1000001:
        kago[now] = True
        now += a[i]

answer = 0
for i in range(N):
    if kago[a[i]] == True:
        continue
    if a[i] in double:
        continue
    answer += 1
    
print(answer)

Measured memory_bytes: 41004
# -*- coding: utf-8 -*-
import sys
from collections import Counter
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    n=int(input())
    S=[input() for i in range(n)]
    cc=[Counter(a) for a in S]
    a=ord('a')
    ans=[]
    for i in range(26):
        s=chr(a+i)
        tmp=INF
        for c in cc:
            if not s in c:
                break
            else:
                tmp=min(tmp,c[s])
        else:
            ans.append((s,tmp))
    for row in ans:
        print(row[0]*row[1],end='')
    print('')

if __name__ == '__main__':
    main()


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


void main()
{
  auto ab = readln.chomp.split.to!(int[]);
  auto s = readln.chomp.split("-");
  auto f = false;
  if (s.length == 2 && s[0].length == ab[0] && s[1].length == ab[1]) {
    f = true;
  }

  writeln(f ? "Yes" : "No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000007
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr(a,n)           for(ll i=0;i<n;i++){ cin>>a[i]; }
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b,ll m) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= m;} b >>= 1; x *= x; x %= m;} return p % m;}
using namespace std;
# define INF 1e15
struct lex_compare {
    bool operator() (pp(ll) p1, pp(ll) p2){
        return p1.ff >= p2.ff;
    }
};




int main(){
    FIO;
    ll n; cin >> n;
    string s; cin >> s;
    ll st = 0, en = n-1;

    ll c1 = 0, c2 = 0;
    for(ll i = 0;i<n;i++){
        if(s[i] == 'R')c1++;
        else c2++;
    }
    ll c3 = 0;
    forn(i,0,c1){
        if(s[i] == 'W')c3++;
    }
    ll c4 = 0;
    for(ll i = c1+1;i<n;i++){
        if(s[i] == 'R')c4++;
    }
    ll ans = (min(c3,c4)) + abs(c3-c4);
    cout << ans << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  int M;
  int L = 1;
  int i = 0; // カウンタ変数
  while (i >= 0) {
    L *= 10;
    M = (N % L - N % (L / 10)) / (L / 10);
    sum += M;
    if (M == 0){
    break;
    }
  i++;
  }
  
  if (N % sum == 0){
   cout << "Yes" << endl;
  }
  else {
   cout << "No" << endl; 
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  #define int long long
  int X,Y,A,B,C,D;
  
  cin >> A >> B >> C >> D;
  X = ceil((double)C / (double)B);
  Y = ceil((double)A / (double)D);
  if(X<=Y){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}




Measured memory_bytes: 3740
n,m=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
x=[]
y=[]
l=[]
p=[]

for i in range(n):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
    
for j in range(m):
    ci,di=map(int,input().split())
    c.append(ci)
    d.append(di)
    
for i in range(n):
    for j in range(m):
        x.append(abs(a[i]-c[j]))
        y.append(abs(b[i]-d[j]))
        l.append(x[j+i*m]+y[j+i*m])
    
    p.append(l.index(min(l))+1)   
    l=[]
    #x=[]
    #y=[]
    
for i in range(n):
    print(p[i])

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

public class Main {
	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String word;
		try {
			word = reader.readLine();
			int num = Integer.parseInt(word);
			int ans = num * num * num;
			System.out.println(ans);
		} catch (IOException e) {
			// TODO ????????????????????? catch ????????????
			e.printStackTrace();
		} finally {
			try {
				reader.close();
			} catch (IOException e) {
				// TODO ????????????????????? catch ????????????
				e.printStackTrace();
			}
		}
		
		
	}
}

Measured memory_bytes: 24408
#include<stdio.h>
int main(void)
{
	int e1,e2,e3,e4;
	scanf("%d %d %d %d",&e1,&e2,&e3,&e4);
	if(e1==e2&&e3==e4){
	printf("yes\n");
	}
	else	if(e1==e3&&e2==e4){
	printf("yes\n");
	}
	else	if(e1==e4&&e2==e3){
	printf("yes\n");
	}
	else	if(e1==e2&&e3==e4){
	printf("yes\n");
	}
	else{
	printf("no\n");
	}
	return 0;
	}


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

public class Main {

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

		int a[] = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}

//		Vector<Integer> colorValue = new Vector<Integer>();
		int colorValue[] = new int[n];
		Arrays.fill(colorValue, Integer.MAX_VALUE);

//		colorValue.add(a[n - 1]);
		colorValue[0] = a[n - 1];
		int tail = 0;

		for(int i = n - 2; i >= 0; i--){
			//Collections.sort(colorValue);

			if(a[i] >= colorValue[tail]){
				tail++;
				colorValue[tail] = a[i];
			}
			else {
				int tmpIndex = Arrays.binarySearch(colorValue, a[i] - 1);
//				System.out.println("tmpIndex "+tmpIndex);
				if(tmpIndex < 0){
					tmpIndex = -tmpIndex - 1;
				}
				for(int j = tmpIndex; j <= tail; j++){
					if(colorValue[j] > a[i]){
						colorValue[j] = a[i];
						break;
					}
				}
			}

			//debug
//			for(int j = 0; j <= tail; j++){
//				System.out.print(colorValue[j]+" ");
//			}
//			System.out.println();
		}

		System.out.println(tail + 1);
	}

}


Measured memory_bytes: 49480
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] s = Console.ReadLine().Split(' ');
		long[] n = new long[s.Length];
		for(int i = 0; i < s.Length; i++) {
			n[i] = long.Parse(s[i]);
		}
		
		while(n[0] != 0 || n[1] != 0) {
			for(int i = 0; i < n[0]; i++){
				for(int j = 0; j < n[1];j++){
					Console.Write("#");
				}
				Console.WriteLine();
			}
			
			Console.WriteLine();
			
			s = Console.ReadLine().Split(' ');
			for(int i = 0; i < s.Length; i++) {
				n[i] = long.Parse(s[i]);
			}
		}
		
	}
}

Measured memory_bytes: 8924
import math
a,b,x=[int(s) for s in input().split()]
if x>a*a*b/2:
  h=2*(a*a*b-x)/(a*a)
  print(math.degrees(math.atan(h/a)))
else:
  k=2*x/(a*b)
  print(math.degrees(math.atan(b/k)))
  

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int p=1;
    int sum=0;
    int x;
    cin>>x;
    while(1){
        sum+=p;
        if(sum>=x){
            cout<<p<<endl;
            return 0;
        }
        p++;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int x1, y1, x2, y2;
    scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
    int x3 = x2-(y2-y1);
    int y3 = y2+(x2-x1);
    int x4 = x3-(y3-y2);
    int y4 = y3+(x3-x2);
    printf("%d %d %d %d",x3,y3,x4,y4);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

ll f(ll h) {
	if(h == 1) return 1;
	else return f(h / 2) * 2 + 1;
}

void solve() {
	ll H; cin >> H;
	cout << f(H) << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	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;

int cnt[50][3];
int main() {
	int n, m; cin >> n >> m;
	rep(i, n) {
		string s; cin >> s;
		for (char c : s) {
			switch (c) {
			case 'W':cnt[i][0]++; break;
			case 'B':cnt[i][1]++; break;
			case 'R':cnt[i][2]++; break;
			}
		}
	}
	int ans = INT_MAX;
	for (int i = 0; i < n - 2; i++) {
		for (int j = i + 1; j < n - 1; j++) {
			int c = 0;
			for (int k = 0; k <= i; k++)c += cnt[k][1] + cnt[k][2];
			for (int k = i + 1; k <= j; k++)c += cnt[k][0] + cnt[k][2];
			for (int k = j + 1; k < n; k++)c += cnt[k][0] + cnt[k][1];
			ans = min(ans, c);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3212
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=500001;
P a[maxn],b[maxn];
int main(){
  ll h,w;
  cin>>h>>w;
  ll res=h*w;
  
  for(ll i=1LL;i<=h-1LL;i++){
      ll a,b,c;
      a=w*i;
      b=(h-i)*(w/2LL);
      c=(h-i)*(w-w/2LL);
      res=min(res,max(max(a,b),c)-min(min(a,b),c));
      if(h>=3LL){
        a=w*i;
        b=w*((h-i)/2LL);
        c=w*(h-i-(h-i)/2LL);
        res=min(res,max(max(a,b),c)-min(min(a,b),c));
      }
  }
  swap(h,w);
  for(ll i=1LL;i<=h-1LL;i++){
      ll a,b,c;
      a=w*i;
      b=(h-i)*(w/2LL);
      c=(h-i)*(w-w/2LL);
      res=min(res,max(max(a,b),c)-min(min(a,b),c));
      if(h>=3LL){
        a=w*i;
        b=w*((h-i)/2LL);
        c=w*(h-i-(h-i)/2LL);
        res=min(res,max(max(a,b),c)-min(min(a,b),c));
      }
  }
  cout<<res<<endl;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

int main()
{
  ll k;
  string s;
  cin >> k >> s;
  
  ll rcnt = 0;
  repl(i, k)
  {
    if(s[i] == 'R') rcnt++;
  }

  ll ans = 0;
  repl(i, rcnt)
  {
    if(s[i] == 'W') ans++;
  }

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

Measured memory_bytes: 3728
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#define all(x) (x).begin(), (x).end()

using namespace std;

struct Event {
    int s, type, x;  
    bool operator<(const Event &rhs) const {
        if (s == rhs.s) return type < rhs.type;
        return s < rhs.s;
    }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<Event> E; 
    for(int i = 0; i < N; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        E.push_back((Event){s - x, 1, x});
        E.push_back((Event){t - x, -1, x});    
    }
    sort(all(E));
    
    vector<int> D(Q);
    for(int i = 0; i < Q; i++) {
        cin >> D[i];
    }
    
    map<int, int> xs; // x, cnt
    auto prev = D.begin();
    for(int i = 0; i < E.size(); i++) {
        
        auto now = lower_bound(all(D), E[i].s);
        while(prev < now) {
            if (xs.size() == 0) {
                cout << -1 << endl;
            } else {
                cout << (*xs.begin()).first << endl;
            }
            prev++;
        }
        
        if (E[i].type == -1) {
            xs[E[i].x]--;
            if (xs[E[i].x] == 0) {
                xs.erase(E[i].x);
            }
        } else {
            xs[E[i].x]++;
        }
    }
    while(prev < D.end()) {
        if (xs.size() == 0) {
            cout << -1 << endl;
        } else {
            cout << (*xs.begin()).first << endl;
        }
        prev++;
    }
    
    
    return 0;
}


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

int main(){
  int N; cin >> N;
  int odd=1;
  int three=1;
  for(int i=0; i<N; i++){
    int A; cin >> A;
    if(A%2==0)odd*=2;
    three*=3;
  }
  cout << three-odd << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

 
int main() {
    SPEED;
    cout.precision(8);

    ll m,n;
    cin>>m>>n;
    if(m<=n){
        for(ll i=0;i<n;i++) cout<<m;
    }
    else{
        for(ll i=0;i<m;i++) cout<<n;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, m = map(int, input().strip().split())
  counts = numpy.zeros(n).astype(numpy.int)
  flags = numpy.zeros(n).astype(numpy.int)
  for _ in range(m):
    p, s = input().strip().split()
    p = int(p)
    if s == 'WA' and flags[p-1] != 1:
      counts[p-1] += 1
    if s == 'AC':
      flags[p-1] = 1
  print(numpy.sum(flags), numpy.sum(counts * flags))

if __name__=='__main__':
  main()

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

#define loop(i,a,b) for(ll i=a; i<b; i++)
#define rloop(i,a,b) for(ll i=a; i>b; i--)
#define all(var) var.begin(), var.end()
#define eloop(var) for(auto elem : var)
#define debug(x) cerr<<#x<<" ----> "<<x<<endl;
#define PB push_back
#define MP make_pair
#define tt ll TT; cin>>TT; while(TT--)
#define F first
#define S second
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define MOD 1000000007
#define MAX 100005
typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // tt
    {
        char ch;
        cin>>ch;
        ch++;
        cout<<ch;
    }
    return 0;
}

Measured memory_bytes: 256
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.lang.reflect.Array;
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		new CGL_2B().doIt();
	}

	class CGL_2B{

		double cross(Point2D p1,Point2D p2){
			return p1.getX()*p2.getY()-p1.getY()*p2.getX();
		}
		double area(ArrayList<Point2D> points){
			double ret=0.0;
			for(int i=0; i<points.size(); ++i){
				Point2D p1=points.get(i), p2=points.get((i+1)%points.size()); 
				ret+=cross(p1, p2); 
			}
			return Math.abs(ret)/2.0;
		}
		void doIt(){
			int n = in.nextInt();
			ArrayList<Point2D> list= new ArrayList<Point2D>();
			for(int i=0;i<n;i++)list.add(new Point2D.Double(in.nextDouble(),in.nextDouble()));
			System.out.printf("%.1f\n",area(list));
		}
	}


}

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

int main() {
  int x,a,b;cin>>x>>a>>b;
  if(a>=b) cout << "delicious" << endl;
  else if(a<b&&b-a>=x+1) cout << "dangerous" << endl;
  else cout << "safe" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));


int main() {

	int n, m;
	cin >> n >> m;

	int k, a, ans = 0;
	map<int, int> cnt;

	rep(i, 0, n) {
		cin >> k;
		rep(i, 0, k) {
			cin >> a;
			cnt[a]++;
			if (cnt[a] == n) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    V<> c(4,0);
    REP(i,n){
        string s; cin >> s;
        if(s == "AC") c[0]++;
        if(s == "WA") c[1]++;
        if(s == "TLE") c[2]++;
        if(s == "RE") c[3]++;
    }
    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;
}

Measured memory_bytes: 3652
package main

import (
	"fmt"
)

func main() {
	var (
		a, b, c, x int
	)
	fmt.Scan(&a, &b, &c, &x)

	res := 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if 500 * i + 100 * j + 50 * k == x {
					res++;
				}
			}
		}
	}

	fmt.Println(res)
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
#include <cassert>
#include <memory>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
typedef vector<tint> vtint;
typedef vector<vint> vvint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//↑templete
signed main(){
    
    char a;
    cin>>a;
    if('a'<= a && a<='z')
        cout<<"a"<<endl;
    else
        cout<<"A"<<endl;

    return 0;
}


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

res = []
a = 26
while N > 0:
    x = N%a
    if x == 0:
        res.append(26)
        N -= a
        N //= a
    else:
        res.append(x)
        N //= a

res.reverse()
res = [chr(0x60+r) for r in res]
print("".join(res))

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long    // %d=>%lld
#define pb push_back
#define INF 100000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;

const int MAX_n = 100;
int n,s[MAX_n];

int ans;



signed main(){

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

    for(int i = 0;i < n;i++){
        ans=ans+s[i];
    }
    if(ans%10 != 0){
        printf("%d\n", ans);
        return 0;
    }

    int s_non10[MAX_n];
    int si=0;

    for(int i = 0;i < n;i++){
        if(s[i] % 10 != 0){
            s_non10[si]=s[i];
            si++;
        }
    }
    if(si == 0){
        printf("0\n");
        return 0;
    }
    SORT(s_non10,si);
    printf("%d\n", ans-s_non10[0]);



    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def solve(a):
    s, res = 0, 0
    for i, ai in enumerate(a):
        ss = s
        ss += ai
        if ss == 0:
            ss = 1 if s < 0 else -1
            res += 1
        else:
            if s < 0 and ss < 0:
                res += abs(ss) + 1
                ss = 1
            if s > 0 and ss > 0:
                res += abs(ss) + 1
                ss = -1
        s = ss
    return res

n = int(raw_input())
a = map(int, raw_input().split()) 

if a[0] == 0:
    a[0] = 1
    ans = solve(a) + 1
    a[0] = -1
    ans = min(ans, solve(a) + 1)
else:
    ans = solve(a)
    tmp = abs(a[0]) + 1
    a[0] = 1 if a[0] < 0 else -1
    ans = min(ans, solve(a) + tmp)
print ans



Measured memory_bytes: 11248
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
a = [LIST() for _ in range(2)]
ans = 0
for i in range(n): #下に移動するとき
    tmp = 0
    for j in range(i + 1):
        tmp += a[0][j]
    tmp += a[1][i]
    for j in range(i + 1, n):
        tmp += a[1][j]
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 61292
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll H,W;
    cin >> H >> W;
    ll c[10][10];
    ll i,j,k;
    for(i=0;i<10;i++){
        for(j=0;j<10;j++){
            cin >> c[i][j];
        }
    }
    for(k=0;k<10;k++){
        for(i=0;i<10;i++){
            for(j=0;j<10;j++){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    ll a;
    ll ans=0;
     for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                cin >> a;
                if(a>=0)ans+=c[a][1];
            }
        }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
const int _B = 131072;
char buf[_B];
int _bl = 0;
inline void flush() {
	fwrite(buf, 1, _bl, stdout);
	_bl = 0;
}
__inline void _putchar(char c) {
	if(_bl == _B) flush();
	buf[_bl++] = c;
}
inline void print(LL x, char c) {
	static char tmp[20];
	int l = 0;
	if(!x) tmp[l++] = '0';
	else {
		while(x) {
			tmp[l++] = x % 10 + '0';
			x /= 10;
		}
	}
	for(int i = l - 1; i >= 0; i--) _putchar(tmp[i]);
	_putchar(c);
}
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int gcd(int a, int b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	int n;
	cin >> n;
	cout << 360 / gcd(n, 360) << endl;
}






Measured memory_bytes: 3640
def main():
    n = int(input().strip())
    l = list(map(int, input().split()))
    stack = [0]*n

    totstack = 0
    for i in range(n-1):
        totstack += l[n-i-1]
        stack[n-i-2] = totstack

    tot = 0
    for i in range(n):
        tot += (l[i] * (stack[i] % (10 ** 9 + 7))) % (10 ** 9 + 7)

    print(tot % (10 ** 9 + 7))


if __name__ == "__main__":
    main()



Measured memory_bytes: 31908
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	char buf[21],s[21];
	int i,p,cnt,n;
	scanf("%s",buf);
	n=strlen(buf);
	p=0;
	for(i=0;i<n;i++)	{
		if(p%2==0)	{
			if(buf[i]=='A')	{
				s[p]=buf[i];
				p++;
			}
		}
		else {
			if(buf[i]=='Z')	{
				s[p]=buf[i];
				p++;
			}
		}
	}
	if(p%2==1)	{
		p--;
	}
	s[p]='\0';
	if(p==0)	{
		printf("-1\n");
	}
	else {
		printf("%s\n",s);
	}
	return 0;
}


Measured memory_bytes: 948