akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


ll binary_power(ll a, ll n) {
    if (n==0) return 1;
    ll k=binary_power(a,n/2);
    if (n%2==0) return k*k;
    else return k*k*a;
}


int main() {
    ios_base::sync_with_stdio(false);
    ll h;
    cin >> h;
    ll cnt=0;
    while (h>0) {
        h/=2;
        ++cnt;
    }

    cout << binary_power(2,cnt)-1  << endl;


    return 0;   
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<string> vs(n);
  for (int i = 0; i < n; ++i) {
    cin >> vs[i];
  }

  int ac, wa, tle, re;
  ac = wa = tle = re = 0;
  for (auto &s : vs) {
    if (s == "AC") {
      ac++;
    } else if (s == "WA") {
      wa++;
    } else if (s == "TLE") {
      tle++;
    } else {
      re++;
    }
  }

  cout << "AC x " << ac << '\n';
  cout << "WA x " << wa << '\n';
  cout << "TLE x " << tle << '\n';
  cout << "RE x " << re << '\n';
  return 0;
}

Measured memory_bytes: 6372
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int n,m;
	List<List<Integer>> graph;
	List<Integer> V;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		n = nextInt();
		m = nextInt();
		graph = new ArrayList<List<Integer>>();
		V = new ArrayList<Integer>();

		for(int i=0;i<=n;i++) {
			V = new ArrayList<Integer>();
			graph.add(V);
		}

		for(int i=0;i<m;i++) {
			int a = nextInt();
			int b = nextInt();
			graph.get(a).add(b);
			graph.get(b).add(a);
		}
		sc.close();

		int res = 0;
		for(int i=1;i<=1;i++)res += SearchforAllVerticesPass(i);

		System.out.println(res);
	}

	private int SearchforAllVerticesPass(int gi) {
		boolean[] f = new boolean[n+1];
		return SearchforAllVerticesPass(gi,0+1,f);
	}

	private int SearchforAllVerticesPass(int gi,int cnt, boolean[] f) {
		List<Integer> VL=graph.get(gi);

		f[gi]=true;
		int sum=0;

		for(int i=0;i<VL.size();i++) {
			if(f[VL.get(i)])continue;
			if(cnt+1==n)sum++;
			else sum+=SearchforAllVerticesPass(VL.get(i),cnt+1,f);
		}
		f[gi]=false;
		return sum;
	}

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

Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,d,cnt=0;cin>>m>>d;
    for(int i=2;i<=m;i++)
    for(int j=22;j<=d;j++)
    {
        int k=j,s;
        s=k%10;
        k/=10;
        if(s*k==i&&s!=1&&k!=1)cnt++;//cout<<i<<"-"<<j<<'\n';}
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
 
#pragma comment(linker, "/STACK:336777216")  
 
using namespace std;

const int MAXN = 200000 + 10;

long long X, Y;

void Work()
{
	scanf("%lld%lld", &X, &Y);
	int Ans = 0;
	while (X <= Y)
	{
		X <<= 1;
		Ans ++;
	}
	printf("%d\n", Ans);
}

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

Measured memory_bytes: 256
n,k = map(int,input().split())
A = []
for i in range(n):
  A.append(int(input()))
A = sorted(A)
ans = 10**9
for i in range(n-k+1):
  d  = A[i+k-1]-A[i]
  if d < ans:
    ans  = d
print(ans)
  

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

namespace AGC10
{
    class Program
    {
        static void Main(string[] args)
        {
            solveA();
        }

        static void solveA()
        {
            int n = int.Parse(Console.ReadLine());
            String[] s = Console.ReadLine().Split(' ');
            List<uint> a = s.Select(e => uint.Parse(e)).ToList();

            List<uint> odd = a.Where(e => e % 2 == 1).ToList();
            
            if (odd.Count % 2 != 0)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
        }
    }
}


Measured memory_bytes: 13656
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
ll mod = 1000000007;

int main(){
    ld a,b;cin>>a>>b;
    cout<<(ll)(a*b+0.001)<<endl;
}

Measured memory_bytes: 3776
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
i = a[0]
counter = 1
while counter <= n+1:
  if i == 2:
    print(counter)
    exit()
  else:
    i = a[i-1]
    counter += 1
print(-1)

Measured memory_bytes: 7084
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, W = map(int, readline().split())
S = [readline().decode('utf8').rstrip() for _ in range(H)]

ans = [[0 if cell == '.' else '#' for cell in row] for row in S]
# print(ans)

for i in range(H):
    for j in range(W):
        if S[i][j] != '#':
            continue
        for dx, dy in itertools.product([-1, 0, 1], repeat=2):
            x = i + dx
            y = j + dy
            if x < 0 or x >= H:
                continue
            if y < 0 or y >= W:
                continue
            if S[x][y] == '#':
                continue

            ans[x][y] += 1

for row in ans:
    print(*row,sep='')


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

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int64> a(n), b(m);
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    for (int i=0; i<m; i++) {
        cin >> b[i];
    }
    int ai = 0;
    int64 time = 0;
    int cnt = 0;
    for (; ai<n; ai++) {
        if (time+a[ai] > k) break;
        time += a[ai];
        cnt++;
    }
    int bi = 0;
    for (; bi<m; bi++) {
        if (time+b[bi] > k) break;
        time += b[bi];
        cnt++;
    }
    int ans = cnt;
    for (ai--; ai>=-1; ai--) {
        if (ai>=0) {
            time -= a[ai];
            cnt--;
        }
        for (; bi<m; bi++) {
            if (time+b[bi] > k) break;
            time += b[bi];
            cnt++;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 5940
using System;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
            
            ////?????????????????????
            string dmmy = Console.ReadLine();

            string[] input = dmmy.Split(' ');

            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            double result1 = 0;
            double result2 = 0;

            //result = dmmy1 * dmmy1 * dmmy1;
            result1 = a*b;
            result2 = 2 * a + 2 * b;

            Console.WriteLine(result1 + " "+result2);  
            Console.ReadLine();
        }
    }

}

Measured memory_bytes: 5628
#include<stdio.h>
#include<string.h>
/*

1 2 3
1 3 4 2
first must be 1
n must be at n if any
n-1 only at n-1 or n
aim 1 1 1 2 2 1 2 3 2
idx 1 2 3 4 5 6 7 8 9
det 0 1 2 2 3 5 5 5 7
ord 1 2 2 3 1 2 2 1 1

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
插入i相当于使第i到第j次的所有数+1

*/

int head;
int val[200], n;

void del(int idx) {
	for (int i = idx; i <= n; i++) {
		val[i] = val[i + 1];
	}
	n--;
}

struct simpleStack
{
	int t[200], n;
	simpleStack() { n = 0; }
	void push(int x) { t[n++] = x; }
	int pop() { return n>0 ? t[--n] : 0; }
}opt;
/*
6
1 2 2 2 5 6
*/

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", val + i);
	}
	int nxt;
	while (n) {
		if (val[1] != 1) {
			printf("-1\n");
			return 0;
		}
		for (nxt = n;val[nxt]!=nxt&&nxt; nxt--);
		if(nxt==0)
		{
			printf("-1"); return 0;
		}
		opt.push(val[nxt]);
		del(nxt);
	}
	while (nxt = opt.pop())printf("%d\n", nxt);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long LL;
LL gcd(LL a, LL b){
	if(b == 0) return a;
	return gcd(b,a%b);
}
LL powmod(LL a, LL n){
	if(n == 0) return 1;
	if(n % 2) return (a*powmod(a,n-1)) % MOD;
	LL c = powmod(a,n/2);
	return (c*c) % MOD;
}
LL inv(LL a){
	return powmod(a,MOD-2) % MOD;
}

vector<int> edges[400000];
int vis[400000];
int ncc = 0;
void dfs(int a){
	if(vis[a]) return;
	vis[a] = 1;
	for(int c = 0; c < edges[a].size(); c++) dfs(edges[a][c]);
}
int main(){
	int a, b;
	cin >> a >> b;
	int freq[26];
	string s[a];
	for(int i = 0; i < a; i++) cin >> s[i];
	LL ans = 1;
	LL num24 = 0;
	int aa = a/2;
	int bb = b/2;
	int zz = 0;
	for(int i = 0; i < 400000; i++) vis[i] = 0;
	for(int i = 0; i < a-1-i; i++){
		for(int j = 0; j < b-1-j; j++){
			//cout << i << " " << j << endl;
			for(int z = 0; z < 26; z++) freq[z] = 0;
			freq[s[i][j]-'a']++;
			freq[s[a-1-i][j]-'a']++;
			freq[s[i][b-1-j]-'a']++;
			freq[s[a-1-i][b-1-j]-'a']++;
			LL r = 24;
			for(int z = 0; z < 26; z++){
				if(freq[z] == 4) r /= 24;
				if(freq[z] == 3) r /= 6;
				if(freq[z] == 2) r /= 2;
			}
			if(r == 24){
				edges[i].push_back(aa+j);
				edges[aa+j].push_back(i);
				zz++;
			}
			ans *= r;
			ans %= MOD;
		}
	}

	for(int i = 0; i < aa+bb; i++) vis[i] = 0;
	for(int i = 0; i < aa+bb; i++){
		if(!vis[i]){
			ncc++;
			dfs(i);
		}
	}
	//cout << aa << " " << bb << " " << zz << endl;
	//cout << ncc << endl;
	ans *= powmod(inv(2), zz+ncc-aa-bb);
	if(a % 2){
		int c = (a-1)/2;
		LL ok = 1;
		for(int j = 0; j < b; j++){
			if(s[c][j] != s[c][b-1-j]) ok = 2;
		}
		ans *= ok;
		ans %= MOD;
	}
	if(b % 2){
		int c = (b-1)/2;
		LL ok = 1;
		for(int j = 0; j < a; j++){
			if(s[j][c] != s[a-1-j][c]) ok = 2;
		}
		ans *= ok;
		ans %= MOD;
	}
	cout << ans % MOD << endl;
}


Measured memory_bytes: 11392
#include <iostream>

using namespace std;
int N;
int P[20000];
int K[20000];
int A[20000], B[20000];
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> P[i];
    --P[i];
    K[P[i]] = i;
  }
  
  for(int i = 0; i < N; ++i) {
    B[i] = 20000 * (N - i);
    A[i] = K[i] + 20000 * N + 1 - B[i];
  }
  for(int i = 0; i < N; ++i) cout << A[i] << (i == N - 1 ? '\n' : ' ');
  for(int i = 0; i < N; ++i) cout << B[i] << (i == N - 1 ? '\n' : ' ');
}

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

int main()
{
	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; ++i)
	{
		int input;
		cin >> input;
		a[i] = make_pair(input,i+1);
	}
	
	sort(a.begin(), a.end());
	
	for (int i = 0; i < n; ++i)
	{
		// cout << a[i].first << " : " << a[i].second << endl;
		cout << a[i].second << " ";
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 1536
///------------------  ONESHOTAC -------------------
#include <bits/stdc++.h>
#define FOR(i,j,k) for(int i = j; i <= k; i ++)
#define FORD(i,j,k) for(int i = j; i >= k; i --)
#define mp make_pair
//#define f first
//#define s second
//#define int long long
using namespace std;

const int MOD=1e9+7;
const int N = 500005;
int n;
int res[N];
string s;
int d[N];
vector < int > ke[N];
long long sum = 0;
void BFS()
{
    queue < int > qu;
    FOR(i, 1, n)
    {
        if(d[i] == 0)
        {
            qu.push(i);
        }
    }
    while(qu.size())
    {
        int u = qu.front();
        qu.pop();
        for(int v : ke[u])
        {
            d[v] --;
            if(d[v] == 0)
            {
                res[v] = res[u] + 1;
                qu.push(v);
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("AGC040.inp","r",stdin);
//    freopen("AGC040.out","w",stdout);
    cin >> s;
    s = ' ' + s;
    n = s.size();
    FOR(i, 1, n - 1)
    {
        if(s[i] == '>')
        {
//            ke[i].push_back(i + 1);
            d[i] ++;
            ke[i + 1].push_back(i);
        }
        else
        {
//            ke[i + 1].push_back(i);
            d[i + 1] ++;
            ke[i].push_back(i + 1);
        }
    }
    BFS();
    FOR(i, 1, n) sum += res[i];
    cout << sum;
    return 0;
}


Measured memory_bytes: 32048
#include<bits/stdc++.h>
    using namespace std;
    int main(){

        int n,x,y,c=0,j;
        bool r=false;
        scanf("%d",&n);
        scanf("%d",&x);
        y=x;
        n--;
        j=n;
        while(n--){
            scanf("%d",&x);
            if(r)y--;
            if(x>=y)c++;
            else c=0;
            if(x==y)r=false;
            else r=true;
            y=x;

        }
        if(c==j||c==j-1)printf("Yes");
        else printf("No");
        return 0;
    }

Measured memory_bytes: 384
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

from itertools import accumulate

n,m,q = li()
grid = [[0 for _ in range(n+1)] for _ in range(n+1)]

for _ in range(m):
    l,r = li()
    grid[l][r] += 1
    
grid_cum = [list(accumulate(grid[row])) for row in range(n+1)]
for row in range(n):
    for col in range(n+1):
        grid_cum[row+1][col] += grid_cum[row][col]
        
for _ in range(q):
    p,q = li()
    print(grid_cum[q][q] - grid_cum[p-1][q] - grid_cum[q][p-1] + grid_cum[p-1][p-1])
    

Measured memory_bytes: 16024
H, W = map(int, input().split())
S = [input() for _ in range(H)]

res = [[float('inf')]*(W) for _ in range(H)]

if S[0][0] == '#':
    res[0][0] = 1
else:
    res[0][0] = 0

for h in range(H):
    for w in range(W):
        if h == 0:
            if w == 0:
                continue
            else:
                res[h][w] = res[h][w-1] + (1 if S[h][w] == '#' and S[h][w-1] == '.' else 0)
        else:
            if w == 0:
                res[h][w] = res[h-1][w] + (1 if S[h][w] == '#' and S[h-1][w] == '.' else 0)
            else:
                f_t = res[h-1][w] + (1 if S[h][w] == '#' and S[h-1][w] == '.' else 0)
                f_l = res[h][w-1] + (1if S[h][w] == '#' and S[h][w-1] == '.' else 0)
                res[h][w] = min(f_t, f_l)

print(res[H-1][W-1])


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

using namespace std;

int main()
{
  int n,k,x,y;
  long long int cost = 0;
  cin >> n >> k >> x >> y;
  for(int i = 0; i < n; i++){
     if(i < k)
       cost += x;
     else
       cost += y;
  }
  cout << cost << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int a = scan.nextInt();
			if(a == 0){
				break;
			}
			int[] p = new int[5];
			p[0] = a;
			for(int i = 1;i < 5;i++){
				p[i] = scan.nextInt();
			}
			int[] t = new int[3];
			for(int i = 0;i < 5;i++){
				t[p[i]-1]++;
			}
			if(t[0] != 0 && t[1] != 0 && t[2] != 0){
				t[0] = t[1] = t[2] = 3;
			}else if(t[0] != 0 && t[1] != 0){
				t[0] = 1;
				t[1] = 2;
			}else if(t[0] != 0 && t[2] != 0){
				t[0] = 2;
				t[2] = 1;
			}else if(t[1] != 0 && t[2] != 0){
				t[1] = 1;
				t[2] = 2;
			}else if(t[0] != 0 || t[1] != 0 || t[2] != 0){
				t[0] = t[1] = t[2] =3;
			}
			for(int i = 0;i < 5;i++){
				System.out.println(t[p[i]-1]);
			}
		}
	}
}

Measured memory_bytes: 20768
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int N, ans=0;

    cin >> N;

    vector<int> d(N);

    rep(i, N) {
        cin >> d[i];
        if(i>0) {
            rep(j, i) {
                ans += d[i] * d[j];
            }
        }
    }

    cout << ans << endl;

    return 0;
    
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	int xorsum=0;
	for (int i=0;i<n;++i)
	{
		cin >> a[i];
		xorsum^=a[i];
	}

	int initial=1;
	for (int i=0;i<n;++i)
	{
		if (initial==0)
		{
			cout << " ";
		}
		else
		{
			initial=0;
		}
		cout << (xorsum ^ a[i]);
	}
	cout << endl;
}






Measured memory_bytes: 3972
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

int main() {
    ll n, cnt = 0;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i, n) { cin >> a[i]; }  //上部
    rep(i, n) { cin >> b[i]; }  //中部
    rep(i, n) { cin >> c[i]; }  //下部
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    for (auto v_b : b) {
        // 未満を求める
        auto iter_a = lower_bound(a.begin(), a.end(), v_b);
        auto idx_a = distance(a.begin(), iter_a);
        // 上を求める
        auto iter_c = upper_bound(c.begin(), c.end(), v_b);
        auto idx_c = distance(c.begin(), iter_c);
        debug(v_b, idx_a, idx_a, c.size() - idx_c);
        cnt += (c.size() - idx_c) * (idx_a);
    }
    cout << cnt << endl;
    return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, k, n) for (int i = (int)(k); i < (int)(n); ++i)
#define rrep(i, k, n) for (int i = (int)(n) - 1; i >= (int)(k); --i)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vv_ii;
typedef pair<int,ii> i_ii;
typedef vector<i_ii> vi_ii;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

template <class T>
inline ostream& operator<<(ostream & o, vector<T> const& v) {
    for (int i = 0; i < (int)(v.size()) - 1; ++i)
        o << v[i] << ' ';
    if (!v.empty())
        o << v.back();
    return o;
}

template <class T, class Q>
inline ostream& operator<<(ostream & o, pair<T,Q> const& p) {
    o << "(" << p.fi << "," << p.se << ")";
    return o;
}


int main(){

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

    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c >= 22 ? "bust\n" : "win\n");
    


    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
list_S = [0]
ans = 0
for i in range(n):
    list_S.append(list_S[i] + a[i])

dict_S = {}
for i in list_S:
    if i in dict_S:
        dict_S[i] += 1
    else:
        dict_S[i] = 1

for v in dict_S.values():
    ans += v * (v-1) // 2

print(ans)

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;



template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

int main() {
    int H, W;
    cin >> H >> W;
    string S;
    vector<vector<int>> maze(H, vector<int>(W));
    rp(i, 0, H) {
        cin >> S;
        rp(j, 0, W) {
            if(S[j] == '#') maze.at(i).at(j) = 0;
            else maze.at(i).at(j) = 1;
        }
    }

    vector<vector<int>> line(H, vector<int>(W));
    vector<vector<int>> row(H, vector<int>(W));
    int ans = 0;
    rp(i, 0, H) {
        rp(j, 0, W) {
            if(maze[i][j] == 1) {
                if(i-1 >= 0 && maze.at(i-1).at(j) != 0) {
                    line.at(i).at(j) = line.at(i-1).at(j);
                }
                else {
                    int end = i;
                    while(maze.at(end).at(j) == 1) {
                        end++;
                        if(end>=H) break;
                    }
                    line.at(i).at(j) = end - i;
                }

                if(j-1 >= 0 && maze.at(i).at(j-1) != 0) {
                    row.at(i).at(j) = row.at(i).at(j-1);
                }
                else {
                    int end = j;
                    while(maze.at(i).at(end) == 1) {
                        end++;
                        if(end>=W) break;
                    }
                    row.at(i).at(j) = end - j;
                }
                chmax(ans, line[i][j] + row[i][j] - 1);
                // printf("(i, j) = (%d, %d) line: %d row = %d\n", i, j, line[i][j], row[i][j]);
            }
        }
    }
    cout << ans << endl; 
    return 0;

}

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

#define pb push_back
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define sz(s) (ll) s.size()
#define deb(i) cout << "Aqui " << (ld) i << "\n";



int main(){
		
	ll n; cin >> n;
	map<string,ll> m;
	
	while(n--){
		string s;
		cin >> s;
		m[s]++;
	}
	cout << "AC x " << m["AC"] << "\n";
	
	cout << "WA x " << m["WA"] << "\n";
	
	cout << "TLE x " << m["TLE"] << "\n";
	
	cout << "RE x " << m["RE"] << "\n";
	
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    int c;
    int F=0,S=0,T=0;
    for(int i=1;i<=N;i++){
        cin >> c;
        if(c<=A)F++;
        else if(c<=B)S++;
        else T++;
    }
    int ans = min(F,min(S,T));
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;

    int ans=0;
    for(int i=0;i<n;i++){
        int cnt=0;

        for(char c='a';c<='z';c++){
            bool left=false,right=false;

            for(int j=0;j<i;j++){
                if(s[j]==c)
                    left=true;
            }

            for(int j=i;j<n;j++){
                if(s[j]==c)
                    right=true;
            }
                if(left&&right)
                    cnt++;


                
             
            if(ans<cnt)
                ans=cnt;
        }   
    }   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int a; cin >> a;
	cout << a+a*a+a*a*a << endl;
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>

using namespace std;

int main(void){
    int A,B;
    cin>>A>>B;
    cout<<max(max(A+B,A-B),A*B)<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long S;cin>>S;
	if(S==1000000000000000000ll)
	{
		puts("0 0 1000000000 0 0 1000000000");
		return 0;
	}
	cout<<"0 0 ";
	int t=1000000000,v=S/t;
	int vvv=S%t;
	cout<<t<<' '<<1<<' ';
	cout<<(t-vvv)<<' '<<(v+1)<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll tmp1[200005],tmp2[200005],a[200005],b[200005],c[200005],g[200005];
int q[200005],tl;
ll crs(int x,int y,int z){return ((y-x)*(g[y]-g[z])-(y-z)*(g[y]-g[x]));}
void add(int x)
{
    while(tl>1&&crs(q[tl-1],q[tl],x)<=0)tl--;
    q[++tl]=x;
}
int main()
{
    int n,mx=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&tmp1[i]);
        if(tmp1[i]>tmp1[mx])mx=i;
    }
    for(int i=1;i<=n;i++)scanf("%lld",&tmp2[i]);
    for(int i=mx;i<=n;i++)a[i-mx]=tmp1[i],b[i-mx]=tmp2[i];
    for(int i=1;i<=mx;i++)a[n-mx+i]=tmp1[i],b[n-mx+i]=tmp2[i];
    for(int i=2;i<=n;i++)c[i]=2*c[i-1]+2*b[i-1]-c[i-2];
    for(int i=0;i<=n;i++)g[i]=a[i]-c[i],add(i);
    int now=1;
    double res=0;
    for(int i=0;i<n;i++)
    {
        while(q[now+1]<=i)now++;
        res+=((((q[now+1]-i)*g[q[now]])+(i-q[now])*g[q[now+1]])*1.0/(q[now+1]-q[now]))+c[i];
    }
    printf("%.12lf",res/n);
    return 0;
}

Measured memory_bytes: 13896
//Author : Ayush Jain

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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	ll k,n,i,a1=1,a2=1;
	cin>>n;
	while(n--){
		cin>>k;
		if(k%2==0){
			a2*=2;
		}
		a1*=3;
	}
	cout<<a1-a2<<endl;
	
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
				using namespace std;
				#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
				#define ll long long int
				#define pb push_back
				#define fe first
				#define se second
				#define endl "\n"
				#define pii pair<int, int>

				#define PI 3.14159265358979323846
				const int N = 1e5 + 10;
				int a,b,k,c1,c2,maxi;	   
             
				void solve() {
					
					string s;
					cin>>s;
					int len=s.size();
					queue<char> q;
					
					
					for(int i=0;i<len;i++) {
						
						if(q.size()>0 && q.front()!=s[i]) {
							   c2+=2;
							   q.pop();						
				        	}
				        	
				        	else 
							    q.push(s[i]); 
							    
					}  					
		
					cout<<c2;
					
					 					
				}
					  
					
				
					   

				int main() {
				  cool;
				  int t = 1;
				  while (t--)
					solve();

				  return 0;
				}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();
            int K = sc.nextInt();
            if (K <= A) {
                System.out.println(K);
                return;
            }
            if (K <= A + B) {
                System.out.println(A);
                return;
            }
            System.out.println(A - (K - (A + B)));
        }
    }
}


Measured memory_bytes: 26872
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n, m;
   cin >> n >> m;
   vector<int> l(m), r(m);
   rep(i, 0, m) cin >> l[i] >> r[i];

   int maxL = 0, minR = 1e6;
   rep(i, 0, m) {
      chmax(maxL, l[i]);
      chmin(minR, r[i]);
   }
   int ans = minR - maxL + 1;
   if (ans < 0) ans = 0;
   cout << ans << endl;

   return 0;
}

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

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int d,t,s;
    cin>>d>>t>>s;
    if (s*t>=d) cout<<"Yes";
    else cout<<"No";
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<VI>

using namespace std;


int N, K;
vector<int> book[15];
int dp[15][2005];
int solve(int jan, int m) {
	if (m == K || jan == 10) return 0;
	if (dp[jan][m] != -1) return dp[jan][m];
	int ret = solve(jan + 1, m);
	int sum = 0;
	rep(i, book[jan].size()) {
		if (m + i + 1 > K) break;
		sum += book[jan][i];
		ret = max(ret, sum + solve(jan + 1, m + i + 1) + i*(i+1));
	}
	return dp[jan][m] = ret;
}
int main() {
	cin >> N >> K;
	rep(i, N) {
		int c, g;
		cin >> c >> g; g--;
		book[g].push_back(c);
	}
	rep(i, 10) sort(book[i].rbegin(), book[i].rend());
	rep(i, 10) rep(j, K+1) dp[i][j] = -1;
	cout << solve(0, 0) << endl;

	return 0;
}



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

  using namespace std;
  const int lim = 2e5 + 10;
  int Arr[lim];
  int main(){
  	int n;
	scanf("%d",&n);
	int sum = 0 , sor = 0 ,idx = 0;
	long long int ans = 0;
	for(int i =0 ; i < n;  ++i){
		scanf("%d",&Arr[i]);
		sum += Arr[i];
		sor ^= Arr[i];
		while(sum != sor){
	//		printf("%d %d\n" ,i , idx);
			ans +=(long long int ) (i -idx);
			sum -= Arr[idx];
			sor ^= Arr[idx];
			idx++;
		}
	}
	while(idx != n){
	//	printf("%d %d\n",n , idx );
		ans += (long long int )(n-idx);
		idx++;
	}
	printf("%lld",ans);
  }


Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int x = 0;
		scan.close();
		for(int i=1;i<=n;i++){

			x=i;//Integer.toString(i);
			if(i%3==0){
				System.out.print(" "+i);
			}else{
				Pattern p = Pattern.compile("3");
				Matcher m = p.matcher(Integer.toString(i));
				if(m.find())
					System.out.print(" "+i);	
				}
		}
		System.out.println("");
	}
}

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

int list[251];
int main() {
	int size, i, j;
	scanf("%d", &size);

	//scanning
	for (i = 1; i <= size; i++) {
		scanf("%d ", &list[i]);
	}

	//printing
	for(i = 1; i <= size; i++) {
		printf("node %d: key = %d, ", i, list[i]);
		j = i / 2;
		if (j >= 1)printf("parent key = %d, ", list[j]);
		if (2 * i <= size)printf("left key = %d, ", list[i * 2]);
		if (2 * i + 1 <= size)printf("right key = %d, ", list[i * 2 + 1]);
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2048
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")

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

#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
#define ff first
#define ss second
#define Clear(x) memset(x,0,sizeof(x))
#define all(x) (x).begin(),(x).end()

void checkpoint1()
{
	/******think more code less******/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
}

bool comp(pair< ll,ll > &a,pair< ll,ll > &b)
{
	if(a.ff!=b.ff)
		return a.ff<b.ff;
	else
	{
		if(a.ss>b.ss)
			return b.ss<a.ss;
		else if(a.ss<b.ss)
			return a.ss<b.ss;
	}
	return a.ff>b.ff;
}

ll powe(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1)
		{
			res*=a;
			res%=mod;
		}
		a*=a;
		a%=mod;
		b>>=1;
	}
	return res;
}

int main()
{
	checkpoint1();
	ll n,m,k;
	cin>>n>>m>>k;
	m=ceil((ld)n/m);
	m*=k;
	cout<<m;
	return 0;
}

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

const int mod = 1e9 + 7;
const int maxn = 3002;
// dp[len][j] - the no of permutations such that the prefix length is 'len' and the last digit is j
int dp[maxn][maxn]; 

void add_self(int &a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}

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

    int n; string s;
    cin >> n >> s;

    dp[1][1] = 1;
    for (int len = 2; len <= n; ++len) {
        // calculate prefix sum of dp[len-1]
        vector<int> prefix(len);
        for (int i = 1; i <= len-1; ++i)
            prefix[i] = (prefix[i-1] + dp[len-1][i]) % mod;

        for (int b = 1; b <= len; ++b) {
            int L, R;
            if (s[len-2] == '<') L = 1, R = b-1;
            else L = b, R = len-1;

            if (L <= R) {
                add_self(dp[len][b], (prefix[R] - prefix[L-1] + mod) % mod);
            }
        }
    }

    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        add_self(ans, dp[n][i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 34176
#include <stdio.h>

void swap(int *i, int *j)
{
	*i += *j;
	*j = *i - *j;
	*i -= *j;
}

int euc(int x, int y)
{
	if (x < y){
		swap(&x, &y);
	}
	
	while (1){
		x %= y;
		swap(&x, &y);
		if (!y){
			break;
		}
	}
	
	return (x);
}

int main(void)
{
	int i;
	int a[2];
	int n;
	
	scanf("%d", &n);
	scanf("%d", &a[0]);
	for (i = 0; i < n - 1; i++){
		scanf("%d", &a[1]);
		a[0] = euc(a[0], a[1]);
	}
	
	for (i = 1; i <= a[0]; i++){
		if (a[0] % i == 0){
			printf("%d\n", i);
		}
	}
	
	return (0);
}

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

using namespace std;

int main() {
    int N, a, b;
    cin >> N;
    int len = 0;
    bool ok = false;
    while (N--) {
        cin >> a >> b;
        if (a == b) {
            len++;
            if (len == 3) {
                ok = true;
                break;
            }
        } else {
            len = 0;
        }
    }
    if (ok) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3596
import numpy as np
import sys

input = sys.stdin.readline

A,B,M = map(int,input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))

res = np.min(a) + np.min(b)

for i in range(M):
    x,y,c = map(int,input().split())
    x-=1
    y-=1
    res = min(res,(a[x]+b[y]-c))

print(res)

Measured memory_bytes: 27576
#include<bits/stdc++.h>
#define ll long long
#define pli pair<ll,int>
#define fi first
#define se second
#define mod 1000000007
using namespace std;

struct R{
  int to,nex,val;
}r[404000];

int n,m,st,en,cnt=0,hea[101000];
ll d[101000],f[101000],g[101000],ans,len;

struct Node{
  int u,v;
};
vector<Node>vec;

priority_queue<pli,vector<pli>,greater<pli> >q;

void Dj(){
  for (;!q.empty();) q.pop();
  memset(d,33,sizeof d);
  d[st]=0; q.push((pli){0,st});
  int x,y; ll dx,dy; pli tmp;
  for (;!q.empty();){
    tmp=q.top(); q.pop();
    x=tmp.se; dx=tmp.fi;
    if (d[x]!=dx) continue;
    for (int i=hea[x];i;i=r[i].nex){
      y=r[i].to; dy=dx+r[i].val;
      if (d[y]>dy){
	d[y]=dy;
	q.push((pli){dy,y});
      }
    }
  }
}

ll dfs1(int x){
  if (~f[x]) return f[x];
  f[x]=0;
  for (int i=hea[x];i;i=r[i].nex)
    if (d[r[i].to]==d[x]+r[i].val){
      f[x]=(f[x]+dfs1(r[i].to))%mod;
      if (d[x]*2<len&&d[r[i].to]*2>len)
	      vec.push_back((Node){x,r[i].to});
    }
  return f[x];
}

ll dfs2(int x){
  if (~g[x]) return g[x];
  g[x]=0;
  for (int i=hea[x];i;i=r[i].nex)
    if (d[r[i].to]==d[x]-r[i].val)
      g[x]=(g[x]+dfs2(r[i].to))%mod;
  return g[x];
}

int main(){
  cin>>n>>m; cin>>st>>en;
  int x,y,z;
  for (;m--;){
    scanf("%d%d%d",&x,&y,&z);
    r[++cnt]=(R){y,hea[x],z}; hea[x]=cnt;
    r[++cnt]=(R){x,hea[y],z}; hea[y]=cnt;
  }
  Dj(); len=d[en];
  //for (int i=1;i<=n;++i) printf("%lld ",d[i]); puts("");
  for (int i=1;i<=n;++i)
    if (d[i]*2==len)
      vec.push_back((Node){i,i});
  memset(f,-1,sizeof f); f[en]=1;
  dfs1(st);
  memset(g,-1,sizeof g); g[st]=1;
  dfs2(en);
  ans=f[st]*f[st]%mod;
  //cerr<<ans<<endl;
  for (auto o:vec){
    //cerr<<g[o.u]<<' '<<f[o.v]<<endl;
    ans=(ans-g[o.u]*f[o.v]%mod*g[o.u]%mod*f[o.v]%mod)%mod;
  }
  ans=(ans%mod+mod)%mod;
  cout<<ans<<endl;
}


Measured memory_bytes: 15740
#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(){
    ll n,k;
    cin >>n>>k;
    ll ans=1;
    for (int i = 0; i < n; ++i) {
        ans=min(ans*2,ans+k);
    }
    cout <<ans <<endl;
    return 0;
}

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

int main(){
    ll a, b;
    cin >> a >> b;
    ll n = b - a + 1;
    ll ans;
    if(a % 2 == 1){
        if((n - 1) % 4 == 0){
            ans = a ^ 0LL;
        }else{
            if((n - 1) % 2 == 0){
                ans = a ^ 1LL;
            }else{
                if((n - 2) % 4 == 0){
                    ans = a ^ 0LL ^ b;
                }else{
                    ans = a ^ 1LL ^ b;
                }
            }
        }
    }else{
        if(n % 4 == 0){
            ans = 0LL;
        }else{
            if(n % 2 == 0){
                ans = 1LL;
            }else{
                if((n - 1) % 4 == 0){
                    ans = 0LL ^ b;
                }else{
                    ans = 1LL ^ b;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  int M = nextInt();
  vector<pair<int,int>> v(M);
  REP(i, M) {
    int s = nextInt() - 1;
    int c = nextInt();
    v[i] = {s, c};
  }
  int ans = -1;
  for (int x = 0; x <= 999; x++) {
    string s = to_string(x);
    if (s.size() != N) continue;
    bool ok = true;
    REP(i, M) {
      int k = v[i].first;
      int c = v[i].second;
      if (s[k] != '0' + c) ok = false;
    }
    if (ok) {
      ans = x;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 256
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    S = list(map(ord,input()))

    ans =0
    for k in range(N+1,0,-1):
        i=0
        count =0
        while i<N-k:
            if S[i]==S[i+k]:
                count+=1
                ans =max(ans,count)
            else:
                count=0
            if count==k:
                break

            i+=1

    print(ans)









if __name__ == "__main__":
    main()


Measured memory_bytes: 68244
#include<bits/stdc++.h>
using namespace std;
int main(){
  	int x,y;
  	cin>>x>>y;
  	int flag=0;
  	if(4*x<y||2*x>y||y%2==1){
      	flag=1;
    }
  	if(!flag){
    	for(int i=0,j=x;i<=x&&j>=0;i++,j--){
        	if(4*j+2*i==y){
            	flag=0;
            	break;}
        }
    }
  if(flag){
  	cout<<"No";}else{
  cout<<"Yes";}
  return 0;
}

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

int main() {
	string s; cin >> s;

	int siz = s.size(), ans = 0;
	rep(i, 1, siz) {
		string str1 = s.substr(0, (siz - i) / 2), str2 = s.substr((siz - i) / 2, (siz - i) / 2);
		if (str1 == str2) {
			ans = str1.size() + str2.size();
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int64_t x;
	cin >> x;

	int a = 6 + 5;
	int b = x % a;
	int64_t result = 2 * (x / a);

	if( b > 6 ) {
		result += 2;
	}
	else if( b > 0 ) {
		result += 1;
	}

	cout << result << endl;
}


Measured memory_bytes: 256
import itertools
N=int(input())
A=[]
for i in range(N):
  a=[]
  B=int(input())
  for _ in range(B):
    x,y=map(int,input().split())
    a.append([x,y])
  A.append(a)
ans=0
for i in list(itertools.product(range(2),repeat=N)):
  for j in range(len(A)):
    flag=True
    if i[j]==0:
      continue
    for x,y in A[j]:
      if i[x-1]!=y:
        flag=False
        break
    if not flag:
      break
  if flag:
    ans=max(ans,sum(i))
print(ans)

Measured memory_bytes: 14468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, k;
    cin >> h >> w >> k;
    int ans = 0;
    VV<char> grid(h, V<char>(w));
    rep(i, h) rep(j, w) cin >> grid[i][j];
    rep(bit, 1 << (h + w)) {
        auto now = grid;
        rep(i, h + w) {
            if(1 & bit >> i) {
                if(i < h) {
                    rep(j, w) now[i][j] = 'x';
                } else {
                    rep(j, h) now[j][i-h] = 'x';
                }
            }
        }
        int cnt = 0;
        rep(i, h) rep(j, w) {
            cnt += (now[i][j] == '#');
        }
        if(cnt == k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
N = int(input())
l = 2
l2 = 1

if N == 1:
    print(l2)
    exit()

for i in range(N - 1):
    if i % 2 == 0:
        l = l + l2
    else:
        l2 = l + l2
    
if i % 2 == 1:
    print(l2)
else:
    print(l)

Measured memory_bytes: 9184
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include <unordered_set>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using std::cout;
using std::vector;
using std::endl;
using std::cin;
using std::string;
using std::min;
using std::max;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e9;
typedef std::pair<int,int> P;
struct edge {ll to,cost;};
#define VMAX 200000+10
    ll d[VMAX];
    ll N,M,L[VMAX],R[VMAX],D[VMAX];
    ll ans=0;
    std::vector<edge> G[VMAX];
    bool dijkstra(int s){
        //頂点数N 辺の数 E
        std::queue<P> que;
//一回もチェックしたことがないなら距離を0にする
        if(d[s]==INF) d[s]=0;
        que.push(P(d[s],s));
        while(!que.empty()){

            P p =que.front();que.pop();
            int v=p.second;
            for(int i=0;i<(signed)G[v].size();i++){
                edge e =G[v][i];
//まだ訪れていないなら
                    if(d[e.to]==INF)
{
                    d[e.to]=d[v]+e.cost;
                    que.push(P(d[e.to],e.to));
                }
//訪れていて与えられた情報と異なる場合
              else if(d[e.to]!=d[v]+e.cost){ 
                return false;
                }
              }
        }
        return true;
    }

int main(){
    std::ios_base::sync_with_stdio(false);
    cin>>N>>M;
    REP(i,M){
		cin>>L[i]>>R[i]>>D[i];

			G[L[i]].push_back({R[i],D[i]});
//線をx座標として考えると,右から左に向かうということはxを小さくするということ
G[R[i]].push_back({L[i],-D[i]});
	}
    bool f=true;
    std::fill(d,d+N + 1,INF);
    EREP(i,N){
        if(!dijkstra(i))f=false;
    }
    cout<<(f?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 21120
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;



int main() {
ll N,count=1;
cin>>N;
vector<ll> A(N-1,0);
vector<ll> A_count(N+1,0);
rep(i,N-1) cin>>A[i];
sort(A.begin(),A.end());
rep(j,N-1) {
  if(A[j]==count) A_count[count]++;
  else {
    j--;
    count++;
  }
}
for(int k=1;k<N+1;k++) cout<<A_count[k]<<endl;
return 0;
}


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

using namespace std;

long long dp[100100];
int w[100100], v[100100];
int N, W;

int main(){
    cin >> N >> W;
    for(int i = 1; i <= N; i++) cin >> w[i] >> v[i];
    memset(dp, 1e9 + 10, sizeof(dp));
    dp[0] = 0;
    for(int i = 1; i <= N; i++){
        for(int j = 100000; j >= v[i]; j--){
            dp[j] = min(dp[j - v[i]] + w[i], dp[j]);
        }
    }
    for(int i = 100000; i >= 0; i--){
        if(dp[i] <= W){
            cout << i << '\n';
            return 0;
        }
    }
}

Measured memory_bytes: 1024
N = int(input())
tasks = []
for _ in range(N):
    A, B = map(int, input().split())
    tasks.append([A, B])
tasks.sort(key=lambda x:x[1])

nums = [0]
for i, t in enumerate(tasks):
    nums.append(nums[i]+t[0])
    if nums[i+1] > t[1]:
        print('No')
        quit()
print('Yes')

Measured memory_bytes: 42632