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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

typedef long long int ll;
typedef long int li;

const ll mod = 1000000007;
const ll inf = 1000000000000000000;

typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef map<ll, ll> mll;
typedef map<ll, string> mls;
typedef map<string, ll> msl;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#pragma GCC optimize ("-O3")
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
#define PI 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define tol(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define tou(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(v) v.begin(), v.end()
#define FOR(i, j, k, in) for(li i=j; i<k; i+=in)
#define RFOR(i, j, k, de) for(li i=j; i>=k; i-=de)
#define rep(i,j,k) FOR(i, j, k, 1)
#define rrep(i,j,k) RFOR(i, j, k, 1)
#define repc(v) for(auto it=v.begin(); it!=v.end(); it++)
#define T ll t; cin>>t; while(t--)

ll gen(){
    ll temp;
    cin>>temp;
    return temp;
}

int main(){
  FAST

  ll n ;
  cin>>n;
  printf("%0.4lf",(2*PI*n));
  
  return 0;
}







Measured memory_bytes: 3772
n = gets.to_i

a, c, t, g = 0, 1, 2, 3

def is_agc(i, j, k)
  a, c, t, g = 0, 1, 2, 3
  return [i, j, k] == [a, g, c]
end

def is_ok(i, j, k, l)
  !is_agc(i, k, l) && !is_agc(j, k, l) && !is_agc(j, l, k) && !is_agc(k, j, l) && !is_agc(i, j, l)
end  


div = 1000_000_007

dp = Array.new(n+1) { Array.new(4) { Array.new(4) { Array.new(4, 0)}}}

4.times do |i|
  4.times do |j|
    4.times do |k|
        dp[3][i][j][k] = 1
    end
  end
end

dp[3][a][g][c] = 0
dp[3][a][c][g] = 0
dp[3][g][a][c] = 0

3.upto(n-1) do |epic|
  4.times do |i|
    4.times do |j|
      4.times do |k|
        sum = 0
        4.times do |l|
          sum += dp[epic][l][i][j] if is_ok(l, i, j, k)
        end

        dp[epic+1][i][j][k] = sum % div
      end
    end
  end
end

sum = 0
4.times do |i|
  4.times do |j|
    4.times do |k|
      sum += dp[n][i][j][k]
    end
  end
end

p sum % div


Measured memory_bytes: 2172
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Task[] jobs = new Task[n];
        for(int i=0;i<n;i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            jobs[i] = new Task(a,b);
        }
        sc.close();
        Arrays.sort(jobs);
        int cur = 0;
        for(int i=0;i<n;i++){
            int a = jobs[i].a;
            int b = jobs[i].b;
            if(cur+a <= b){
                cur += a;
            }else{
                System.out.println("No");
                return;
            }            
        }
        System.out.println("Yes");
        return;
    }
}

class Task implements Comparable<Task>{
    int a; int b;
    public Task(int a, int b){
        this.a = a;
        this.b = b;
    }

    @Override
    public int compareTo(Task t){
        if(this.b == t.b){
            return this.a - t.a;
        }else{
            return this.b - t.b;
        }
    }
}

Measured memory_bytes: 108540
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
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; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;}

// head


int m,n,k,res,tmp,tmp2,tmp3,h,x,y;
VI a;
deque<PII> que;
string s;
//VI b;
vector<PII> g[2100600];
int b[2100000];
int c[210000] = {};
int rui[210000];
set<int> ch;



signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  int ga,gb,sa,sb,ba,bb;
  cin>>ga>>sa>>ba>>gb>>sb>>bb;
  int w[3] = {ga,sa,ba};
  int v[3] = {gb,sb,bb};
  vector<int> dp(n+1,0);
	for (int i=0; i<3; ++i)
		for (int j=w[i]; j<=n; ++j)
			dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
  int i = n;
  while(dp[n] == dp[i] && i>=0){i--;}
  dp[n] += n-i-1;
  n = max(dp[n],n);
  vector<int>().swap(dp);
  vector<int> dp2(n+1,0);
	for (int i=0; i<3; ++i)
		for (int j=v[i]; j<=n; ++j)
			dp2[j] = max(dp2[j], dp2[j-v[i]] + w[i]);
  i = n;
  while(dp2[n] == dp2[i] && i>=0){i--;}
  dp2[n] += n-i-1;
  n = max(dp2[n],n);
  cout << n << '\n';
}

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

int main() {
  string O, E;
  cin >> O >> E;
  string ans;
  int j = 0, k = 0;
  for (int i = 0; i < O.size() + E.size(); i++) {
    if (i % 2 == 0) {
      ans.push_back(O[j]);
      j++;
    } else {
      ans.push_back(E[k]);
      k++;
    }
  }
  cout << ans << endl;

  return 0;
}

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

int main()
{
    string n;
    cin >> n;
    for(int i = 0; i < 3; i++){
        if(n[i]== '1'){
            n[i] = '9';
        }else if(n[i] == '9'){
            n[i] = '1';
        }
    }
    cout << n << endl;
}


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

class Mult3
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        long first = long.Parse(input[0]);
        long second = long.Parse(input[1].Replace(".",""));

       

         long ans = first * second / 100;

         Console.WriteLine(ans);

    }
}

Measured memory_bytes: 17936
/*
 * https://atcoder.jp/contests/dp/tasks/dp_a
 */

#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int n, dp[100000], x;
    vector <int> h;
    h.push_back(-1);

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

    dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);

    for (int i = 3; i <= n; i++) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    cout << dp[n];

    return 0;
}

Measured memory_bytes: 1144
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define INF 2000000000LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,a;
int x[51];
ll dp[51][51][2501];
int main(void){
	scanf("%d%d",&n,&a);
	for(int i=0;i<n;i++){
		scanf("%d",&x[i]);
	}
	dp[0][0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			for(int k=0;k<=j*50;k++){
				if(dp[i][j][k]>0){
					dp[i+1][j][k]+=dp[i][j][k];
					dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
				}
			}
		}
	}
	ll res=0;
	for(int i=1;i<=n;i++){
		res+=dp[n][i][a*i];
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
#define ll long long
#define EPS 1e-9
#define rank asadf
using namespace std;

const int MAXN = 3e5 + 111;
const int MOD = 998244353;

int was[MAXN];

int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    int x, m;
    cin >> n >> x >> m;
    if (n <= 3 * m) {
        ll ans = 0;
        ll cur = x;
        for (int i = 0; i < n; ++i) {
            ans += cur;
            cur = (cur * 1LL * cur) % m;
        }
        cout << ans;
        return 0;
    }
    int cur = x;
    int pre = 0, cycle = 0;
    ll sum_pre = 0, sum_cycle = 0;
    int cycle_start = -1;
    while (true) {
        if (was[cur] == 2) {
            cycle_start = cur;
            break;
        }
        ++was[cur];
        cur = (cur * 1LL * cur) % m;
    }
    for (int i = 0; i < m; ++i) {
        if (was[i] == 1) {
            ++pre;
            sum_pre += i;
        }
        if (was[i] == 2) {
            ++cycle;
            sum_cycle += i;
        }    
    }
    ll times = (n - pre) / cycle;
    ll ans = sum_pre + sum_cycle * times;
    cur = cycle_start;
    for (ll i = pre + cycle * times; i < n; ++i) {
        ans += cur;
        cur = (cur * 1LL * cur) % m;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3976
if __name__ == "__main__":
      S = (input()).split()
      n = int(S[0])
      q = int(S[1])
      head = 0
      tail = n-1
      que = []
      runtime = 0
      fin = []

      for i in range(0, n):
            que.append((input()).split())

      while head <= tail:
            nowjob = que[head]
            jobtime = int(nowjob[1])
            if jobtime > q :
                  jobtime = jobtime -q
                  jobname = nowjob[0]
                  que.append([jobname, jobtime])
                  runtime = runtime + q
                  head = head + 1
                  tail = tail + 1
            else :
                  runtime = runtime + jobtime
                  fin.append([(que[head])[0], runtime])
                  head = head + 1
      for i in range(0,n):
            print("{} {}".format((fin[i])[0], (fin[i])[1]))

Measured memory_bytes: 44052
#include<bits/stdc++.h>
using namespace std;
long long a[1000005];
int m[1000005];
bool isPrime[10000005];
long long Prime[10000005],cnt=0;
void GetPrime(int n)
{
    for(int i=1;i<=n;++i)isPrime[i]=1;
    isPrime[1] = 0;
    for(int i = 2; i <= n; i++)
    {
        if(isPrime[i])
            Prime[++cnt] = i; 
        for(int j = 1; j <= cnt && i*Prime[j] <= n/*不超上限*/; j++) 
        {
            isPrime[ i*Prime[j] ] = 0;
            if(i % Prime[j] == 0)
                break;
        }
    }
}
long long gcd(long long a,long long b)
{
	return b?gcd(b,a%b):a;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%lld",&a[i]);
	long long tmp=a[1];
	for(int i=2;i<=n;++i)tmp=gcd(tmp,a[i]);
	if(tmp>1)return !printf("not coprime\n");
	GetPrime(5000005);
	int Max=0;
	for(int i=1;i<=n;++i)
	{
		long long now=a[i];
	//	++m[a[i]];
		for(int j=1;Prime[j]*Prime[j]<=now;++j)
		{
			if(now%Prime[j]==0)
			{
				++m[Prime[j]];
				while(now%Prime[j]==0&&now)now/=Prime[j];
			}
		}
		if(now)++m[now];
	}
	for(int i=2;i<=1000000;++i)Max=max(Max,m[i]);
	if(Max<=1)printf("pairwise coprime\n");
	else if(Max<n)printf("setwise coprime\n");
	else printf("not coprime\n");
	return 0;
}

Measured memory_bytes: 22820
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int count = 0;
		if(s/100 == 1) {
			count++;
			s -= 100;
		}
		if(s/10 == 1) {
			count++;
			s -= 10;
		}
		if(s == 1) {
			count++;
		}
		System.out.println(count);
	}
}

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

int main(){
  int n;
  cin >> n;
  vector<double> a(n);
  double ans = 0.0000000000;
  for(int i = 0; i < n; i++){
  	cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  ans = a.at(0);
  for(int i = 1; i < n; i++){
  	ans = (ans+a.at(i))/2;
  }
  cout << fixed << setprecision(7);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int R, S, P;

int main() {
  int N, K; cin >> N >> K;
  cin >> R >> S >> P;
  string t; cin >> t;

  for(int i = 0; i+K < N; i++) {
    if(t[i] == t[i+K]) t[i+K] = '_';
  }

  int ans = 0;
  for(int i = 0; i < N; i++) {
    if(t[i] == 'r') ans += P;
    if(t[i] == 's') ans += R;
    if(t[i] == 'p') ans += S;
  }

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


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

int main(void) {
    int A,B,C,K;
    cin >> A >> B >> C >> K;

    int ans = -1;
    if (A>=K) {
        ans = K;
    }
    else if ((A+B)>=K) {
        ans = A;
    }
    else {
        ans = A-(K-(A+B));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)

d = {}
for a in A:
  d.setdefault(a,0)
  d[a] += 1
  
A = sorted(set(A))
t = [True] * (10 ** 6 + 1)
for a in A:
    if d[a] > 1:
        t[a] = False
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False
print(sum(1 for a in A if t[a]))

Measured memory_bytes: 44200
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

string res;

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

    string S;
    cin >> S;
    res = S.substr(0, 3);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
unsigned N;
char chars[4096];
unsigned posr[4096],posg[4096],posb[4096];
unsigned szr,szg,szb;
ll cnt; 
int main(){
	//freopen("rd.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin>>N;
	cin>>chars;
	
	for(register unsigned i=0;i<N;++i)
	{
		if(chars[i]=='R')
			posr[szr++]=i;
		else if(chars[i]=='G'){
			posg[szg++]=i;
		}
		else {
			posb[szb++]=i;
		}
	}
	cnt=szr*szg*szb;
	for(register int i=0;i<N-2;++i){
		for(register int j=i+1;j<N-1;++j){
			if(chars[i]==chars[j])continue;
			int k=2*j-i;
			if(k>j&&k<N){
				if(chars[k]!=chars[i]&&chars[k]!=chars[j])
				cnt--;
			}
		}
	}
	
	cout<<cnt;
}


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


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

    vector<int> B(N-1);
    for (int i = 0; i < B.size(); ++i) cin >> B[i];

    vector<int> A(N);
    for (int i = B.size()-1; i >= 0; --i) {
        if (i == B.size()-1) {
            A[i+1] = B[i];
            A[i] = B[i];
        } else {
            A[i] = B[i];
            A[i+1] = min(B[i], B[i+1]);
        }
    }

    int ans =0;
    for (int i = 0; i < A.size(); ++i) {
        ans += A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long int n;
    int sum=0,p;
    scanf("%d",&n);
    long int x=n;
    while(n!=0){
        p=n%10;
        n=n/10;
        sum+=p;
     }
    if(x%sum==0){
    printf("Yes\n");}
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;
const int INF = -2e9;

int n, m, p;
int dist[N], cnt[N];
bool inqueue[N];
vector<pair<int, int> > g[N];
vector<int> rg[N];
bool vis[N];

void dfs(int u)
{
	if(vis[u])
		return;
	vis[u] = 1;
	for(auto &it:rg[u])
		dfs(it);
}

bool negativeCycle() //Returns true if there is a negative cycle
{
	queue<int> q;

	for(int i = 1; i <= 1; i++)
	{
		dist[i] = cnt[i] = 0;
		q.push(i), inqueue[i]=true;
	}

	for(int i = 2; i <= n; i++)
		dist[i] = -INF;

	while(!q.empty())
	{
		int v=q.front();
		q.pop();
		inqueue[v]=false;

		for(auto &edge:g[v])
		{
			int to=edge.first;
			int w=edge.second;

			if(dist[v] + w < dist[to])
			{
				dist[to] = dist[v] + w;
				dist[to] = max(dist[to], INF);
				if(!inqueue[to])
				{
					q.push(to);
					inqueue[to]=true;
					cnt[to]++;
					if(cnt[to]>n)
						return true;
				}
			}
		}
	}
	return false;
}

int32_t main()
{
	IOS;
	cin >> n >> m >> p;
	for(int i = 1; i <= m; i++)
	{
		int u, v, w;
		cin >> u >> v >> w;
		g[u].push_back({v, p - w});
		rg[v].push_back(u);
	}
	dfs(n);
	for(int i = 1; i <= n; i++)
	{
		vector<pair<int, int> > v;
		for(auto &it:g[i])
			if(vis[it.first])
				v.push_back(it);
		g[i].clear();
		g[i] = v;
	}
	int check = negativeCycle();
	if(check)
	{
		cout << "-1";
		return 0;
	}
	cout << max(0LL, -dist[n]);
	return 0;
}

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

int main(){
    int a, b;
    cin>> a >> b;
    if(a < b) cout << "a < b" << endl;
    else if(a > b) cout << "a > b" << endl;
    else cout << "a == b" << endl;
    return 0;
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vec a(n);
  for(ll i=0;i<n;i++) cin >> a[i];
  map<ll,ll> od,ev;
  for(ll i=0;i<n;i++) {
    if(i%2) ev[a[i]]++;
    else od[a[i]]++;
  }
  pll evx={-1,0};
  pll odx={-1,0};
  for(auto p:ev) {
    if(evx.second<p.second) {
      evx=p;
    }
  }
  for(auto p:od) {
    if(odx.second<p.second) {
      odx=p;
    }
  }
  ll ans=evx.second+odx.second;
  if(evx.first==odx.first) {
    pll evs={-1,0};
    pll ods={-1,0};
    for(auto p:ev) {
      if(evx.first!=p.first&&evs.second<p.second) {
        evs=p;
      }
    }
    for(auto p:od) {
      if(odx.first!=p.first&&ods.second<p.second) {
        ods=p;
      }
    }
    ans=max(evx.second+ods.second,evs.second+odx.second);
  }
  cout << n-ans << endl;
}

Measured memory_bytes: 7296
n = gets.to_i
i = 0
s = []

while i < n
  s << gets.to_s
  i += 1
end

s = s.join
ac = s.scan("AC").length
wa = s.scan("WA").length
tle = s.scan("TLE").length
re = s.scan("RE").length

puts "AC x #{ac}"
puts "WA x #{wa}"
puts "TLE x #{tle}"
puts "RE x #{re}"


Measured memory_bytes: 21812
def compute():
    from sys import stdin
    N, Q = map(int, stdin.readline().split())
    S = stdin.readline().strip()

    cnt = [0]
    prev = S[0]
    cur = 0
    for s in S[1:]:
      if prev=='A' and s=='C':
        cur += 1
      cnt.append(cur)
      prev = s
    
    for _ in range(Q):
      l, r = map(int, stdin.readline().split())
      print(cnt[r-1] - cnt[l-1])


if __name__ == "__main__":
    compute()


Measured memory_bytes: 53372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		sc.close();
		
		int count = 0;
		for(int i = a; i<=b; i++) {
			if(c % i == 0) {
				count++;
			}
		}
		
		System.out.println(count);
		
	}

}

Measured memory_bytes: 26352
#include <cstdio>
#include <algorithm>

typedef long long ll;

ll a[100005], b[100005], c[100005];

int main()
{
    //freopen("a.in", "r", stdin);
    int x, y, na, nb, nc;
    scanf("%d%d%d%d%d", &x, &y, &na, &nb, &nc);
    for(int i = 0; i < na; i++) scanf("%lld", &a[i]);
    for(int i = 0; i < nb; i++) scanf("%lld", &b[i]);
    for(int i = 0; i < nc; i++) scanf("%lld", &c[i]);
    std::sort(a, a + na);
    std::sort(b, b + nb);
    std::sort(c, c + nc);
    int pa = na - x, pb = nb - y, pc = nc - 1;
    while(pa < na && pb < nb && pc >= 0)
    {
        if(a[pa] >= c[pc] && b[pb] >= c[pc]) break;
        if(a[pa] < b[pb]) pa++, pc--;
        else pb++, pc--;
    }
    while(pa < na && pc >= 0 && a[pa] < c[pc]) pa++, pc--;
    while(pb < nb && pc >= 0 && b[pb] < c[pc]) pb++, pc--;
    ll ans = 0;
    for(int i = pa; i < na; i++) ans += a[i];
    for(int i = pb; i < nb; i++) ans += b[i];
    for(int i = pc + 1; i < nc; i++) ans += c[i];
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}
// https://tmasaaa.github.io/kaito_procon/procon/201810041749.html
class UnionFind {
  private:
    vector<int> parent;
    vector<int> height;
    vector<int> m_size;

  public:
    UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
        for(int i = 0; i < size_; ++i)
            parent[i] = i;
    }
    void init(int size_) {
        parent.resize(size_);
        height.resize(size_, 0);
        m_size.resize(size_, 0);
        for(int i = 0; i < size_; ++i)
            parent[i] = i;
    }
    int find(int x) {
        if(parent[x] == x)
            return x;
        return parent[x] = find(parent[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if(x == y)
            return;
        int t = size(x) + size(y);
        m_size[x] = m_size[y] = t;
        if(height[x] < height[y])
            parent[x] = y;
        else
            parent[y] = x;
        if(height[x] == height[y])
            ++height[x];
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) {
        if(parent[x] == x)
            return m_size[x];
        return size(parent[x] = find(parent[x]));
    }
};

int main() {
    long long N, K, L;
    cin >> N >> K >> L;
    vector<long long> p(K), q(K);
    REP(i, K) cin >> p[i] >> q[i];
    vector<long long> s(L), r(L);
    REP(i, L) cin >> r[i] >> s[i];
    UnionFind road(N);
    REP(i, K) { road.unite(p[i] - 1, q[i] - 1); }
    UnionFind rail(N);
    REP(i, L) { rail.unite(r[i] - 1, s[i] - 1); }
    vector<int> a(N);
    vector<int> b(N);
    map<pair<int, int>, int> mp;
    REP(i, N) {
        a[i] = road.find(i);
        b[i] = rail.find(i);
        mp[make_pair(a[i], b[i])]++;
    }
    REP(i, N) { cout << mp[make_pair(a[i], b[i])] << " "; }
    cout << endl;
}

Measured memory_bytes: 21120
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main(){
  int n;
  cin >> n;
  rep(i,50001){
    if((int)(i * 1.08) == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include<cassert>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

/////////////////////////////////////
struct unionfind {
	ll N;
	vector<ll> par;
	vector<ll> sz;//根の場合、その木のサイズ

	unionfind(ll N0) {
		N = N0;
		par.assign(N + 1, -1);
		sz.assign(N + 1, 1);

	}

	ll root(ll x) {
		if (par[x] == -1) { return x; }
		par[x] = root(par[x]);
		return par[x];
	}

	bool same(ll x, ll y) {
		return root(x) == root(y);
	}

	void unite(ll x, ll y) {
		ll a = root(x);
		ll b = root(y);
		if (a != b) {
			par[a] = b; sz[b] += sz[a];
		}

	}

	ll size(ll x) {
		ll r = root(x);
		return sz[r];
	}
};


int main() {
	ll N, M;
	cin >> N >> M;

	unionfind uf(N);

	repn(i, M) {
		ll a, b;
		cin >> a >> b;
		uf.unite(a, b);
	}

	vll con(N + 1, 0);
	repn(i, N)con[uf.root(i)]++;

	ll ans = 0;
	repn(i, N)ans = max(ans, con[i]);
	cout << ans << endl;
}


Measured memory_bytes: 14016
n, k, q = map(int, input().split())
dic = {i:0 for i in range(1, 1+n)}
for i in range(1, 1+q):
    dic[int(input())] += 1
for key, value in sorted(dic.items(), key=lambda x: x[0]):
    if k-q+value > 0:
        print('Yes')
    else:
        print('No')

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

#define SEG_NUM (1<<20)

long seg[SEG_NUM*2];

long find(int x, int y){
    long ans = 2147483647;
    x += SEG_NUM;
    y += SEG_NUM;
    while(x < y){
        if(x % 2 == 1){
            ans = min(ans, seg[x]);
            x++;
        }
        x /= 2;
        if(y % 2 == 1){
            ans = min(ans, seg[y-1]);
            y--;
        }
        y /= 2;
    }
    return ans;
}

void update(int x, long y){
    x += SEG_NUM;
    seg[x] = y;
    while(true){
        x /= 2;
        if(x==0)break;
        seg[x] = min(seg[2*x], seg[2*x+1]);
    }
}

int main() {
    long MAX = 2147483647;
    for(int i=0;i<SEG_NUM*2;++i){
        seg[i] = MAX;
    }
    int n, q;
    cin>>n>>q;
    long com, x, y;
    for(int i=0;i<q;++i){
        cin>>com>>x>>y;
        if(com){
            cout<<find(x, y+1)<<endl;;
        }
        else {
            update(x, y);
            //cout<<seg[1]<<endl;
        }
    }
}



Measured memory_bytes: 19500
#include <iostream>
#include <math.h>
using namespace std;
int main(){
  int d,n;cin>>d>>n;
  if(n!=100){
    cout<<int(pow(100,d))*n<<endl;
  }else{
    cout<<int(pow(100,d))*(n+1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int w = cin.Int();
			int h = cin.Int();
			long[] p = cin.ArrayLong(w);
			long[] q = cin.ArrayLong(h);

			Array.Sort(p);
			Array.Sort(q);

			long hsum = q.Sum();
			long[] wsums = new long[w + 1];
			for (int i = 1; i <= w; i++) {
				wsums[i] = wsums[i - 1] + p[i - 1];
			}

			long ans = p.Sum() + hsum;
			for (int i = 0; i < h; i++) {
				long hh = q[i];
				long windex = UpperBound(p, hh);
				if (windex > w) {
					windex = w;
				}

				if (windex >= 0) {
					ans += wsums[windex];
				}
				ans += hh * (w - windex);
			}

			Console.WriteLine(ans);
		}

		public static int UpperBound(IReadOnlyList<long> list, long target)
		{
			int left = -1;
			int right = list.Count();

			while (right - left > 1) {
				int mid = (right + left) / 2;

				if (list[mid] > target) {
					right = mid;
				} else {
					left = mid;
				}
			}

			return right;
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 18132
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: u64,
        a: [u64; n],
    }

    let ans = a.into_iter().fold(1_u64, |acc, ai| acc.saturating_mul(ai));
    if ans > 10_u64.pow(18) {
        println!("{}", -1);
        return;
    }
    println!("{}", ans);
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> PP;



int main(){
    ll N; cin >> N;
    ll cnt = 0;
    for(int a=1; a<=N/2; a++){
        if(a != N - a){
            cnt++;
        }
    }
    cout << cnt << endl;
}


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

class Myclass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int ans=0;
        if (N == 100000)
        {
            N = 99999;
        }
        if (N >= 10000)
        {
            ans += N - 9999;
            N = 9999;
        }
        if (N >= 1000)
        {
            N = 999;
        }
        if (N >= 100)
        {
            ans += N - 99;
            N = 99;
        }
        if (N >= 10)
            N = 9;
        ans += N;
        Console.WriteLine(ans);
            
    }
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

int dp[20005];

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

  int H;
  cin >> H;
  int N;
  cin >> N;

  vi A(N), B(N);
  rep(i, 0, N) {
    cin >> A[i] >> B[i];
  }

  dp[0] = 0;
  rep(i, 1, 20005) {
    dp[i] = 1e9+7;
  }

  rep(i, 1, 20005) {
    rep(j, 0, N) {
      int a = A[j], b = B[j];
      if (i - a >= 0) {
        dp[i] = min(dp[i], dp[i-a] + b);
      } else {
        dp[i] = min(dp[i], b);
      }
    }
  }

  int ans = 1e9+7;
  rep(h, H, 20005) {
    ans = min(ans, dp[h]);
  }

  cout << ans << endl;


  return 0;
};


Measured memory_bytes: 384
/*
	bfs 找环
*/
#include <bits/stdc++.h>
#define N 1005
#define M 2005

using namespace std;

int n, m;
int dep[N];
int head[N], nex[M], to[M], e;
int stk[N], top;
bool instack[N], vis[N], G[N][N];
vector<int> res;

inline int Rd() {
	int x = 0; char ch = getchar();
	while(!isdigit(ch)) ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x;
}
inline void Ae(int u, int v) {
	nex[++e] = head[u], head[u] = e;
	to[e] = v;
}

void calc(int u, int v) {
	do {
		res.push_back(stk[top]);
	} while(stk[top--] != v);
	int ans = res.size();
	printf("%d\n", ans);
	for(int i = 0; i < ans; ++i) printf("%d\n", res[i]);
	exit(0);
}
void dfs(int u) {
	stk[++top] = u;
	instack[u] = vis[u] = true;
	for(int i = head[u]; i; i = nex[i]) {
		int v = to[i];
		if(vis[v]) {
			if(instack[v]) calc(u, v);
		} else {
			dfs(v);
		}
	}
	instack[u] = false, --top;
	return;
}

int main() {
	n = Rd(), m = Rd();
	for(int i = 1; i <= m; ++i) {
		int u = Rd(), v = Rd();
		G[u][v] = true;
		Ae(u, v);
	}
	
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= n; ++j) {
			if(G[i][j] && G[j][i]) {
				puts("2");
				printf("%d\n%d\n", i, j);
				return 0;
			}	
		}
	}
	for(int i = 1; i <= n; ++i)
		if(!vis[i])
			dfs(i);
	puts("-1");
	return 0;	
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin>>n;
  vl A(n+1),B(n);
  rep(i,n+1){
    cin>>A[i];
  }
  rep(i,n){
    cin>>B[i];
  }
  ll ans = 0;
  rep(i,n){
    ll sm = A[i]+A[i+1];
    ans+=min(sm,B[i]);
    A[i+1] = min(max(sm-B[i],0LL),A[i+1]);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
map<int,int>vis;
int n,ans,k,a[200005];
int tmp[]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824};
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		vis[a[i]]++;
	}
	sort(a+1,a+n+1);
	for(int i=n;i>=1;i--)
	{
		int pos=upper_bound(tmp,tmp+30,a[i])-tmp;
		k=tmp[pos]-a[i];
		if((k!=a[i]&&vis[k]||k==a[i]&&vis[k]>1)&&pos<31&&vis[a[i]])
		{
			ans++;
			vis[k]--; vis[a[i]]--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 19712
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long X = stdIn.nextLong();
		long restor = 100;
		
		for(int i = 0; ; i ++) {
			if(X <= restor) {
				System.out.println(i);
				break;
			}else {
				restor = restor + (long)(0.01 * restor);
			}
		}
	}
}

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

using namespace std;

int main(void)
{
    string str;
    bool like = true;
    cin >> str;

    if(str[2] != str[3]) like = false;
    if(str[4] != str[5]) like = false;

    if(like == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func lowerbound(v []int, k int) int {
	l, r := -1, len(v)
	for r-l > 1 {
		m := l + (r-l)/2
		if v[m] >= k {
			r = m
		} else {
			l = m
		}
	}
	return r
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt(sc)
	}
	// sort.Ints(a) // 二分探索のためにソートする
	q := nextInt(sc)
	ans := make([]int, q)
	wtr := bufio.NewWriter(os.Stdout)
	for i := 0; i < q; i++ {
		k := nextInt(sc)
		ans[i] = n
		r := lowerbound(a, k)
		if 0 <= r && r < n {
			ans[i] = r
		}
	}
	for i := 0; i < len(ans); i++ {
		fmt.Fprintln(wtr, ans[i])
	}
	wtr.Flush()
}



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

string revstr(string &moto){
     string temp;
     for(int i=moto.size()-1;i>-1;i--)temp+=moto[i];
     return temp;
}

int main(){
     int M;
     cin>>M;
     for(int count=0;count<M;count++){
	  string str;
	  cin>>str;
	  list<string> changed;
	  changed.push_back(str);
	  changed.push_back(revstr(str));
	  for(int k=1;k<str.size();k++){
	       string temp1,temp2;
	       for(int i=0;i<k;i++){
		    temp1+=str[i];
	       }
	       for(int i=k;i<str.size();i++){
		    temp2+=str[i];
	       }
	       changed.push_back(temp2+temp1);
	       changed.push_back(revstr(temp1)+temp2);
	       changed.push_back(revstr(temp2)+temp1);
	       changed.push_back(temp1+revstr(temp2));
	       changed.push_back(temp2+revstr(temp1));
	       changed.push_back(revstr(temp1)+revstr(temp2));
	       changed.push_back(revstr(temp2)+revstr(temp1));
	  }
	  /*list<string>::iterator it = changed.begin();
	  while( it != changed.end() )
	  {
	       cout << *it << endl;
	       ++it;
	       }*/
	  changed.sort();changed.unique();
	  
	  cout<<changed.size()<<endl;
     }
}

Measured memory_bytes: 1056
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = []
for i in range(n+1):
    if i == 0:
        ans.append(sum(a1))
    elif 1<=i<=n:
        ans.append(sum(a1[:i]) + sum(a2[i-1:]))
    elif i==n:
        ans.append(sum(a2))
print(max(ans))

Measured memory_bytes: 9132
def main():
    from sys import stdin
    input = stdin.readline

    import numpy as np
    n, m = map(int, input().split())
    abc = [list(map(int, input().split())) for _ in [0]*m]
    g = [[] for _ in [0]*n]
    [g[u-1].append([v-1, c]) for u, v, c in abc]
    [g[i+1].append([i, 0]) for i in range(n-1)]

    import heapq

    yen = np.full(n, np.inf)
    h = [(0, 0)]
    heapq.heapify(h)
    while h:
        d, i = heapq.heappop(h)
        if yen[i] == np.inf:
            yen[i] = d
            for x, y in g[i]:
                heapq.heappush(h, (d+y, x))
    if yen[n-1] == np.inf:
        print(-1)
        return 0
    print(int(yen[n-1]))


main()

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

int main() {
	int A,B,C;cin>>A>>B>>C;

	int ans = 0;
	if(A + B >= C)ans = B+C;
	else ans = (A+B)+B+1;

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

Measured memory_bytes: 256
n = int(input())
s = [input() for x in range(n)]

answers = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for si in s:
    if si in answers.keys():
        answers[si] += 1

for ans,c in answers.items():
    print(ans + ' x ' + str(c))


Measured memory_bytes: 16324
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10

const int MOD = 1000000007;
int N, K;


vector<vector<int>> tree;
int seen[100100];

ll ans = 1;

void dfs(int current, int one_span) {
	seen[current] = 1;
	ans = (ans * (K - one_span)) % MOD;
	int my_one_span = tree[current].size();
	int cnt = 0;
	for (int i = 0; i < tree[current].size(); i++) {
		if (seen[tree[current][i]] == 1)continue;
		else {
			dfs(tree[current][i], my_one_span-cnt);
			cnt++;
		}
	}
}

int main() {
	cin >> N >> K;
	tree.assign(N, vector<int>(0));
	for (int i = 0; i < N-1; i++) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	dfs(0, 0);
	ans %= MOD;
	print(ans);

	return 0;
}


Measured memory_bytes: 9600
# 解説参照
N, P = gets.split.map(&:to_i)
s = gets.chomp

if 10 % P == 0
  ans = 0
  N.times do |i|
    if s[i].to_i % P == 0
      ans += i + 1
    end
  end
  puts ans
  exit
end

d = Array.new(N + 1, 0)
ten = 1
(N-1).downto(0) do |i|
  a = s[i].to_i * ten % P
  d[i] = (d[i+1] + a) % P
  ten *= 10
  ten %= P
end

cnt = Array.new(P, 0)
ans = 0
N.downto(0) do |i|
  ans += cnt[d[i]]
  cnt[d[i]] += 1
end
puts ans


Measured memory_bytes: 3836
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <complex>

using namespace std;

#define mod 1000000007

double result[21][200001];

int main()
{
	int n;
	cin >> n;
	double a[21];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 1; i <= 200000; i++){
		result[n - 1][i] = abs(i + 0.0 - a[n - 1]) / a[n - 1];
	}
	for(int i = n - 2; i >= 0; i--){
		for(int j = 1; j <= 200000; j++){
			result[i][j] = mod + 0.0;
			for(int k = j; k <= 200000; k += j){
				result[i][j] = min(result[i][j], max(abs(j + 0.0 - a[i]) / a[i], result[i + 1][k]));
			}
		}
	}
	double ans = mod + 0.0;
	for(int i = 1; i <= 200000; i++){
		ans = min(ans, result[0][i]);
	}
	printf("%.10f\n", ans);
}


Measured memory_bytes: 34348
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n,a,b,c,x;
    string s,t;
    cin>>n;
    cout<<n/2+n%2<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int D = sc.nextInt();
    int T = sc.nextInt();
    int S = sc.nextInt();
    
    if (D <= T * S) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL


int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	string s;
	cin >> s;
	vi arr(n);
	ll ans = 0;
	bool good = false;
	if(s.at(0) == s.at(1) && s.at(1) == s.at(2)) {
		good = true;
	}
	if(s.at(1) == s.at(2) && s.at(2) == s.at(3)) {
		good = true;
	}
	//cout << ans;
	cout << (good ? "Yes" : "No");
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll N;
    cin>>N;
    ll h[N],ans=0,c=0;
    rep(0,i,N)cin>>h[i];
    rep(1,i,N){
        cin>>h[i];
        if((h[i]-h[i-1])<=0){
            ++c;
        }else{
            ans=max(ans,c);
            c=0;
        }
    }
    ans=max(ans,c);
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>

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



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

    int n, m, k; cin>>n>>m>>k;
    vl a(n);
    for (int i=0; i<n; ++i){
        cin>>a[i];
    }

    vl b(m);
    for (int i=0; i<m; ++i){
        cin>>b[i];
    }

    vl sum(n);
    sum[0] = a[0];
    for (int i=1; i<n; ++i){
        sum[i] = sum[i-1] + a[i];
    }

    int ma = 0;
    lint cursum = 0;
    int curcnt = 0;
    for (int i = 0; i<=m; ++i){
        int it = upper_bound(sum.begin(), sum.end(), k - cursum)  - sum.begin();

        ma = max(ma, curcnt + it);
        if (i== m) break;
        curcnt++;
        cursum += b[i];
        if (cursum > k) break;
    }
    cout<<ma;
}


Measured memory_bytes: 7944