akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;


int ans;

int main(void) {
  int n, t;
  cin >> n >> t;
  vector<ll> A(n);
  rep(i, 0, n) cin >> A[i];
  
  ll mn = LINF, mx = -1;
  rep (i, 0, n) {
    if (A[i]<mn) {
      mn = A[i];
    } else {
      mx = max(mx, A[i]-mn);
    }
  }
  
  priority_queue<ll> q;
  
  q.push(-1*A[0]);
  rep (i, 1, n) {
    ll x = q.top()*-1;
    if (A[i]-x==mx) {
      ans++;
      q.pop();
    } else {
      q.push(-1*A[i]);
    }
 
  }
  
  cout << ans << endl;

    return 0;
}



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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A,B=MAP()

if A<=5:
    print(0)
elif 6<=A<=12:
    print(B//2)
else:
    print(B)


Measured memory_bytes: 3064
#include <iostream>;
#include <vector>;
using namespace std;
int main() {
 int a,b,c,i; string name;
 cin >> a;
 b = a % 111;
 b = 111 - b;
 if (b == 111) {
  b = 0;
 }
 a = a + b;
 cout << a;
 return 0; 
} 

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    ll val=1;
    while(val*2<=n){
        val*=2;
    }
    cout << val << endl;
    return 0;
} 

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> vi{a, b, c};
    sort(vi.begin(), vi.end());
    cout << vi.at(0) << " " << vi.at(1) << " " << vi.at(2) << endl;
}




Measured memory_bytes: 3132
n=int(input())
d=list(map(int,input().split()))
d.sort()
l=n//2-1
half=(d[l]+d[l+1])//2
count=0
sum=0
if d[l]==d[l+1]:
  print(0)
  exit()
sum+=d[l+1]-d[l]
print(sum)

Measured memory_bytes: 13992
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main(){ 
long long int a;
 long long int b;
    cin>>a;
    cout<<a/3;
}


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

using namespace std;

using int64 = long long;
const int INF = 1 << 30;

string s;

int64 rec(int idx, int64 sum, int64 cur) {
  if(idx == s.size()) return sum + cur;
  return rec(idx + 1, sum + cur, s[idx] - '0') + rec(idx + 1, sum, cur * 10 + s[idx] - '0');
}

int main() {
  cin >> s;
  cout << rec(1, 0, s[0] - '0') << endl;
}

Measured memory_bytes: 256
import sys
L,R=map(int,input().split())
modifyed=[]
flag=0
for i in range(L,R+1):
    modifyed.append(i%2019)
    if i%2019==0:
        print(0)
        sys.exit()
ans=[]
for m in range(len(modifyed)):
    for j in range(m+1,len(modifyed)):
        ans.append(modifyed[m]*modifyed[j]%2019)
        if modifyed[m]*modifyed[j]%2019==0:
          print(0)
          sys.exit()
print(min(ans))

Measured memory_bytes: 6892
#include "bits/stdc++.h"
using namespace std;
void fast() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}

#define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;

void solve() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	int val = 0;
	
	for (int i = 0; i < k; i++) {
		if (i < a) {
			val++;
		}
		else if (i >= a+b) {
			val--;
		}
	}
	
	cout << val;
}

signed main() {
    
    fast();
    int t = 1;
    //cin >> t; // comment this line if single case
    while (t--) {
        solve();
    }
    
    
}


Measured memory_bytes: 3664
#include<stdio.h>
int main()
{
    int a,b,c;
    char s[101];
    // 整数の入力
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

  if (a > b) {
    if ((a > c) && (c > b)){
        printf("Yes\n");
    }
    else 
        printf("No\n");
  }
    else {
        if ((a < c) && (c < b)) {
            printf("Yes\n");
        }
        else
            printf("No\n");
    }
/*
    // スペース区切りの整数の入力
    scanf("%d %d",&b,&c);
    // 文字列の入力
    scanf("%s",s);
    // 出力
    printf("%d %s\n",a+b+c,s);
*/
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        if(A+B == 3) System.out.println("3");
        else if(A+B == 4) System.out.println("2");
        else if(A+B == 5) System.out.println("1");
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	int A, B;

	cin >> A >> B;
	cout << max(0, A - B * 2) << endl;
}



Measured memory_bytes: 256
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
    int n;
    cin >> n;
    bool ans = (n % 10 == 9) || (n / 10 == 9);
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const ll INF=1e18;

int gcd(int a,int b)
{
    if(a!=0 && b==0)
    {
        return a;
    }
    if(a%b==0)
    {
        return b;
    }
    else
    {
        return(gcd(b,a%b));
    }
    
}

int mulgcd(int a,int b,int c)
{
    int temp=gcd(a,b);
    return gcd(c,temp);
}

int main()
{
    int k;
    cin>>k;
    ll ans=0;
    for(int i=1;i<=k;i++)
    {
        for(int j=i;j<=k;j++)
        {
            for(int l=j;l<=k;l++)
            {
                int gcdnum=mulgcd(i,j,l);
                if(i!=j && j!=l && i!=l)
                {
                    gcdnum*=6;
                }
                else if(i==j && j==l && i==l)
                {
                    gcdnum*=1;
                }
                else
                {
                    gcdnum*=3;
                }
                ans+=gcdnum;
                
                
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    map<int, int> V1, V2;
    int v1, v2;
    for ( int i = 0; i < N/2; i++ ) {
        cin >> v1 >> v2;
        V1[v1]++;
        V2[v2]++;
    }
    vector<pair<int,int>> VV1, VV2;
    for ( auto x : V1 ) VV1.push_back(make_pair(x.second, x.first));
    for ( auto x : V2 ) VV2.push_back(make_pair(x.second, x.first));
    sort(VV1.begin(), VV1.end(), greater<>());
    sort(VV2.begin(), VV2.end(), greater<>());

    int mm1 = VV1.size() > 1 ? VV1[1].first : 0;
    int mm2 = VV2.size() > 1 ? VV2[1].first : 0;

    int ans = 0;
    if ( VV1[0].second != VV2[0].second ) {
        ans = N - VV1[0].first - VV2[0].first;
    } else {
        ans = min(N - VV1[0].first - mm2 , N - VV2[0].first - mm1);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 6136
n=int(input())
hoge=[-1 for i in range(15)]
alf="abcdefghijklmnopqrstuvwxyz"
for i in range(15):
  if(n==0):
    break
  else:
    n=n-1
    hoge[i]=(n%26)
  n=(n-n%26)//26
hoge=hoge[::-1]

for i in range(len(hoge)):
  if(hoge[i]!=-1):
    print(alf[hoge[i]],end="")

Measured memory_bytes: 8976
# test
import sys
readline = sys.stdin.buffer.readline


class SegmentTree:
    def __init__(self, N, func, I):
        self.N = N
        self.sz = 2**(N-1).bit_length()
        self.func = func
        self.I = I
        self.seg = [I] * (self.sz * 2)

    def assign(self, k, x):
        self.seg[k + self.sz] = x

    def build(self):
        for i in reversed(range(1, self.sz)):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])

    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k >>= 1
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])

    def query(self, a, b):
        L = self.I
        R = self.I
        a += self.sz
        if b == self.N:
            b = self.sz
        b += self.sz
        while a < b:
            if a & 1:
                L = self.func(L, self.seg[a])
                a += 1
            if b & 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a >>= 1
            b >>= 1
        return self.func(L, R)


def main():
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    N = int(readline())
    L = map(int, readline().split())
    seg = SegmentTree(N, gcd, 0)
    for i, n in enumerate(L):
        seg.assign(i, n)
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans, gcd(seg.query(0, i), seg.query(i+1, N)))
    print(ans)


main()


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

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

    int n;
    bool bingo[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++)
            bingo[i][j] = false;
    }
    int a;
    map<int, pair<int, int> > mp;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> a;
            mp[a] = make_pair(i, j);
        } 
    }
    cin >> n;   
    int brr[n];
    for(int i = 0; i < n; i++){
        cin >> a;
        if(mp.find(a) != mp.end()){
            bingo[mp[a].first][mp[a].second] = true;
        }
    }
    if(bingo[0][0] && bingo[1][1] && bingo[2][2])
        cout << "Yes";
    else if(bingo[0][2] && bingo[1][1] && bingo[2][0])
        cout << "Yes";
    else if(bingo[0][0] && bingo[0][1] && bingo[0][2])
        cout << "Yes";
    else if(bingo[1][0] && bingo[1][1] && bingo[1][2])
        cout << "Yes";
    else if(bingo[2][0] && bingo[2][1] && bingo[2][2])
        cout << "Yes";
    else if(bingo[0][0] && bingo[1][0] && bingo[2][0])
        cout << "Yes";
    else if(bingo[0][1] && bingo[1][1] && bingo[2][1])
        cout << "Yes";
    else if(bingo[0][2] && bingo[1][2] && bingo[2][2])
        cout << "Yes";
    else
        cout << "No";
    cout << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define F first
#define S second

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, a, b; cin >> n >> a >> b;
	if (a > b)
		swap(a, b);
	ll dif = b-a;
	if (dif%2 == 0)
		cout << dif/2 << "\n";
	else{
		cout << min(a+(dif-1)/2, n-b+1+(dif-1)/2) << "\n";
	}
	return 0;
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using static System.Console;

class Program {
	static int n, m;
	static string[] a, b;

	static void Main() {
		n = NextInt();
		m = NextInt();
		Array.Resize(ref a, n);
		Array.Resize(ref b, n);

		for (var i = 0; i < n; i++) {
			a[i] = ReadLine();
		}
		for (var i = 0; i < m; i++) {
			b[i] = ReadLine();
		}
		for (var i = 0; i < n; i++) {
			for (var j = 0; j < n; j++) {
				if (Judge(i, j)) {
					WriteLine("Yes");
					return;
				}
			}
		}
		WriteLine("No");
	}

	static bool Judge(int ni, int nj) {
		for (var i = 0; i < m; i++) {
			for (var j = 0; j < m; j++) {
				if (ni + i >= n || nj + j >= n || b[i][j] != a[ni + i][nj + j]) {
					return false;
				}
			}
		}
		return true;
	}

	static int NextInt() {
		return int.Parse(NextString());
	}

	static string NextString() {
		var result = new List<char>();
		while (true) {
			int next = Read();
			if (next < 0)
				break;
			var nextChar = (char)next;
			if (!char.IsWhiteSpace(nextChar))
				result.Add(nextChar);
			else if (nextChar != '\r')
				break;
		}
		return string.Join("", result);
	}
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld",&x);

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

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

int main(){
    ll n; sc(n)
    ll T[n], ans;
    for (int i = 0; i < n; i++) sc(T[i])
    if (n > 1) ans = lcm(T[0], T[1]);
    else ans = T[0];
    for (int i = 2; i < n; i++){
        ans = lcm(ans, T[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h,w,m = ( int(x) for x in input().split() )

h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
    hi,wi = ( int(x)-1 for x in input().split() )
    h_array[hi] += 1
    w_array[wi] += 1
    ps.add( (hi,wi) )
h_great = max(h_array)
w_great = max(w_array)
h_greats = list()
w_greats = list()
for i , hi in enumerate(h_array):
    if hi == h_great:
        h_greats.append(i)
for i , wi in enumerate(w_array):
    if wi == w_great:
        w_greats.append(i)

ans = h_great + w_great


for _h in h_greats:
    for _w in w_greats:
        if (_h,_w) in ps:
            continue
        print(ans)
        exit()

print(ans-1)

Measured memory_bytes: 83424
let () =
  Scanf.scanf "%d\n%d\n%d\n%d\n" @@ fun a b c x ->
  let ans = ref 0 in
  for i = 0 to a do
    for j = 0 to b do
      for k = 0 to c do
        if 500 * i + 100 * j + 50 * k = x then ans := !ans + 1
      done;
    done;
  done;
  Printf.printf "%d\n" !ans

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
typedef long long ll;

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

    if(s[2] == s[3] && s[4] == s[5]){
        OP("Yes");
    }else{
        OP("No");
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include<iostream>
using namespace std;

typedef long long ll;

const int maxn = 1e6;

ll qmul(ll n, ll m, ll p) {
    ll res = 0;
    while (m) {
        if (m & 1) res = (res + n) % p;
        n = n * 2 % p;
        m >>= 1;
    }
    return res;
}

ll qpow(ll x, ll n, ll p) {
    ll res = 1;
    while (n) {
        if (n & 1) res = qmul(res, x, p);
        n >>= 1;
        x = qmul(x, x, p);
    }
    return res;
}

ll phi(ll n) {
    ll ans = n;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ans = ans / i * (i - 1);
            while (n % i == 0) n /= i;
        }
    }
    if (n > 1) ans = ans / n * (n - 1);
    return ans;
}

ll gcd(ll n, ll m) {
    return m == 0 ? n : gcd(m, n % m);
}


ll solve(ll p, ll mod) {
    int ans = 0;
    ll s = sqrt(1.0 * p);
    for (ll i = 1; i <= s; i++) {
        if (p % i == 0) {
            if (qpow(10ll, i, mod) == 1) {
                return i;
            }
        }
    }

    for (ll i = s - 1; i >= 1; i--) {
        if (p % i == 0) {
            if (qpow(10ll, p / i, mod) == 1) {
                return p / i;
            }
        }
    }
    return 0;
}

int main() {
    ll L;
    int kase = 0;
    while (cin>>L) {
        ll d = gcd(L, 7);
        ll mod = 9 * L / d;
        ll p = phi(mod);

        if (gcd(mod, 10) != 1) {
            cout << "-1\n";
            continue;
        }
        ll ans = solve(p, mod);
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr char sp=' ';
constexpr ll mod=1000000007;

ll a,b,c;

int main(){
	cin>>a>>b>>c;
	if(a+b>=c){
		cout<<"No"<<endl;
	}
	else if(4*a*b<(c-a-b)*(c-a-b)){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

///////////////////////////////////////////////////////////////////////////

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll now,ans = 0;

    if( a >= b){
        cout << b * (n-1) << endl;
        
    }else{
        cin >> now;

        rep(i,0,n-1){
            ll next;
            cin >> next;
            
            ans += min((next-now)*a , b);
            now = next;
            
            //cout << ans << endl;
        }
        cout << ans << endl;
    }
	return  0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                continue
            if L[i] + L[j] <= L[k] or L[i] + L[k] <= L[j] or L[j] + L[k] <= L[i]:
                continue
            cnt += 1
print(cnt)

Measured memory_bytes: 9088
#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 sum;;
	while(cin>>sum, sum>0){
		rep(i, 9){
			ll temp; cin>>temp;
			sum-=temp;
		}
		cout << sum << endl;
	}
	return 0;
}


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

int main() {
  int n; cin >> n;
  if (n%1000 == 0) {
    cout << 0 << endl;
    return 0;
  }
  int t = n/1000;
  int ans = 1000*(t+1) - n;
  cout << ans << endl;
}

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

#define INF INT_MAX

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

int main(void){
 	cin.tie(0);
    ios::sync_with_stdio(false);
	int r,D,x;
	cin >> r >> D >> x;
	int ans = x;
	for(int i = 0;i < 10;i++){
		ans = r*ans - D;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [int(x) for x in input().split()]
min_a = min(a)
max_a = max(a)
ans = 10**10
for i in range(min_a,max_a+1):
    sum_c = 0
    for x in a:
        sum_c += (x-i)**2
    ans = min(ans,sum_c)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int n,k,h;
int a[60];
int main()
{
    cin>>n>>k;
    for(int i=1; i<=n; i++)
    cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1; i<=k; i++)
    h+=a[n-i+1];
    cout<<h;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
task = []
task_sum = 0
for i in range(n):
    a, b = [int(i) for i in input().split()]
    task.append([a, b])
task_f = sorted(task, key=lambda x: x[1])

s = 0
flag = True
for i in range(n):
    if s + task_f[i][0] > task_f[i][1]:
        flag = False
        break
    s += task_f[i][0]
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 39640
fun main(arr:Array<String>) {
    val (n,a,b) = readLine()!!.split(" ").map { it.toInt() }
    val s = readLine()!!
    var bCount = 0
    var count = 0
    for(i in (1..n)) {
        if(s[i-1] == 'c') {
            println("No")
            continue
        }
        if(count >= a + b) {
            println("No")
            continue
        }
        if(s[i-1] == 'b') {
            bCount++
            if(bCount > b) {
                println("No")
                continue
            }
            count++
            println("Yes")
        } else {
            count++
            println("Yes")
        }
    }
}

Measured memory_bytes: 42212
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <utility>
#include <string>
#include <queue>

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

typedef long long ll;

using namespace std;

struct UnionFind{
    vector<int> par;
    vector<int> sizes;

    UnionFind(int n) : par(n), sizes(n, 1){
        rep(i, n) par[i] = i;
    }

    int find(int x){
        if(x == par[x]) return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

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

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

struct Edge{
    int a, b, cost;
    bool operator<(const Edge& o) const{
        return cost < o.cost;
    }
};

struct Graph{
    int n;  //頂点数
    vector<Edge> es;

    int kruskal(){
        sort(es.begin(), es.end());
        UnionFind uf(n);
        int min_cost = 0;

        rep(i, es.size()){
            Edge& e = es[i];
            if(!uf.same(e.a, e.b)){
                min_cost += e.cost;
                uf.unite(e.a, e.b);
            }
        }
        return min_cost;
    }
};

Graph input_graph(){
    Graph g;
    int m;
    cin >> g.n >> m;
    rep(i, m){
        Edge e;
        cin >> e.a >> e.b >> e.cost;
        g.es.push_back(e);
    }
    return g;
}

void solve(){
    Graph g = input_graph();
    cout << g.kruskal() << endl;
}

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


Measured memory_bytes: 4640
n,k=map(int,input().split())
a=list(map(int,input().split()))
bit = [0]*64
  
for i in range(n):
    for j in range(60):
        if a[i]>>j & 1:
            bit[j] += 1
 
x = 0
for i in range(59,-1,-1):
    if bit[i] < n-bit[i] and x + (1<<i) <= k:
        x += 1<<i
sum = 0
for i in range(n):
    sum += a[i]^x
print(sum)

Measured memory_bytes: 14620
s=input()
X,Y=map(int,input().split())
from collections import defaultdict
def solve(da,dp,G):
    for i in range(len(da)):
        tmp=set()
        for j in dp:
            tmp.add(j-da[i])
            tmp.add(j+da[i])
        dp=tmp
    if G in dp:
        return True
    else:
        return False
    """amax=0
    for i in a:
        amax+=abs(i)
    if amax==0:
        if G==0:
            return True
        else:
            return False
    if a[0]==G:
        return True
    dp=[[0]*2*amax for _ in range(3)]
    dp[0][a[0]]=1
    for i in range(1,len(a)):
        p=a[i]
        for j in range(-amax,amax):
            dp[i%3][j-p]+=dp[(i-1)%3][j]
            dp[i%3][j+p]+=dp[(i-1)%3][j]
            #print(dp)
        if dp[i%3][G]>=1:
            return True
    return False"""
    """#print(a)
    dp=set()
    dp.add(a[0])
    dp2=set()
    for i in range(1,len(a)):
        for j in dp:
            dp2.add(j-a[i])
            dp2.add(j+a[i])
        dp=copy.deepcopy(dp2)
    #print(dp)
    if G in dp:
        return True
    return False"""

d=[len(x) for x in s.split("T")]

dx=d[2::2]
dy=d[1::2]

if solve(dx,{d[0]},X) and solve(dy,{0},Y):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 45916
#include<bits/stdc++.h>
using namespace std;
#define cs const 
#define int long long
#define mid ((l+r)>>1)
#define low(i) (i&(-i))
#define ls (now<<1)
#define rs (now<<1|1)
cs int ff = 1e6+1;
cs int mod = 1e9+7;
int n, m;
string s;
void init()
{
	cin >> s;
	if( s == "AAA" || s == "BBB" ) puts("No");
	else puts("Yes");
}
signed main()
{
	init();
} 

Measured memory_bytes: 256
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]


def winner_or_loss(point):
    return 'Yes' if point > 0 else 'No'


def solve():
    point = [K-Q] * N

    for answer_id in A:
        answer_id -= 1
        point[answer_id] += 1

    return '\n'.join(list(map(winner_or_loss, point)))


print(solve())


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

int main() {
  vector<vector<int>> data(3, vector<int>(4));
 
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for(int k=0; k<N; k++){
        if(data.at(i).at(j)==A.at(k)){
          data.at(i).at(j)=0;
        }
      }
    }
  }
  
  

  
  bool b=false;
  if(data.at(0).at(0)==0&&data.at(0).at(1)==0&&data.at(0).at(2)==0){
    b=true;
  }
  if(data.at(1).at(0)==0&&data.at(1).at(1)==0&&data.at(1).at(2)==0){
    b=true;
  }
  if(data.at(2).at(0)==0&&data.at(2).at(1)==0&&data.at(2).at(2)==0){
    b=true;
  }
  if(data.at(0).at(0)==0&&data.at(1).at(0)==0&&data.at(2).at(0)==0){
    b=true;
  }
  if(data.at(0).at(1)==0&&data.at(1).at(1)==0&&data.at(2).at(1)==0){
    b=true;
  }
  if(data.at(0).at(2)==0&&data.at(1).at(2)==0&&data.at(2).at(2)==0){
    b=true;
  }
  if(data.at(0).at(0)==0&&data.at(1).at(1)==0&&data.at(2).at(2)==0){
    b=true;
  }
  if(data.at(2).at(0)==0&&data.at(1).at(1)==0&&data.at(0).at(2)==0){
    b=true;
  }
  
  if(b){
  cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

  

}

Measured memory_bytes: 256
s = input()
l = len(s) - 1

ans = 0

for i in range(2 ** l):
    bin_str = format(i, "09b")[::-1] + "0"

    new_s = "".join([x + "+" if bin_str[idx] == "1" else x + "" for idx, x in enumerate(s)])

    ans += eval(new_s)

print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#ifdef STOPIT
#define debug(...) 0
#else
#define debug(...)\
do {\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;\
} while (false)
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::string s; std::cin >> s;
  std::string t{s.begin(), s.begin() + n / 2};
  std::string u{s.begin() + n / 2, s.end()};
  bool ans = t == u;
  std::cout << (ans ? "Yes" : "No") << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef BUG
  #include "debug.hpp"
#else
  #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

int main(const int argc, char **argv) {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  size_t n, k;
  string str;
  cin >> n >> k >> str;
  vector<int> a;
  for (size_t i = 0, j = 0; i < str.size(); i = j) {
    for (; j < str.size() && str[i] == str[j]; ++j)
      ;
    const int count = j - i;
    a.push_back(str[i] == '0' ? -count : count);
  }
  size_t out = 0, val = 0, r = 0;
  for (size_t i = 0, j = 0; i < a.size() && j < a.size(); ++j) {
    val += abs(a[j]);
    if (a[j] < 0) ++r;
    while (k < r) {
      val -= abs(a[i]);
      if (a[i] < 0) --r;
      ++i;
    }
    out = max(val, out);
  }
  cout << out;
  return EXIT_SUCCESS;
}


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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        
        static void Solve()
        {
            var o = ReadAndParseIntArr();
            int h = o[0];
            int w = o[1];
            var c = new string[h];
            for(int i=0;i<h;++i)
            {
                c[i] = Console.ReadLine();
            }

            for(int i=0;i<2*h;++i)
            {
                string s = c[i/2];
                Console.WriteLine(s);
            }
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    int n,j,c;
    int a[107];
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        rep(j,i){
            if(a[j]>a[i]){
                c=a[i];
                for(int k=i;k>j;k--){
                    a[k]=a[k-1];
                }
                a[j]=c;
                break;
            }
        }
    rep(j,n){
            cout  << a[j] ;
            if(j!=n-1)  cout << " ";
        }
        cout <<endl;
    }
}


Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
	int n,t,a,h[1000];
	cin>>n>>t>>a;
	for(int i=0;i<n;i++) cin>>h[i];
	
	int v;
	double minv=1000;
	for(int i=0;i<n;i++){
		if(minv>fabs(t-h[i]*0.006-a)){
			minv=fabs(t-h[i]*0.006-a);
			v=i+1;
		}
	}
	
	cout<<v<<endl;
	
	return 0;
}


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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	ll int n,m,T,res;

	ll int maxi=-mx,mini=mx,count=1;

	ll int i,j,k,x,y;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>x>>y;

	ll multi=x;

	while(multi<=y){
        multi=multi*2;
        if(multi>=x && multi<=y) count++;

	}
	cout<<count<<endl;
}


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

int main(){

    long double  N,A,sum=0;
      cin>>N;
   for(int i=0;i<N;i++){
    cin>>A;
    sum=sum+(1/A);
 }
  sum=1/sum;
   cout<<setprecision(10)<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
from itertools import accumulate

N, K = map(int, input().split())
s = input()
s = list(map(int, s))

v = []
now = 1  # 現在見ている数
cnt = 0  # nowが並ぶ数
for ss in s:
    if ss == now:
        cnt += 1
    else:
        v.append(cnt)
        now = 1 - now  # 0と1を切り替える計算 now ^= 1
        cnt = 1  # ss分を計上
if cnt > 0:
    v.append(cnt)
# 1-0-1-0-1-0-1のように
# 1で終わる配列が欲しい
# 1-0-1-0のように0で終わっていたら、1を足す

# ※1の人数-0の人数-...の配列

if len(v) % 2 == 0: v.append(0)
# 1が0個という項を追加して、
# 1-0-1-0-1にする

c_sum = [0] + list(accumulate(v))
# accumulate:=[1項目, 1,2項目の和, ...]

# 1-0-1-...の1から始めるので、偶数番目だけ見る
lv = len(v)
# [left, right)
ans = 0
for i in range(0, lv, 2):
    left = i
    right = min(2 * K + 1 + i, lv)
    ans = max(c_sum[right] - c_sum[left], ans)

print(ans)

# 累積和

# forループの外側にleft, rightを持つ
# 次のleft, rightを計算する
# 左端を移動する
# 右端を移動する


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;
// string s;

int main() {
    cin >> n;
    Vi a(n);
    REP(i, n) cin >> a[i];

    int mini = 1e9;
    REP(i, 100) {
        int sum = 0;
        REP(j, n) sum += pow(a[j] - i, 2);
        mini = min(mini, sum);
    }
    cout << mini << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    ll N, P;
    string S;

    cin >> N >> P >> S;
    reverse(S.begin(), S.end());

    if(P==2 || P==5) {
        ll ans = 0;
        REP(i, N) {
            if(ll(S[i] - '0') % P == 0) ans+= (N-i);
        }
        cout << ans << endl;
        return 0;
    }

    vector<ll> mod_idx(P);
    ll mod = 0, pow_mod = 1;
    mod_idx[0] = 1;
    REP(i, N) {
        mod += ll(S[i] - '0') * pow_mod % P;
        mod %= P;

        pow_mod *= 10;
        pow_mod %= P;

        mod_idx[mod]++;
    }

    ll ans = 0;
    REP(mod, P) {
        ll candidates = mod_idx[mod];
        ans += candidates * (candidates - 1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
n = int(input())
li = []
for _ in range(n):
    li.append([int(i) for i in input().split()])
dp = [[-1,-1,-1] for x in range(n)]
for i in range(3):
    dp[0][i] = li[0][i]

for i in range(1,n):
    for j in range(3):
        dp[i][j] = max(dp[i-1][(j+1)%3]+li[i][j],dp[i-1][(j+2)%3]+li[i][j])

print(max(dp[n-1]))

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

int main(){
  string s;
  cin >> s;
  
  if((s.at(0) == s.at(1)&&s.at(1) == s.at(2))||(s.at(2) == s.at(1)&&s.at(3) == s.at(2))){
    puts("Yes");
  }else{
    puts("No");
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(a) int((a).size())
#define pb push_back
#define allc c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())
#define cpresent(c,x) (find(allc,x) != c.end())
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
using namespace std;
 
int main()
 
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	while(n)
	{
	    ll r=n%10;
	    if(r==7)
	        {
	            cout<<"Yes"<<endl;
	            return 0;
	        }
	   n=n/10;
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

ll H,W;
cin >> H >> W;

if(H == 1 || W == 1) {
    cout << 1 << endl;
    return 0;
}

cout << (H*W+1)/2 << endl;

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,t;
struct Route{
    int no;
    int time;
};
Route r[100];
bool c[1001];
void Solve(){
    cin>>n>>t;
    int flag=0;
    for(int i=0;i<n;i++){
        cin>>r[i].no>>r[i].time;
        if(r[i].time<=t){
            c[r[i].no]=1;
            flag=1;
        }
    }
    if(flag==0) cout<<"TLE"<<endl;
    else{
        for(int i=0;i<1001;i++){
            if(c[i]==1){
            cout<<i<<endl;
            break;
            }
        }
    }
}
int main(){
    Solve();
    return 0;
}

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


int main() {
  int x,n;
  cin >> x >> n;
  vector<int> p(n);
  vector<int> all(400);
  rep(i,400){
    all.at(i) = -200+i; //all={-200,-199,...,199}
  }
  rep(i,n) cin >> p.at(i);
  rep(i,n){
    all.at(p.at(i)+200) = INF;
  }
  int min=INF;
  int ans=x;
  rep(i,400){
    int tmp = abs(all.at(i)-x);
    //cout << all.at(i) << endl;
    if(tmp<min){
      min = tmp;
      ans = i;
    }
  }
  cout << ans-200 << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main(){

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

    for(int i = 0; i < N; i++) sort(s.at(i).begin(), s.at(i).end());
    sort(s.begin(), s.end());

    int64_t ans = 0;
    map<string, int> list;
    for(int i = 0; i < N; i++){
        if(list.find(s.at(i)) == list.end()){
            list.insert(make_pair(s.at(i), 1));
        }else{
            ans += list.at(s.at(i));
            list.at(s.at(i))++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13568
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int D = sc.nextInt();
            int L = sc.nextInt();
            System.out.println(D / L + (D % L));
        }
    }
}



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

#define int long long int

using namespace std;

const int mod = 1E9 + 7;

vector<int> fact, inv_fact;

int pw(int a, int p) {
    int ans = 1;
    int cur = a;
    while (p > 0)
    {
        if (p & 1) ans = (ans * cur) % mod;
        cur = (cur * cur) % mod;
        p /= 2;
    }
    return ans;
}

int inv(int x) {
    return pw(x, mod - 2);
}

int get_c(int n, int k) {
    int s = fact[n] * inv_fact[k];
    s %= mod;
    s *= inv_fact[n - k];
    s %= mod;
    return s;
}

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

    int n, k, res = 0;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    fact.resize(n + 1);
    inv_fact.resize(n + 1);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
   for (int i = 0; i <= n; i++) inv_fact[i] = inv(fact[i]);
    sort(a.begin(), a.end());
    for (int i = k - 1; i < n; i++) res = (res + a[i] * get_c(i, k - 1)) % mod;
    for (int i = k - 1; i < n; i++) res = (res - a[n - i - 1] * get_c(i, k - 1)) % mod;
    cout << (res < 0 ? res + mod : res) << "\n";

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a+0,a+3);
	cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
	return 0 ;
}



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

using namespace std;

#define mod 1000000007
#define pi atan(1) * 4

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			if(m * i + n * j - 2 * i * j == k){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
	return 0;
}

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

typedef long long int ll;
ll dp[3009][3009];
char str[3009][3009];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s,t;
	cin>>s;
	
	cin>>t;
	
	ll l1,l2;
	l1=s.length();
	l2=t.length();
	ll i,j;
	
	for(i=0;i<=max(l1,l2);i++)
	{
		dp[0][i]=0;
		dp[i][0]=0;
	}
	for(i=1;i<=l1;i++)
	{
		for(j=1;j<=l2;j++)
		{
			if(s[i-1]==t[j-1])
			{
			dp[i][j]=1+dp[i-1][j-1];str[i][j]=s[i-1];
			}
			else
			{
			if(dp[i-1][j]>dp[i][j-1])
			{
				dp[i][j]=dp[i-1][j];
				str[i][j]=str[i-1][j];
			}
			else
			{
				dp[i][j]=dp[i][j-1];
				str[i][j]=str[i][j-1];
			}
			}
			//cout<<dp[i][j]<<" ";
		}
		//cout<<endl;
	}
	i=l1;j=l2;
	vector <char> vec;
	while(i>0 && j>0)
	{
		if(dp[i][j]==1+dp[i-1][j-1] && s[i-1]==t[j-1])
		{	
			vec.push_back(str[i][j]);		
			i=i-1;j=j-1;
			
		}
		else if(dp[i][j]==dp[i-1][j])
		{
			i=i-1;
		}
		else
		{
			j=j-1;
		}
		
	}
	reverse(vec.begin(),vec.end());
	//cout<<vec.size()<<" ";
	for(auto it:vec)
	{
		cout<<it;
	}
}


Measured memory_bytes: 79616