akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define printP(x) "(" << (x).first << ", " << (x).second << ")"
#define mod 1000000007
using namespace std;
typedef pair<llint, llint> P;

struct edge{
	llint to, cap, rev;
	edge(llint a, llint b, llint c){
		to = a, cap = b, rev = c;
	}
};


llint h, w;
vector<edge> G[205];
llint S, T;
llint level[255], iter[255];

void bfs(llint s)
{
	for(int i = 1; i <= T; i++) level[i] = inf;
	level[s] = 0;
	
	queue<int> Q;
	Q.push(s);
	while(Q.size()){
		int v = Q.front();
		Q.pop();
		for(int i = 0; i < G[v].size(); i++){
			int u = G[v][i].to;
			if(G[v][i].cap <= 0 || level[u] < inf) continue;
			level[u] = level[v] + 1;
			Q.push(u);
		}
	}
}

llint dfs(int v, llint f)
{
	if(v == T) return f;
	
	llint ret;
	for(llint &i = iter[v]; i < G[v].size(); i++){
		if(level[v] >= level[G[v][i].to] || G[v][i].cap <= 0) continue;
		ret = dfs(G[v][i].to, min(f, G[v][i].cap));
		if(ret > 0){
			G[v][i].cap -= ret;
			G[G[v][i].to][G[v][i].rev].cap += ret;
			return ret;
		}
	}
	return 0;
}

void add_edge(int s, int t, llint cap)
{
	G[s].push_back(edge(t, cap, G[t].size()));
	G[t].push_back(edge(s, 0, G[s].size()-1));
}

int main(void)
{
	cin >> h >> w;
	S = h+w+1, T = h+w+2;
	
	char c;
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			cin >> c;
			if(c == 'S'){
				add_edge(S, x, inf);
				add_edge(S, y+w, inf);
			}
			if(c == 'T'){
				add_edge(x, T, inf);
				add_edge(y+w, T, inf);
			}
			if(c == 'o'){
				add_edge(x, y+w, 1);
				add_edge(y+w, x, 1);
			}
		}
	}
	
	llint ans = 0, flow;
	while(1){
		bfs(S);
		if(level[T] >= inf) break;
		for(int i = 1; i <= T; i++) iter[i] = 0;
		while(1){
			flow = dfs(S, inf);
			if(flow <= 0) break;
			ans += flow;
		}
	}
	if(ans > inf/2) cout << -1 << endl;
	else cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
#include<cstdlib>
using namespace std;

bool isso(long long int a) {
	if (a == 1||a==0)return false;
	for (long long int i = 2; i*i <= a; ++i) {
		if ((a%i)) {
		}
		else {
			return false;
		}
	}
	return true;
}

struct edge {
	int from;
	int to;
	long double time;
};
struct aa {
	int now;
	long double time;
	bitset<8>tickets;
};

class Compare {
public:
	//keiroが昇順に並ぶ
	bool operator()(const aa&l, const aa&r) {
		return l.time> r.time;
	}
};

long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}

int fizznum[15] = { 0,0,1,1,1,2,2,2,3,3,3,4,4,4,4 };
int buzznum[15] = { 0,0,0,0,1,1,1,1,1,2,2,2,2,2,2 };
int fibunum[15] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 };
long long int memo[18];

string makefb(long long int num) {
	string st;
	if (!(num % 3)) {
		st+=("Fizz");
	}
	if (!(num % 5)) {
		st+=("Buzz");
	}
	if (st.size() == 0) {
		st = to_string(num);
	}
	return st;
}

string getans(long long int rest, long long int from) {
	string ans;
	long long int now(from);
	while (1) {
		string ast(makefb(now));
		if (rest <= ast.size()) {
			ans+=(ast.substr(rest, int(ast.size() - rest)));
			rest = 0;
		}
		else {
			rest -= ast.size();
		}
		now++;
		if (ans.size() >= 20) {
			return ans.substr(0, 20);
		}
	}
}

long long int dp[20001][256];
int main() {
	while (1) {
		memset(dp, 9999999, sizeof(dp));
		int N, M; cin >> N >> M;
		if (!N)break;
		set<int>changes;
		for (int i = 0; i < M; ++i) {
			int c; cin >> c;
			changes.emplace(c);
		}
		vector<int>nums;
		for (int i = 0; i < N; ++i) {
			int x; cin >> x;
			nums.emplace_back(x);
		}
		
		dp[0][128] = 0;
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < 256; ++j) {
				for (auto it = changes.begin(); it != changes.end(); ++it) {
					long long int nextnum = max(0,min(255, j + (*it)));
					dp[i + 1][nextnum] = min(dp[i+1][nextnum],dp[i][j]+(nextnum - nums[i])*(nextnum - nums[i]));
				}
			}
		}
		long long int ans = 1e16;
		for (int j = 0; j < 256; ++j) {
			ans = min(ans, dp[N][j]);
		}
		cout << ans << endl;
	}
	
	return 0;
}

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

namespace agc043_a
{
  class Program
  {
    static void Main(string[] args)
    {
      var H = CIn.ReadInt();
      var W = CIn.ReadInt();
      var s = CIn.ReadCharMatrix(H, W);

      var c = new int[H, W];

      if (s[0, 0] == '#') c[0, 0] = 1;

      for (int i = 0; i < H; i++)
      {
        for (int j = 0; j < W; j++)
        {
          if (i == 0 && j == 0) continue;

          var a = int.MaxValue;
          if (i > 0)
          {
            a = c[i - 1, j];
            if (s[i - 1, j] == '.' && s[i, j] == '#') a++;
          }

          var b = int.MaxValue;
          if (j > 0)
          {
            b = c[i, j - 1];
            if (s[i, j - 1] == '.' && s[i, j] == '#') b++;
          }

          c[i, j] = Math.Min(a, b);
        }
      }

      Console.WriteLine(c[H - 1, W - 1]);
    }
  }

  class Search
  {
    public int X { get; }
    public int Y { get; }
    public int Count { get; }

    public Search(int x, int y, int count)
    {
      X = x;
      Y = y;
      Count = count;
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

int main()
{
    double d,s,t,i,j;
    cin>>d>>t>>s;
    i=ceil(d/s);
    if(i<=t)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3716
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e7+4;
typedef long long ll;
int n;
int prime[N],tot;
bool vis[N];
int d[N],t[N];
inline int read() {
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}

inline void linear_shaker(int lim) {
	d[1]=1;
	for (register int i=2;i<=lim;i++) {
		if (!vis[i]) prime[++tot]=i,d[i]=2,t[i]=1;
		for (register int j=1;j<=tot&&i*prime[j]<=lim;j++) {
			vis[i*prime[j]]=true;
			if (i%prime[j]==0) {
				t[i*prime[j]]=t[i]+1;
				d[i*prime[j]]=d[i]/(t[i]+1)*(t[prime[j]*i]+1);
				break;
			}
			t[i*prime[j]]=1;
			d[i*prime[j]]=d[i]*2;
		}
	}
}
ll ans;
int main() {
	n=read();
	linear_shaker(n);
	for (register int i=1;i<=n;++i)
		ans+=1ll*i*d[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 94080
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    map<ll, ll> mp;
    ll n;
    cin >> n;
    ll a;
    ll ans = 0;
    for(int i=0;i<n;i++) {
    	cin >> a;
    	ans += mp[i-a];
    	mp[a+i]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 26316
q = int(input())

def lcs(a, b):
    # L[i]はa1~ajとb1~bkから長さがi+1の共通部分列が作れるときのjが取りうる最小値とする
    L = []
    for bk in b:
        bgn_idx = 0 # 検索開始位置
        for i, cur_idx in enumerate(L):
            # bkがbgn_idx以降でaにあれば、そのidx+1かcur_idxの小さい方で更新
            chr_idx = a.find(bk, bgn_idx) + 1
            if not chr_idx:
                break
            L[i] = min(cur_idx, chr_idx)
            bgn_idx = cur_idx
        # 全部まわったということはbkが現在の最長の共通文字列以降にaにあったということ。であれば末尾に追加できる
        else:
            # bkがbgn_idx以降でaにあれば、そのidx+1をLに追加
            chr_idx = a.find(bk, bgn_idx) + 1
            if chr_idx:
                L.append(chr_idx)
    return len(L)

for _ in range(q):
    s = input()
    t = input()
    print(lcs(s, t))



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

int main(){
    int n=0,a=0,count=0,b=0,t=0;

    cin>>n;

        int x[3][100]={};    

    for(int i=0;i<3;i++){
        cin>>a;
        t=a;


        for(int j=0;j<t;j++){
            cin>>b;
            x[i][b-1]=1;

        }

    }


    for(int j=0;j<n;j++){
        
        if(x[0][j]==0 && x[2][j]==1){
            count++;
        }
        if(x[1][j]==1 && x[2][j]==1){
            count++;

        }
        if(x[0][j]==0 && x[1][j]==1 && x[2][j]==1){
            count--;
        }
    }
    cout<<count<<endl;



}


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

int main() {
  int a, b, sum, res;

  while(cin >> a >> b) {
    res = 0;
    sum = a+b;

    while(sum/10 != 0) {
      sum /= 10;
      res++;
    }
    cout << res+1 << endl;
  }
}

Measured memory_bytes: 1160
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

const int mod = 998244353;

int mul(int a, int b) {
  return (long long) a * b % mod;
}

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

int powMod(int x, int p) {
  int res = 1;
  while (p) {
    if (p & 1) {
      res = mul(res, x);
    }
    p >>= 1;
    x = mul(x, x);
  }
  return res;
}

const int maxn = (int) 1e7 + 5;
int p2[maxn];
int f[maxn], inv[maxn], finv[maxn];

void precalc() {
  p2[0] = 1;
  for (int i = 1; i < maxn; i++) {
    p2[i] = mul(p2[i - 1], 2);
  }
  f[0] = 1;
  for (int i = 1; i < maxn; i++) {
    f[i] = mul(f[i - 1], i);
  }
  inv[1] = 1;
  for (int i = 2; i < maxn; i++) {
    inv[i] = (mod - (long long) (mod / i) * inv[mod % i] % mod) % mod;
  }
  finv[0] = 1;
  for (int i = 1; i < maxn; i++) {
    finv[i] = mul(finv[i - 1], inv[i]);
  }
}

int c(int n, int k) {
  return mul(f[n], mul(finv[k], finv[n - k]));
}

int n;

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  return true;
}

void solve() {
  int res = powMod(3, n);
  for (int a = n / 2 + 1; a <= n; a++) {
    add(res, mod - mul(c(n, a), p2[n - a + 1]));
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 156544
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a>=13){
		printf("%d\n",b);
	}
	if(a>=6&&a<=12){
		printf("%d\n",b/2);
	}
	if(a<=5){
		printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (register ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 5e2 + 10 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 1e9 + 7 ;
const double eps = 1e-7 ;
template <class T> void read(T &a)
{
	int f = 1 ; a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	a *= f;
}

int n;

double ans;

struct vec
{
	db x, y;
}
p[maxn];

signed main()
{
	scanf("%d", &n);
	rep(i, 1, n) scanf("%lf %lf", &p[i].x, &p[i].y);
	sort(p + 1, p + n + 1,[](vec a, vec b)
		{
			return atan2(a.y, a.x) < atan2(b.y, b.x);
		}
	);
	// rep(i, 1, n) printf("%lf %lf\n", p[i].x, p[i].y);
	auto cg = [=](int a)
	{
		return (a - 1) % n + 1;
	};
	rep(i, 1, n)
	{
		double tx = 0, ty = 0;
		rep(j, 0, n - 1)
		{
			tx += p[cg(i + j)].x, ty += p[cg(i + j)].y;
			// db tmp = sqrt(tx * tx + ty * ty);
			// if(tmp > ans) printf("%d %d %lf %lf\n", cg(i), cg(i + j), tx, ty);
			ans = max(ans, sqrt(tx * tx + ty * ty));
		}
	}
	printf("%.11lf\n", ans);
	return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;

public class Main {
	static long mod = (long)1e9+7;
	public static void main(String[] args) {
		FastScanner sc=new FastScanner();
		String s = sc.next();
		char c = s.charAt(s.length()-1);
		if(c=='s') {
			System.out.println(s+"es");
		}else {
			System.out.println(s+"s");
		}
	}
	
	static final Random random = new Random();
	
	static void sort(int[] a) {
		int n = a.length;
		for(int i =0; i<n; i++) {
			int val = random.nextInt(n);
			int cur = a[i];
			a[i] = a[val];
			a[val] = cur;
		}
		Arrays.sort(a);
	}
	
	static void sortl(long[] a) {
		int n = a.length;
		for(int i =0; i<n; i++) {
			int val = random.nextInt(n);
			long cur = a[i];
			a[i] = a[val];
			a[val] = cur;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (st == null  || !st.hasMoreTokens()) {
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		String nextLine() { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
		} 
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
	}

}


Measured memory_bytes: 36492
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  string str;
  cin >> str;
  str[3] = '8';
  cout << str << endl;

  return 0;
}

Measured memory_bytes: 256
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
    std.range, std.container, std.bigint, std.ascii, std.typecons;

// }}}
// nep.scanner {{{
class Scanner
{
    import std.stdio : File, stdin;
    import std.conv : to;
    import std.array : split;
    import std.string : chomp;

    private File file;
    private char[][] str;
    private size_t idx;

    this(File file = stdin)
    {
        this.file = file;
        this.idx = 0;
    }

    private char[] next()
    {
        if (idx < str.length)
        {
            return str[idx++];
        }

        char[] s;
        while (s.length == 0)
        {
            s = file.readln.chomp.to!(char[]);
        }

        str = s.split;
        idx = 0;

        return str[idx++];
    }

    T next(T)()
    {
        return next.to!(T);
    }

    T[] nextArray(T)(size_t len)
    {
        T[] ret = new T[len];

        foreach (ref c; ret)
        {
            c = next!(T);
        }

        return ret;
    }

    void scan()()
    {
    }

    void scan(T, S...)(ref T x, ref S args)
    {
        x = next!(T);
        scan(args);
    }
}
// }}}

void main()
{
    auto cin = new Scanner;
    int n;
    cin.scan(n);
    writeln("ABC" ~ n.to!string);
}


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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> C(N-1), S(N-1), F(N-1);
	REP(i, N-1) cin >> C[i] >> S[i] >> F[i];

	REP(i, N)
	{
		ll t{0};
		FOR(k, i, N-1)
		{
			if (t <= S[k]) t = S[k];
			else if (t % F[k] != 0) t += F[k] - t%F[k];
			t += C[k];
		}
		std::cout << t << std::endl;
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vv = vector<vector<ll>>;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()

typedef pair<ll, ll> Pair;
bool pairCompare(const Pair &firstElof, const Pair &secondElof) {
  return firstElof.second > secondElof.second;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

ll factorial(int n) {
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll P(int n, int m) {
  ll ans = 1;
  for (int i = m + 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll power(int n, int m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = power(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * power(n, m - 1)) % MOD;
  }
}
ll C(int n, int m) {
  return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
ll GCD(ll a, ll b) {
  if (b == 0)
    return a;
  return GCD(b, a % b);
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ll ans = llINF, N = 0;
  ll po, yo, bo;
  vector<ll> A;
  cin >> N >> po >> yo >> bo;
  REP(i, N) {
    ll a = 0;
    cin >> a;
    A.push_back(a);
  }
  REP(i, pow(4, N)) {
    ll hoge = i;
    ll score = 0;
    ll a = 0, b = 0, c = 0;
    REP(j, N) {
      if (hoge % 4 == 0) {
        if (a > 0)
          score += 10;
        a += A[j];
      }
      if (hoge % 4 == 1) {
        if (b > 0)
          score += 10;
        b += A[j];
      }
      if (hoge % 4 == 2) {
        if (c > 0)
          score += 10;
        c += A[j];
      }
      hoge /= 4;
    }
    if (a == 0 || b == 0 || c == 0) {
      continue;
    } else {
      score += abs(a - po) + abs(b - yo) + abs(c - bo);
      if (score < ans)
        ans = score;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, t, a int
	var h []int
	fmt.Scanf("%d", &n)
	fmt.Scanf("%d %d", &t, &a)

	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scanf("%d", &tmp)
		h = append(h, tmp)
	}

	hh := (t - a) * 1000 / 6
	var an, tmp int
	tmp = 1<<63 - 2
	for j, i := range h {
		if tmp > hh-i && hh-i > (-tmp) {
			tmp = abs(hh - i)
			an = j + 1
		}
	}
	fmt.Println(an)
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1928
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string a;
            while (true)
            {
                 a = Console.ReadLine();
                if (a == "0")break;
                int d = a.Length;int e = 0;
                for(int c = 0; c < d; c++)
                {
                    int k = (int)char.GetNumericValue(a[c]);
                    e = e + k;
                }if (a == "0") break;
                Console.Write(e+"\n");
            }
          
        }
    }
}

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

int abs(int x)
{
    if(x > 0){
        return x;
    } else {
        return -x;
    }
}

int main()
{
    int n, z, w;
    cin >> n >> z >> w;
    int a[2010];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n == 1){
        cout << abs(a[0] - w) << endl;
    } else {
        cout << max(abs(a[n-1] - a[n - 2]), abs(w - a[n - 1])) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int a; cin >> a;
    double b; cin >> b;
    int B = (int)(b * 100 + 0.5);

    Out(a * B / 100);

    return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  deque<int> d;
  for (int i = 0; i < n; i++) {
    int p = lower_bound(d.begin(), d.end(), v[i]) - d.begin();
    if(p == 0){
      d.push_front(v[i]);
    }else d[p-1] = v[i];
  }
  int res = d.size();
  cout << res << endl;
}


Measured memory_bytes: 1024
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n,k  = i2()
def B(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
print(len(B(n,k)))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int cmp(const void *a, const void *b);
//your code here!
ll F(ll a, ll b);
int main(void){
    ll N, s, i;
    scanf("%lld", &N);
    ll MIN = F(1, N);
    if(N%2==0) s=2;
    else s=3;
    for(i=s; i<=sqrt(N); i+=2){
        if(N%i==0){
            chmin(MIN, F(i, N/i));
        }
    }
    printf("%lld\n", MIN);
    return 0;
}
ll F(ll a, ll b){
    ll w=max(a,b), cnt=0;
    while(w!=0){
        w /= 10;
        cnt++;
    }
    return cnt;
}
int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return 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 V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 998244353;

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

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

    ll ret = LLINF;
    REP(i, n) REP(j, n) REP(k, n) {
        if(i==j || j==k || k==i) continue;
        // cout << i << " " << j << " " << k << endl;
        vector<ll> v;
        REP(x, n) if(x!=i && x!=j && x!=k) v.push_back(l[x]);
        // if(v == vector<ll>({30, 21})) {
        //     cout << v << endl;
        // }
        REP(mask, 1LL<<((n-3)*2)) {
            ll m = mask;
            ll p = l[i], q = l[j], r = l[k], cnt = 0;
            REP(x, n-3) {
                ll t = m%4;
                if(t == 0) {}
                else if(t == 1) p += v[x], cnt+=10;
                else if(t == 2) q += v[x], cnt+=10;
                else if(t == 3) r += v[x], cnt+=10;
                m /= 4;
            }
            // if(v == vector<ll>({30, 21})) {
            //     cout << p << " " << q << " " << r << endl;
            // }
            chmin(ret, abs(a-p)+abs(b-q)+abs(c-r)+cnt);

        }
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, K;
    cin >> N >> K;
    map<int, int> m;
    rep(i,N) {
      int a;
      cin >> a;
      if (m.count(a) > 0) m[a]++;
      else m[a] = 1;
    }
    if (m.size() <= K) {
        cout << 0 << endl;
        return 0;
    }
    vector<pair<int,int>> M2;
    for (auto x : m) M2.push_back(make_pair(x.second,x.first));
    sort(M2.begin(),M2.end());
    int M = m.size() - K;
    int c = 0;
    int i = 0;
    while (M > 0) {
        c += M2[i++].first;
        M--;
    }
    cout << c << endl;
}

Measured memory_bytes: 11768
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a,b;
	cin>>a>>b;
	int gcd=__gcd(a,b);
//	cout<<gcd<<endl;
	long long int lcm=a*b;
//	lcm=a*b;
	lcm/=gcd;
	cout<<lcm<<endl;
}

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

using namespace std;

typedef long long ll;

int main(){
    #ifdef magUNbos
    freopen("in","r",stdin);
    freopen("out","w",stdout);
    #endif // magUNbos

    ll a, b;
    cin>>a>>b;
    if( (a > 0 && b > 0) || ( a < 0 && b < 0)){
        if(a < 0 && b < 0 && ( (abs(a - b) + 1) & 1) )
            cout<<"Negative\n";
        else
            cout<<"Positive\n";
    }
    else{
        cout<<"Zero\n";
    }
}


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

using namespace std;
#define ll long long

ll INF = 1e9 + 7;
const int MAX = 5e5 + 5;

struct Query 
{ 
    int l, r, idx; 
}; 

bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 

void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 

int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 

void solve(int arr[], int n, Query queries[], int q)
{
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 

    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 

    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 

        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 

        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
  
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                     query(queries[query_counter].r + 1, bit, n)- 
                     query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 

    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
}

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

    int n,q;
    cin>>n>>q;

    int arr[n];

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

    Query queries[q];

    for(int i=0;i<q;i++)
    {
        cin>>queries[i].l>> queries[i].r;
        queries[i].l--;
        queries[i].r--;
        queries[i].idx = i;
    }

    sort(queries, queries+q, cmp);

    solve(arr,n,queries,q);

    return 0;
}


Measured memory_bytes: 17380
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int h,w,a,b;
int main(){
	cin>>h>>w>>a>>b;
	int c=h/a*a;
	int d=w/b*b;
	cout<<h*w-c*d<<endl;
}


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

int main(){
  int n;
  cin >> n;

  vector<vector<int>> f(n,vector<int>(10));
  vector<vector<int>> p(n,vector<int>(11));

  rep(i,n) rep(j,10) cin >> f[i][j];
  rep(i,n) rep(j,11) cin >> p[i][j];

  ll ans = -100000000000;

  for(int i = 1; i < 1024; i++){
    ll c = 0;
    rep(j,n){//店ごとに
      //かぶっている営業時間の数を求める
      int ci = 0;
      rep(k,10){
        if((f[j][k]==1)&&((i>>k)&1==1)) ci++;
      }
      //店jに対する利益を足す
      c += p[j][ci];
    }
    if(c>ans) ans = c;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
const double PI  = 3.1415926535897932384626433832795028841971;
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll ans = 0;

int main(){
	cin >> n;
	bool yes = false;
	rep(i,n){
		int a;
		cin >> a;
		if(yes == true && a > 0){
			ans++;
			a--;
		}
		yes = false;
		ans += a/2;
		a = a%2;
		if(a == 0){
			yes = false;
		} else{
			yes = true;
		}
	}
	cout << ans << endl;
}

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define M_PI       3.14159265358979323846
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n,m;
    cin>>n>>m;
    ll x,sum=0;
    rep(i,0,m-1){
        cin>>x;
        sum+=x;
    }
    cout<<max(-1ll,n-sum)<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 3656
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	nums := 15
	var (
		xCount int
		oCount int
	)
	for _, r := range s {
		if r == 'x' {
			xCount++
		} else {
			oCount++
		}
		nums--
	}
	if nums+oCount >= 8 {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#define N 50000
using namespace std;

int main(){
  bool ip[N];
  int p[N];
  for(int i=0;i<N;i++) ip[i]=true;
  int q=0;
  ip[0]=ip[1]=false;
  for(int i=0;i<N;i++){
    if(ip[i]){
      p[q++]=i;
      for(int j=i*2;j<N;j+=i) ip[j]=false;
    }
  }
  int n,a;
  while(1){
    cin>>n;
    a=0;
    if(n==0) break;
    if(n%2){
      if(binary_search(p,p+min(n,q),n-2)) a=1;
    }
    else{
      for(int i=0;p[i]<=n/2;i++){
	if(binary_search(p+i,p+min(n,q),n-p[i])) a++;
      }
    }
    cout<<a<<endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
 
using namespace std;

signed main()
{
    fast;
    string s;
    cin>>s;

    if ( s[0] == s[1] && s[1] == s[2] )
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,x,m=map(int,input().split())
a=[x]
check=set()
check.add(x)

past=x
cnt=1
while(1):
  now=(past**2)%m
  if now not in check:
    a.append(now)
    check.add(now)
    cnt+=1
    past=now
    if cnt==n:
      print(sum(a))
      exit()
  else:
    #timeは周期の長さ
    time=len(a)-a.index(now)
    #timeより前のものをpreとする
    pre=a.index(now)
    #preの合計
    pre_sum=sum(a[:a.index(now)])
    #循環したものの合計
    time_sum=((n-pre)//time)*sum(a[a.index(now):len(a)])+sum(a[a.index(now):a.index(now)+(n-pre)%time])
    
    print(pre_sum+time_sum)
    exit()
  
  
  

Measured memory_bytes: 77048
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;

long n;
vector<vector<long> > x;
vector<long> vis;
vector<long> pathinfo;

void dfs( long curr, long count[2] )
{
    if(vis[curr]) return;
    vis[curr] = 1;

    long i;
    for(i=0; i<(long)x[curr].size(); i++) {
        long count0[2]={0};
        dfs( x[curr][i], count0 );

        count[0] += count0[0];
        count[1] += count0[1];
    }

    count[0]++;
    if(curr==n-1) count[1]=1;

    //printf("[%ld] (%ld,%ld)\n", curr, count[0], count[1]);
    if(count[1]) pathinfo.push_back( count[0] );

    return;
}

int main(int argc, char* argv[])
{
    scanf("%ld", &n);

    vis.resize(n);
    x.resize(n);

    long i;
    for(i=0; i<n-1; i++) {
        long a, b;
        scanf("%ld%ld", &a, &b);
        x[a-1].push_back(b-1);
        x[b-1].push_back(a-1);
    }

    long count[2]={0};
    dfs( 0, count );

    sort(pathinfo.begin(), pathinfo.end());
    long nn = pathinfo.size();
    long val = pathinfo[nn/2-1];
    if(val >= (n+1)/2) {
        printf("Snuke\n");
    }
    else {
        printf("Fennec\n");
    }


    return 0;
}


Measured memory_bytes: 13944
#include <iostream>
using namespace std;
 
int main(void){
    int a,b;
    cin >> a;
    cin >> b;
    cout << "a";
    if(a<b){
      cout << " < ";
    } 
    if(a==b){
      cout << " == ";
    }
    if(a>b){
      cout << " > ";
    }
    cout << "b" << endl;
     
}


Measured memory_bytes: 3032
#include<iostream>
#include<vector>
#define MAX 200000
using namespace std;

/*
1 <= n,m < 200000
1 <= k,a,b < 10^9
*/

long long k,m,n;
vector<long long> a,b;

int main(){
    cin >> n >> m >> k;

    for(int i = 0;i < n;i++){
        int x;
        cin >> x;
        a.push_back(x);
    }

    long long sum = 0;

    for(int i = 0;i < m;i++){
        int x;
        cin >> x;
        b.push_back(x);
        sum += x;
    }

    /*尺取り法*/
    /*sum : bの合計*/
    int j = m;
    int ans = 0;

    for(int i = 0;i < n + 1;i++){
        /*aを0冊からn冊まで考える*/
        while(j > 0 && sum > k){
            j--;
            sum -= b[j];
        }
        if(sum > k) break;
        ans = max(ans, j + i);
        if(i == n) break;
        //cout << j + i << " " << i <<" " << j << endl;
        sum += a[i];
    }

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

Measured memory_bytes: 7936
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
template<typename T> inline void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> inline void chmax(T& a, T b) { if (a < b) a = b; }
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 19;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[4];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint(), M = getint(), L = getint();
	int C[300][300];
	rep(j, N) rep(i, j) C[i][j] = 1e9 + 1;
	rep(i, M) {
		int a = getint(), b = getint(), c = getint();
		C[--a][--b] = c;
		C[b][a] = c;
	}

	rep(k, N) {
		auto Ck = C[k];
		rep(i, k) {
			auto Ci = C[i];
			auto Cik = Ci[k];
			for (int j = i + 1; j < k; j++) {
				chmin(Ci[j], Cik + C[j][k]);
			}
			for (int j = k + 1; j < N; j++) {
				chmin(Ci[j], Cik + Ck[j]);
			}
		}
		for (int i = k + 1; i < N; i++) {
			auto Ci = C[i];
			auto Cki = Ck[i];
			for (int j = i + 1; j < N; j++) {
				chmin(Ci[j], Cki + Ck[j]);
			}
		}
	}

	rep(j, N) rep(i, j) {
		C[i][j] = (C[i][j] <= L) ? 1 : 1e9;
	}

	rep(k, N) {
		auto Ck = C[k];
		rep(i, k) {
			auto Ci = C[i];
			auto Cik = Ci[k];
			for (int j = i + 1; j < k; j++) {
				chmin(Ci[j], Cik + C[j][k]);
			}
			for (int j = k + 1; j < N; j++) {
				chmin(Ci[j], Cik + Ck[j]);
			}
		}
		for (int i = k + 1; i < N; i++) {
			auto Ci = C[i];
			auto Cki = Ck[i];
			for (int j = i + 1; j < N; j++) {
				chmin(Ci[j], Cki + Ck[j]);
			}
		}
	}

	int Q = getint();
	rep(i, Q) {
		int s = getint(), t = getint();
		if (--s > --t) swap(s, t);
		if (C[s][t] == 1) {
			*di++ = '0';
			*di++ = '\n';
		}
		else if (C[s][t] < 1e9) putint(C[s][t] - 1);
		else {
			*di++ = '-';
			*di++ = '1';
			*di++ = '\n';
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 1152
n=int(input())
a=list(map(int, input().split()))
m=max(a)
table=[0]*(m+2)
cnt=0

for num in a:
    if num==0:
        cnt+=1
        table[0]+=1
        table[1]+=1
    else:
        table[num-1]+=1
        table[num]+=1
        table[num+1]+=1

tmp=max(table)
ans=max(tmp, cnt)
print(ans)

Measured memory_bytes: 14092
#include <bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 3.14159265358979323846
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define deb(x) cerr << ">> " << #x << " : " << x << "\n"
#define endl '\n'
#define ff first
#define ss second
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define RAGE ios::sync_with_stdio(0); cin.tie(0);

using namespace std;

const ll inf = 1e18 + 42;

const ll M = 998244353;

ll power(ll x, ll y) {
    if (y == 0) return 1;
    if (y & 1) return (x * power(x, y - 1));
    ll t = power(x, y / 2);
    return (t * t);
}

const ll MAX = 1e5 + 5;

void solve()
{
	ll k; cin >> k;
	ll p = 100;
	ll t = 0;
	while(p < k)
	{
		p += (p * 1 * 1) / 100;
		// deb(p);
		t++;
	}
	cout << t << endl;
}


int main()
{
	RAGE
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	ll t = 1;
	// cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

// GCDを計算します
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
    if (a < b) {
        NumType tmp = a;
        a = b;
        b = tmp;
    }

    NumType r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

// 約数を数えます
template <typename NumType>
NumType cntDivisor(const NumType & num) {
    NumType cnt = 0;
    for(NumType i = 1; i * i <= num; ++i) {
        if(num % i == 0) {
            cnt++;
            if(i * i != num) cnt++;
        }
    }

    return cnt;
}

// [beg, end)の範囲を，添え字indexでループするfor文に置換します
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"

template<class T>
T min(T a, T b) {
    return (a < b) ? a : b;
}

template<class T>
T max(T a, T b) {
    return (a > b) ? a : b;
}

int main() {
    int N;
    cin >> N;

    if (N % 2 == 0) cout << 0.5;
    else cout << (double)(N/2+1)/N;

    return 0;
}



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

ans = 10**11
for i in range(2**n):
    temp = 0
    b = a[:]
    i = format(i, "0{}b".format(n))
    if i.count("1") == k:
        maxi = 0
        for j in range(n):
            if i[j] == "1":
                if maxi >= b[j]:
                    temp += maxi - b[j] + 1
                    b[j] = maxi + 1
            maxi = max(maxi, b[j])
        ans = min(ans, temp)


print(ans)


Measured memory_bytes: 3064