akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a*b>=c*d){
        printf("%d",a*b);
    }
    else{
        printf("%d",c*d);
    }


    return 0;
}


Measured memory_bytes: 128
input_n = input()
n = str(input_n)

listN = list(n)
#listN = n.split(' ')

if listN[len(listN) - 1] == "s":
    listN.append("e")
    listN.append("s")
else:
    listN.append("s")

for i in range(len(listN)):
    print(listN[i], end = "")


Measured memory_bytes: 9108
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect

N, K = list(map(int, input().split()))
x = [-INF] + list(map(int, input().split()))

ans = INF
for i in range(1,N+1):
    if i+K-1 <= N:
        if x[i+K-1] < 0:
            ans = min(abs(x[i]), ans)
        elif x[i] < 0 and x[i+K-1] >= 0:
            ans = min( min(abs(x[i]), x[i+K-1]) + x[i+K-1] - x[i], ans)
        else:
            ans = min(abs(x[i+K-1]), ans)

print(ans)





Measured memory_bytes: 91152
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_090_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 c1     PIC X(3).
    01 c2     PIC X(3).
    01 c3     PIC X(3).
    01 ans    PIC X(3).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT c1.
    ACCEPT c2.
    ACCEPT c3.

    STRING
        c1(1:1)
        c2(2:1)
        c3(3:1)
        INTO ans
    END-STRING.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.


Measured memory_bytes: 764
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    int A[N];
    int B[N];
    int C[N-1];
    for(int i = 0; i < N ; i++)cin >>A[i];
    for(int i = 0; i < N ; i++)cin >>B[i];
    for(int i = 0; i < N-1 ; i++)cin >>C[i];
    
    int sum = 0;
    for(int i = 0;i <N;i++){
        sum +=B[i]; 
    }
    
    for(int i = 0;i < N-1;i++){
       
        if(A[i+1]-A[i]==1)sum += C[A[i]-1];
        
        
    }
    
    cout << sum << endl;
    
    
}


Measured memory_bytes: 256
var
	N,L,R,M:Longint;
	S,T,U:String;
begin
	readln(N);
	writeln(0);
	flush(output);
	readln(S);
	if S='Vacant' then exit;
	writeln(N div 2);
	flush(output);
	readln(T);
	if T='Vacant' then exit;
	if S=T then begin
		if N div 2 mod 2=0 then begin
			L:=N div 2;
			R:=N;
			U:=T;
			T:=S;
			S:=U;
		end else begin
			L:=0;
			R:=N div 2;
		end;
	end else begin
		if N div 2 mod 2=0 then begin
			L:=0;
			R:=N div 2;
		end else begin
			L:=N div 2;
			R:=N;
			U:=T;
			T:=S;
			S:=U;
		end;
	end;
	while R-L>1 do begin
		M:=(L+R)div 2;
		writeln(M);
		flush(output);
		readln(U);
		if U='Vacant' then exit;
		if S=U then begin
			if (M-L)mod 2=0 then begin
				L:=M;
				S:=U;
			end else begin
				R:=M;
				T:=U;
			end;
		end else begin
			if (M-L)mod 2=0 then begin
				R:=M;
				T:=U;
			end else begin
				L:=M;
				S:=U;
			end;
		end;
	end;
	writeln(L);
	flush(output);
	readln(U);
	if U='Vacant' then exit;
	writeln(R);
	flush(output);
	readln(U);
end.


Measured memory_bytes: 760
#include<iostream>

using namespace std;

char c;

int main(){
	cin >> c;

	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
		cout << "vowel" << "\n";
	}
	else{
		cout << "consonant" << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
def op(i):
    return '+' if i == 1 else '-'

def solve():
    x = [int(i) for i in input()]
    for op1 in [-1, 1]:
        for op2 in [-1, 1]:
            for op3 in [-1, 1]:
                if x[0] + op1 * x[1] + op2 * x[2] + op3 * x[3] == 7:
                    return '{}{}{}{}{}{}{}=7'.format(x[0], op(op1), x[1], op(op2), x[2], op(op3), x[3])

print(solve())


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

long long mod = 2019;

int main(){
  string S;
  cin >> S;
  long long N = S.size();
  vector<long long> V(N);
  for(int i=0;i<N;i++) V[i] = S[N-i-1] - '0';
  
  vector<long long> x10(N,1);
  for(int i=1;i<N;i++){
    x10[i] = x10[i-1] * 10;
    x10[i] %= mod;
    V[i] *= x10[i];
    V[i] %= mod;
    V[i] += V[i-1];
    V[i] %= mod;
  }
  
  vector<long long> C(2019,0);
  C[0] = 1;
  long long ans=0;
  for(int i=0;i<N;i++){
    ans += C[V[i]];
    C[V[i]]++;
  }
  
  cout << ans << endl;
  return 0;
}


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

string s;

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> s;
    rep(i, s.size()-1) {
        if (s[i]==s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            exit(0);
        }
    } 
    rep(i, s.size()-2) {
        if (s[i]==s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            exit(0);
        }
    }
    cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n, cnt = 0, p[1000][1000];
    bool check[1000];
    cin >> n;
    for (int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> p[i][j];
        }
        sort(p[i], p[i] + 3);
    }
    for(int i = 0; i < n - 1; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = 0; k < 3; k++){
                if(p[i][k] != p[j][k]){
                    break;
                }
                if(k == 2){
                    check[j] = true;
                }
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(check[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k; cin>>n>>k;
	ll sumA=0, maxC=0;
	vll A(n), F(n), C(n);
	rep(i, n) cin>>A[i];
	rep(i, n){
		cin>>F[i];
		C[i] = A[i]*F[i];
		maxC = max(maxC, C[i]);
	}
	
	sort(all(A));
	sort(rall(F));

	ll left=-1, right=maxC;
	while(right-left>1){
		ll mid = (left+right)/2;
		ll sum = 0;
		rep(i, n){
			sum += max(0ll, A[i]-mid/F[i]);
		}
		if (sum<=k){
			right = mid;
		}else{
			left = mid;
		}
	}
	cout << right << "\n";

	return 0;
}

Measured memory_bytes: 4992
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    int k = sc.nextInt();
    String p = s.substring(k-1,k);
    StringBuilder sb = new StringBuilder();
    for(int i = 0;i < n;i++){
      if(s.substring(i,i+1).equals(p))sb.append(p);
      else sb.append("*");
    }
    System.out.println(sb.toString());
  }
}

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

typedef long long ll;

ll X, K, D;

int main()
{
    cin >> X >> K >> D;
    if (X < 0) X = -X;
    if (D <= X / K) X -= K * D;
    else {
        ll tims = X / D;
        X -= tims * D;
        K -= tims;
        if (K % 2) X = abs(X - D);
    }
    cout << X << endl;
    return 0;
}


Measured memory_bytes: 3588
def main():
    _ = int(input())
    a = [int(s) for s in input().split()]
    if solve(a):
        print('Yes')
    else:
        print('No')

def solve(a):
    odds = 0
    f4 = 0

    for i in a:
        if i % 4 == 0:
            f4 += 1
        elif i % 2 != 0:
            odds += 1
    
    if f4 + odds == len(a) and f4 + 1 == odds:
        return True
    elif f4 >= odds:
        return True
    else:
        return False

main()


Measured memory_bytes: 14252
package main

import "fmt"

func main() {
	var n, d, x int
	fmt.Scan(&n, &d, &x)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}

	var num_eaten int
	for _, a := range as {
		num_eaten += 1 + (d-1)/a
	}
	fmt.Println(x + num_eaten)
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<sys/time.h>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline int ri()
{
	register int x=0;register bool f=0;register char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();};
	return f?-x:x;
}
void wi(int x)
{
	if(x<0)	x=-x,putchar('-');
	if(x>9)	wi(x/10);
	putchar('0'+x%10);
}
const int mod=1e9+7,N=23000000;
int dig[N+5];
inline void add(int &x,int y)
{
    x+=y;
    if(x>=mod) x-=mod;
}
ll modpow(ll a,int b)
{
    ll res=1;
    for(;b;b>>=1,a=a*a%mod)
        if(b&1) res=res*a%mod;
    return res;
}
int main()
{
    int n=ri(),res=0,i,j,s;
    for(i=1;i<=N;i++) dig[i]=dig[i/10]+1;
    for(i=1,j=1,s=0;i<1e7;i++)
    {
        while(s<n) s+=dig[j],j++;
        if(s==n) add(res,1);
        s-=dig[i];
    }
    for(i=1;i<=n/8;i++)
    {
        if(n%i==0) add(res,((modpow(10,n/i)-modpow(10,n/i-1)-i+1)%mod+mod)%mod);
        else add(res,1);
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 90240
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

int main(){
  int X; cin >> X;
  int q = X/100;
  int r = X%100;
  if(0 <= r && r <= q*5) cout << 1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x": " << x << endl;
inline int lowbit(int x) { return x & -x; }
typedef long long LL;
const int N = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
const int mod = 1e9 + 7;

LL h[N];
int n, a, b;

bool check(LL times) {
    LL k = 0;
    for (int i = 1; i <= n; i++) {
        if (h[i] <= times * b)
            continue;
        else {
            LL t = h[i] - times * b;
            LL p = a - b;
            k += t / p + (t % p != 0);
        }
    }
    return k <= times;
}

int main() {
#ifdef purple_bro
    freopen("in.txt", "r", stdin);
#endif // purple_bro
    scanf("%d%d%d", &n, &a, &b);

    for (int i = 1; i <= n; i++)
        scanf("%lld", &h[i]);

    LL res = -1, L = 1, R = 1e9 + 1;

    for (;L <= R;) {
        LL mid = L + R >> 1;
        if (check(mid)) {
            res = mid;
            R = mid - 1;
        } else
            L = mid + 1;
    }

    printf("%lld\n", res);

    return 0;
}


Measured memory_bytes: 1024
N,M = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
K = []
for i in range(M-1):
  K.append(L[i+1]-L[i])
if N >= M:
  print(0)
else:
  K.sort()
  K.reverse()
  ans = L[M-1]-L[0]
  for i in range(N-1):
    ans -= K[i]
  print(ans)

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) V vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define Vec vector
#define P pair
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

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

  int n,m;
  cin>>n>>m;
  V k(m),p(m);
  Vec<set<ll>> s(m);
  rep(i,m){
    cin>>k[i];
    rep(j,k[i]){
      int S;
      cin>>S;
      s[i].insert(S);
    }
  }
  rep(i,m)cin>>p[i];

  int ans=0;
  for(int bit=0;bit<(1<<n);++bit){
    V a(m,0);
    for(int i=0;i<n;++i){
      if((bit>>i)&1){
        rep(j,m){
          if(s[j].find(i+1)!=s[j].end()){
            a[j]++;
          }
        }
      }
    }
    rep(i,m)a[i]%=2;
    bool flag=true;
    rep(i,m)if(a[i]!=p[i])flag=false;
    ans+=flag;
  }
  out(ans);
  
  
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
		int a=0, b=0, c=0;
		int N=0;
		int i;
		
		
		scanf("%d", &N );

		for( i=0; i<N; i++ ){
				scanf("%d %d %d", &a, &b, &c );
				if( a >= b && a >= c ){
						if( a*a == b*b + c*c ){
								printf("YES\n");
						}else{
								printf("NO\n");
						}
				}else if( b >= a && b >= c ){
						if( b*b == a*a + c*c ){
								printf("YES\n");
						}else{
								printf("NO\n");
						}
				}else{
						if( c*c == a*a + b*b ){
								printf("YES\n");
						}else{
								printf("NO\n");
						}
				}
		}
		return 0;
}

Measured memory_bytes: 580
nums = input().split()
W = int( nums[0])
H = int( nums[1])
x = int( nums[2])
y = int( nums[3])
r = int( nums[4])
    
if (x - r) >= 0 and (x + r) <= W:
    if (y - r) >= 0 and (y + r) <= H:
        print( "Yes")
    else:
        print( "No")
else:
    print( "No")

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

int main() {
  double t, x;
  cin >> t >> x;
  cout << fixed << t / x << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a = 0, b, c = 0, N;
	scanf("%d", &N);
	int aa[N];
	for (int i = 0; i < N; i++){
		scanf("%d", &aa[i]);
	}
	for (int j = 0; j < N; j++){
		b = aa[j];
		if (a < b) a = b;
	}
	for (int l = 0; l < N; l++){
		c += aa[l];
	}
	int d = a / 2;
	c -= d;
	printf("%d\n", c);
}

Measured memory_bytes: 128
<?php
 fscanf(STDIN,"%d%d",$n,$m);
$citys = array();
 for($i=0;$i<$m;$i++){
   $p_y = explode(" ",trim(fgets(STDIN)));
   $pref[$p_y[0]][] = $p_y[1];
   $py_li[] = $p_y;
 }
 

//昇順にする
$p_y_key_li = array_keys($pref);
for($i=0;$i<count($p_y_key_li);$i++){
  sort($pref[$p_y_key_li[$i]]);
}

$memo = array();

//print_r($pref);
foreach($pref as $c){
  foreach($c as $x => $year){
    $memo[$year] = $x+1;
  }
}

//print_r($memo);
  


foreach($py_li as $py){
  $x = $memo[$py[1]];
  for($i=0;$i<6-strlen($py[0]);$i++){
    echo "0";
  }
  echo $py[0];
   for($i=0;$i<6-strlen($x);$i++){
    echo "0";
  }
  echo ($x)."\n";
}
//print_r($pref);

Measured memory_bytes: 115884
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int i,j,k,n,a[105],ans;
int main()
{
	//freopen("jiao.in","r",stdin);
	//freopen("jiao.out","w",stdout);
	cin>>n;
	for(i=1;i<=n;i++)
	cin>>a[i];
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			for(k=j+1;k<=n;k++)
			{
			    if(a[i]==a[j]||a[j]==a[k]||a[i]==a[k]) {
			        continue;
                }
				if(a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i])
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
int H;
void maxHeapify(int A[],int i)
{
  int l,r,largest,a;
  l=i*2;
  r=l+1;
  if(l<=H && A[l]>A[i]) largest=l;
      else largest=i;
    
      if(r<=H && A[r]>A[largest])
        largest=r;

      if(largest!=i)
        {
          a=A[i];
          A[i]=A[largest];
          A[largest]=a;
      maxHeapify(A,largest);
        }
}
void buildMaxHeap(int A[])
{
  int i;
  for(i=H/2;i>=1;i--)
    {
      maxHeapify(A,i);
    }
}
 

int main()
{
  int i,A[500000];
   scanf("%d",&H);
      for(i=1;i<=H;i++)
    {
      scanf("%d",&A[i]);
    }
      buildMaxHeap(A);

  for(i=1;i<=H;i++)
    {
      if(i==H) printf(" %d\n",A[i]);
      else printf(" %d",A[i]);
    }
          

  return 0;
}



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

template<u_int32_t Mod>
struct ModInt {
    u_int64_t value;
    ModInt(const u_int32_t& value) : value(value % Mod) {}
    ModInt<Mod>& operator+=(const ModInt<Mod>& other) {
        value = (value + other.value) % Mod;
        return *this;
    }
    ModInt<Mod>& operator-=(const ModInt<Mod>& other) {
        value = ((value < other.value ? value + Mod : value) - other.value) % Mod;
        return *this;
    }
    ModInt<Mod>& operator*=(const ModInt<Mod>& other) {
        value = (value * other.value) % Mod;
        return *this;
    }
    ModInt<Mod> inverse() {
        int64_t a = value, b = Mod, u = 1, v = 0;
        while (b) {
            int64_t t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= Mod;
        if (u < 0) {
            u += Mod;
        }
        return ModInt<Mod>(u);
    }
    ModInt<Mod> pow(u_int32_t n) {
        ModInt<Mod> res(1u), a(value);
        while (n > 0) {
            if (n & 1) {
                res *= a;
            }
            a *= a;
            n >>= 1;
        }
        return res;
    }
    ModInt<Mod> combination(u_int32_t k) {
        ModInt<Mod> nf = 1, kf = 1;
        for (u_int32_t n = value; k > 0; n--, k--) {
            nf *= n;
            kf *= k;
        }
        nf *= kf.inverse();
        return nf;
    }
};

typedef ModInt<1000000007> MInt;

int main() {
    u_int32_t n, a, b;
    cin >> n >> a >> b;
    MInt two = 2, num = n;
    MInt res = two.pow(n);
    res -= num.combination(a);
    res -= num.combination(b);
    res -= 1;
    cout << res.value << endl;
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  int count = 0;
  for(int i = 0; i < 4; i++) {
    if(S.at(i) == '2') {
      count++;
    }
  }

  cout << count << endl;
}


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

int main() {

	int x1, x2, y1, y2;
	cin >> x1 >> y1  >> x2 >> y2;
	int x3, x4, y3, y4;

	x3 = x2 - (y2 - y1);
	y3 = y2 + (x2 - x1);
	x4 = x3 - (y3 - y2);
	y4 = y3 + (x3 - x2);

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << "\n";
	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define setNil(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
#define setNegINF(x) memset((x),192,sizeof(x)) //NegINF=-INF-1
#define setNeg1(x) memset((x),255,sizeof(x))
#define MP make_pair
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int n,q,f[200005],cnt;
ll res;
priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > > pq;
inline int fnd(int x){
	return f[x]==x?x:f[x]=fnd(f[x]);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>q;
	for(int i=0;i<n;i++)f[i]=i;
	while(q--){
		int a,b,c;
		cin>>a>>b>>c;
		pq.push(MP(c,MP(a,b)));
		pq.push(MP(c+1,MP((a+1)%n,b)));
	}
	while(!pq.empty()){
		int u=pq.top().Y.X,v=pq.top().Y.Y,c=pq.top().X;
		pq.pop();
		if(fnd(u)==fnd(v))continue;	
		f[fnd(u)]=fnd(v);
		res+=c;
		if((++cnt)==n-1)break;
		pq.push(MP(c+2,MP((u+1)%n,(v+1)%n)));
	}
	cout<<res<<endl;
	return 0;
}

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

typedef struct UnionFind{
    vector<int> par;
    vector<int> groups;
    UnionFind(int N) : par(N), groups(N){
        for(int i=0;i<N;++i){
            par[i] = i;
            groups[i] = 1;
        }
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx!=ry){
            par[rx] = ry;
            groups[ry] += groups[rx];
        }
    }
    bool same(int x, int y){
        int rx = root(x);
        int ry = root(y);
        return rx==ry;
    }
    int size(int x){
        int rx = root(x);
        return groups[rx];
    }
}UF;
long long n, a[200010], wa[200010];// dp[200010][25];

int main(void){
    cin >> n;
    for(int i=0;i<n;++i) cin >> a[i];
    long long sum = 0;
    for(int i=0;i<n;++i){
        sum += a[i];
        wa[i+1] = sum;
    }
    long long X=0, ans=0;
    sum = 0;
    int r = 0;
    for(int l=0;l<n;++l){
        while(r < n && ((sum + a[r]) <= (X ^ a[r]))){
            sum += a[r];
            X ^= a[r];
            ++r;
        }
        ans += r-l;
        if(r==l) ++r;
        else{
            sum -= a[l];
            X ^= a[l];
        }
    }
    cout << ans << endl;
}
    /*int now = a[0], j=0;
    while(now > 0){
        if(now&1 == 1) dp[0][j] = 1;
        else dp[0][j] = 0;
        now >>= 1;
        ++j;
    }
    for(int i=1;i<n;++i){
        j = 0;
        now  = a[i];
        while(now > 0){
            if(now&1 == 1) dp[i][j] = dp[i-1][j] + 1;
            else dp[i][j] = dp[i-1][j];
            now >>= 1;
            ++j;
        }
    }*/

Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int cost = inf;
    for(int p = -100; p <= 100; p++)
    {
        int tmp = 0;
        rep(i, N){
            tmp += (p - A[i]) * (p - A[i]);
        }
        cost = min(cost, tmp);
    }
    
    output(cost, 0);
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	// var n int
	// fmt.Scan(&n)
	var a, b int
	fmt.Scanf("%d %d", &a, &b)

	if a%2 != b%2 {
		fmt.Print("IMPOSSIBLE")
	} else {
		fmt.Print((a + b) / 2)
	}

}


Measured memory_bytes: 512
#include <vector>
using namespace std;

//Base class for Segment Trees
template <class T>
class segtree_base
{
protected:
	size_t width;
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		width = 1;
		while (width < size_)width *= 2;
		vec.resize(width * 2 - 1, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, width, 0);
	}
	virtual ~segtree_base() {}
};

#include <algorithm>
//Range Minimum Tree
template <class T, class Comp>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index, T val)
	{
		auto &vec = this->vec;
		index += (this->width - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2],Comp());
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		const auto &vec = this->vec;
		if (l_ <= a_ && b_ <= r_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return this->def;
		}
		int m = (a_ + b_) / 2;
		return min(
			query_raw(l_, r_, a_, m, k_ + k_ + 1),
			query_raw(l_, r_, m, b_, k_ + k_ + 2),Comp());
	}
};


#include <algorithm>
//Range Sum + Range Add Tree
template <class T>
class rsaq_tree : public segtree_base<T>
{
protected:
	vector<T>lazy;
public:
	rsaq_tree(size_t size_, const T& def = 0) :segtree_base<T>(size_, def)
	{
		lazy.resize(this->vec.size());
	}
	void init(const vector<int>&base)
	{
		for (int i = 0; i < this->width; i++) this->vec[i + this->width - 1] = base[i];
		for (int i = this->width - 2; i >= 0; i--) this->vec[i] = this->vec[i * 2 + 1] + this->vec[i * 2 + 2];
	}
	void update(int left, int right, int val)
	{
		update_raw(left, right, val, 0, this->width, 0);
	}
private:
	void eval(int k_, int a_, int b_)
	{
		if (lazy[k_] != 0) {
			this->vec[k_] += lazy[k_];
			if (b_ - a_ > 1) {
				lazy[2 * k_ + 1] += lazy[k_] / 2;
				lazy[2 * k_ + 2] += lazy[k_] / 2;
			}
			lazy[k_] = 0;
		}
	}
	void update_raw(int l_, int r_, int x_, int a_, int b_, int k_)
	{
		eval(k_, a_, b_);
		if (r_ <= a_ || b_ <= l_) return;
		if (l_ <= a_ && b_ <= r_) {
			lazy[k_] += (b_ - a_) * x_;
			eval(k_, a_, b_);
		}
		else {
			update_raw(l_, r_, x_, a_, (a_ + b_) / 2, 2 * k_ + 1);
			update_raw(l_, r_, x_, (a_ + b_) / 2, b_, 2 * k_ + 2);
			this->vec[k_] = this->vec[2 * k_ + 1] + this->vec[2 * k_ + 2];
		}
	}
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		eval(k_, a_, b_);
		if (r_ <= a_ || b_ <= l_) return this->def;
		if (l_ <= a_ && b_ <= r_) return this->vec[k_];
		T vl = query_raw(l_, r_, a_, (a_ + b_) / 2, 2 * k_ + 1);
		T vr = query_raw(l_, r_, (a_ + b_) / 2, b_, 2 * k_ + 2);
		return vl + vr;
	}
};

#include <iostream>
#include <climits>

#include <functional>


int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int, less<int>>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Measured memory_bytes: 3912
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<cfloat>
using namespace std;
int mod = 1e9+7;
long long int inf = 1e18;

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

  vector<int> l(n, 0);
  vector<int> r(n, 0);
  if( s[0] == 'W' ) l[0]++;
  for(int i=1; i<n; i++){
    l[i] = l[i-1];
    if( s[i] == 'W' ) l[i]++;
  }

  if( s[n-1] == 'E' ) r[n-1]++;
  for(int i=n-2; i>=0; i--){
    r[i] = r[i+1];
    if( s[i] == 'E' ) r[i]++;
  }

  int cnt = 1e9;
  for(int i=0; i<n; i++){
    int tl = (i == 0 ? 0:l[i-1]);
    int tr = (i == n-1 ? 0:r[i+1]);
    cerr << tl + tr << endl;
    cnt = min(cnt, tl+tr);
  }
  cout << cnt << endl;




  return 0;
}

//


Measured memory_bytes: 3076
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  double cont = 0.0;
  LL n;
  cin >> n;
  REP(i,n) {
    double a;
    cin >> a;
    cont += 1.0 / a;
  }
  cout << 1.0 / cont << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
INF = float('inf')


def main():
    V, E = map(int, input().split())
    dist = [[0 if i == j else INF for j in range(V)] for i in range(V)]
    for _ in range(E):
        s, t, d = map(int, input().split())
        dist[s][t] = d
    for k in range(V):
        for i in range(V):
            for j in range(V):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    for i in range(V):
        if dist[i][i] < 0:
            print('NEGATIVE CYCLE')
            exit()
        for j in range(V):
            if dist[i][j] == INF:
                dist[i][j] = 'INF'
    for l in dist:
        print(*l)


if __name__ == '__main__':
    main()



Measured memory_bytes: 6292
h,w = map(int,input().split())
s = [list(input().split()) for nesya in range(h)]
n = 0
for i in range(h):
  for j in range(w):
    if s[i][j] == 'snuke':
      ai = i
      aj = j
      n += 1
      break
  if n == 1:
    break
print(chr(aj+ord('A'))+str(ai+1))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <stack>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <map>

using namespace std;

typedef pair<int,int> pii;

main(){
    int size;
    cin >> size;
    vector<int> arr(size,0);
    int num;
    for(int i=0;i<size;++i){
        cin >> num;
        arr[i] = num;
    }
    sort(arr.begin(),arr.end());
    cout << arr[size-1] - arr[0] << endl;
}

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

int main(){
   long long x;
   cin >> x;
   int cnt=0;
   long long t=100;

   while(true){
      if(t<x){
         t+=t/100;
         cnt++;
      }else{
         cout << cnt<<endl;
         return 0;
      }
   }
  
   return 0;
}

Measured memory_bytes: 3636
//BISMILLAHIR RAHMANIR RAHIM
//ALLAH HU AKABR
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x,y;
   x=(a+d-1)/d;
   y=(c+b-1)/b;
   cout<<(x>=y?"Yes":"No")<<endl;
}


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

namespace AtCoder {
    class Program {
        static void Main(string[] args) {
            var input = IntInput(' ');
            var a = input[0];
            var b = input[1];
            double total = 0;
            if(a > b) {
                for(var i = 0; i < a; i++) {
                    var keta = Math.Pow(10, i);
                    total += keta * b;
                }
            } else {
                for (var i = 0; i < b; i++) {
                    var keta = Math.Pow(10, i);
                    total += keta * a;
                }
            }
            Output(total.ToString());
        }

        #region ReadLineメソッド
        /// <summary>
        /// 文字列をリストで返す
        /// </summary>
        static List<string> StringInput(char splitChar) {
            return Console.ReadLine().Split(splitChar).ToList();
        }

        /// <summary>
        /// 文字列を分割し、数字のリストで返す
        /// </summary>
        static List<int> IntInput(char splitChar) {
            return StringInput(splitChar).Select(str => int.Parse(str)).ToList();
        }

        /// <summary>
        /// 数字を1つ返す
        /// </summary>
        static int IntInput() {
            return int.Parse(Console.ReadLine());
        }
        #endregion

        #region　WriteLineメソッド
        /// <summary>
        /// string型を改行せずに出力する
        /// </summary>
        static void Output(string str) {
            Console.Write(str);
        }

        /// <summary>
        /// int型をそのまま出力する
        /// </summary>
        static void Output(int number) {
            Console.WriteLine(number);
        }

        /// <summary>
        /// int型のリストを改行して出力する
        /// </summary>
        static void Output(List<int> numList) {
            numList.ForEach(num => Console.WriteLine(num));
        }
        #endregion 
    }
}


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

void chmin(int64_t& a, int64_t b){
    a = min(a, b);
}

int main(){
    int N, T;
    cin >> N >> T;
    vector<pair<int64_t, int64_t>> AB;
    vector<int64_t> B0;
    for(int i=0; i<N; i++){
        int64_t a, b;
        cin >> a >> b;
        if(a > 0){
            AB.emplace_back(a, b);
        }else{
            B0.push_back(b);
        }
    }
    sort(AB.begin(), AB.end(), [](auto x, auto y){ return x.first * (y.second+1) > y.first * (x.second+1); });
    sort(B0.begin(), B0.end());
    int sz = AB.size();

    int64_t dp[50];
    for(int j=0; j<=35; j++) dp[j] = T+1;
    dp[0] = 0;
    for(int i=0; i<sz; i++){
        int64_t a = AB[i].first, b = AB[i].second;
        for(int j=34; j>=0; j--){
            int64_t t = dp[j]+1 + a*(dp[j]+1) + b;
            chmin(dp[j+1], t);
        }
    }

    int ans = 0;
    for(int j=0; j<=35; j++) if(dp[j] <= T){
        int res = j;
        int64_t t = dp[j];
        for(int64_t b : B0) if(t+1+b <= T){
            res++;
            t += 1+b;
        }
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6556
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) {
        par.resize(n, -1);
    }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

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

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    
    UnionFind uf(n);
    rep(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        --x;
        --y;
        uf.unite(x, y);
    }

    int ans = 0;
    for (int x : uf.par) if (x < 0) ans++;

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

Measured memory_bytes: 640
N = int(input())

str = input()

arr = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
ans = ""

str_arr = list(str)

length = len(str_arr)

for i in range(length):
  a = str_arr[i]
  b = arr.index(a)
  c = b + N
  ans = ans + arr[c]
  
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int n,m,sum;
int main() {
	cin>>n>>m;
	if(n<0&&m<0&&n!=m){
		sum=m-n+1;
		if(sum%2==1)
			cout<<"Negative"<<endl;
		else
			cout<<"Positive"<<endl;
	}
	if(n<0&&m>0){
		cout<<"Zero"<<endl;
		return 0;
	}
	if(n>0&&m>0){
		cout<<"Positive"<<endl;
		return 0;
	}
	if(n==0||m==0){
		cout<<"Zero"<<endl;
		return 0;
	}
	if(n>0&&n==m){
		cout<<"Positive"<<endl;
		return 0;
	}
	if(n==0&&n==m){
		cout<<"Zero"<<endl;
		return 0;
	}
	if(n<0&&n==m)
		cout<<"Negative"<<endl;
	return 0;
}

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

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

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll func(vvl &DP, vector<string> &S, ll &H, ll &W, ll x, ll y, ll score) {
  ll ans = 0;
  if (x > W - 1 || y > H - 1 || S[y][x] == '#')
    return 0;
  if (x == W - 1 && y == H - 1)
    return score;
  if (DP[y][x] != 0)
    return DP[y][x];

  ans = func(DP, S, H, W, x + 1, y, score) % MOD;
  ans += func(DP, S, H, W, x, y + 1, score) % MOD;
  DP[y][x] = ans % MOD;
  return ans % MOD;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll H, W;
  cin >> H >> W;
  vector<string> S(H);
  vvl DP = VVL(H + 1, W + 1, 0);
  REP(i, H) cin >> S[i];

  DP[0][0] = 1;
  for (ll i = 0; i < H; ++i) {
    for (ll j = 0; j < W; ++j) {
      if (S[i][j] == '#')
        continue;
      DP[i + 1][j] += DP[i][j];
      DP[i + 1][j] %= MOD;
      DP[i][j + 1] += DP[i][j];
      DP[i][j + 1] %= MOD;
    }
  }
  cout << DP[H - 1][W - 1] << endl;

  // cout << func(DP, S, H, W, 0, 0, 1) << endl;

  return 0;
}


Measured memory_bytes: 9600
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define BUFSIZE 200000
int n;
int hoge[BUFSIZE]={0};
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
void survey(int A){
    if(A==n-1){
        printf("YES");
        exit(0);
     }    
    if(hoge[A]==hoge[A+1]){
        printf("NO");
        exit(0);
    }
    survey(A+1);    
}
int main(void){
    scanf("%d",&n);
for(int i=0;i<n;i++){
    scanf("%d",&hoge[i]);
    }
    qsort(hoge,n,sizeof(int),compare_int);
    survey(0);
 }

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
void out(int a,int b){
	cout<<a<<" "<<b<<endl;
}
int main(){
	int n;cin>>n;
	int s;
	for(int i=1;i<20;i++){
		if((1<<i)-1>n){
			break;
		}
		s=(1<<i)-1;
	}
	if(n==s+1||n==1){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<s;i++){
		out(i,i+1);
	}
	out(s,n+1);
	for(int i=n+1;i<n+s;i++){
		out(i,i+1);
	}
	if(n>=s+2){
		out(1,s+1);
		out(s+1,s+2);
		out(1,s+2+n);
		out(s+2+n,s+1+n);
	}
	for(int i=s+3;i<=n;i++){
		out(i-1+n,i);
		out(i-s-1,i+n);
	}
}


Measured memory_bytes: 2688
n = gets.chomp.to_i
h = gets.chomp.split.map(&:to_i)

dp = []
(0..10**5).each do |i|
  dp << Float::INFINITY
end
dp[0] = 0

(1...n).each do |i|
  a = dp[i - 1] + (h[i] - h[i - 1]).abs
  if dp[i] > a
    dp[i] = a
  end
  if i > 1 
    b = dp[i - 2] + (h[i] - h[i - 2]).abs
    if dp[i] > b
      dp[i] = b
    end
  end
end
p dp[n-1]

Measured memory_bytes: 9356
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N,K=LI()
HS=LI()
HS.sort(reverse=True)
hcnt = 0
normal = 0
for i in range(N):
    if hcnt < K:
        hcnt += 1
    else:
        normal += HS[i]

print(normal)


Measured memory_bytes: 25868
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    ll a, b, c; cin >> a >> b >> c;
    ll A;
    ll aa = a/2, bb = a - a/2;
    A = abs(aa*b*c - bb*b*c);
    aa = b/2, bb = b-b/2;
    A = min(abs(aa*a*c - bb*a*c), A);
    aa = c/2, bb = c-c/2;
    A = min(abs(aa*a*b - bb*a*b), A);
    cout << A << endl;
}

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

int isPrime(int);

int main(){
	int n;
	cin>>n;
	int sum=0;
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin>>x;
		sum+=isPrime(x);
	}
	cout<<sum<<endl;
	
return 0;
}

int isPrime(int x){
	if(x==2) return 1;
	if(x<2 || x%2==0) return 0;
	for (int i = 3; i*i<=x ; i=i+2)
	{
		if (x%i==0) return 0;
	}
	return 1;
}

Measured memory_bytes: 3004
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  //N 莠ｺ縺ｮ縺吶〓縺大菅
  //K 遞ｮ鬘槭・縺願藷蟄・
  int n,k;cin>>n>>k;
  //縺願藷蟄舌・謨ｰ
  vector<int> snuke(n,0);
  int d,a;
  rep(i,k){
    cin>>d;
    rep(i,d){
      cin>>a;
      snuke[--a]++;
    }
  }
  int cnt=0;
  rep(i,n){
    //cout<<i<<" "<<snuke[i]<<endl;
    if(snuke[i]==0)cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 3668
import java.util.Scanner;

public class Main {

public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
String output = "";
if (a-b > 0) {
 output = "a > b";
} else if(a-b<0){
output = "a < b";
} else {
output = "a == b";
}
System.out.println(output);
}
}


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

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int d = scanner.nextInt();
		int g = scanner.nextInt();
		int p[] = new int[d];
		int c[] = new int[d];

		for (int i = 0; i < d; i++) {
			p[i] = scanner.nextInt();
			c[i] = scanner.nextInt() + (i + 1) * 100 * p[i];
		}

		int min = 1000000000;
		for (int i = 0; i < Math.pow(2, d); i++) {
			int scr = 0;
			int cnt = 0;
			List<Integer> list = new ArrayList<>();
			for (int j = 0; j < d; j++) {
				if ((i >> j & 1) == 1) {
					scr += c[j];
					cnt += p[j];
					list.add(j);
				}
			}
			if (scr >= g && cnt < min) {
				min = cnt;
				continue;
			}
			for (int j = d - 1; j >= 0; j--) {
				if (!list.contains(j)) {
					for (int k = 0; k < p[j]; k++) {
						scr += (j + 1) * 100;
						cnt++;
						if (scr >= g && cnt < min)
							min = cnt;
					}
				}
			}

		}

		System.out.println(min);

	}
}


Measured memory_bytes: 23252
import java.util.Arrays;
import java.util.Scanner;

/**
 * Engines
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            Vector[] V = new Vector[N];
            for (int i = 0; i < N; i++) {
                long x = sc.nextLong();
                long y = sc.nextLong();
                V[i] = new Vector(x, y);
            }

            for (Vector v : V) {
                v.r = Math.acos(v.x / Math.sqrt(v.x * v.x + v.y * v.y));
                if (v.y < 0) {
                    v.r = Math.PI * 2 - v.r;
                }
            }

            Arrays.sort(V, (o1, o2) -> Double.compare(o1.r, o2.r));

            double max = 0;

            for (int i = 0; i < N; i++) {
                long X = 0;
                long Y = 0;

                for (int j = i; j < N + i; j++) {
                    X += V[j % N].x;
                    Y += V[j % N].y;

                    double d = Math.sqrt(X * X + Y * Y);

                    if (max < d) {
                        max = d;
                    }
                }
            }

            System.out.println(max);
        }

    }

    static class Vector {

        long x;

        long y;

        double r;

        public Vector(long x, long y) {
            this.x = x;
            this.y = y;
        }

    }

}


Measured memory_bytes: 28884
#n=int(input())
n,m=map(int,input().split())
#a=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]

ll=[[]for i in range(n)]

for i in range(m):
    ll[l[i][0]-1].append(l[i][1])
    ll[l[i][1]-1].append(l[i][0])

lt=[0 for i in range(n)]
lll=[1]
for i in range(n):
    for j in ll[lll[i]-1]:
        if (j!=1 and lt[j-1]==0):
            lll.append(j)
            lt[j-1]=lll[i]

print("Yes")
for i in range(1,n):
    print(lt[i])


Measured memory_bytes: 132244
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

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

    long long n,k,s=0;

    cin >> n >> k;

    vector<long long> a(100001,0);

    for(int i = 0;i < n;i++)
    {
        int x,y;
        cin >> x >> y;
        a[x]+=y;
    }

    for(int i = 0;;i++)
    {
        s+=a[i];
        if(s>=k){ cout << i; return 0; }
    }
}


Measured memory_bytes: 1024