akhauriyash/Code-Regression huggingface dataset:
#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--)
long long n,s;
long long check(long long b,long long n){
     long long ans=0;
     while(n!=0){
        ans+=n%b;
        n/=b;
     }
     return ans;
}
int main(){
	cin>>n>>s;
		     //cout<<n<<s;

	long long ans=-1;
	REP(i,sqrt(n)+2){
	    if(i==0||i==1)continue;
		       //cout<<i<<" "<<check(i,n)<<endl;
	    if(check(i,n)==s){
	       ans=i;
	       break;
	    }
	}

        if(ans==-1&&s==n){
           ans=n+1;
        }
        //if(ans==-1){
           REP(i,sqrt(n)){
               if(i==0)continue;
               if((n-s)%i==0){
                  long long b=(n-s)/i+1;
                  if(b<2)continue;
                  long long q=n%b;
                  if(i+q==s){
                     if(ans==-1)ans=b;
                     ans=min(b,ans);
                  }
               }
           }
        //}

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

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

typedef long long ll;
using namespace std;

int n, k;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    int k[m];
    int s[m][n];
    int p[m];
    for (int i = 0; i < m; i++) {
        int knum; cin >> knum;
        k[i] = knum;
        for (int l = 0; l < knum; l++) {
            cin >> s[i][l];
            s[i][l]--;
        }
    }
    for (int i = 0; i < m; i++) cin >> p[i];
    int ans = 0;
    for (int i = 0; i < (1<<n); i++) {
        int on[n];
        fill(on, on+n, 0);
        for (int l = 0; l < n; l++) {
            if (i & (1<<l)) {
                on[l] = 1;
            }
        }
        bool valid = true;
        for (int l = 0; l < m; l++) {
            int cnt = 0;
            for (int v = 0; v < k[l]; v++) {
                int ss = s[l][v];
                if (on[ss]) cnt++;
            }
            if (cnt % 2 != p[l]) {
                valid = false;
                break;
            }
        }
        if (valid) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return list(map(int, input().split()))
def getList():
    return list(map(int, input().split()))

n,m,c = getList()
ans = 0
bnums = getList()

for i in range(n):
    tmp = 0
    anums = getList()
    for a,b in zip(anums,bnums):
        tmp += a*b

    if tmp + c > 0:
        ans += 1

print(ans)


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int N,A,B;
		var d = ria();
		N = d[0]; A = d[1]; B = d[2];
		
		Console.WriteLine(Math.Min(A * N , B));
		
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # search
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # unite
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # check
    def same_check(self, x, y):
        return self.find(x) == self.find(y)


def solve_d(n, m, q, a_list, b_list, c_list):

    res = 'Yes'
    uf = UnionFind(n - 1)
    for i in range(q):
        if c_list[i] == 0:
            uf.union(a_list[i], b_list[i])

    for i in range(q):
        if c_list[i] == 1:
            if uf.same_check(a_list[i], b_list[i]):
                res = 'No'

    par_list = [0] * n
    for i in range(n):
        par_list[i] = uf.find(i)

    k = len(set(par_list))
    # print(k, par_list)
    if max(c_list) == 0:
        min_m = n - 1
    else:
        min_m = n
    if m < min_m:
        res = 'No'
    elif m > n + k * (k - 3) // 2:
        res = 'No'

    return res


def main():
    n, m, q = map(int, input().split())
    a_list = [0] * q
    b_list = [0] * q
    c_list = [0] * q

    for i in range(q):
        a, b, c = map(int, input().split())
        a_list[i] = a
        b_list[i] = b
        c_list[i] = c

    res = solve_d(n, m, q, a_list, b_list, c_list)
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 78680
#include<bits/stdc++.h>
using namespace std;
char s[100008];
int n;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	if(s[1]==s[n]){
		if(n%2){
			puts("Second");
		}
		else{
			puts("First");
		}
	}
	else{
		if(n%2){
			puts("First");
		}
		else{
			puts("Second");
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << ", " << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;


int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int w, a, b;
    cin>>w>>a>>b;
    int result;
    if(b> (a+w)) {
        result = b-(a+w);
    } else if ((b+w)<a) {
        result = a-(b+w);
    } else {
        result = 0;
    }

    cout<<result;

return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }






void solve() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll dif = abs(a - b);
    
    if (dif % 2 == 0) {
        cout << dif / 2 << endl;
    } else {
        ll ans = LLONG_MAX;
        
        ll tmp = a - 1;
        tmp++;
        {
            b -= tmp;
            chmin(ans, tmp + (b - 1) / 2);
            b += tmp; // debuged
        }
        
        tmp = n - b;
        tmp++;
        a += tmp;
        chmin(ans, tmp + (n - a) / 2);
        
        cout << ans << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T;
    // cin >> T;
    T = 1;
    while (T--) {
        solve();
        // cout << (solve() ? "YES" : "NO") << endl;
    }
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

A, B, C = map(str, input().split())
len_A = len(A)
len_B = len(B)
flag = 0

if A[len_A - 1] == B[0]:
    if B[len_B - 1] == C[0]:
        flag = 1
        print("YES")

if flag == 0:
    print("NO")


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
const long double EPS = 1e-9;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}


long double x[55],y[55];

int main(void){
	int n,i,j,k,t;
	long double cx,cy,r,d,ans=1e9,A,B,C,D,E,F;
	bool flag;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> x[i] >> y[i];
	}
	for(i=0; i<n; ++i){
		for(j=0; j<i; ++j){
			cx = (x[i]+x[j])/2.0L;
			cy = (y[i]+y[j])/2.0L;
			r = sqrt((x[i]-cx)*(x[i]-cx)+(y[i]-cy)*(y[i]-cy));
			flag = true;
			for(t=0; t<n; ++t){
				d = sqrt((x[t]-cx)*(x[t]-cx)+(y[t]-cy)*(y[t]-cy));
				if(d-r>EPS){
					flag = false;
					break;
				}
			}
			if(flag){
				ans = min(ans,r);
			}
		}
	}
	for(i=0; i<n; ++i){
		for(j=0; j<i; ++j){
			for(k=0; k<j; ++k){
				A = (x[i]-x[j]);
				B = (y[i]-y[j]);
				C = ((x[i]*x[i]+y[i]*y[i])-(x[j]*x[j]+y[j]*y[j]))/2.0L;
				D = (x[j]-x[k]);
				E = (y[j]-y[k]);
				F = ((x[j]*x[j]+y[j]*y[j])-(x[k]*x[k]+y[k]*y[k]))/2.0L;
				if(abs(A*E-D*B)<EPS){
					continue;
				}
				cx = (C*E-F*B)/(A*E-D*B);
				cy = (C*D-F*A)/(B*D-E*A);
				r = sqrt((x[i]-cx)*(x[i]-cx)+(y[i]-cy)*(y[i]-cy));
				flag = true;
				for(t=0; t<n; ++t){
					d = sqrt((x[t]-cx)*(x[t]-cx)+(y[t]-cy)*(y[t]-cy));
					if(d-r>EPS){
						flag = false;
						break;
					}
				}
				if(flag){
					ans = min(ans,r);
				}
			}
		}
	}
	cout << fixed << setprecision(50) << ans << 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[] c = new int[4];
        for (int i = 0; i < 3; i++) {
           c[sc.nextInt() - 1]++;
           c[sc.nextInt() - 1]++;
        }
        // その街から出ている道の数が偶数か奇数か
        // 奇数2なら可能
        int o = 0;
        for (int i = 0; i < 4; i++) {
            if ((c[i] & 1) == 1) o++;
        }
        System.out.println((o == 2) ? "YES" : "NO");
    }
}

Measured memory_bytes: 23124
N = int(input())
A = [0]
for _ in range(N):
    A.append(int(input()))

button = 1
cnt = 0
for i in range(N):
    if button == 2:
        print(cnt)
        break
    else:
        button = A[button]
        cnt += 1
else:
    print(-1)

Measured memory_bytes: 7080
from  itertools import combinations
from collections import deque
h,w,k = list(map(int, input().split()))
bk = deque()
cr = [[]]*((h+1)*10)
for i in range(1,h+1):
  S = input()
  t = []
  for j in range(1,w+1):
    if S[j-1] == '#':
      bk.append(i*10 + j)
      t.append(i*10 + j)
  cr[i*10] = t
for j in range(1,w+1):
  t = []
  for i in range(1,h+1):
    if (i*10 +j) in bk:t.append(i*10 + j)
  cr[j] = t
  
xy = [i*10 for i in range(1,h+1)]
xy.extend([j for j in range(1,w+1)])
ans = 0

for i in range(len(xy)):
  com = combinations(xy,i)
  n = len(bk)
  for ps in com:
    cnt = set()
    for p in ps:
      [cnt.add(x) for x in cr[p]]
    if n-len(cnt) == k:
      ans += 1

print(ans)

Measured memory_bytes: 9364
package main

import (
	"fmt"
)

func main() {
	var s, t string
	fmt.Scanf("%s\n%s", &s, &t)
	answer := satisfy(s, t)
	fmt.Println(answer)
}

func satisfy(s, t string) string {
	if t[0:len(s)] == s {
		return "Yes"
	}
	return "No"
}


Measured memory_bytes: 1812
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j,k;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		int ans;
		if(n<=9) {
			ans = n;
		} else if(n<=99) {
				ans = 9;
		} else if(n<=999){
			ans = 9 + n-99;
		} else if(n<=9999){
			ans = 9 + 900;
		} else if(n<=99999){
			ans = 9 + 900 + n - 9999;
		} else {
			ans = 9 + 900 + 90000;
		}
		out.println(ans);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define N 2009
#define M 4000009
#define cbn(x,y) ((ll)fac[x]*inv[y]%mod*inv[(x)-(y)]%mod)
using namespace std;

int n,m,tot,fac[M],inv[M],dp[N][N];
int main(){
	scanf("%d%d",&n,&m); tot=n*m;
	if (m==1){ puts("1"); return 0; }
	int i,j;
	fac[0]=inv[0]=inv[1]=1;
	for (i=1; i<=tot; i++) fac[i]=(ll)fac[i-1]*i%mod;
	for (i=2; i<=tot; i++) inv[i]=mod-(ll)inv[mod%i]*(mod/i)%mod;
	for (i=2; i<=tot; i++) inv[i]=(ll)inv[i-1]*inv[i]%mod;
	dp[1][0]=fac[n];
	for (i=1; i<=n; i++)
		for (j=0; j<=i; j++){
			if (i<n) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%mod;
			if (j<i) dp[i][j+1]=(dp[i][j+1]+(ll)dp[i][j]*cbn(tot-i-(m-1)*j-1,m-2))%mod;

		}
	printf("%d\n",dp[n][n]); 
	return 0;
}


Measured memory_bytes: 46336
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(void){
  int N,K;
  cin>>N>>K;
  int h;
  int getOn=0;
  for(int i=0;i<N;i++){
    cin>>h;
    if(h>=K){
      getOn+=1;
    }
  }
  cout<<getOn<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long lucas(long long a, long long b, int d, int N) {
  if (N == 0) return 2;
  else if (N == 1) return 1;
  
  if (d == N) return a;
  return lucas(b, a + b, d + 1, N);
}

int main()
{
  int N;
  cin >> N;
  cout << lucas(2, 1, 0, N) << endl;
  
  return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
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();
		int d = sc.nextInt();
		

	int k =0;
	 while(a>0 && c>0){
	     if(k%2==0){
	         c-=b;
	         k++;
	         
	     }else{
	         a-=d;
	         k++;
	     }
	 }
if(a<=0){
    System.out.println("No");
}else{
     System.out.println("Yes");
}
	}
}


Measured memory_bytes: 35828
#include<bits/stdc++.h>
using namespace std;
int main(){
    int K;
    int g=0;
    int k=0;
    cin>>K;
    for(int i=1;i<=K;i++){
        if(i%2==0) g++;
        else k++;
    }
    cout<<g*k<<endl;
    return 0;
}


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

using namespace std;

int main () {

    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a.at(i);

    int broken = 0, num = 1;
    for(int i = 0; i < N; i++) {
        if(num == a.at(i)) num++;
        else broken++;
    }

    if(broken == N) cout << -1 << endl;
    else cout << broken << endl;

    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    string S; cin >> S;
    int N = S.size();
    int i = 0;
    char c = '.';
    int ans = 0;
    while(i<N){
        if(c != S[i]){
            c = S[i];
            ans++;
        }
        i++;
    }
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 3644
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int r;
  cin >> r;
  cout << r * r * r;


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        int N;
        PriorityQueue<Double> v = new PriorityQueue<>();

        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            for (int i = 0; i < N; ++i) v.add((double)in.nextInt());
            while(v.size() > 1) {
                double x = v.poll();
                double y = v.poll();
                v.add((x + y) / 2);
            }
            out.println(v.poll());
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
int N;
vector<P> A;
bool flag = true;
void solve()
{
    /*
    FOR(i, 0, N)
    {
        A[i].second -= A[i].first;
        
        if (A[i][2] < 0) {
            flag = false;
            break;
        }
    }*/
    sort(all(A), [](P& x, P& y) {
        return x.second < y.second;
    });
    int t = 0;
    FOR(i, 0, N)
    {
        //cout << t << " " << A[i].first << " " << A[i].second << endl;
        if (t <= A[i].second - A[i].first) {
            t += A[i].first;
        } else {
            flag = false;
            break;
        }
    }
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N)
    {
        int a, b;
        cin >> a >> b;
        P p;
        p = make_pair(a, b);
        A.pb(p);
    }
    //cin >> A[i].first >> A[i].second;
    solve();
    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 6128
using System;

class Program
{
    static void Main(string[] args)
    {
        var nt = Console.ReadLine().Split();
        var n = int.Parse(nt[0]);
        var t = int.Parse(nt[1]);

        var d = new int[n];
        var s = Console.ReadLine().Split();
        for (int i = 0; i < n; i++)
        {
            d[i] = int.Parse(s[i]);
        }

        var ans = (long)t;
        for (int i = 1; i < n; i++)
        {
            ans += Math.Min(t, d[i] - d[i - 1]);
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 28164
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			int val = sc.nextInt();
			int res = Arrays.binarySearch(a, val);
			while (res > 0 && res < n) {
				if (a[res - 1] == val) {
					--res;
				} else {
					break;
				}
			}
			if (res >= 0) {
				System.out.println(res);
			} else {
				res *= -1;
				--res;
				System.out.println(res);
			}
		}
		
	}
}



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

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    if(a == b && b == c) cout << 1 << endl;
    else if(a != b && b == c|| a == b && b != c || a == c && c != b){
        cout << 2 << endl;
    }
    else cout << 3 << endl;

    return 0;
}

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

using namespace std;

typedef long long int64;


int main()
{
  int64 L;
  int N;
  int64 S[100000], T[100000], A[200001];
  A[0] = 0;

  scanf("%lld", &L);
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%lld %lld", &S[i], &T[i]);
    A[i + 1] = T[i] - S[i] + A[i];
  }

  int64 ret = 0, tail = 0;
  for(int i = 0; i < N; i++) {
    int64 start = S[i], end = S[i] + L - 1;
    while(tail + 1 < N && end > S[tail + 1]) ++tail;
    ret = max(ret, A[tail] - A[i] + max(0LL, min(T[tail] - 1, end) - S[tail] + 1));
  }
  printf("%lld\n", ret);
}

Measured memory_bytes: 5568
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
ll MOD = 1000000007;

int main()
{
	ll N, T; cin >> N >> T;
	ll t[200001];
	rep(i, 0, N) {
		cin >> t[i];
	}

	ll sum = 0;
	rep(i, 1, N) {
		ll d = t[i] - t[i - 1];
		sum += ((d < T) ? d : T);
	}
	sum += T;

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
N, Q = map(int, input().split())
S = input()
l = [0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())
counter = [0] * N

for i in range(N-1):
    if S[i:i+2] == 'AC':
        counter[i+1] += counter[i] + 1
    else:
        counter[i+1] += counter[i]

for i in range(Q):
    print(counter[r[i]-1] - counter[l[i]-1])


Measured memory_bytes: 15748
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,m;
    cin>>n>>m;
    long long sum=0,c=0;
    int tho[n+5],weild[n+5];

    for(i=0; i<n; i++)
    {
        cin>>tho[i]>>weild[i];
    }
    sort(tho,tho+n);
    sort(weild,weild+n);

    for(i=n-1;  i>=0; i--)
    {
        if(tho[n-1]<=weild[i])
        {
            sum+=weild[i];
            c++;

            if(sum>=m)break;
        }


    }
    if(sum<m)
    {
         sum=m-sum;

        c+=sum/tho[n-1];

        if(sum%tho[n-1]!=0)c++;

        cout<<c<<endl;
    }
    else  cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 1024
# coding = SJIS

w, h, n = map(int, input().split())
points = []
area = [0, w, 0, h]

for i in range(n):
    x, y, a = map(int, input().split())
    points.append([x, y, a])

for i in range(n):
    if points[i][2] == 1:
        area[0] = max(area[0], points[i][0])
    if points[i][2] == 2:
        area[1] = min(area[1], points[i][0])
    if points[i][2] == 3:
        area[2] = max(area[2], points[i][1])
    if points[i][2] == 4:
        area[3] = min(area[3], points[i][1])

ans = max(0, (area[1] - area[0])) * max(0, (area[3] - area[2]))

print(ans)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define dd(x) cout << #x << "=" << x << ","
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define IO(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
const int INF = 2e9+7;
const int maxn=300;
int a[maxn][maxn];
bool vis[maxn][maxn];
int main()
{
 int n;
 cin>>n;
 ll sum=0;
 memset(vis,0,sizeof(vis));
 for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) { scanf("%d",&a[i][j]); sum+=(ll)a[i][j]; }
 sum/=2;
 for(int k=1;k<=n;k++) for(int u=1;u<=n;u++) for(int v=1;v<=n;v++)
 {
   if(vis[u][v]||vis[v][u]||u==v||u==k||k==v) continue;
   if(a[u][k]+a[k][v]<a[u][v])  { printf("-1"); return 0; }
   if(a[u][k]+a[k][v]==a[u][v]) { vis[u][v]=1; sum-=a[u][v]; }
 }
 cout<<sum;
 return 0;
}


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

using namespace std;

int A,B,X;




int main()
{
    cin>>A>>B;
    
    X = A+B;
    
    if(X>=10){
        cout<<"error"<<endl;
    }
    else{
        cout<<X<<endl;
    }
    
    return 0;
}


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

int cnt[4];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n,a,b,c;
	cin>>n>>a>>b>>c;
	vector<string> v(n+1);
	cnt[0] = a;
	cnt[1] = b;
	cnt[2] = c;
	for(int i=0;i<n;i++)cin>>v[i];
	bool hano = true;
	vector<char> sol;
	v[n] = "DD";
	for(int i=0;i<n;i++){
		char x=v[i][0],y = v[i][1];
		if(cnt[x-'A'] == 0 && cnt[y-'A'] == 0){
			hano = false;
			break;
		}
		if(cnt[x-'A'] == 0){
			sol.push_back(x);
			cnt[x-'A']++;
			cnt[y-'A']--;
			continue;
		}
		if(cnt[y-'A'] == 0){
			sol.push_back(y);
			cnt[y-'A']++;
			cnt[x-'A']--;
			continue;
		}
		if(cnt[x-'A'] == 1 && cnt[y-'A'] == 1){
			set<char> s;
			s.insert(v[i+1][0]);
			s.insert(v[i+1][1]);
			if(s.count(x)){
				sol.push_back(x);
				cnt[x-'A']++;
				cnt[y-'A']--;
				continue;
			}else{
				sol.push_back(y);
				cnt[y-'A']++;
				cnt[x-'A']--;
				continue;
			}
		}
		if(cnt[x-'A'] < cnt[y-'A']){
			sol.push_back(x);
			cnt[x-'A']++;
			cnt[y-'A']--;
			continue;
		}else{
			sol.push_back(y);
			cnt[y-'A']++;
			cnt[x-'A']--;
			continue;
		}
	}
	
	if(!hano){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
		for(char hnhn:sol)cout<<hnhn<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 6688
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 1000002
#define int long long
using namespace std;
const int mod=924844033;
const int G=5;
int head[N],ver[N*2],nxt[N*2],l;
int n,i,size[N],cnt[N],fac[N],inv[N],f[N],g[N],m=1,lim,r[N];
int read()
{
	char c=getchar();
	int w=0;
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0'){
		w=w*10+c-'0';
		c=getchar();
	}
	return w;
}
void insert(int x,int y)
{
	l++;
	ver[l]=y;
	nxt[l]=head[x];
	head[x]=l;
}
void dfs(int x,int pre)
{
	size[x]=1;
	for(int i=head[x];i;i=nxt[i]){
		int y=ver[i];
		if(y!=pre){
			dfs(y,x);
			size[x]+=size[y];
			cnt[size[y]]++;
		}
	}
	cnt[n-size[x]]++;
}
int poww(int a,int b)
{
	int ans=1,base=a;
	while(b){
		if(b&1) ans=ans*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ans;
}
void init()
{
	dfs(1,0);
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	inv[n]=poww(fac[n],mod-2);
	for(int i=n-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
}
void NTT(int *a,int inv)
{
	for(int i=0;i<m;i++){
		if(i<r[i]) swap(a[i],a[r[i]]);
	}
	for(int l=2;l<=m;l<<=1){
		int mid=l/2;
		int cur=poww(G,(mod-1)/l);
		if(inv==-1) cur=poww(cur,mod-2);
		for(int i=0;i<m;i+=l){
			int omg=1;
			for(int j=0;j<mid;j++,omg=omg*cur%mod){
				int tmp=omg*a[i+j+mid]%mod;
				a[i+j+mid]=(a[i+j]-tmp+mod)%mod;
				a[i+j]=(a[i+j]+tmp)%mod;
			}
		}
	}
}
int C(int n,int m)
{
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
signed main()
{
	n=read();
	for(i=1;i<n;i++){
		int u=read(),v=read();
		insert(u,v);
		insert(v,u);
	}
	init();
	for(i=1;i<=n;i++) f[i]=cnt[i]*fac[i]%mod;
	for(i=0;i<=n;i++) g[i]=inv[i];
	reverse(f,f+n+1);
	while(m<2*n+2) m<<=1;
	while((1<<lim)<m) lim++;
	for(i=0;i<m;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(lim-1));
	NTT(f,1);NTT(g,1);
	for(i=0;i<m;i++) f[i]=f[i]*g[i]%mod;
	NTT(f,-1);
	int invm=poww(m,mod-2);
	for(i=0;i<m;i++) f[i]=f[i]*invm%mod;
	reverse(f,f+n+1);
	for(i=1;i<=n;i++) printf("%lld\n",(n*C(n,i)%mod-inv[i]*f[i]%mod+mod)%mod);
	return 0;
}


Measured memory_bytes: 57216
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;
const int maxn = 1<<17;
const int mod = 1e9+7;
const int N = 1e6+10;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<a*b;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
#define F first 
#define S second
const int N = 1e5+1;
signed main()
{
    fast;
    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(m1!=m2)
        cout<<1;
    else cout<<0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long, long long>
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define MAXN 10000057
#define MOD 998244353
#define f first
#define s second
#define fr(i, s, e, st) for(ll (i) = (s); (i) < (e); (i) += (st))
#define fre(i, s, e, st) for(ll (i) = (s); (i) <= (e); (i) += (st))
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
using namespace std;

int main()
{
    fastio;
    ll T = 1;
    //cin >> T;
    while (T--)
    {    
        ll n, t;
        cin>>n>>t;
        ll mn = inf;
        ll a[n], d, mx = 0, c = 0;
        for(ll i = 0; i < n; i++) {
            cin>>d;
            mn = min(mn, d);
            a[i] = d - mn;
            mx = max(mx, a[i]);
        }
        for(ll i = 0; i < n; i++) c += (a[i] == mx);
        cout<<c<<endl;
    }         
    return 0;
}
// 15   5 5, 1

Measured memory_bytes: 4404
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def cross3(p0, p1, q0):
    return (p1[0] - p0[0])*(q0[1] - p0[1]) - (p1[1] - p0[1])*(q0[0] - p0[0])
def cross_point(p0, p1, q0, q1):
    x0, y0 = p0; x1, y1 = p1
    x2, y2 = q0; x3, y3 = q1
    dx0 = x1 - x0
    dy0 = y1 - y0
    dx1 = x3 - x2
    dy1 = y3 - y2

    s = (y0-y2)*dx1 - (x0-x2)*dy1
    sm = dx0*dy1 - dy0*dx1
    if sm < 0:
        return -(x0*sm + s*dx0), -(y0*sm + s*dy0), -sm
    return x0*sm + s*dx0, y0*sm + s*dy0, sm
def solve():
    N, M = map(int, readline().split())
    PSS = []
    for i in range(N):
        L = int(readline())
        PS = [list(map(int, readline().split())) for i in range(L)]
        PSS.append(PS)
    QS = [list(map(int, readline().split())) for i in range(M)]
    LS = []
    for PS in PSS:
        for x0, y0 in PS:
            for x1, y1 in QS:
                LS.append(((x0, y0), (x1, y1)))
    def check(p, q, r):
        p0 = (p, q)
        res = 0
        PSS1 = [[(x*r, y*r) for x, y in PS] for PS in PSS]
        for x1, y1 in QS:
            x1 *= r; y1 *= r
            q0 = (x1, y1)
            for PS in PSS1:
                l = len(PS)
                for i in range(l):
                    p1 = PS[i-1]; q1 = PS[i]
                    C0 = cross3(p0, q0, p1)
                    C1 = cross3(p0, q0, q1)
                    D0 = cross3(p1, q1, p0)
                    D1 = cross3(p1, q1, q0)
                    if C0 * C1 < 0 and D0 * D1 < 0:
                        break
                else:
                    continue
                break
            else:
                res += 1
        return res

    ans = 0
    K = len(LS)
    for i in range(K):
        p0, p1 = LS[i]
        for j in range(i):
            q0, q1 = LS[j]
            p, q, r = cross_point(p0, p1, q0, q1)
            if r == 0:
                continue
            ans = max(ans, check(p, q, r))
    write("%d\n" % ans)
solve()


Measured memory_bytes: 5668
#include <stdio.h>

int main()
{
  int w, n;
  int a, b;
  int ans[31];
  int i, tmp;

  scanf("%d", &w);
  scanf("%d", &n);

  for(i = 0; i < w; i++)
    ans[i] = i+1;

  for(i = 0; i < n; i++){
    scanf("%d,%d", &a, &b);

    tmp = ans[a-1];
    ans[a-1] = ans[b-1];
    ans[b-1] = tmp;
  }

  for(i = 0; i < w; i++)
    printf("%d\n", ans[i]);

  return 0;
}

Measured memory_bytes: 596
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
# ヒープキューを使用するために、符号を反転
a = list(map(lambda x: x*(-1), A))
heapq.heapify(a)

tmp = 0
for i in range(M):
    # 商を求める際に一旦、正の数に変換
    tmp = (heapq.heappop(a)*(-1)) // 2
    # 負の数に変換して元に戻す
    heapq.heappush(a, -tmp)

print(sum(a)*(-1))

Measured memory_bytes: 73196
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=1000000007
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()

  s1=S()
  s2=S()

  i=0
  ans=1
  free=3
  while True:
    if i+1>n:
      return ans%mod

    if i==0:
      if s1[i]==s2[i]:
        ans*=3
        ans%=mod
        i+=1
        free=0
      else:
        ans*=6
        ans%=mod
        i+=2
        free=1
      continue

    if s1[i]==s2[i]:
      if free==0:
        ans*=2
        ans%=mod
      i+=1
      free=0
    else:
      if free==0:
        ans*=2
        ans%=mod
      else:
        ans*=3
        ans%=mod
      i+=2
      free=1

# main()
print(main())


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

typedef long long ll;

const ll N = 201;

const ll MAX = (1LL<<29);

ll w[N][N];

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, m, R; cin >> n >> m >> R;
	int rn[R];
	for (int i = 0; i < R; i++)
		cin >> rn[i];
	sort(rn, rn+R);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			w[i][j] = (i == j ? 0 : MAX);
	for (int i = 0; i < m; i++) {
		int u, v, wg; cin >> u >> v >> wg;
		w[u][v] = w[v][u] = wg;
	}
	for (int k = 1; k <= n; k++)
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				w[i][j] = min(w[i][j], w[i][k]+w[k][j]);

	ll ans = MAX;
	do {
		ll temp = 0;
		for (int i = 1; i < R; i++)
			temp += w[rn[i-1]][rn[i]];
		ans = min(ans, temp);
	} while (next_permutation(rn, rn+R));
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-

N,X = [int(i) for i in input().rstrip().split()]
x_list = [int(i) for i in input().rstrip().split()]
#-----

def gcd(a,b):
    x = max(a,b)
    y = min(a,b)

    while y != 0:
        r = x % y
        
        x = y
        y = r
    
    return x

ans = abs(x_list[0]-X)
for i in range(1,len(x_list)):
    ans = gcd( ans, abs(x_list[i]-X) )

print(ans)


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main(){
	string S;
	cin >> S;
	//int day = (S[9] - '0') + (S[8] - '0') * 10;
	int manth = (S[6] - '0') + (S[5] - '0') * 10;
	if(manth <= 4){
		cout << "Heisei" << endl;
	}
	else{
		cout << "TBD" << endl;
	}
}


Measured memory_bytes: 256
# I saw the editorial to solve this problem :-)
n = gets.to_i
s = gets.split.map(&:to_i)

max = 0
1.upto(n/2) do |c|
  k = 0
  a = 0
  while (k+1) * c <= n - 1 && (!((n-1) % c == 0) || k * c < n - 1 - k * c)
    a += s[k * c] + s[n - 1 - k * c]
    k += 1
    max = [a, max].max
  end
end

p max


Measured memory_bytes: 13212
n,m,x,y=map(int,input().split())
xx=list(map(int,input().split()))
yy=list(map(int,input().split()))
xx.append(x)
yy.append(y)
xx.sort()
yy.sort()
if xx[-1]<yy[0]:print("No War")
else:print("War")

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

int main(void){
    int N,M;
    cin>>N>>M;
    vector<pair<int,int>> AB(N);
    for(int i=0;i<N;i++){
        cin>>AB[i].first>>AB[i].second;
    }
    sort(AB.begin(),AB.end());

    priority_queue<int> q;
    long long ans=0;
    int memo=0;

    for(int i=1;i<=M;i++){
        while(memo<N){
            if(AB[memo].first<=i){
                q.push(AB[memo].second);
                memo++;
            }else{
                break;
            }
        }
        if(!q.empty()){
            ans+=q.top();
            q.pop();
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1660
N, M = gets.chomp.split.map(&:to_i)
input = Array.new(M) { gets.chomp.split.map(&:to_i) }
min = Array.new
max = Array.new
input.each do |a, b|
  min.push(a)
  max.push(b)
end
puts (min.max..max.min).size


Measured memory_bytes: 11284
#include<bits/stdc++.h>
using namespace std;
struct node{
  node* l;
  node* r;
  node* p;
  int key;
};

node L;
node* nil=&L;
node* t=nil;

void insert(node* a){
  node* y=nil;
  node* x=t;
  while(x!=nil){
    y=x;
    if(a->key<x->key)x=x->l;
    else x=x->r;
  }
  a->p=y;
  if(y==nil)t=a;
  else if(a->key<(y->key))y->l=a;
  else y->r=a;
}

void pri(node* b,int a){
  if(b==nil)return;
  if(!a)cout<<" "<<b->key;
  pri(b->l,a);
  if(a)cout<<" "<<b->key;
  pri(b->r,a);
}

int main(){
  int n,a;
  string s;
  cin>>n;
  
  for(int i=0;i<n;i++){
    cin>>s;
    if(s[0]=='i'){
      cin>>a;
      node* b=(node *)malloc(sizeof(node));
      b->l=nil;
      b->r=nil;
      b->key=a;
      insert(b);
    }
    else{
      pri(t,1);
      cout<<endl;
      pri(t,0);  
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 24640
#include <stdio.h>
#include <stdlib.h>

int main(){
  char s[3];
  for(int i=0;i<3;i++){
    scanf("%c",&s[i]);
  }
  
  int nedan = 700; //初期値　素ラーメン？w
  for(int j=0;j<3;j++){
    if(s[j] == 'o') nedan += 100;
  }
  printf("%d",nedan);
}

Measured memory_bytes: 128
s=input()
n=0
ans=0
A=[0]*2019
A[0]=1
for i,j in enumerate(reversed(s)):
  n=(n+int(j)*pow(10,i,2019))%2019
  #print(i,n)
  A[n]+=1
for i in A:
  ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 9204
#include <iostream>
using namespace std;
int main() {
  int r = 0, b = 0, n;
  char x;
  cin >> n;
  while(n--) {
    cin >> x;
    if(x == 'R') ++r;
    else ++b;
  }
  if(r>b) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B; cin >> A >> B;

    int n = 1;
    int res = 0;
    while(n < B){
        n--;
        n += A;
        res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#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;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/

void solve()
{
	string s;
	cin >> s;
	lli i, c = 0;
	for (auto it : s)
	{
		c += it - '0';
	}
	if (c % 9 == 0)
	{
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	solve();
	return 0;
}


Measured memory_bytes: 3776
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

fn main() {
    let mut scan = Scan::new();

    let x = scan.list::<i64>(5);
    let mut j = 0;
    for i in 0..5 {
        if x[i] == 0 {
            j = i;
            break;
        }
    }

    println!("{}", j + 1);
}


Measured memory_bytes: 2104
H, W, K = map(int, input().split())
s = []
for _ in range(H):
	s.append(list(map(int, input().strip())))

count_table = []
for line in s:
	counts = [0]
	count = 0
	for c in line:
		if c == 1:
			count += 1
		counts.append(count)
	count_table.append(counts)

def check_limit(groups, last_div, x):
	for g in groups:
		whites = 0
		for y in g:
			counts = count_table[y]
			whites += counts[x + 1] - counts[last_div]
			if whites > K:
				return False
	return True

def check(groups):
	count = 0
	last_div = 0
	divides = 0
	for x in range(W):
		if not check_limit(groups, last_div, x):
			if last_div == x:
				return None
			else:
				divides += 1
				last_div = x
	return divides

min_total = W + H

for i in range(2 ** (H - 1)):
	div = []
	n = i
	divides_h = 0
	for j in range(H - 1):
		if n % 2 == 0:
			div.append(True)
			divides_h += 1
		else:
			div.append(False)
		n = n // 2
	cur_group = [0]
	groups = [cur_group]
	for j in range(H - 1):
		if div[j]:
			cur_group = [j + 1]
			groups.append(cur_group)
		else:
			cur_group.append(j + 1)
	divides_v = check(groups)
	if divides_v != None and divides_h + divides_v < min_total:
		min_total = divides_h + divides_v

print(min_total)


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " = " << x << endl
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define infll 1e18
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };



//===========================DEBUG======================//
#define XOX 1
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

//================================================================//



//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=2e5+5;


int main(){
 //    #ifndef ONLINE_JUDGE
 //    freopen("../input.txt", "r", stdin);
 //    freopen("../output.txt", "w", stdout);
	// #endif
    fast

    ll l,r,d; cin>>l>>r>>d;
    l--;
    pt((r/d - l/d));
    
}


/*


*/





Measured memory_bytes: 3528