akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？


"""
グラフ入力例
n,m=mii()
g = [[] for _ in range(n)]
seen = [0]*n
for i in range(m):
    x,y=mii()
    g[x-1].append(y-1)
    g[y-1].append(x-1)
    
"""
#g:グラフ v:スタート地点
def dfs(g, v):
	seen[v] += 1
    #スタート地点
	#print('v :', v)
	
	for nv in g[v]:
		if seen[nv]: continue
        #次の場所
		#print('v nv :', v, nv, 'Recursion')
		dfs(g, nv)

n,m=mii()
arr = []
for i in range(m):
    x,y=mii()
    arr.append([x,y])

ans = 0
for i in range(m):
	g = [[] for _ in range(n)]
	for j, m in enumerate(arr):
		if i != j:
			a, b = m
			g[a-1].append(b-1)
			g[b-1].append(a-1)
		
	seen = [0]*n
	dfs(g, 1)
	#print(i, j, seen)
	
	if sum(seen) != n: ans += 1

print(ans)

Measured memory_bytes: 67288
N, M = [int(i) for i in input().split()]
dp = [0] * (N + 1)
dp[0] = 1
for _ in range(M):
  stair = int(input())
  dp[stair] = 'broken'

for i in range(N + 1):
  if dp[i] != 'broken':
    dp[i] += dp[i - 1] if (i - 1 >= 0) and dp[i - 1] != 'broken' else 0
    dp[i] += dp[i - 2] if i - 2 >= 0 and dp[i - 2] != 'broken' else 0

BASE = 10**9 + 7
print(dp[-1] % BASE)
  

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

using namespace std;

typedef long long int ll;

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

  int x, y;
  cin >> x >> y;
  int a = 4 * x - y, b = y - 2 * x;
  if (a % 2 || b % 2) cout << "No\n";
  else {
    if (a >= 0 && b >= 0) cout << "Yes\n";
    else cout << "No\n";
  }
}


Measured memory_bytes: 3584
package main

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

var sosuu []int
var findsosuu int

func sosuuMake(a int) {

	sosuu = make([]int, 1)
	sosuu[0] = 2
	flg := false
	for i := 3; i <= int(math.Sqrt(float64(a))); i++ {
		flg = true
		for j := 0; j < len(sosuu); j++ {
			if i%sosuu[j] == 0 {
				flg = false
				break
			}
		}
		if flg {
			sosuu = append(sosuu, i)
		}

	}
}

func sosuuFind(n int) {

	k := n
	sosuuflg := true
	for findsosuu == 1 {
		sosuuflg = true
		for i := 0; i < len(sosuu); i++ {
			if k%sosuu[i] == 0 {
				sosuuflg = false
				break
			}
		}
		if sosuuflg {
			findsosuu = k
		} else {
			k++
		}
	}

}

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	x, _ := strconv.Atoi(sc.Text())
	findsosuu = 1
	if x > 2 {
		sosuuMake(x)

		go sosuuFind(x)
		for findsosuu == 1 {

		}

	} else {
		findsosuu = 2
	}
	fmt.Println(findsosuu)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

vector<long long> fc(300001);
vector<long long> ifc(300001);
long long modpow(long long x,long long n){
    long long ans = 1;
    while(n > 0){
        if(n & 1) {
            ans = ans*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}

unsigned long long Combination(long long L,long long R){
    unsigned long long up=1,ans;
    fc[0]= 1;
    ifc[0]=1;
    for(long long i=0;i<10000;i++){
        fc[i+1] = fc[i]*(i+1)%mod;
        ifc[i+1] = ifc[i]*modpow(i+1,mod-2)%mod;
    }
    if(L==0&&R==0){
        return 1;
    }else if(L<R||L<0){
        return 0;
    }else{
        long long t = ifc[L-R]*ifc[R]%mod;
        ans = t*fc[L]%mod;
    }
    return ans;
}

/*ここから*/
int main() {
    ll K,N;
    cin >> N >> K;
    ll Red = N-K;
    for(int i=1;i<=Red+1;i++){
        ull ans = (Combination(Red+1,i)%mod)*(Combination(K-1,i-1)%mod);
        ans %= mod;
        cout << ans << endl;
        if(i==K){
            break;
        }
    }
    if(Red+1<K){
        for(int i=0;i<K-Red-1;i++){
            cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 7804
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll lg=22;
const ll N=1e6+5;
const ll M=16;
const ll INF=1e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define is(n) scanf("%d",&n)
#define io(n) printf("%d\n",n)
#define ls(n) scanf("%lld",&n)
#define lo(n) printf("%lld\n",n)
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
 
inline ll mul(ll a, ll b, ll p){ return (a * 1ll * b) % p; }
inline ll sub(ll a, ll b, ll p){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll add(ll a, ll b, ll p){ ll c = a + b; if(c > p) c -= p; return c; }
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
int main()
{
    ld n;
    cin>>n;
    vector<ld> v;
    for(ll i=0;i<n;i++)
    {
        ld x;
        cin>>x;
        v.pb(x);
    }
    sort(all(v));
    //reverse(all(v));
    ld ans=(v[0]+v[1])/2;
    for(ll i=2;i<n;i++)
    {
        ans=((ans+v[i])/2);
    }
    cout<<fixed<<setprecision(9)<<ans<<endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    string a, b, c;
    cin >> a >> b >> c;
    cout << ((a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char a, b, c;
	scanf("%c%c%c", &a, &b, &c);
	if(a != b){
		printf("Yes");
	}
	else if(a != c){
		printf("Yes");
	}
	else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
import numpy as np
from sys import stdin


def get_result(data):
    A = np.array([data[0], data[1], data[2]])
    N = data[3][0]
    B = [data[i+4][0] for i in range(N)]
    for i in range(3):
        for j in range(3):
            if A[i, j] in B:
                A[i, j] = 1
            else:
                A[i, j] = 0
    # judge bingo
    tmp = []
    for i in range(3):
        tmp.append(sum(A[:, i]))
        tmp.append(sum(A[i, :]))
    tmp.append(A[0,0]+ A[1,1]+A[2,2])
    tmp.append(A[0,2]+ A[1,1]+A[2,0])
    return 'Yes' if 3.0 in tmp else 'No'

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)


Measured memory_bytes: 12508
#include <stdio.h>

int main(){
	char op;
	int a,b;
	int r;
	while(1){
		scanf("%d %c %d", &a, &op, &b);
		if(op == '?')break;
		switch(op){
			case '+': r = a+b;break;
			case '-': r = a-b;break;
			case '*': r = a*b;break;
			case '/': r = a/b;break;
		}
		printf("%d\n", r);
	}
	return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=100111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

int main(){
	ll l,r,ans=INF;
	cin>>l>>r;
	if(r-l>=2019){
		print(0);
		return 0;
	}
	else{
		rep(i,l,r)rep(j,i+1,r+1){
			ll tmp=((i%2019)*j)%2019;
			ans=min(ans,tmp);
		}

		print(ans);
		return 0;
	}
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	r := getNextInt(scanner)

	ans := 3 * r * r

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
 string s;
 cin >> s;
 ll ans = 0;
 string mae ="",now="";
 for(int i=0;i<s.size();i++){
     now+=s.at(i);
     if(mae!=now){
         ans++;
         mae=now;
         now="";
     }
 }
 cout << ans << endl;
}


Measured memory_bytes: 640
function Main(input) {
	input = input.split("\n");
	var tmp = input[0].split(" ");
    var N = parseInt(tmp[0], 10);
    var M = parseInt(tmp[1], 10);
    var inputArray = getInputArray(input,N,M);
    sortEachCol(inputArray);
    setCode2InputArray(inputArray);
    sortEachColIndex(inputArray);
	for(var i=0;i<inputArray.length;i++){
        console.log(zeroPaddingSixDigit(inputArray[i].p) + zeroPaddingSixDigit(inputArray[i].code));
    }
}

function setCode2InputArray(inputArraySorted){
    var indexArray = new Array(inputArraySorted.length);
    inputArraySorted.forEach(function(element) {
        var p = element.p;
        indexArray[p] = indexArray[p] === undefined?0:indexArray[p]+1;
        element.code = indexArray[p] + 1;
    });
}
function sortEachCol(inputArray){
    inputArray.sort(function(a,b){
        return a.value - b.value;
    });
}
function sortEachColIndex(inputArray){
    inputArray.sort(function(a,b){
        return a.index - b.index;
    });
}

function getInputArray(input,N,M){
    var inputArray = [];
    for(var i=0;i<M;i++){
	    var tmp = input[i+1].split(" ");
        if(tmp.length !== 2){
            continue;
        }
        var p = parseInt(tmp[0],10);
        var value = parseInt(tmp[1],10);
        inputArray.push({index:i,value:value,p:p});
    }
    return inputArray;
}

function zeroPaddingSixDigit(num){
    return ('000000' + num).slice(-6)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 64560
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl
#define pb push_back

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[200010];
ll xa,xb,ua,ub;
bool r,ra,rb,rc[200010];
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc,vd,ve,vaa,vbb;
set<ll> st;

vector<vector<ll>> dp;

vector<vector<ll>> v2vec(int x,int y,int value=0){ return vector<vector<ll>>(y,vector<ll>(x,value)); }



ll gcdt(ll tara,ll tarb){ //最大公約数
    ll am=1;
    while(am){
        am=tara%tarb;
        tara=tarb;
        tarb=am;
    }
    return tara;
}
 
ll lcmt(ll tara,ll tarb){ //最小公倍数
    return tarb/gcdt(tara,tarb)*tara;
}

ll udig(ll lef,ll rig){
    return ((lef+rig-1)/rig)*rig;
}




int main(){
    cin>>n;

    for(int i=0;i<n;i++){
        cin>>aa[i]>>ab[i];

    }
    a=aa[0];
    b=ab[0];
    

    for(int i=1;i<n;i++){
        ua=udig(a,aa[i]);
        ub=udig(b,ab[i]);
        xa=aa[i]-ua;
        xb=ab[i]-ub;
        if(xa<xb){
            if(ua/aa[i]*ab[i]>=b){
                a=ua;
                b=ua/aa[i]*ab[i];
            }
            else{
                a=ub/ab[i]*aa[i];
                b=ub;
            }
        }
        else{
            if(ub/ab[i]*aa[i]>=a){
                a=ub/ab[i]*aa[i];
                b=ub;

            }
            else{
                a=ua;
                b=ua/aa[i]*ab[i];
            }
        }
    }
    C a+b E;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N, M; cin >> N >> M;
	vector< vector<ld> > v(N, vector<ld>(3)); cin >> v;
	ld ans = 0;
	REP(i,1 << N) {
		if (__builtin_popcount(i) != M) continue;
		ld r = 0;
		REP(j,N) {
			REP(k,j) {
				if ((i & (1 << j)) && (i & (1 << k))) {
					REP(l,3) {
						ld d = abs(v[j][l]-v[k][l]);
						r += d * d;
					}
				}
			}
		}
		ans = max(ans, r);
	}
	cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 3304
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod=1e9+7;
ll inf=1e18;


int main(void){
	string S,T="";
	ll w;
	cin>>S>>w;
	rep(i,1e9){
		if(i*w>=S.size())break;
		T+=S[i*w];
	}
	cout<<T<<endl;
	return 0;
}

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


int main(){
	int n,k,S;
	
	
	cin >> n >> k >> S;
	for(int i=1;i<=k;i++){
		if(i!=1)
			cout << " ";
		cout << S;
	}
	if(S==1e9)
		S-=2;
	
	
	for(int i=k+1;i<=n;i++){
		cout << " " << S+1;
	}
	return 0;
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    string s;cin >> s;
    ll k;cin >> k;
    int index = 0;
    while(index<(int)s.length())
    {
        if(s[index]=='1')
        {
            index++;
            continue;
        }
        break;
    }
    if(k<=index)
    {
        cout << '1' << endl;
        return 0;
    }
    cout << s[index] << endl;

    
}

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll n;cin>>n;
  ll a[n];rep(i,0,n)cin>>a[i];

  if(n==1){
    out(1);
    return 0;
  }

  ll ans=0;
  int jud;//1：単調非減少，-1:単調非増加,0:判定不可
  if(a[0]==a[1])jud=0;
  else if(a[0]<a[1])jud=1;
  else jud=-1;

  rep(i,0,n-1){
    if(jud==0){
      if(a[i]==a[i+1])continue;
      else if(a[i]<a[i+1])jud=1;
      else jud=-1;
    }
    else if(jud==1){
      if(a[i]>a[i+1]){
        ans++;
        jud=0;
      }
    }
    else {
      if(a[i]<a[i+1]){
        ans++;
        jud=0;
      }
    }
  }
  out(ans+1);

  return 0;
}


Measured memory_bytes: 1024
/*
Author- Aasav Badera
Time- Sun Apr 26 17:28:53 2020
*/
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long    
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long                        
#define pb                 push_back                                                     
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                9223372036854775807
#define endl               '\n' 
#define N                  200005
ll n, m, k, a[N];


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
    	ll d;
        cin >> n >> m >> k >> d;
        if((n + d-1) / d >= (k + m - 1)/m)cout << "Yes";
        else cout << "No";
    }
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<long> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    vector<bool> ignore(N, false);
    int ignoreCount = 0;

    long ans;

    while (ignoreCount < N - 1)
    {
        int minIndex = -1;
        long minValue = 10000000000;
        for (int i = 0; i < N; i++)
        {
            if (!ignore[i])
            {
                if (A[i] < minValue)
                {
                    minValue = A[i];
                    minIndex = i;
                }
            }
        }

        for (int i = 0; i < N; i++)
        {
            if (!ignore[i] && i != minIndex)
            {
                A[i] = A[i] % A[minIndex];
                if (A[i] == 0)
                {
                    ignore[i] = true;
                    ignoreCount++;
                }
            }
        }

        ans = minValue;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
def solution():
    input1 = input()
    input2 = input()
    target, _ = [int(x) for x in input1.split()]
    num_list = set()
    for n in input2.split():
        num_list.add(int(n))
    diff = 0
    while True:
        candidate1 = target - diff
        candidate2 = target + diff
        if candidate1 not in num_list:
            print(candidate1)
            return
        if candidate2 not in num_list:
            print(candidate2)
            return
        diff += 1
    
solution()

Measured memory_bytes: 9124
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll MOD = pow(10,9) + 7;
ll memo[100][64];



bool cont_AGC(string t)
{
  if(t[0]=='A'&&t[1]=='G'&&t[2]=='C') return true;
  if(t[1]=='A') return t[2]=='G'&&t[3]=='C';
  return false;
}

bool ok(string last4)
{
  for(int i=0; i<4; i++)
  {
    string t = last4;
    if(i>0){
      t[3-i] = last4[4-i];
      t[4-i] = last4[3-i];
    }
    if(cont_AGC(t)) return false;
  }
  return true;
}

int para(char t)
{
  switch (t) {
    case 'A':
      return 0;
      break;
    case 'T':
      return 1;
      break;
    case 'G':
      return 2;
      break;
    case 'C':
      return 3;
      break;
  }
  cout <<"t = "<< t << "Bad input on para()" << endl;
  return -1;
}

int dict(string S)
{
  int tmp = 0;
  for(int i=0; i<3; i++)
  {
    tmp += pow(4,i)*para(S[i]);
  }
  return tmp;
}

ll dfs(int n, int cur, string last3)
{
  if(cur == n) return 1;
  if(memo[cur][dict(last3)]!=-1) return memo[cur][dict(last3)];
  ll ret = 0;
  string s = "ATGC";
  for(int i=0; i<4; i++)
  {
    if(ok(last3+s[i])) ret = (ret + dfs(n,cur+1,last3.substr(1)+s[i])) % MOD;
  }
  memo[cur][dict(last3)] = ret;
  return ret;
}

int main()
{
  for(int i=0; i<100; i++)
  {
    for(int j=0; j<64; j++)
    {
      memo[i][j] = -1;
    }
  }
  int n;
  cin >> n;
  cout << dfs(n,0,"TTT") << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

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

    vector<int> e, w;
    (S[0] == 'E') ? e.push_back(0) : e.push_back(1);
    for (int i = 1; i < S.size(); ++i) {
        if (S[i] != 'E') e.push_back(e[i-1]+1);
        else e.push_back(e[i-1]);
    }
    reverse(S.begin(), S.end());
    (S[0] == 'W') ? w.push_back(0) : w.push_back(1);
    for (int j = 1; j < S.size(); ++j) {
        if (S[j] != 'W') w.push_back(w[j-1]+1);
        else w.push_back(w[j-1]);
    }
    reverse(w.begin(), w.end());

    int ans = INF;
    for (int k = 0; k < S.size(); ++k) {
        if (k == 0) ans = min(ans, w[k+1]);
        else if (k == S.size()-1) ans = min(ans, e[k-1]);
        else ans = min(ans, e[k-1]+w[k+1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5752
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){

    int l,n=0,m=0;
    string str;

    cin >> str;
    const char* ch = str.c_str();
    l = str.size();

    FOR(i,0,l){
        if(ch[i] == 'S')n--;
        else if(ch[i] == 'T'){
            n++;
            if(n > m)m = n;
        }
    }

    cout << m * 2;

    return 0;
}


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

using namespace std;

int N, M;
vector<int> p;

//UnionFind
vector<int> parent;

//根を探す
int find(int x) {
	//自分が根である場合
	if (parent[x] < 0) return x;
	//自分が根ではない場合、根の情報を探して代入したあとで、根を返す
	return parent[x] = find(parent[x]);
}

int size(int x) {
	return -parent[find(x)];
}

//統合する
void unite(int x, int y) {
	//親を探す
	x = find(x);
	y = find(y);
	//既に統合済み
	if (x == y) return;

	//サイズが小さい根のものを大きい根のものにくっつける
	if (size(x) < size(y)) swap(x, y);
	//xをｙにくっつける
	parent[y] += parent[x];
	parent[x] = y;
}

bool same(int x, int y) {
	return find(x) == find(y);
}


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

	p.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> p[i];
		p[i]--;
	}

	parent.resize(N);
	for (int i = 0; i < N; i++)
		parent[i] = -1;

	for (int i = 0; i < M; i++) {
		int x, y;
		cin >> x >> y;
		unite(x - 1, y - 1);
	}

	int ans = 0;

	for (int i = 0; i < N; i++) {
		if (same(p[i], i))
			ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define int long long int
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define MOD 1000000007
#define MAX 200005
#define sz size()
ll power(ll n,ll x)
{
    if(x==0)   return 1;
    if(x%2==0) return power(n*n,x/2);
    else       return n*power(n*n,x/2);
}
bool prime(ll n)
{
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
ll powermode(ll n,ll x)
{
    if(x==0) return 1;
    ll y=((n%MOD)*(n%MOD))%MOD;
    if(x%2==0)  return powermode(y,x/2)%MOD;
    else    return ((n%MOD)*(powermode(y,x/2)%MOD))%MOD;
}
ll inv(ll a){ return powermode(a,MOD-(ll)2);}
ll mul(ll x,ll y) { return ((x%MOD)*(y%MOD))%MOD; }
ll sum(ll x,ll y) { return ( x%MOD+ y%MOD) %MOD;}
ll sub(ll x,ll y) {  return ((x%MOD)-(y%MOD)+MOD)%MOD;}
ll divide(ll x,ll y) { return mul(x,inv(y));}
ll ans=0;
void d(ll n)
{
	if(n>0)
	{
	ll temp=n;
	ll cnt=0;
	while(temp)
	{
		cnt+=temp%2;
		temp/=2;
	}
	ans++;
	d(n%cnt);
	}
	
}
ll i;
   void solve()
   {
        ll n;
        cin>>n;
        string s;
        cin>>s;
        ll a[n]={0};
        ll b[n]={0};
        ll cnt=0;
        for(i=0;i<n;i++)
        {
        	  if(s[i]=='1')
        	  cnt++;
        }
        ll temp1=1;
        ll temp2=1;
        for(i=0;i<n;i++)
        {
        	 a[i]=temp1%(cnt+1);
         if(cnt-1)	 b[i]=temp2%(cnt-1);
        	 temp1=(temp1*2)%(cnt+1);
         if(cnt-1)	 temp2=(temp2*2)%(cnt-1);
        	 
        }
        ll aa=0,bb=0;
        for(i=0;i<n;i++)
        {
           if(s[i]=='1')
           {
           	   aa=(aa+a[n-i-1])%(cnt+1);
           	   if( cnt>1)
                 bb=(bb+b[n-i-1])%(cnt-1);
           }
        }
       
        for(i=0;i<n;i++)
        {
        	if(s[i]=='1')
        	{
        		ll t=bb;
        		 if(cnt>1)
                   bb=(bb-b[n-i-1]+cnt-1)%(cnt-1);
              else{
                   cout<<0<<endl;
                   continue;
              }
        		ans=1;
        		d(bb);
        		cout<<ans<<endl;
        		bb=t;
        	}else
        	{
        		ll t=aa;
        	    aa=(aa+a[n-i-1])%(cnt+1);
        		ans=1;
        		d(aa);
        		cout<<ans<<endl;
        		aa=t;
        	}
        }
        

   }
            signed main()
            {
               FAST;
               ll q=1;
             //  cin>>q;
	            while(q--)
                {
                   solve();
                }
            }

Measured memory_bytes: 6904
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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;}

#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
    string S;
    cin>>S;
    if(S[0]==S[1]&&S[1]==S[2]||S[1]==S[2]&&S[2]==S[3]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
import sys
N = int(input())
point = [[int(i) for i in input().split()] for _ in range(N)]
point.sort(key=lambda x:x[2],reverse=True)
for cx in range(101):
    for cy in range(101):
        H = point[0][2]+abs(cx-point[0][0])+abs(cy-point[0][1])
        OK = True
        for i in range(N):
            if not point[i][2]==max(H-abs(cx-point[i][0])-abs(cy-point[i][1]),0):
                OK = False
                break
        if OK:
            print(cx,cy,H)
            sys.exit(0)


Measured memory_bytes: 41712
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
#define inf 1e18+9
using namespace std;
int32_t main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	int n,a,b;
	cin >> n >> a >> b;
	cout << (n/(a+b))*a+min(n%(a+b),a) << endl;
}

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

int gc(ll n,ll m){
    if(m==0)return n;
    return gc(m,n%m);
}
int main(){
   string s,t;
    ll n,m;
    cin>>n>>m>>s>>t;
    int i=0;
    while(i<gc(n,m)){
        if(s[n/gc(n,m)*i]!=t[m/gc(n,m)*i]){
            cout<<-1<<endl;
            return 0;
        }
        i++;
    }
    cout<<n*m/gc(n,m)<<endl;
    return 0;
}

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

int main() {
  int H,W;
  char a;
  cin >> H >> W;
  for(int i=0;i<W+2;i++){
    cout << '#';
  }
  cout << endl;
  for(int i=0;i<H;i++){
    cout << '#';
    for(int j=0;j<W;j++){
      cin >> a;
      cout << a;
    }
    cout << '#' << endl;
  }
  for(int i=0;i<W+2;i++){
    cout << '#';
  }
  cout << endl;
}


Measured memory_bytes: 256
//#include<iostream>
#include<cstring>
#include<cstdio>
//#include<time.h>
//#include<complex>
//#include<set>
#include<algorithm>
//#include<math.h>
#include<stdlib.h>
using namespace std;

int n,m;
char mp[15][15];

int a[15]; bool vis[15],ans=0;

bool v2[15];
bool check()
{
//    for (int i=1;i<=n;i++) cout<<a[i]<<' ';cout<<endl;
    memset(v2,0,sizeof(v2));
    bool used=(m&1);
    for (int i=1;i<=m;i++) if (!v2[i])
    {
        bool flag=0;
        for (int j=i+1;j<=m;j++) if (!v2[j])
        {
            bool ff=1;
            for (int k=1;k<=n;k++) if (mp[a[k]][i]!=mp[a[n-k+1]][j]) ff=0;
            if (ff) {v2[j]=1; flag=1; break;}
        }
        if (!flag)
        {
            if (used)
            {
                bool ff=1;
                for (int k=1;k<=n;k++) if (mp[a[k]][i]!=mp[a[n-k+1]][i]) ff=0;
                if (ff) used=0;
                else return 0;
            }
            else return 0;
        }
    }
    return 1;
}
            
void dfs(int cur,int pos,bool odd)
{
    if (ans) return;
    if (cur>n) {ans=check(); return;}
    if (vis[cur]) {dfs(cur+1,pos,odd); return;}
    
    for (int i=cur+1;i<=n;i++) if (!vis[i])
    {
        a[pos]=i; a[n-pos+1]=cur;
        vis[i]=1;
        dfs(cur+1,pos+1,odd);
        vis[i]=0;
    }
    if (odd)
    {
        a[(n>>1)+1]=cur;
        dfs(cur+1,pos,0);
    }
}

int main()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++) scanf("%s",mp[i]+1);
    dfs(1,1,n&1);
    puts(ans?"YES":"NO");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define umap unordered_map<int, int>
#define F first
#define S second
#define pii pair<int, int>
#define endl "\n"
using namespace std;
const int N = 101;
const int W =  100005;
int dp[N][W];
int knapsack(pii *a, int i, int n, int c){
	if(i==n) return 0;

	if(dp[i][c]) return dp[i][c];
	if(a[i].F<=c) {

		int rakh_ke = knapsack(a, i + 1, n, c - a[i].F) + a[i].S;
		int bina_rakh_ke = knapsack(a, i + 1, n, c);

		return dp[i][c]= max(rakh_ke, bina_rakh_ke);
	}

	return dp[i][c] = knapsack(a, i + 1, n, c);

}
int32_t main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	// int t; cin >> t; while(t--)
	{
		int n, w;
		cin >> n >> w;
		pii a[n + 1];
		for(int i=0; i<n; i++) {
			cin >> a[i].F >> a[i].S;
		}

		cout << knapsack(a, 0, n, w);
	}

	return 0;
}

Measured memory_bytes: 76416
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  long long L[87];
  L[0]=2,L[1]=1;
  for(int i=2;i<=86;i++){
    L[i]=L[i-1]+L[i-2];
  }
  cout<<L[N]<<endl;
  return 0;
}


Measured memory_bytes: 256
while 1:
    n = int(input())
    if n == 0:
        break
    a = b = c = sum = 0
    lst = []
    f = [str(x) for x in raw_input().split()]
    for i in range(n):
        if f[c] == 'lu':
            a += 1
        if f[c] == 'ld':
            a -= 1
        if f[c] == 'ru':
            a += 1
        if f[c] == 'rd':
            a -= 1
        if b == 0:
            if a == 2:
                sum += 1
                b = 1
        if b == 1:
            if a == 0:
                sum += 1
                b = 0
        c += 1
    print sum

Measured memory_bytes: 6388
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll q,h,s,d,n,cost,low;
    cin>>q>>h>>s>>d>>n;
    low=min(min(min(8*q,4*h),2*s),d);
    cost=low*(n/2)+(n%2)*min(min(4*q,2*h),s);
    cout<<cost;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

char x, y;

int main() {
	cin >> x >> y;
	if (x < y)cout << "<" << endl;
	else if (x == y)cout << "=" << endl;
	else cout << ">" << endl;
}

Measured memory_bytes: 256
H, W, A, B = map(int, input().split())
mod = int(1e9) + 7
def inved(a):
  x, y, u, v, k, l = 1, 0, 0, 1, a, mod
  while l != 0:
    x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
    k, l = l, k % l
  return x % mod
fact = [1 for _ in range(H+W+A+B+1)]
invf = [1 for _ in range(H+W+A+B+1)]
for i in range(H+W+A+B):
  fact[i+1] = (fact[i] * (i + 1)) % mod
invf[-1] = inved(fact[-1])
for i in range(H+W+A+B, 0, -1):
  invf[i-1] = (invf[i] * i) % mod
S = 0
for i in range(H-A):
  S += (fact[i+B-1] * invf[i] * fact[H-i+W-B-2] * invf[H-1-i]) % mod
  S %= mod
S *= (invf[B-1] * invf[W-B-1]) % mod
S %= mod

print(S)

Measured memory_bytes: 34712
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i=j; i<k; i+=step)
#define loop(i, j, k) for (int i=j; i<k; i++) 
#define rloop1(i, j, k, step) for (int i=j; i>=k; i-=step)
#define rloop(i, j, k) for(int i=j; i>=k; i--)
#define rep(i, k) for(int i = (0); i < (k); i++ )
#define rrep(i, k) for(int i = k-1; i >= 0; i-- )

#define forall(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;


void solve()
{
	int n,i,j,k=0,l,a,b,c,d;
	string s;
	cin>>n;
	map<string,int> m;
	rep(i,n){
		cin>>s;
		m[s]=1;
	}
	cout<<sz(m)<<endl;
}
int  main() 
{
	auto start=clock();
	fast_io;
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    auto stop =clock();
    cerr<<"time taken:"<<double(stop-start)/double(CLOCKS_PER_SEC)<<" s"<<endl;
	return 0; 
}

Measured memory_bytes: 19372
#include <bits/stdc++.h>
using namespace std;
int f(int x) {
    string s = to_string(x);
    int res = 0;
    for (auto k: s) {
        res += k-'0';
    }
    return res;
}
int main () {
    int N;
    cin >> N;
    int ans = INT_MAX;
    for (int i = 1; i < N; i++) {
        ans = min(ans, f(i)+f(N-i));
    }
    cout << ans << endl;
}

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

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

  int ans_water = 0;
  int ans_sugar = 0;

  for(int i = 0;i * 100 * A <= F;i++){
    for(int j = 0;j * 100 * B + i * 100 * A <= F;j++){
      for(int k = 0;k * C <= F;k++){
        for(int l = 0;l * D + k * C <= F;l++){
          int now_water = i * 100 * A + j * 100 * B;
          int now_sugar = k * C + l * D;
          if(now_water + now_sugar <= F && (ans_water + ans_sugar) * 100 * now_sugar >= (now_water + now_sugar) * 100 * ans_sugar && E * now_water >= 100 * now_sugar){
            ans_water = now_water;
            ans_sugar = now_sugar;
          }
        }
      }
    }
  }

  cout << ans_water + ans_sugar << " " << ans_sugar << endl;

}


Measured memory_bytes: 256
use strict;
use warnings;

my $a = <STDIN>;
chomp $a;
my $b = <STDIN>;
chomp $b;
my $c = <STDIN>;
chomp $c;
my $x = <STDIN>;
chomp $x;

my $ans = 0;
for (my $i=0; $i<=$a; $i++)
{
    for (my $j=0; $j<=$b; $j++)
    {
        for (my $k=0; $k<=$c; $k++)
        {
            $ans++ if $i*500+$j*100+$k*50==$x;
        }
    }
}

print "$ans\n";

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int MOD=1e9+9;

struct Point{
	ll x,y;
	Point(){}
	Point(ll x,ll y):x(x),y(y){}
};

vvi mul(const vvi& a,const vvi& b)
{
	int size=a.size();
	vvi c(size,vi(size));
	rep(i,size) rep(k,size) rep(j,size)
		c[i][j]=(c[i][j]+(ll)a[i][k]*b[k][j])%MOD;
	return c;
}
vi mul(const vvi& a,const vi& b)
{
	int size=b.size();
	vi c(size);
	rep(i,size) rep(j,size)
		c[i]=(c[i]+(ll)a[i][j]*b[j])%MOD;
	return c;
}

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a)
{
	os<<'[';
	for(int i=0;i<a.size();i++)
		os<<(i?" ":"")<<a[i];
	return os<<']';
}

int solve(int w,ll h,int n,vector<Point>& os)
{
	// a[i]: 遷移行列の(2^i)乗
	vector<vvi> a(70);
	a[0].resize(w,vi(w));
	rep(i,w)
		for(int j=max(i-1,0);j<=min(i+1,w-1);j++)
			a[0][i][j]=1;
	repi(k,1,70)
		a[k]=mul(a[k-1],a[k-1]);
	
	// y座標でソート
	rep(i,n) per(j,i)
		if(os[j].y>os[j+1].y)
			swap(os[j],os[j+1]);
	
	vi p(w); p[0]=1;
	ll cy=0;
	for(int i=0,j,k;cy<h-1;){
		for(j=i;j<os.size() && os[j].y<=cy;j++)
			;
		for(k=j;k<os.size() && os[k].y==os[j].y;k++)
			;
		ll ny=j<os.size()?os[j].y:h-1;
		
		ll r=ny-cy;
		rep(l,60)
			if(r>>l&1)
				p=mul(a[l],p);
		repi(l,j,k)
			p[os[l].x]=0;
		
		cy=ny;
		i=k;
	}
	
	return p[w-1];
}

int main()
{
	for(int tc=1;;tc++){
		int w,n; ll h; scanf("%d%lld%d",&w,&h,&n);
		if(!(w|h|n)) break;
		
		vector<Point> os(n);
		rep(i,n){
			scanf("%lld%lld",&os[i].x,&os[i].y);
			os[i].x--; os[i].y--;
		}
		
		printf("Case %d: %d\n",tc,solve(w,h,n,os));
	}
	
	return 0;
}

Measured memory_bytes: 2896
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//
int n;
vector<int> px,py,qx,qy;
int dp[8100][8100];
struct vevev{
	vector<int> a;vector<int> b;vector<int> ab;
};
vevev compress(vector<int> x1,vector<int> x2){
	vector<int> xs;
	for(int i=0;i<n;i++){
		for(int j=0;j<=1;j++){
			xs.push_back(x1[i]+j);
			xs.push_back(x2[i]+j);
		}
	}
	xs.push_back(1e9+7);
	sort(xs.begin(),xs.end());
	xs.erase(unique(xs.begin(),xs.end()),xs.end());
	for(int i=0;i<n;i++){
		x1[i]=lower_bound(xs.begin(),xs.end(),x1[i])-xs.begin();
		x2[i]=lower_bound(xs.begin(),xs.end(),x2[i])-xs.begin();
	}
	vevev v;
	v.a=x1;v.b=x2;v.ab=xs;
	return v;
}
//
int main(){
	cin>>n;
	px.resize(n);
	py.resize(n);
	qx.resize(n);
	qy.resize(n);
	for(int i=0;i<n;i++){
		cin>>px[i]>>py[i]>>qx[i]>>qy[i];
	}
	vevev x=compress(px,qx);
	vevev y=compress(py,qy);
	px=x.a;qx=x.b;vector<int> X=x.ab;
	py=y.a;qy=y.b;vector<int> Y=y.ab;
	for(int i=0;i<n;i++){
		dp[px[i]][py[i]]++;
		dp[qx[i]][qy[i]]++;
		dp[px[i]][qy[i]]--;
		dp[qx[i]][py[i]]--;
	}
	for(int i=0;i<X.size()-1;i++){
		for(int j=1;j<Y.size()-1;j++){
			dp[i][j]+=dp[i][j-1];
		}
	}
	for(int i=0;i<Y.size()-1;i++){
		for(int j=1;j<X.size()-1;j++){
			dp[j][i]+=dp[j-1][i];
		}
	}
	long long ans=0;
	for(int i=0;i<X.size()-1;i++){
		for(int j=0;j<Y.size()-1;j++){
			if(dp[i][j]){
				ans+=(long long)(X[i+1]-X[i])*(Y[j+1]-Y[j]);
			}
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256372
#include <iostream>

using namespace std;

int main(){
     int data[10000], i;
     while(1){
         cin >> data[i];
         if(data[i]==0)
            break;
        i++;
     }
     for(int j=0; j<i; j++){
         cout << "Case " << j+1 << ": " << data[j] << endl;
     }
     return 0;
}

Measured memory_bytes: 3112
#include <iostream>
using namespace std;
using ll = long long;

int N, K;
int A[100010];
ll B[100010];

ll buy(ll L) {
    ll val = 0;
    for (int i = 0; i < N; ++i) {
        if ((L & A[i]) == A[i]) {
            val += B[i];
        }
    }

    return val;
}

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        cin >> A[i] >> B[i];
    }

    ll ans = buy(K);
    for (int b = 0; b < 30; ++b) {
        if ((K >> b) & 1) {
            ll L = (K ^ (1 << b));
            L |= (1 << b) - 1;
            ans = max(ans, buy(L));
        }
    }

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


Measured memory_bytes: 1408