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


public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {

		new AOJ1187();
		
	}

	class AOJ1187{
		int all_time,all_team,all_problem,all_submit;
		public AOJ1187() {
			while(true){
				all_time = in.nextInt();
				all_team = in.nextInt();
				all_problem = in.nextInt();
				all_submit = in.nextInt();
				ArrayList<AOJTeam> list = new ArrayList<AOJTeam>();
				
				for(int i=0;i<all_team;i++)list.add(new AOJTeam(i));
				
				if(all_time+all_team+all_problem+all_submit==0)break;
				for(int i=0;i<all_submit;i++){
					int m = in.nextInt(),t = in.nextInt(),p = in.nextInt(),j = in.nextInt();
					list.get(t-1).doIt(m, p, j);
				}
				Collections.sort(list);
				
//				for(int i=0;i<list.size();i++)System.out.println(list.get(i));
				System.out.print(list.get(0).num);
				for(int i=1;i<list.size();i++){
					if(list.get(i-1).accept==list.get(i).accept&&
							list.get(i-1).time==list.get(i).time)System.out.print("=");
					else System.out.print(",");
					System.out.print(list.get(i).num);
				}
				System.out.println();
			}
		}
		
		class AOJTeam implements Comparable<AOJTeam>{
			int time;//過ぎた時間
			int num;//チーム番号
			int accept;//正解数
			int[] cnt;//不正解した回数をカウント
			public AOJTeam(int t){//初めて呼び出される
				time = 0;
				num = t+1;
				accept = 0;
				cnt = new int[all_problem+1];
			}
			
			void doIt(int m,int p,int j){//経過時間,問題番号,判定結果
				if(j==0){//AC
					time+=cnt[p]*20+m;
					accept++;
				}else{//WA
					cnt[p]++;
				}
			}
			
			public String toString(){
				return "num= "+num+" "+accept;
			}

			public int compareTo(AOJTeam o) {
				if(this.accept>o.accept)return -1;
				else if(this.accept<o.accept)return 1;
				else if(this.time<o.time)return -1;
				else if(this.time>o.time)return 1;
				else if(this.num>o.num)return -1;
				else if(this.num<o.num)return 1;
				return 0;
			}
		}
	}

	class problem_A{
		public problem_A() {
			//			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			int[] list = new int[n];
			for(int i=0;i<n;i++)list[i] = in.nextInt();
			Arrays.sort(list);

		}
	}


}

Measured memory_bytes: 60784
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

#include <iostream>
#include <queue>
#include <vector>
using namespace std;

using i64 = long long;

struct Graph {
  struct edge {
    int to;
    i64 cap;
    i64 rev;
  };

  int n;
  vector<vector<edge>> edges;

  Graph(int N) {
    n = N;
    edges.resize(n, vector<edge>());
  }

  int size() const { return n; }

  vector<edge> &operator[](int v) { return edges[v]; }
};

struct Dinic {
  int N;
  vector<int> level;
  vector<int> itr;
  Graph G;

  Dinic(int n) : G(n) { N = n; }

  void add_edge(int from, int to, i64 cap, i64 rev_cap) {
    G[from].push_back({to, cap, (int)G[to].size()});
    G[to].push_back({from, rev_cap, (int)G[from].size() - 1});
  }

  bool g_level(int s, int t) {
    level.assign(N, -1);
    queue<int> que;
    que.push(s);
    level[s] = 0;
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (auto &e : G[v]) {
        if (e.cap > 0 && level[e.to] == -1) {
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
    return level[t] >= 0;
  }

  i64 dfs(int v, int t, i64 f) {
    if (v == t) return f;

    for (int &i = itr[v]; i < G[v].size(); i++) {
      auto &e = G[v][i];
      if (e.cap > 0 && level[e.to] > level[v]) {
        i64 mi_f = dfs(e.to, t, min(f, e.cap));
        if (mi_f > 0) {
          e.cap -= mi_f;
          G[e.to][e.rev].cap += mi_f;
          return mi_f;
        }
      }
    }
    return 0;
  }

  i64 max_flow(int s, int t) {
    i64 result = 0;
    i64 flow;
    while (g_level(s, t)) {
      itr.assign(N, 0);
      while ((flow = dfs(s, t, 1e9)) > 0) result += flow;
    }
    return result;
  }
};

/*
checked
    http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2723921#1
*/

int N,M;

string U;

i64 A[505];

i64 S[1010];
i64 T[1010];
i64 B[1010];

i64 cost[505][505];

i64 f[505];


int main() {

  cin >> N >> M;
  cin >> U;
  for(int i = 0;i < N;i++) {
    if(U[i] == 'R') f[i] = 1;
    else f[i] = -1;
  }
  for(int i = 0;i < N;i++) cin >> A[i];
  for(int j = 0;j < M;j++) cin >> S[j] >> T[j] >> B[j];

  for(int j = 0;j < M;j++) {
    S[j]--;
    T[j]--;
    cost[min(S[j], T[j])][max(S[j], T[j])] += B[j];
  }

  Dinic pd(N + 10);
  int s = N;
  int t = N + 1;

  for(int i = 0;i < N;i++) {
    if(f[i] == 1) {
      pd.add_edge(s, i, 0, 0);
      pd.add_edge(i, t, A[i], 0);
    }
    else {

      pd.add_edge(s, i, A[i], 0);
      pd.add_edge(i, t, 0, 0);
    }
    for(int j = i + 1;j < N;j++) {
      if(cost[i][j] > 0) {
        pd.add_edge(j, i, cost[i][j], 0);
      }
    }
  }

  cout << pd.max_flow(s, t) << endl;
}



Measured memory_bytes: 4420
# -*- coding: utf-8 -*-
def normal_form(n, base='', e=1, l='abcdefghij'):
    if n == 1:
        for i in range(e):
            print(base + l[i])
        return
    
    for i in range(e-1):
        normal_form(n-1, base + l[i], e)
    normal_form(n-1, base + l[e-1], e+1)


n = int(input())
normal_form(n)


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

int main() {
	int n, m;
	cin>>n>>m;
	vector<int> A(m);
	int sum=0;
	for(int i=0;i<m;i++)
	{
		cin>>A[i];
		sum+=A[i];
	}
	if(sum>n)
	cout<<"-1\n";
	else
	cout<<n-sum<<endl;
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int c; cin >> c; n -= c;
    }
    cout << max(-1, n) << "\n";
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	int a, b;

	std::cin >> a >> b;

	for (size_t i = 0; i < 100000; i++)
	{
		if (int(i * 0.08) == a && int(i * 0.10) == b) {
			std::cout << i << std::endl;
			return 0;
		}
	}

	std::cout << -1 << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int h, w;
    while(cin >> h >> w){
        if(w==0||h==0)
            break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(i%2==0)
                    if(j%2==0)
                        cout << "#";
                    else
                        cout << ".";
                else
                    if(j%2==1)
                        cout << "#";
                    else
                        cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
}


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

int main()
{
	while (true)
	{
		int n, r;
		scanf("%d%d", &n, &r);
		if (n == 0 && r == 0) break;
		std::vector<int> cards(n);
		for (int i{}; i < n; i++) cards[i] = i + 1;

		for (int r_i{}; r_i < r; r_i++)
		{
			int p, c;
			scanf("%d%d", &p, &c);
			for (int c_i{}; c_i < c; c_i++)
				for (int p_i{n - p - c_i}; p_i < n - 1 - c_i; p_i++)
					std::swap(cards[p_i], cards[p_i + 1]);
		}
		printf("%d\n", cards.back());
	}

	return 0;
}


Measured memory_bytes: 3144
s = list(input())
n = len(s)
s1 = s[:int((n-1)/2)]
s2 = s[int((n+3)/2-1):]

def isk(st):
    return st == st[::-1]

print("Yes" if (isk(s) and isk(s1) and isk(s2)) else "No")

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
 
	int h[(int)2e5+1];
 
int main(){
    int n, k;
    long long s=0;
    cin >> n >> k;
    for(int i=1; i <= n; i++)
        cin >> h[i];
    sort(h, h + n + 1);
    int a;
    a = n - k;
    for(int i = 1; i <= a; i++){
        s = s + h[i];
    }
    cout << s;

    return 0;
}

	

		


Measured memory_bytes: 1024
// https://atcoder.jp/contests/abc132/tasks/abc132_a

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

int main() 
{
    map<char, int> mp;
    for (int i=0; i<4; i++)
    {
        char x;
        cin >> x;
        mp[x]++;
    }
    bool y = true;
    for (map<char, int>::iterator it = mp.begin(); it != mp.end(); it++)
        if (it->second != 2)
            y = false;
    cout << (y?"Yes":"No");
    return 0;
}

Measured memory_bytes: 892
S = input()
ans = [[0] * 13 for _ in range(len(S))]
MOD = 10 ** 9 + 7
if S[0] == "?":
    for i in range(10):
        ans[0][i] = 1
else:
    ans[0][int(S[0])] = 1

for i, s in enumerate(S):
    if i == 0:
        continue
    if s == "?":
        for n in range(10):
            for j in range(13):
                ans[i][(j * 10 + n) % 13] += ans[i - 1][j]
                ans[i][(j * 10 + n) % 13] %= MOD
    else:
        for j in range(13):
            ans[i][(j * 10 + int(s)) % 13] = ans[i - 1][j]

print(ans[-1][5])


Measured memory_bytes: 61916
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int N, now, sum = 0;
  cin >> N;
int h[N];
  
  for(int i = 0;i < N;i++) cin >> h[i];
  
now = h[0];    
  
  for(int i = 1;i < N;i++){
  if(now > h[i]){
  sum += now - h[i];
  now = h[i];
  }
  else now = h[i]; 
  }   
    
  cout << sum + h[N - 1] << endl;
  return 0;
  
}

Measured memory_bytes: 256
import math

N = int(input())
X = [int(i) for i in input().split()]

g = sum(X)/N

g1 = math.floor(g)
g2 = g1 + 1

ans1 = 0
ans2 = 0

for i in range(N):
    ans1 += (X[i] - g1)**2
    ans2 += (X[i] - g2)**2

print(min(ans1, ans2))

Measured memory_bytes: 3064
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>8 or b>8)cout<<":(";
    else cout<<"Yay!";
system("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define F first
#define S second
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define maxp 22
#define EPS (ld)(1e-18)
#define mod (int)(1e9+7)
#define N (int)(1e5+1)


int main (){
fastio;

int x,y;
cin>>x>>y;

if(x*2<=y && y<=x*4 && y%2==0)
    cout<<"Yes"<<endl;
else
    cout<<"No";



}


Measured memory_bytes: 3648
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,a,b = na()

if a == 0 and b == 0:
    print(0)
    exit()

p = n//(a+b)
q = n%(a+b)

print(a*p+min(a,q))

Measured memory_bytes: 3064
N = int(input())
A = [int(x) for x in input().split()]

def F(A, sgn):
  cnt_operation = 0
  cum = 0
  for a in A:
    sgn *= (-1)
    cum += a
    if cum * sgn > 0:
      continue
    if sgn > 0:
      cnt_operation += (1 - cum)
      cum = 1
    else:
      cnt_operation += (cum + 1)
      cum = -1
  return cnt_operation

answer = min(F(A,1), F(A,-1))
print(answer)

Measured memory_bytes: 14332
#include<bits/stdc++.h>
#define inf 2147283647
using namespace std;
string f(string x)
{
    string a;
    int l=x.size();
    for(int i=l-1;i>=0;i--)
        a+=x[i];
    return a;
}
int main(){
    string a,b;
    cin>>a>>b;
    if(a==f(b))
        cout<<"YES";
    else
    {
            cout<<"NO";
    }
    
    return 0;
}

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

int main(void) 
{
	int i, n;
	double x[100], y, tmp, p0, p1, p2, p3;
	p0 = p1 = p2 = p3 = 0;

	scanf("%d", &n);
	for (i = 0; i < n; i++) 
	{
		scanf("%lf", x + i);
	}

	for (i = 0; i < n; i++) 
	{
		scanf("%lf", &y);
		tmp = fabs(*(x + i) - y);
		p0 < tmp && (p0 = tmp);
		p1 += tmp;
		p2 += tmp * tmp;
		p3 += tmp * tmp * tmp;
	}

	printf("%f\n%f\n%f\n%f\n", p1, sqrt(p2), cbrt(p3), p0);
	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

ll bin[50];
ll sum[50];

int main()
{
	memset(bin, 0LL, sizeof(bin));
	memset(sum, 0LL, sizeof(sum));
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll N; cin >> N;

	rep (i, 50){
		bin[i] = (1LL<<i);
		sum[i] = (1LL<<i);
	} // end rep
	rep (i, 50){
		if (i % 2 != 0){
			sum[i] *= -1LL;
		} // end if
	} // end rep

	for (int i = 0; i < 50 - 2; i += 2){
		sum[i+2] += sum[i];
	} // end for
	for (int i = 1; i < 50 - 1; i += 2){
		sum[i+2] += sum[i];
	} // end for

	string s(50, '0');
	while(N != 0LL){
		if (N > 0LL){
			for (int i = 0; i < 50 - 2; i += 2){
				if (N > sum[i]) continue;
				s[i] = '1';
				N -= bin[i];
				break;
			} // end for
		}else
		if (N < 0LL){
			for (int i = 1; i < 50 - 1; i += 2){
				if (N < sum[i]) continue;
				s[i] = '1';
				N += bin[i];
				break;
			} // end for
		} // end if
	} // end while

	reverse(ALL(s));
	while(s.length() != 1 && s[0] == '0'){
		s = s.substr(1);
	} // end while

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var T = int.Parse(inputs[1]);
        var min = int.MaxValue;
        for (int i = 0; i < N; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            var c = int.Parse(inputs[0]);
            var t = int.Parse(inputs[1]);
            if (t > T)
            {
                continue;
            }

            min = Math.Min(c, min);
        }

        if (min == int.MaxValue)
        {
            Console.WriteLine("TLE");
        }
        else
        {
            Console.WriteLine(min);
        }
    }
}



Measured memory_bytes: 13140
#include<iostream>
#include<string>

int main(){
    std::string tile;
    std::cin >> tile;
    char p = '-';
    int sum = 0;
    for(int i=0;i<tile.size();i++){
	if(p != tile[i]){
	    p = tile[i];
	}else{
	    sum++;
	    if(tile[i] == '0'){
		p = '1';
	    }else{
		p = '0';
	    }
	}
    }
    std::cout << sum << std::endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int64 cnt = 0;
  REP(i, S.size()) {
    if (S[i] == 'o') cnt++;
  }
  if (cnt + 15-S.size() >= 8) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
package main

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

func solve() {
	n := scanInt()
	// a := []int{}
	ans := [2*10*10*10*10*10 + 3]int{}
	for i := 0; i < n-1; i++ {
		ans[scanInt()]++
	}
	// for i := 0; i < n; i++ {
	// 	for j := 0; j < i; j++ {
	// 		if a[j] > a[i] {

	// 		}
	// 	}
	// }
	for i := 1; i < n+1; i++ {
		fmt.Println(ans[i])
	}
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}

func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	p := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}

		nums[i], nums[j] = nums[j], nums[i]
		*ret = append(*ret, makeCopy(nums))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}
func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 6416
import java.io.PrintStream;
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        doit(args, new Scanner(System.in), System.out);
    }

    static void doit(String[] args, Scanner scanner, PrintStream out) {
        while (scanner.hasNext()) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int result = (int) Math.log10(a + b) + 1;
            out.println(result);
        }
    }
}

Measured memory_bytes: 12000
#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 <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
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;
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=100050;
//↑templete
signed main(){

	int A, B;
	cin>>A>>B;
	int now=1;
	for(int i=0;i<=100;i++){
		if(now>=B){
			cout<<i<<endl;
			return 0;
		}
		else
			now+=A-1;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, m, Q, mod, A[N], B[N], C[N], dsu[N], can[2][N];
inline int getid(int u, int p, int q) { return (u - 1) * 6 + p * 3 + q; }
int Find(int x) { return x == dsu[x] ? x : dsu[x] = Find(dsu[x]); }
void Union(int x, int y) { x = Find(x), y = Find(y); dsu[x] = y; }
int main() {
	scanf("%d%d%d%d", &n, &m, &Q, &mod);
	int g = mod;
	for (int i = 1; i <= m; i++) {
		scanf("%d%d%d", &A[i], &B[i], &C[i]);
		g = __gcd(g, abs(C[i] - C[1]));
	}
	mod = __gcd(g * 3, mod);
	int z = C[1] % g;
	for (int i = 0; i < 6 * n; i++) dsu[i] = i;
	for (int i = 1; i <= m; i++) {
		int w = ((C[i] - z) / g) % 3;
		for (int p = 0; p < 2; p++) {
			for (int q = 0; q < 3; q++) {
				Union(getid(A[i], p, q), getid(B[i], p ^ 1, (2 * q + w) % 3));
				Union(getid(B[i], p, q), getid(A[i], p ^ 1, (2 * q + w) % 3));
			}
		}
	}
	for (int i = 0, j = z; i < mod; i++, j = j * 2 % mod) can[i & 1][j] = 1;
	while (Q--) {
		int s, t, r;
		scanf("%d%d%d", &s, &t, &r);
		int ans = 0;
		for (int p = 0; p < 2; p++) {
			for (int q = 0; q < 3; q++) {
				if (Find(getid(t, 0, 0)) == Find(getid(s, p, q)))
					ans |= can[p][(z + r + (3 - q) * g) % mod];
			}
		}
		if (ans) puts("YES");
		else puts("NO");
	}
	return 0;
}

Measured memory_bytes: 16768
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-08 00:42:09
**/

#pragma GCC target("avx")

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  string s; cin >> s;
  int q; cin >> q;
  int rev = 0;
  for (int i = 0; i < q; ++i) {
    int op; cin >> op;
    if (op == 1) {
      rev ^= 1;
    } else {
      int f; char c; cin >> f >> c;
      if (f == 1) {
        if (rev & 1) {
          s += c;
        } else {
          s.insert(s.begin(), c);
        }
      } else {
        if (rev & 1) {
          s.insert(s.begin(), c);
        } else {
          s += c;
        }
      }
    }
  }

  if (rev & 1) reverse(all(s));

  cout << s << endl;

  return 0;
}

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

const int bB = 10;
const int B = 1 << bB;

int up(int x) {
	return (x + (1 << bB) - 1) >> bB;
}

int down(int x) {
	return x >> bB;
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	const int H = up(n);
	vector<int> bv(H, 0), v(n, 0);
	while (q--) {
		int com;
		cin >> com;
		if (com) {
			int x;
			cin >> x; x--;
			printf("%d\n", bv[down(x)] + v[x]);
		}
		else {
			int x, y, val;
			cin >> x >> y >> val; x--;
			for (int i = x; i < y && i < (up(x) << bB); i++) {
				v[i] += val;
			}
			if (up(x) <= down(y)) {
				for (int i = up(x); i < down(y); i++) {
					bv[i] += val;
				}
				for (int i = down(y) << bB; i < y; i++) {
					v[i] += val;
				}
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3356
-- ABC122 A
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST


main = getLine >>= putStrLn . solve
solve :: String -> String
solve b = case b of
  "A" -> "T"
  "T" -> "A"
  "C" -> "G"
  "G" -> "C"

Measured memory_bytes: 380
#include <iostream>
int main() {
  int raw, sec, min, hour;
  std::cin >> raw;
  sec = raw % 60;
  hour = raw / 3600;
  raw -= hour * 3600;
  min = raw / 60;
  std::cout << hour << ":" << min << ":" << sec << std::endl;
}

Measured memory_bytes: 1168
n = int(input())
cnt = [0]*(n+1)

for i in range(1,int(n**0.5)+1):
  for j in range(1,int(n**0.5)+1):
    for k in range(1,int(n**0.5)+1):
      v = (i**2)+(j**2)+(k**2)+i*j+j*k+k*i
      if v<=n:
        cnt[v] += 1
for i in range(1,n+1):
  print(cnt[i])


Measured memory_bytes: 9568
#include <stdio.h>

int main(void)
{
    int i, n;
    int A[1000];

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

    int ans = 1;

    for (i=0; i<n; i++) {
        if (A[i]%2==0) {
            if (!(A[i]%3==0 || A[i]%5==0)) {
                ans = 0;
                break;
            }
        }
    }

    printf("%s\n", ans ? "APPROVED":"DENIED");

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		long s=0;
		for(int i=1;i<n+1;i++){
			if(i%3!=0&&i%5!=0){
				s+=i;
			}
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 35820
K, A, B = map(int, input().split())
if A >= B-1:
    print(K+1)
else:
    if K <= A-1:
        print(K+1)
    else:
        K -= A-1
        print(A + (B-A)*(K//2) + [1,0][K%2 == 0])

Measured memory_bytes: 9124
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#include<bitset>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed  main(){
    int a,b;cin>>a>>b;
    if(a%2==1&&b%2==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail
{
  template <typename T, std::size_t NDIMS>
  struct vector_builder
  {
    using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

    static type make(std::vector<std::size_t> dims, const T &v = {})
    {
      const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
      if (!dims.empty())
        dims.pop_back();
      return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
    }
  };

  template <typename T>
  struct vector_builder<T, 1>
  {
    using type = std::vector<T>;

    static type make(std::vector<std::size_t> dims, const T &v = {})
    {
      return type(dims.empty() ? 0 : dims.back(), v);
    }
  };
} // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T &v, SIZE_T... dims)
{
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

void solve(std::string S)
{
  if (S[2] == S[3] && S[4] == S[5])
    cout << YES << endl;
  else
    cout << NO << endl;
}

int main()
{
  cout << setprecision(10);
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 3600
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let s = scan!();
    let cs = s.chars().collect::<Vec<_>>();
    if cs[0] == cs[1] || cs[1] == cs[2] || cs[2] == cs[3] {
        println!("Bad")
    } else {
        println!("Good")
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    string S,T;
    cin >> S >> T;
    for(int i=0;i<S.size();i++){
        if(S[i]!=T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),a,m=100000000,t,i;
		for(i=0;i<n;i++) {
			a=stdIn.nextInt();
			t=0;
			while(a%2==0) {
				a/=2;
				t++;
			}
			if(m>t) m=t;
		}
		System.out.print(m);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<n; i++)
#define per(i, n) for(int i=n-1; i>=0; i--)
#define reps(i, n) for(int i=1; i<n; i++)
#define pers(i, n)  for(int i=n-1; i>=1; i--)

const int INF = 1001001001;

void solve(){
  long long n, k; cin >> n >> k;
  cout << min(n%k, abs(n%k-k)) << endl;
}

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


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

/*
void query1(string, vector<set<int>>&);
void query2(const vector<set<int>>&);
*/
#define MAX_N 500001

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

  //vector<set<int>> sets(26, set<int>({MAX_N}));
  vector<set<int>> sets(26);

  //初期化
  for (int i = 0; i < N; i++) {
    sets[(int)(((char)S[i]) - 'a')].insert(i);
  }
  for (int q = 0; q < Q; q++) {
    int t;
    cin >> t;
    //(t == 1) ? query1(S, sets) : query2(sets);
    if (t == 1) {
      int i;
      char c;
      cin >> i >> c;
      i--;
      sets[(int)(((char)S[i]) - 'a')].erase(i);
      S[i] = c;
      sets[(int)(c-'a')].insert(i);
    }
    else {
      int l, r;
      cin >> l >> r;
      l--; r--;
      int cnt = 0;
      for (int i = 0; i < 26; i++) {
        //set<int> s = sets[i];
        //auto it = lower_bound(sets[i].begin(), sets[i].end(), l);
        auto it = sets[i].lower_bound(l);
        //cout << *it << endl;
        if((it != sets[i].end()) && (*it <= r)) cnt++;
      }
      cout << cnt << endl;
    }
  }
}

Measured memory_bytes: 24196
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <climits>

using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::string;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {

	for(typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";

    return out;

}

int main() {

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

	int n;
	cin >> n;

	for(int x = 0; x <= 25; ++x) {
		for(int y = 0; y <= 15; ++y) {
			if(4 * x + 7 * y == n) {
				cout << "Yes\n";
				return 0;
			}
		}
	}

	cout << "No\n";

	return 0;

}

Measured memory_bytes: 256
import os, sys, re, math

(N, L) = [int(n) for n in input().split()]

apples = []
apples2 = []
for i in range(N):
    apples.append(abs(L + i))
    apples2.append(L + i)

apples.sort()
if apples[0] in apples2:
    print(sum(apples2) - apples[0])
else:
    print(sum(apples2) + apples[0])


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second


int main(){
	ll a, b, c = 0;
	cin >> a >> b;
	int sa = b - a;
	for (int i = 1;i < sa;i++) {
		c += i;
	}
	cout << c - a << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int m1, d1, m2, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  
  if (m1 != m2)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n, i;
	int maxn = 1e6;
	scanf("%d", &n);
	int now = 0;
	for(i = 1; i <= maxn; i++)
	{
		now = now * 10 + 7;
		now = now % n;
		if(now == 0)
			break;
	}
	if(i <= maxn)	printf("%d", i);
	else	printf("-1"); 
	return 0;
}

Measured memory_bytes: 3732
#include <stdio.h>
int t[1000];
main()
{
  int N,i,ret,d,d1,d2;
  d1=d2=0;
  scanf("%d",&N);
  for(i=0;i<N;i++)
    {
      scanf("%d",&d);
      t[d]=t[d+10*d1]=t[d+10*d1+100*d2]=1;
      d2=d1;
      d1=d;
    }
    for(i=0;i<1000;i++)
      if(t[i]==0)
	{
	  printf("%d\n",i);
	  break;
	}
  return(0);
}

Measured memory_bytes: 604
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>

using namespace std;

void solve(){
    long long int x, money=100LL, year=1LL;
    cin >> x;
    while(true){
        money += money / 100;
        if(money >= x) break;
        year++;
    }
    cout << year << endl;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(16);
    
    solve();

    return 0;
}


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

using namespace std;

const int MAX_N = 100;
int n;
int a[MAX_N];

int main(){
    cin >> n;
   for(int i=0;i<n;i++){
       cin >> *(a+i);
   }

   for(int i=n;i>1;i--){
       cout << *(a+i-1) << " ";
   }
   cout << a[0] << endl;
    return 0;
}


Measured memory_bytes: 3112
def main():
    n,m=map(int,input().split())
    L=2**n
    cost=[0]+[10**8 for i in range(L-1)]

    for _ in range(m):
        a,_=map(int,input().split())
        c=sum([2**(int(i)-1) for i in input().split()])
        for j in range(L):
            q=j|c
            x=cost[j]+a
            if cost[q]>x:
                cost[q]=x
    print(cost[L-1] if cost[L-1]<10**8 else -1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 46296
import sys

def input():
    return sys.stdin.readline()[:-1]
def smax(a,b):
    if a>b:
        return a
    else:
        return b

def smin(a,b):
    if a<b:
        return a
    else:
        return b

from collections import deque

def BFS(vi,c,e_list,color_list):
        
    Q = deque([vi])
    color_list[vi] = c
    while len(Q)>0:
        v = Q.pop()
        for v1 in e_list[v]:
            if color_list[v1]==-1:
                color_list[v1]=c
                Q.appendleft(v1)



def main():
    H,W = list(map(int,input().split()))
    s1,s2 = list(map(int,input().split()))
    g1,g2 = list(map(int,input().split()))
    s1,s2 = s1-1,s2-1
    g1,g2 = g1-1,g2-1
    S = [input() for i in range(H)]

    def z(i,j):
        return i*W + j

    e_list = [[] for i in range(H*W)]

    for i in range(H):
        for j in range(W):
            if i!=H-1:
                if S[i][j]=="." and S[i+1][j]==".":
                    e_list[z(i,j)].append(z(i+1,j))
                    e_list[z(i+1,j)].append(z(i,j))
            if j!=W-1:
                if S[i][j]=="." and S[i][j+1]==".":
                    e_list[z(i,j)].append(z(i,j+1))
                    e_list[z(i,j+1)].append(z(i,j))

    color_list = [-1]*(H*W)
    c = 0


    for i in range(H*W):
        if S[i//W][i%W] == ".":
            if color_list[i]==-1:
                BFS(i,c,e_list,color_list)
                c+=1

    comp = max(color_list)+1
    e_list = [set([]) for i in range(comp)]


    for x in range(H*W):
        i,j = x//W,x%W
        if color_list[x]!=-1:
            for y in range(25):
                i1,j1 = y//5,y%5
                i2 = i1 + i - 2
                j2 = j1 + j - 2
                if 0<=i2 and i2<=H-1 and 0<=j2 and j2<=W-1:
                    if color_list[z(i2,j2)]!=-1 and color_list[z(i2,j2)]!=color_list[x]:
                        e_list[color_list[z(i2,j2)]].add(color_list[x])
                        e_list[color_list[x]].add(color_list[z(i2,j2)])

    vi = color_list[z(s1,s2)]  #change
    INF = float('inf')
    N = comp
    Q = deque([vi])

    checked_list = [False]*N
    checked_list[vi]=True

    min_path_list = [INF]*N #change
    min_path_list[vi] = 0
    #print(e_list)
    while len(Q)>0:
        v = Q.pop()
        for v1 in e_list[v]:
            if not checked_list[v1]:
                checked_list[v1]=True
                Q.appendleft(v1)
                min_path_list[v1]=min(min_path_list[v1],min_path_list[v]+1) #change
    if min_path_list[color_list[z(g1,g2)]]<=10**26:
        print(min_path_list[color_list[z(g1,g2)]])
    else:
        print(-1)

if __name__ == '__main__':
    main()



Measured memory_bytes: 182556
n,l = map(int,input().split())
q = []
p = []
ans = 0
for i in range(1,n+1):
  m = l+i-1
  q.append(m)
  ans += m
for i in range(n):
    p.append(abs(q[i]))

print(ans - q[p.index(min(p))])

Measured memory_bytes: 9200
import sys
stdin = sys.stdin
import copy

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
if n % 2 != 0:
    print(0)
else:
    n2 = copy.copy(n)
    n5 = copy.copy(n)
    c2, c5 = 0, 0
    while n2 > 1:
        n2 //= 2
        c2 += n2
    while n5 > 1:
        n5 //= 5
        c5 += n5//2
    print(min(c2, c5))




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

const int N = 100500;

char buf[N];


int main() {
    scanf("%s", buf);
    int n = strlen(buf);
    int k ;
    scanf("%d", &k);
    for (int i = 0; i < n; i++) {
        int need = (buf[i] == 'a') ? 0 : ('z' - buf[i] + 1);
        if (need <= k)
            buf[i] = 'a', k -= need;
    }
    buf[n - 1] = ((buf[n - 1] - 'a') + k) % 26 + 'a';
    puts(buf);
}


Measured memory_bytes: 888
N,K,Q = map(int,input().split())
judgepoint = Q - K

anslist = [0 for i in range(N)]
 
for i in range(Q):
  Aperson = int(input())
  anslist[Aperson -1] += 1

for i in range(N):
  if anslist[i] <= judgepoint:
    print("No")
  else:
    print("Yes")

Measured memory_bytes: 4620
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,a,b = map(int,input().split())
c = n//(a+b)
count += c * a
count += min(a,n%(a+b))
print(count)

Measured memory_bytes: 38384
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}


ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,cnt=1;
  cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  rep(i,n){
    if(v[i]==cnt){
      cnt++;
    }
  }
  if(cnt==1){
    cout<<-1<<endl;
  }else{
    cout<<n-cnt+1<<endl;
  }
}

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

int main(){
    cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	ll a, b; cin >> a >> b;
	vector<ll> x(n);
	REP(i, n) cin >> x[i];

	ll res = 0;
	REP(i, n - 1) {
		ll tmp = x[i + 1] - x[i];
		if (tmp * a >= b) res += b;
		else res += tmp * a;
	}

	cout << res << '\n';
    return 0;
}


Measured memory_bytes: 3932
#include <iostream>
#include <cstdio>
using namespace std;

int n, s, t, A, B, a[4];
int main()
{
	int i;
	cin >> n;
	cin >> A >> B;
//	a[0][0] = 1;
//	for (i =1; i <= n; i++) {
//		scanf ("%d", &t);
//		a[i][0] = a[i - 1][0];
//		a[i][1] = a[i - 1][1];
//		a[i][2] = a[i - 1][2];
//		if (t <= A) a[i][0]++;
//		else if (t > A && t <= B) {
//			if (a[i - 1][0] > 0) a[i][1] += a[i - 1][0];
//		} else {
//			a[i][2] += a[i - 1][1];
//		}
//	}
//	cout << a[n][2];
	for (i = 1; i <= n; i++) {
		scanf ("%d", &t);
		if (t <= A) a[1]++;
		else if (t > A && t <= B) a[2]++;
		else a[3]++;
	}
	cout << min(min(a[1], a[2]), a[3]);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  char c[n];
  
  bool ans = false;
  for(int i = 0; i < n; i++){
    cin>>c[i];
    if(c[i]=='Y'){
      ans = true;
      break;
    }
  }

  if(ans) cout<<"Four"<<endl;
  else cout<<"Three"<<endl;
  return 0;
}




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

using namespace std;

int main() {
	int K, N;
	cin >> K >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i + 1];
	}
	A[0] = A[N] - K;
	
	int ans = K;
	for (int i = 0; i < N; i++) {
		int temp = K - A[i + 1] + A[i];
		if (ans > temp) {
			ans = temp;
		}
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 1152
/*#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC target("avx2")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define endl '\n'


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

mt19937 mrand(random_device{}());

const double PI = acos((double)-1);
const double eps = 1e-7;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

void solve() {
	ll x; cin >> x;
	ll kek = 100;
	for (int i = 1;; i++) {
		kek += kek / 100;
		if (kek >= x) {
			cout << i << endl;
			break;
		}
	}
	return;
}

Measured memory_bytes: 3664