akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
#mod = 10 ** 9 + 7 
mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
xy = [LIST() for _ in range(N)]
xy.sort(key = lambda x:(x[0], x[1]))

delta = defaultdict(int)
if N == 1:
	print(1)
else:
	for x, y in combinations(xy, 2):
		delta[(y[0]-x[0], y[1]-x[1])] += 1

	print(N - max(delta.values()))

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

int main() {
  int N, A, B, m1, m2;
  cin >> N >> A >> B;
  m1 = A * N ;
  m2 = B ;
  if (m1 > m2){
    cout << m2 << endl;
  }
  else {
    cout << m1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string x,y;
int main()
{
	cin >>x>>y;
	cout <<y<<x;
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#define int long long
using namespace std;
signed main(){
    int S;
    cin >> S;
    int dp[S+1][S+1];//no.ofelements,sum
    int ps[S+1][S+1];
    for(int i=0;i<=S;i++){
        for(int j=0;j<=S;j++){
            dp[i][j]=0;
            ps[i][j]=0;
        }
    }
    for(int i=3;i<=S;i++){
        dp[1][i]=1;
        ps[1][i]=ps[1][i-1]+dp[1][i];
    }
    for(int i=2;i<=S;i++){
        for(int j=3;j<=S;j++){
            if(i>3*j)continue;
            dp[i][j]=ps[i-1][j-3];
            ps[i][j]=(10000000070ll+ps[i][j-1]+dp[i][j])%1000000007;
            ps[i][j]%=1000000007;
        }
    }
    int ans=0;
    for(int i=1;i<=S;i++) ans+=dp[i][S], ans%=1000000007;
    cout << ans;
    
}

Measured memory_bytes: 65584
//url:
//problem name: 

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N; cin >> N;
    map<string,int> mp;
    set<string> ans;
    queue<string> que;
    que.push("a");

    while(1) {
        string S = que.front();
        que.pop();
        if(S.size() > N) break;
        if(S.size() == N) ans.insert(S);
        for(int i = 0; i < S.size(); i++) {
            string ret = S + S[i];
            string res = S + (char)((int)S[i]+1);
            if(!mp.count(ret)) {
                mp[ret] = 1;
                que.push(ret);
            }
            if(!mp.count(res)) {
                mp[res] = 1;
                que.push(res);
            }
        }
    }

    for(auto s:ans) cout << s << endl;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,k,q;
  cin >> n >> k >> q;
  vector<int32> a(n);
  REP(i,n){
    cin >> a[i];
  }
  a.pb(-1);
  int32 ans = INF;
  REP(i,n){
    vector<int32> cur;
    vector<int32> canBeDeleted;
    REP(j,n+1){
      if(a[j] < a[i]){
        sort(ALL(cur));
        REP(l,(signed)cur.size() - k + 1)canBeDeleted.pb(cur[l]);
        cur.clear();
      }else{
        cur.pb(a[j]);
      }
    }
    sort(ALL(canBeDeleted));
    if(canBeDeleted.size() < q)continue;
    ans = min(ans, canBeDeleted[q-1] - a[i]);
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(int argc, char const *argv[])
{
    /* code */
    int N, M;
    scanf("%d %d", &N, &M);
    if(N == M)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll N;
  	cin>>N;
  	string S[N];
  	int c[4]={0};
	string C[4]={"AC","WA","TLE","RE"};
  
  	rep(i,N) {
      cin>>S[i];
    }
  
  	rep(i,N){
     	if(S[i]==C[0]) c[0]++;
     	if(S[i]==C[1]) c[1]++; 
    	if(S[i]==C[2]) c[2]++;
     	if(S[i]==C[3]) c[3]++; 
    }
  
  	rep(i,4){
     	cout<<C[i]<<" x "<<c[i]<<endl; 
    }
  
  
  
}

Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  vector<long long>A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  if(K>=N){
    cout<<0<<endl;
  }
  else{
    long long sum=0;
    for(int i=0;i<N-K;i++){
      sum=sum+A.at(i);
    }
    cout<<sum<<endl;
  }
}
      

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c,k,ans=0;cin>>a>>b>>c>>k;
  ans+=min(a,k);
  k=max(0ll,k-a-b);
  ans-=k;
  print(ans);
  return 0;
}

Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	static class Node {
		int p = -1, l, r;
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		Node[] nodes = new Node[n];
		for (int i = 0; i < n; i++) nodes[i] = new Node();
		for (int i = 0; i < n; i++) {
			StringTokenizer st = new StringTokenizer(reader.readLine());
			int id = Integer.parseInt(st.nextToken());
			int l = Integer.parseInt(st.nextToken());
			int r = Integer.parseInt(st.nextToken());
			nodes[id].l = l;
			nodes[id].r = r;
			if (l != -1) nodes[l].p = id;
			if (r != -1) nodes[r].p = id;
		}
		reader.close();

		int rootId = -1;
		for (int i = 0; i < n; i++) {
			if (nodes[i].p == -1) {
				rootId = i;
				break;
			}
		}
		System.out.println("Preorder");
		preOrder(nodes, rootId);
		System.out.println();
		System.out.println("Inorder");
		inOrder(nodes, rootId);
		System.out.println();
		System.out.println("Postorder");
		postOrder(nodes, rootId);
		System.out.println();
	}

	private static void preOrder(Node[] nodes, int u) {
		if (u == -1) return;
		System.out.print(" " + u);
		preOrder(nodes, nodes[u].l);
		preOrder(nodes, nodes[u].r);		
	}
	
	private static void inOrder(Node[] nodes, int u) {
		if (u == -1) return;
		inOrder(nodes, nodes[u].l);
		System.out.print(" " + u);
		inOrder(nodes, nodes[u].r);
	}

	private static void postOrder(Node[] nodes, int u) {
		if (u == -1) return;
		postOrder(nodes, nodes[u].l);
		postOrder(nodes, nodes[u].r);
		System.out.print(" " + u);
	}
}



Measured memory_bytes: 24240
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

	if (n % 1000000000 == 0) {
		cout << "0 0 1000000000 1 " << 0 << " " << n / 1000000000 << endl;
	} else {
		cout << "0 0 1000000000 1 " << 1000000000 - (n % 1000000000) << " " << (n + 999999999) / 1000000000 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N,M,K=map(int,input().split())
AB=[[] for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  AB[a-1].append(b)
  AB[b-1].append(a)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
      
uf=UnionFind(N)
for i in range(N):
  for j in AB[i]:
    uf.union(i,j-1)

ans=[0]*N
for i in range(N):
  ans[i]=uf.size(i)-1-len(AB[i])
for i in range(K):
  c,d=map(int,input().split())
  if uf.same(c-1,d-1):
    ans[c-1]-=1
    ans[d-1]-=1
print(*ans)

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

int main(){
    ll bingo[3][3];
    ll bingo2[3][3];
    rep(i,3)rep(j,3) cin >> bingo[i][j];
    int n;
    cin >> n;
    rep(i,3)rep(j,3) bingo2[i][j]=0;
    rep(i,n){
        int b;
        cin >> b;
        rep(j,3)rep(k,3){
            if(bingo[j][k]==b) bingo2[j][k]=1;
        }
    }
    
    rep(i,3){
        int total=0;
        rep(j,3){
            total+=bingo2[i][j];
        }
        if(total==3){
            puts("Yes");
            return 0;
        }
    }
    
    rep(i,3){
        int total=0;
        rep(j,3){
            total+=bingo2[j][i];
        }
        if(total==3){
            puts("Yes");
            return 0;
        }
    }
    
    int a,b;
    a=bingo2[0][0]+bingo2[1][1]+bingo2[2][2];
    b=bingo2[0][2]+bingo2[1][1]+bingo2[2][0];
    if(a==3||b==3){
        puts("Yes");
        return 0;
    }
    
    puts("No");

    return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* 最大公約数 */
ll gcdx(ll a, ll b) {
    return b ? gcdx(b, a % b) : a;
}

/* 最小公倍数 */
ll lcmx(ll a, ll b) {
    return a / gcdx(a, b) * b;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    int X;
    cin >> X;
    int lc = lcmx(X,360);
    cout << lc/X << "\n";
}

Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <string>
#include <string.h>
#include <cmath>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#define pi acos(-1.0)
#define INF 0x3f3f3f3f
#define SIZE 200005
#define read(a,n) for(i=0;i<n;i++)cin>>a[i];
#define pii pair<int,int>
#define pb push_back
using namespace std;
typedef	long long ll;
ll n, m, i, j, k, h, t, maxn, ttt, t1, t2, sig = 0;
int main() 
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e >> k;
	int s1[] = { a,b,c,d,e };
	int maxx = 0;
	for (i = 0; i < 5; i++) {
		for (j = i + 1; j < 5; j++) {
			int tmp = abs(s1[i] - s1[j]);
			maxx = max(maxx, tmp);
		}
	}
	if (maxx <= k)cout << "Yay!";
	else cout << ":(";
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque
mod=10**9+7
H,W = map(int,input().split())
Gd = [list(input()) for _ in range(H)]
INF = 0
direc = [[1,0],[0,1]]
def dfs(start):
  Rt = [[INF]*W for _ in range(H)]
  Rt[start[0]][start[1]]=1
  q = deque([])# スタック
  q.append(start)
  while len(q)!=0:
    h,w = q.popleft()# スタック取りだし（はじめ）
    for d in direc:
      hs, ws = h + d[0], w + d[1]
      if not (0<=hs<H and 0<=ws<W):
        continue
      if Gd[hs][ws]=='.':
        if Rt[hs][ws]==INF:
          q.append([hs,ws])
        Rt[hs][ws] = (Rt[hs][ws] + Rt[h][w])%mod
  return Rt[H-1][W-1]
print(dfs([0,0]))

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

int main() {

  int N, M, A, sum;
  cin >> N >> M;
  sum = 0;

  for (int i=0; i<M; i++){
    cin >> A;
    sum = A + sum;
  }

  if(N >= sum){
    cout << N - sum << endl;

  }else{
    cout << "-1" << endl;
  }

}

Measured memory_bytes: 3620
#include <stdio.h>

int main(){
  int num, d, i = 0, t[10001][2] = {};
  char str[100];
  while(gets(str)){
    if(str[0] == 0) i++;
    else{
      sscanf(str, "%d %d", &num, &d);
      t[num][i]++;
    }
  }

  for(i = 0;i < 10001;i++)
    if(t[i][0] && t[i][1])
      printf("%d %d\n", i, t[i][0] + t[i][1]);
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    int sum = 0;
    
    sum = (N / 1000000000 ) % 10 
        + (N / 100000000 ) % 10 
        + (N / 10000000 ) % 10 
        + (N / 1000000 ) % 10 
        + (N / 100000 ) % 10 
        + (N / 10000 ) % 10 
        + (N / 1000 ) % 10 
        + (N / 100 ) % 10 
        + (N / 10 ) % 10 
        + N % 10;

    if(N % sum == 0){
        cout << "Yes" << endl;
    }

    else cout << "No" << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const long long INF=1e18,MOD=1e9+7;
bool comp(P a,P b){
	return a.second>b.second;
}
int main(){
	priority_queue<P>que;
	ll n,m,ans=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		que.push(P(a,1));
	}
	for(int i=0;i<m;i++){
		ll b,c;
		cin>>b>>c;
		que.push(P(c,b));
	}
	while(true){
		if(n<=0)break;
		P top_num=que.top();que.pop();
		ans+=min(top_num.second,n)*top_num.first;
		n-=top_num.second;
	}
	cout<<ans<<endl;
	
}

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

int main(){
  int n,m,p,x;
  cin >> n;
  vector<int> t(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin >> t[i];
    sum+=t[i];
  }
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> p >> x;
    cout << sum-t[p-1]+x << endl;
  }
}

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

int main() {
    int n; cin >> n;
    vector<char>s(n);
    for(int i = 0; i < n; i++) cin >> s[i];
    
    for(int i = 0; i < n; i++) {
        if(s[i] == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}


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

def imos(n,a):
  imos_l=[0 for i in range(n)]

  for i in range(n):
    x=i
    x_left=max(x-a[i],0)
    x_right=min(x+a[i],n-1)

    imos_l[x_left]+=1
    if (x_right+1)!=n:
      imos_l[x_right+1]-=1

  b=[0]
  for i in range(1,n+1):
    b.append(imos_l[i-1]+b[i-1])

  return(b[1:])

for i in range(k):
  a=imos(n,a)

  if a.count(n)==n:
    break

print(*a)

Measured memory_bytes: 182540
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	vector<tuple<int, int, char, LL, string>> a(n);

	for (int i = 0; i < n; i++) {
		int v, w;
		char t;
		LL d;
		string c;

		cin >> v >> w >> t >> d >> c;

		a[i]=make_tuple(v, w, t, d, c);
	}

	sort(a.begin(), a.end());

	for (auto tp : a) {
		int v, w;
		char t;
		LL d;
		string s;

		tie(v, w, t, d, s) = tp;

		cout << v << " " << w << " " << t << " " << d << " " << s << endl;
	}

	return 0;
}


Measured memory_bytes: 12168
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 1001


void LCSLength(char *X, char *Y){
  int i,j,m,n;
  int c[N][N];
  m = strlen(X+1);
  n = strlen(Y+1);
  for(i=1;i<=m;i++){
    c[i][0] = 0;
  }
  for(j=0;j<=n;j++){
    c[0][j] = 0;
  }
  for (i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(X[i] == Y[j])
	c[i][j] = c[i-1][j-1] + 1;
      else if(c[i-1][j] >= c[i][j-1])
	c[i][j] = c[i-1][j];
      else
	c[i][j] = c[i][j-1];
    }
  }
  printf("%d\n",c[i-1][j-1]);
}


main(){
  int i,n;
  char x[N],y[N];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%s",x+1);
    scanf("%s",y+1);
    LCSLength(x,y);
  }
  
  return 0;
}

Measured memory_bytes: 4524
MOD = 10**9 + 7
class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

def cmb(fact, n, r):
    mul = ModInt(1)
    for i in range(n - r + 1, n + 1):
        mul *= i
    return mul / fact[r]

def solve(n, a, b):
    fact = [ModInt(1)]
    for i in range(1, max(a, b) + 1):
        fact.append(fact[i-1] * i)
    return  ModInt(pow(2,n)) - 1 - cmb(fact, n, a) - cmb(fact, n, b)

if __name__ == '__main__':
    n, a, b = map(int, input().split())
    ret = solve(n, a, b)
    print(ret)

Measured memory_bytes: 177108
def resolve():
    n=int(input())
    k=int(input())
    l=list(map(int, input().split()))
    kyori=0
    for i in range(n):
        if l[i]<=k-l[i]:
            kyori+=2*l[i]
        else:
            kyori+=2*(k-l[i])
    print(kyori)

resolve()


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
int ddx[8]={0,0,-1,1,1,1,-1,-1};
int ddy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//int arr[SIZE]={};
int main(){
	ll X,Y;
	cin>>X>>Y;
	if(llabs(X-Y)<=1)
		cout<<"Brown"<<endl;
	else
		cout<<"Alice"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int max[2] = {0};
	int i, j;
	
	for (i = 0; i < 2; i++){
		for (j = 0; j < 4; j++){
			int n;
			
			scanf("%d", &n);
			max[i] += n;
		}
	}
	printf("%d\n", max[0] > max[1] ? max[0] : max[1]);
	
	return 0;
}

Measured memory_bytes: 592
#include <iostream>

using namespace std;

int main() {
  int array[101][101] = {0};
  int r, c;
  cin >> r >> c;
  for(int y=0; y < r; ++y){
    for(int x=0; x < c; ++x){
      cin >> array[y][x];
      array[100][x] += array[y][x];
      array[y][100] += array[y][x];
      array[100][100] += array[y][x];
    }
  }
  for(int y=0; y < r; ++y){
    for(int x=0; x < c; ++x){
      cout << array[y][x] << ' ';
    }
    cout << array[y][100] << endl;
  }
  for(int x=0; x < c; ++x){
    cout << array[100][x] << ' ';
  }
  cout << array[100][100] << endl;
  return 0;
}


Measured memory_bytes: 3168
"""
sの異なる部分文字列のうち、
辞書順でK番目に小さいもの
|s| <= 5000
"""

s = input()
K = int(input())
n = len(s)
substrs = set()
for i in range(n):
    for j in range(K):
        if i + j >= n:
            continue
        substrs.add(s[i:i+j+1])
print(sorted(substrs)[K-1])
    


Measured memory_bytes: 4464
h,w = map(int, input().split())
s = list()
for i in range(h):
    s.append(list(input()))
for i in range(h):
    for j in range(w):
        count = 0 
        if s[i][j] == "#":
            continue
        if i == 0:
            pass
        else:
            if s[i-1][j] == "#":
                count += 1
        if j == 0:
            pass
        else:
            if s[i][j-1] == "#":
                count += 1
        if i == h-1:
            pass
        else:
            if s[i+1][j] == "#":
                count += 1
        if j == w-1:
            pass
        else:
            if s[i][j+1] == "#":
                count += 1
        if i == 0 or j == 0:
            pass
        else:
            if s[i-1][j-1] == "#":
                count += 1
        if i == h-1 or j == 0:
            pass
        else:
            if s[i+1][j-1] == "#":
                count += 1
        if i == 0 or j == w-1:
            pass
        else:
            if s[i-1][j+1] == "#":
                count += 1
        if i == h-1 or j == w-1:
            pass
        else:
            if s[i+1][j+1] == "#":
                count += 1
        s[i][j] = str(count)
for i in range(h):
    print("".join(s[i]))                        
                        
                        
                        

Measured memory_bytes: 3188
# include <bits/stdc++.h>
/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ld, ld>                                  pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

//const ll md = 1e9 + 7;//998244353;
const int xn = 4e3 + 10;
const int xm = -20 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int Md = 998244353;
const int TM = 3;
const int Base = 257;

ll n, k, dp[xn][xn][3], fact[xn], ifact[xn], ted[xn], res;

ll C(ll a, ll b){
	if (a < 0 || a > b)		return 0;
	return fact[b] * (ifact[a] * ifact[b - a] % Md) % Md;
}
ll F(ll a, ll b){
	if (a == 0 && b == 0)	return 1;
	return C(a - 1, b + a - 1);
}

int main(){
    InTheNameOfGod;
    
    cin >> k >> n;
    fact[0] = ifact[0] = 1;
    for (ll i = 1; i < xn; ++ i){
    	fact[i] = fact[i - 1] * i % Md;
    	ifact[i] = ifact[i - 1] * power(i, Md - 2, Md) % Md;
	}
	for (ll i = 2; i <= k + k; ++ i) for (ll j = 1; j <= min(i - 1, k); ++ j) ted[i] += bool(i - j <= k);
	dp[0][0][2] = 1;
	for (ll i = 1; i <= k; ++ i){
		for (ll j = 0; j <= n; ++ j){
			if (i % 2){
				dp[i][j][2] = dp[i - 1][j][2];
				if (j)	dp[i][j][2] = (dp[i][j][2] + dp[i - 1][j - 1][2]);
				continue;
			}
			dp[i][j][0] = dp[i - 2][j][2];
			if (j) dp[i][j][1] = (dp[i][j - 1][1] + 2 * dp[i][j - 1][0]) % Md;
			dp[i][j][2] = (dp[i][j][0] + dp[i][j][1]) % Md;
		}
	}
	for (ll i = 2; i <= k + k; ++ i){
		res = 0;
		for (ll j = 0; j <= n; ++ j) res = (res + dp[ted[i]][j][2] * F(k - ted[i], n - j) % Md) % Md;
		cout << res << endl;
	}
	
    return 0;
}


Measured memory_bytes: 187776
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

   int m[(1<<('z'-'a' +1))];
vector<pair<int,int>> k;
        signed main() {
     string s;
     cin>>s;
     vector<int> hen[s.size()];
     int sc[s.size()+1],b=0;
  
     for(int i=0;i<s.size();i++){
             sc[i]=b;
           
             b^=1<<(s[i]-'a');
             
     }
       m[b]=s.size();
     for(int i=s.size()-1;i>=0;i--){
             for(int j=0;j<='z'-'a';j++){
                  
                     if(m[sc[i]^(1<<j)]!=0)hen[i].push_back(m[sc[i]^(1<<j)]);
             }
             m[sc[i]]=i;
     }

     queue<int> que,que2;
     int c=0;
     que.push(0);
     while(true){
             if(que.empty()){
                     swap(que,que2);
                     c++;
             }
             if(que.front()==s.size()||sc[que.front()]==b){
                     cout<<max(1ll,c);
                     return 0;
             }
             if(sc[que.front()]==-1){
                     que.pop();
                     continue;
             }
             //cerr<<que.front()<<' '<<c<<endl;
             sc[que.front()]=-1;
             for(int i=0;i<hen[que.front()].size();i++)que2.push(hen[que.front()][i]);
             que.pop();
     }

      
        


      }


        


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

public class Main {
    public static void main(String[] args) {
		try{
			Scanner sc = new Scanner(System.in);
			int[] list = new int[3];
			for(int i = 0; i < 3; i++){
				list[i] = sc.nextInt();
			}
			Arrays.sort(list);
			System.out.println(list[1] + list[0]);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
#define SQ(A)   ((A)*(A))
using namespace std;
typedef long long ll;

int main(){
    int role[12];
    char *li;
    string str;
    while(getline(cin,str)){
        li=(char *)str.c_str();
        int len;
        char sp[]=" ";
        char *res=NULL;
        sscanf(strtok(li,sp),"%d",&len);
        int n=0;
        for(;;){
            res=strtok(NULL,sp);
            if(res==NULL) break;
            sscanf(res,"%d",&role[n]);
            n++;
        }
        double path[13][13];
        for(int i=0;i<n;i++){
            path[0][i]=path[i][0]=role[i];
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                path[i][j]=sqrt(SQ(role[i]+role[j])-SQ(role[i]-role[j]));
            }
        }
        double dp[1<<n][n];
        for(int i=0;i<n;i++){
            dp[0][i]=0;
        }
        for(int i=1;i<(1<<n);i++){
            for(int j=0;j<n;j++){
                dp[i][j]=10000;
                if(i&(1<<j)){
                    int bef=i-(i&(1<<j));
                    for(int k=0;k<n;k++){
                        if(bef==0){
                            dp[i][j]=min(dp[i][j],(double)role[j]);
                        }else if(bef&(1<<k)){
                            dp[i][j]=min(dp[i][j],dp[bef][k]+path[k][j]);
                        }
                    }
                }
            }
        }
        double ret=10000;
        for(int i=0;i<n;i++){
            ret=min(ret,dp[(1<<n)-1][i]+role[i]);
        }
        if(ret<=len) printf("OK\n");
        else printf("NA\n");
    }
}

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


int main(){
    
    int n, x;
    cin>>n>>x;
    vector<int> l(n);
    for(int i=0; i<n; i++){
        cin>>l[i];
    }
    vector<int> d(n+1, 0);
    
    int cnt=1;
    for(int i=1; i<n+1; i++){
        d[i]=d[i-1]+l[i-1];
        
        if(d[i]<=x){
            cnt++;
        }
    }
    
    cout<<cnt<<endl;
}


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

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

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

    const int MAX = 100005;

    vector<int> l;
    
    int m = 6;
    while(m < MAX){
        l.push_back(m);
        m = m * 6;
    }

    m = 9;
    while(m < MAX){
        l.push_back(m);
        m = m * 9;
    }
    l.push_back(1);

    sort(l.begin(), l.end());

    int dp[N+1];
    fill(dp, dp+N+1, MAX);
    dp[0] = 0;
    for(int i=0; i<N; i++){
        for(auto num : l){
            if(i+num > N) continue;
            dp[i+num] = min(dp[i+num], dp[i]+1);
        }
    }

    cout << dp[N] << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

inline void solve(){

  int n, temp,ans;

  int d;
  cin >> d>> n;
  if(n!=100)
    cout << 100*(d==2?100:(d==0?0.01:1))*n fin;
  else
    cout << 100*(d==2?100:(d==0?0.01:1))*101 fin;
}


struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(0);};}xyzzy;
signed main(){solve();return 0;}


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

int main(void){
	int t;

	cin >> t;

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

		int *hight = new int[block];
		for(int j=0; j<block; j++)
			cin >> hight[j];

		int *step = new int[block-1];
		for(int j=0; j<block-1; j++)
			step[j]=hight[j+1]-hight[j];

		int max,min;
		max=min=0;
		for(int j=0; j<block-1; j++){
			if(max<step[j])
				max = step[j];
			if(min>step[j])
				min = step[j];
		}
		min*=-1;
		cout << max << ' ' << min << endl;

		delete [] hight;
		delete [] step;
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>

int main()
{
    int k, a, b, t;
    scanf("%d", &k);
    scanf("%d %d", &a, &b);

    if (b / k != a / k || b % k == 0 || a % k == 0)
        printf("OK");
    else
    {
        printf("NG");
    }

    return 0;
}

Measured memory_bytes: 1724
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;

#define INF 100000000
#define EPS 1e-9

#define MAX_N 50
#define MAX_R 50

#define MAX_W 20
#define MAX_H 20

int W, H;
int ans[100000];
int C = 0;
char maze[MAX_W][MAX_H];

void dfs(int sx, int sy){
	
	maze[sy][sx] = '#';

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

	for (int i = 0; i < 4; i++){
		int nx = sx + dx[i];
		int ny = sy + dy[i];
		if (nx >= 0 && nx < W && ny >= 0 && ny < H && maze[ny][nx] != '#'){
			ans[C]++;
			dfs(nx, ny);
		}
	}

}

int main(){

	while (true){
		cin >> W >> H;
		if (W == 0 && H == 0){
			break;
		}
		int sx;
		int sy;
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				cin >> maze[i][j];
				if (maze[i][j] == '@'){
					sx = j;
					sy = i;
				}
			}
		}

		ans[C] = 1;
		dfs(sx,sy);
		C++;

	}

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


	return 0;

}

Measured memory_bytes: 1188
#include<stdio.h>
#include<math.h>

int main(){
  long a;
  double b;
  scanf("%ld%lf",&a,&b);
  if(a==0||b==0){
    printf("0\n");
    return 0;
  }
  long c;
  c=round(b*100);
  //if((double)c+0.5>b*100)c+=1;
  //printf("%ld\n",c);
  //printf("%ld\n",a*c);
  a=a*c/100;
  printf("%ld\n",a);
  return 0;
}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    if (n % 1000 == 0) cout << 0 << endl;
    else cout << 1000 - n % 1000 << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N;
mat graph;

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

    cin >> N;
    graph.assign(N, vec());
    vec a(N-1), b(N-1);
    Rep (i, N-1) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        graph[a[i]].push_back(b[i]);
        graph[b[i]].push_back(a[i]);
    }

    ll root = -1, sub = 0;
    Rep (i, N) {
        ll tmp = graph[i].size();
        if (tmp > sub) {
            root = i;
            sub = tmp;
        }
    }

    queue<ll> q;
    q.push(root);
    vec color(N, -1);
    color[root] = -2;
    map<pair<ll, ll>, ll> m;
    while (q.size()) {
        ll v = q.front(); q.pop();
        ll c = 0;
        for (ll nv : graph[v]) {
            if (color[nv] != -1) continue;
            if (c == color[v]) c++;
            color[nv] = c;
            m[make_pair(min(v, nv), max(v, nv))] = c;
            c++;
            q.push(nv);
        }
    }

    cout << sub << "\n";
    Rep (i, N-1) {
        cout << m[make_pair(a[i], b[i])] + 1 << "\n";
    }
}

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

int main() {
  int n, k;
  cin >> n >> k;
  if ((n + 1) / 2 >= k)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

int main(){
  int a;
  cin >> a;
  for(int i=0; i < 3; i++){
    if(a%10 == 7){
      cout << "Yes\n";
      return 0;
    }
    a = a/10;
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 3624
def partition(p, r):
    x = A[r]
    i = - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = [A[r]], A[i+1]
    print(' '.join(list(map(str, A))))

if __name__ == "__main__":
    n = int(input())
    A = list(map(int, input().split()))
    partition(0, n-1)


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

int main() {
  int N;
  cin >> N;
  
  int t = N;
  int c = 0;
  
  while(t > 0) {
    c += t % 10;
    t = t / 10;
  }
  
  if (N % c == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x:
        ans += 1
print(ans)

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vector<P> v1(n), v2(n);
  REP(i, n) {
    cin >> v1[i].first >> v1[i].second;
    v2[i].first = v1[i].second;
    v2[i].second = v1[i].first;
  }
  sort(ALL(v1));
  sort(ALL(v2));

  ll lmi = LINF, lma = -LINF, rmi = LINF, rma = -LINF;
  if(n % 2) {
    lmi = v1[n/2].first;
    lma = v2[n/2].first;
    cout << lma - lmi + 1 << endl;
  } else {
    lmi = v1[n/2-1].first;
    lma = v2[n/2-1].first;
    rmi = v1[n/2].first;
    rma = v2[n/2].first;
    ll l = lmi + rmi;
    ll r = lma + rma;
    cout << r - l + 1 << endl;
  }
}
























Measured memory_bytes: 6352
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

using namespace std;

typedef long long ll;

ll vals[1000002];
ll maxnr = 400000000;
set<ll> s;
void bkt(ll x)
{
    if(s.find(x) != s.end())
        return;
    s.insert(x);
    if(x >= maxnr)
        return;
    if(x == 0)
        for(int i = 1; i <= 9; ++i)
            bkt(i);
    else
    {
        int lst = x%10;
        if(lst > 0)
            bkt(x*10 + (lst-1));
        bkt(x*10 + lst);
        if(lst < 9)
            bkt(x*10 + (lst+1));
    }
}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int k;
    cin >> k;
    bkt(0);
    while(k)
    {
        s.erase(s.begin());
        --k;
    }
    cout << *s.begin();
    return 0;
}


Measured memory_bytes: 5504
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int K;
char S[100002];
int main(){
  int i, res=0;
  rd(N);
  rd(K);
  rd(S);
  for(i=0;i<(N);i++){
    if(i+1 < N  && S[i]==S[i+1] && S[i+1]=='R'){
      res++;
    }
    if(i-1 >= 0 && S[i]==S[i-1] && S[i-1]=='L'){
      res++;
    }
  }
  res =min_L(N-1, res+2*K);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190902-1

// --- original code ---
// int N, K;
// char S[100002];
// {
//   int res = 0;
//   rd(N,K,S);
//   rep(i,N){
//     if(i+1 < N  && S[i]==S[i+1]=='R') res++;
//     if(i-1 >= 0 && S[i]==S[i-1]=='L') res++;
//   }
//   res = min(N-1, res+2K);
//   wt(res);
// }


Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int D;
	cin >> D;
	vector<int>c(26);
	rep(i, 26)cin >> c[i];
	vector<vector<int>>s(D, vector<int>(26));
	rep(i, D)rep(j, 26)cin >> s[i][j];
	vector<int>t(D);
	rep(i, D)cin >> t[i];
	rep(i, D)t[i]--;
	vector<int>last(26, 0);
	int res = 0;
	rep(i, D) {
		int d = i + 1;
		last[t[i]] = i + 1;
		res += s[i][t[i]];
		rep(j, 26)res -= c[j] * (d - last[j]);
		cout << res << endl;
	}
}

Measured memory_bytes: 3704