akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int k;
vector<long long int> a;

long long int g(long long int x){
    for(int i=0;i<k;++i){
        x = x - x % a[i];
    }
    return x;
}

long long int bs(long long int ok, long long int ng, function<bool(long long int)> check){
    while(abs(ok - ng) > 1){
        long long int mid = (ok + ng) / 2;
        if(check(mid))ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(){
    cin >> k;
    long long int maxi = 2;
    for(int i=0;i<k;++i){
        long long int tmp;
        cin >> tmp;
        a.push_back(tmp);
        maxi = max(maxi, tmp);
    }

    long long int x = bs(2+k*maxi, 0, [](long long int x){return g(x) >= 2;});
    long long int y = bs(0, 2+k*maxi, [](long long int x){return g(x) <= 2;});
    if(x > y)cout << -1 << endl;
    else cout << x << " " << y << endl;

    return 0;
}


Measured memory_bytes: 1400
#include<cstdio>
#include<queue>
#include<numeric>
#include<functional>

using namespace std;

typedef long long ll;

#define INF 1LL << 61

int n;
ll a[300000];
ll s[100001], t[100001];

int main(){
	scanf("%d", &n);
	for(int i = 0; i < 3 * n; i++) scanf("%lld", &a[i]);
	fill(s + 1, s + n + 1, -INF);
	ll sum = accumulate(a, a + n, 0LL); s[0] = sum;
	priority_queue<ll, vector<ll>, greater<ll> > qs;
	for(int i = 0; i < n; i++) qs.push(a[i]);
	for(int i = 0; i < n; i++){
		sum += a[n + i] - qs.top(); qs.pop();
		qs.push(a[n + i]);
		s[i + 1] = max(sum, s[i]);
	}
	fill(t + 1, t + n + 1, INF);
	sum = accumulate(a + 2 * n, a + 3 * n, 0LL); t[0] = sum;
	priority_queue<ll> qt;
	for(int i = 0; i < n; i++) qt.push(a[2 * n + i]);
	for(int i = 0; i < n; i++){
		sum += a[2 * n - i - 1] - qt.top(); qt.pop();
		qt.push(a[2 * n - i - 1]);
		t[i + 1] = min(sum, t[i]);
	}
	ll res = -INF;
	for(int i = 0; i < n + 1; i++) res = max(res, s[i] - t[n - i]);
	printf("%lld\n", res);
}

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    ll ans=0,maxn=0;
    vector<ll> a(5);
    rep(i,5){
        cin >> a[i];
        ans += a[i];
    }
    rep(i,5){
        ll iti = a[i] % 10;
        iti  = 10 - iti;
        if(iti != 10) maxn = max(maxn,iti);
        if(iti != 10) ans += iti;
    }
    ans -= maxn;
    cout << ans << "\n";
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;

    if (B - A == C - B) cout << "YES" << endl;
    else  cout << "NO" << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
int n,m,a[200],up,down,i;
scanf("%d",&n);
while(n-->0){
up=0;
down=0;
scanf("%d",&m);
for(i=0;i<m-1;i++)
scanf("%d ",&a[i]);
scanf("%d",&a[m-1]);
for(i=0;i<m-1;i++){
if(a[i]<a[i+1]){
if(a[i+1]-a[i]>up)
up=a[i+1]-a[i];
}
else if(a[i]>a[i+1]){
if(a[i]-a[i+1]>down)
down=a[i]-a[i+1];
}
}
printf("%d %d\n",up,down);
}
return 0;
}

Measured memory_bytes: 0
array = gets.chomp.split(" ").map(&:to_i)
n = array[0]
a = array[1]
b = array[2]

num = n / (a + b)
rest = n % (a + b)

rest_a = 0
if rest > a
  rest_a = a
else 
  rest_a = rest
end

print(a * num + rest_a)

Measured memory_bytes: 1788
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    maxnum = max(a[0]*a[1],a[2]*a[3])
    print(maxnum)

Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String p[] = { "101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "10011001", "10011110", "00101", "111", "10011111", "1000", "00110", "00111", "10011100", "10011101",
                "000010", "10010010", "10010011", "10010000" };
        String c = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        String q[] = { "11010", "11110", "11100", "11101", "11011", "11111", "00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111",
                "11000", "11001" };
        while (sc.hasNext()) {
            String result = "";
            char[] s = sc.nextLine().toCharArray();
            for (char t1 : s) {
                for (int i = 0; i < c.length(); i++) {
                    if (t1 == c.charAt(i)) {
                        result += p[i];
                    }
                }
            }
            for (int i = 0; i < result.length() % 5; i++) {
                result += "0";
            }
            String result2 = "";
            for (int i = 0; i < result.length(); i += 5) {
                for (int j = 0; j < q.length; j++) {
                    if (result.substring(i, i + 5).equals(q[j])) {
                        result2 += c.charAt(j);
                    }
                }
            }
            System.out.println(result2);
        }
    }
}



Measured memory_bytes: 62756
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
	int n, d[100], count = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
		for (int j = 0; j < i; j++) {
			if (d[i] == d[j]) {
				count++;
				break;
			}
		}
	}
	cout << n - count << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))

dp = [0] * N
dp [0] = 0
dp [1] = abs(h[1]-h[0])

for i in range (2, N):
    dp_1 = dp[i-2] + abs(h[i]-h[i-2])
    dp_2 = dp[i-1] + abs(h[i]-h[i-1])
    dp[i] = min(dp_1,dp_2)
print(dp[N-1])

Measured memory_bytes: 13980
#include <stdio.h>
#include <ctype.h>

int main(void){
	char c;
	for (;;){
		scanf("%c", &c);
		if (isupper(c) != 0){
			printf("%c", tolower(c));
		}else{
			printf("%c", toupper(c));
		}
		if (c == '\n'){
			break;
		}
	}
	return 0;
}

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

using namespace std;


int main(int argc, char **argv) {


    long long int N,K;
    cin>>N>>K;
    vector<long long> pos, neg;
    for(int c=0;c<N;c++) {
        long long z;
        cin>>z;
        if(z>=0)
            pos.push_back(z);
        else neg.push_back(z);
    }


    sort(pos.rbegin(),pos.rend());
    sort(neg.begin(),neg.end());
    long long MOD = 1e9+7;

    if(K == N) {
        long long res = 1;
        for(auto z:pos) {
            res*=z;
            res%=MOD;
        }
        for(auto z:neg) {
            res*=z;
            res%=MOD;
        }
        cout<<(res+10*MOD)%MOD;
        return 0;
    }

    if(neg.size() == 0) {
        long long res = 1;
        for(int c=0;c<K;c++) {
            res*=pos[c];
            res%=MOD;
        }
        cout<<res;
        return 0;
    }

    if(pos.size() == 0 && K%2==1) {
        sort(neg.rbegin(),neg.rend());
        long long res = 1;
        for(int c=0;c<K;c++) {
            res*=neg[c];
            res%=MOD;
        }
        cout<<(res+10LL*MOD)%MOD;
        return 0;
    }

    if(pos.size() == 0) {
        long long res = 1;
        for(int c=0;c<K;c++) {
            res*=neg[c];
            res%=MOD;
        }

        cout<<(res+10LL*MOD)%MOD;
        return 0;
    }

    int a=0,b=0;

    for(int c=0;c<K;c++) {
        if(a>=pos.size() || (b<neg.size() && -neg[b]>pos[a])) {
            b++;
        } else {
            a++;
        }
    }



    if(b%2==1) {


        vector<pair<long long ,long long > > cases(2,make_pair(MOD+10,MOD+10));
        if(a>0&&b<neg.size()) {
            cases[0] = make_pair(pos[a-1],-neg[b]);
        }
        if(a<pos.size()) {
            cases[1] = make_pair(-neg[b-1],pos[a]);
        }
        if(cases[0].first > MOD || (cases[1].first <= MOD && cases[1].first*cases[0].second <= cases[1].second*cases[0].first)){
            b--;
            a++;
        } else if(cases[0].first <= MOD) {
            a--;
            b++;
        }
    }



    long long res = 1;
    for(int c=0;c<a;c++) {
        res *= pos[c];
        res%=MOD;
    }

    for(int c2=0;c2<b;c2++) {
        res *= neg[c2];
        res%=MOD;
    }

    if(b%2==1) {
        sort(pos.begin(),pos.end());
        sort(neg.rbegin(),neg.rend());
        long long trueRes = 1;
        int a2=0,b2=0;
        for(int c=0;c<K;c++) {
            if(a2>=pos.size() || (b2<neg.size()&&(-neg[b2])<pos[a2])) {
                trueRes *= neg[b2++];
                trueRes%=MOD;
            } else {
                trueRes *= pos[a2++];
                trueRes%=MOD;
            }
        }
        cout<<(trueRes+MOD)%MOD;
        return 0;
    }


    cout<<(res+MOD)%MOD;

}


Measured memory_bytes: 5456
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M;
  cin>>N>>M;
  int a[N], b[N], c[M], d[M];
  for(int i=0;i<N;++i) cin>>a[i]>>b[i];
  for(int i=0;i<M;++i) cin>>c[i]>>d[i];
  int tmp;
  int ans[N];
  for(int i=0;i<N;++i) {
    tmp = inf;
    for(int j=0;j<M;++j) {
      if(abs(a[i]-c[j])+abs(b[i]-d[j])<tmp) {
        tmp = abs(a[i]-c[j])+abs(b[i]-d[j]);
        ans[i] = j+1;
      }
    }
  }
  for(int i=0;i<N;++i) cout<<ans[i]<<endl;
}



Measured memory_bytes: 3588
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

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

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

    int h, w; cin>>h>>w;
    vector<string> s(h);
    for(int i=0; i<h; i++) cin>>s[i];

    vector<vector<int>> dp(h, vector<int>(w, inf));
    if(s[0][0] == '#') dp[0][0] = 1;
    else dp[0][0] = 0;

    queue<P> que;
    que.emplace(0, 0);
    while(que.size()){
        int cy, cx; tie(cy, cx) = que.front(); que.pop();
        
        for(int i=0; i<2; i++){
            int ny = cy + dy[i], nx = cx + dx[i];
            if(!(ny < h && nx < w)) continue;

            int cost = 0;
            if(s[cy][cx] == '.' && s[ny][nx] == '#') cost = 1;

            if(dp[ny][nx] > dp[cy][cx] + cost){
                dp[ny][nx] = dp[cy][cx] + cost;
                que.emplace(ny, nx);
            }
        }
    }

    cout << dp[h-1][w-1] << endl;

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
using namespace std;

typedef long long LL;

int main()
{
	LL n;
	cin>>n;
	LL ans=n;
	for(int i=1;i<=n/i;i++)
	{
		if(n%i==0)
			ans=min(ans,i-1+n/i-1);
	}
	cout<<ans<<endl;
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll q, t, f, dqsize;
  char c;
  string s;
  deque <char> dq;
  cin >> s;
  bool trueord = true;
  forll(i, 0, s.size())
	dq.push_back(s[i]);
  cin >> q;
  forll(i, 0, q){
	cin >> t;
	if (t == 1)
	  trueord = !trueord;
	else{
	  cin >> f >> c;
	  if ((f == 1 && trueord) || f == 2 && !trueord)
		dq.push_front(c);
	  else
		dq.push_back(c);
	}
  }
  dqsize = dq.size();
  forll(i, 0, dqsize){
	if (!trueord){
	  cout << dq.back();
	  dq.pop_back();
	}
	else{
	  cout << dq.front();
	  dq.pop_front();
	}
  }
}



Measured memory_bytes: 896
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#include <tuple>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    string S; cin >> S;
    int cnt = 0;
    REP(i, S.size()) {
        if (S[i] == 'o') {
            cnt++;
        }
    }
    if (15 - S.size() + cnt >= 8) {
        puts("YES");
    }
    else {
        puts("NO");
    }
    getchar(); getchar();
}

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

int main(void)
{
	int A, B, C, D, ans;
	cin >> A >> B >> C >> D;
	if (A * B >= C * D) {
		cout << A * B << endl;
	}
	else {
		cout << C * D << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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 int INF = 100000; 

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

    ll y1 = a * b;
    ll y2 = c * d;

    if(y1 > y2) cout << y1 << endl;
    else cout << y2 << endl;
    
    return 0;
}


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

class Union{
public:
	vector<long long int> par;
	vector<long long int> size;

	Union(){		
	}
	
	Union(long long int n):par(n),size(n){
		for(long long int i=0;i<n;++i){
			par[i] = i;
			size[i] = 1;
		}
	}
	
	int root(long long int x){
		return par[x] == x ? x :par[x] = root(par[x]);
	}
	
	bool same(long long int x,long long int y){
		return root(x) == root(y);
	}
	
	void unite(long long int x,long long int y){
		x = root(x);
		y = root(y);
		if(x == y) return;
		
		if(size[x] < size[y]) swap(x,y);
		par[y] = x;
		size[x] += size[y];
	}
	
	int sizes(int x){
		return size[root(x)];
	}
	
	
	
};


int main(){
	long long int n,m;
	cin >> n >> m;
	vector<pair<long long int,long long int> > inputs(m);
	Union uni(n);
	for(long long int i=0;i<m;++i){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		inputs[i] = pair<int,int>(a,b);
		
	}
	vector<long long int> reses;
	long long int res = n*(n-1)/2;
	reverse(inputs.begin(),inputs.end());
	for(long long int i=0;i<inputs.size();++i){
		long long int a = inputs[i].first;  
		long long int b = inputs[i].second;
		reses.push_back(res);
		if(!uni.same(a,b)){/*
			cout << a << " " << b << endl;
			cout << uni.sizes(a) << " "<<uni.sizes(b) << endl;;*/
			res -= uni.sizes(a)*uni.sizes(b);
			uni.unite(a,b);
		}
	}
	reverse(reses.begin(),reses.end());
	for(long long int i=0;i<reses.size();++i){
		cout << reses[i] << endl;
	}
	
	return 0;
}



Measured memory_bytes: 5364
def main():
    N, M = map(int, input().split())
    t = [int(i) for i in input().split()]
    t.sort()

    if N >= M:
        return 0

    x = [j-i for i, j in zip(t, t[1:])]
    x.sort(reverse=True)
    return t[-1] - t[0] - sum(x[:N-1])


print(main())


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

int main() {
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i+=2){
    int div=0;
    for(int j=1;j<=i;j++){
      if(i%j==0) div++;
    }
    if(div==8) ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
a,b = map(int,input().split())
s = input()
sw = 0
for i in range(len(s)):
    if i == a and s[i] != '-':
        sw = 1
    elif i != a and s[i] == '-':
        sw = 1
    else:
        pass
if sw == 1:
    print('No')
else:
    print('Yes')

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

int main() {
	// your code goes here
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n,m,i,j,l;
	cin>>n>>m;
	int k;
	vector <vector<int>> g(n+m+1);
	bool vis[n+m+1];
	memset(vis,false,sizeof(vis));
	for(i=1;i<=n;i++)
	{
	    cin>>k;
	    for(j=0;j<k;j++)
	    {
	        cin>>l;
	        g[i].push_back(n+l);
	        g[n+l].push_back(i);
	    }
	    

	}
	
	
	queue<int>q;
	
	q.push(1);
	
	while(!q.empty())
	{
	    i=q.front();
	  //  cout<<i<<endl;
	    vis[i]=true;
	    q.pop();
	    //cout<<"j"<<endl;
	    for(int j : g[i])
	    {
	  //      cout<<j<<" " ;
	        if(!vis[j])
	        q.push(j);
	    }
	 //   cout<<endl;
	}
	j=0;
	for(i=1;i<=n;i++)
	{
	    if(vis[i])
	    j++;
	}
	if(j==n)
	cout<<"YES";
	else
	cout<<"NO";
	
	return 0;
}


Measured memory_bytes: 9080
class Array
  # 最大公約数: ２つ以上の正の整数に共通な約数（公約数）のうち最大のもの
  def gcd
    self.inject{|a,b| a.gcd(b)}
  end

  # 最小公倍数: ２つ以上の正の整数の共通な倍数（公倍数）のうち最小のもの
  def lcm
    self.inject{|a,b| a.lcm(b)}
  end
end

while str = gets
  a = str.split(' ').map(&:to_i)
  puts "#{a.gcd} #{a.lcm}"
end

Measured memory_bytes: 6112
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <utility>
#include <functional>
using pii = pair<int, int>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<pii>> G(n);
    REP(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].emplace_back(b, i);
        G[b].emplace_back(a, i);
    }
    int m;
    cin >> m;
    vector<ll> constrains(m, 0LL);
    function<ll(int, int, int)> dfs = [&](int prev, int v, int goal) {
        if (v == goal) return 0LL;
        for (auto &vv : G[v]) {
            if (vv.first == prev) continue;
            ll res = dfs(v, vv.first, goal);
            if (res >= 0) {
                return res | (1LL << vv.second);
            }
        }
        return -1LL;
    };

    REP(i, 0, m) {
        int v, w;
        cin >> v >> w;
        constrains[i] = dfs(-1, v - 1, w - 1);
        dump(constrains[i]);
    }

    int size = 1 << m;
    auto dp = make_v(n, size, 0LL);
    dp[0][0] = 1;
    REP(i, 0, n - 1) {
        int bit = 0;
        REP(j, 0, m) {
            if ((constrains[j] & (1LL << i)) > 0) {
                bit |= (1 << j);
            }
        }
        dump(bit);
        REP(j, 0, size) {
            int nxt = j | bit;
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][nxt] += dp[i][j];
        }
    }
    cout << dp[n - 1][size - 1] << endl;

    return 0;
}


Measured memory_bytes: 418304
#include <stdio.h>

int main(void)
{
	int a, b, c, d;
	
	scanf("%d", &a);
	
	c = 100000;
	for (b = 0; b < a; b++) {
		c *= 1.05;
		d = c % 1000;
		if (d < 1000 && d != 0) {
			 d = 1000 - d;
			 c += d;
		}
	}
	printf("%d\n", c);
	
	return (0);
}	

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

ll arr[MX][2],dp[MX];

int main() {

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

    int N,W; cin >> N >> W;

    F0R(i,N) F0R(j,2) {
        cin >> arr[i][j];
    }

    dp[0] = 0;
    F0R(i,N) {
        ROF(w,arr[i][0],W+1) {
            dp[w] = max(dp[w],dp[w-arr[i][0]]+arr[i][1]);
        }
    }

    ll res = 0;
    F0R(i,W+1) res = max(dp[i],res);

    cout << res << "\n";

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll n,m,k,ans=0,a[200010],b[200010],fa[200010]={},fb[200010]={};
bool f=0;
int main(){
	ios::sync_with_stdio(false);
	ll i,j,tmpa,tmpb,x;
	cin>>n>>m>>k;
	for(i=1;i<=n;++i){
		cin>>a[i];
		fa[i]=fa[i-1]+a[i];
	}
	for(i=1;i<=m;++i){
		cin>>b[i];
		fb[i]=fb[i-1]+b[i];
	}
	for(i=n;fa[i]>k;--i);
	ans=i;
	j=1;
	while(i>=0){
		while(fa[i]+fb[j]<=k&&j<=m)
			++j;
		--j;
		//cout<<i<<" "<<j<<endl;
		ans=max(ans,i+j);
		--i;
	}
	cout<<ans;
	
	
	return 0;
}

Measured memory_bytes: 9884
def II(): return int(input())
N=II()
N-=1
ans=''
for l in range(1,15):
  if N>=26**l:
    N-=26**l
    continue
  for i in range(l):
    d=N%26
    ans+=chr(d+ord('a'))
    N//=26
  ans=ans[::-1]
  break
print(ans)

Measured memory_bytes: 61896
K, S = map(int, input().split())

ans = 0
for i in range(K+1):
  mod = S - i
  if mod-K <= K:
    up = min(i+K+1, S+1)
    down = max(i, S-K)
    if up > down:
      plus = up - down
      ans += plus
print(ans)

Measured memory_bytes: 9148
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

double a, b, c, d, e, f, x, y;
int main()
{
	while (cin >> a >> b >> c >> d >> e >> f)
	{
		y = (c*d - f*a) / ((b*d) - (e*a));
		x = (c - b*y) / a;
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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

int main(){
  long N, t0, x0, y0, t1, x1, y1;
  cin >> N;
  t0=0; x0=0; y0=0;
  for(int i=0; i<N; i++){
    cin >> t1 >> x1 >> y1;
    long tval = t1-t0;
    long dval = abs(x1-x0)+abs(y1-y0);
    t0=t1; x0=x1; y0=y1;
    if(tval<dval || tval%2!=dval%2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<int, int> > vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef pair<int, int> pii;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax];
int main()
{
    ios::sync_with_stdio(0);
    string s;
    cin >> s;
    int n = s.length();
    if(n < 4)
    {
        cout << "No";
        return 0;
    }
    s = s.substr(0, 4);
    if(s == "YAKI")
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q,l,r;
ll x[500005],y[500005],z[500005];
ll dp[100][100];
bool used[500005];
char s[500005],t[500005];
bool flag,dame;

int main(){
	cin >> n;
	string s;
	pair<string,ll> table[200];
	for(i=0;i<n;i++){
		cin >> s >> a;
		a *= 200;
		a += (i+1);
		table[i].first = s;
		table[i].second = -1 * a; 
	}
	sort(table,table + n);
	for(i=0;i<n;i++){
		a = table[i].second;
		a *= -1;
		a %= 200;
		p(a);
	}
	return 0;
}

Measured memory_bytes: 24704
const Main = (input) => {
	var xs = input.trim().split(' ').map(v=>parseInt(v,10));
    if(xs[0]>=13){
    console.log(xs[1]);
    }else if(xs[0] <=12 && xs[0]>=6){
    console.log(xs[1]/2);
    }else{
    console.log(0)  
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
r,g,b,n= map(int,input().split())
s = [r,g,b]
s.sort()

t = n // s[-1]
c = 0

for i in range(t+1):
    m = n - i * s[-1]
    t_1 = m // s[-2]
    for j in range(t_1+1):
        m_1 = m - j * s[-2]
        if m_1 % s[0] == 0:
            c += 1

print(c)

Measured memory_bytes: 3060
*r=1
M=1000000007
100002.times{|i|r<<(r[-1]*(i+1))%M}
n,m = gets.split.map(&:to_i)
p (n==m ? 2*r[n]*r[m] : (n-m).abs==1 ? r[n]*r[m] : 0)%M


Measured memory_bytes: 2684
#include <bits/stdc++.h>
#define Tayeb ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main()
{
    Tayeb;
    int count=0;
    string S;
    cin >> S;
    for(int i=0; i<S.length(); i++)
    {
        if(S[i]=='R'&&S[i+1]=='R'&&S[i+2]=='R')
        {
            count=3;
            break;
        }
        else if(S[i]=='R'&&S[i+1]=='R')
        {
            count=2;
            break;
        }

        else if(S[i]=='R')
        count=1;
    }
    cout << count << "\n";

    return 0;

}


Measured memory_bytes: 3656
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;

signed main() {
	int a[110][110] = {};
	int r[110], c[110];
	for (int n; cin >> n&&n;) {
		rep(i, 0, n) rep(j, 0, n) cin >> a[i][j];
		memset(r, 0x3f, sizeof(r));
		memset(c, 0, sizeof(c));
		dumpc(r);
		dumpc(c);
		rep(i, 0, n) rep(j, 0, n) {
			r[i] = min(r[i], a[i][j]);
			c[j] = max(c[j], a[i][j]);
		}
		bool f = true;
		rep(i, 0, n) rep(j, 0, n) {
			if (f&&r[i] == a[i][j] && c[j] == a[i][j]) {
				cout << a[i][j] << endl;
				f = false;
			}
		}
		if (f) cout << 0 << endl;
	}
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int a = -1, z;
    for(int i=0; i<s.length(); i++){
        if(s[i] == 'A' && a == -1) a = i;
        if(s[i] == 'Z') z = i;
    }
    cout << z - a + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll;
ll mod = 1e9+7;

int main() { 
  
	ll n;
	cin>>n;
	if(1000 - n%1000 == 1000) cout<<0;
	else cout<<1000 - n%1000;

	return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 0x3f3f3f3f
#define mod 998244353
#define maxn 300010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
int a[maxn],mx1[maxn],mx2[maxn];
int n;
int main()
{
	n=read();
	for(int i=0;i<1<<n;i++)
		a[i]=read(),mx1[i]=a[i],mx2[i]=0;
	for(int k=1;k<1<<n;k<<=1)
		for(int j=0;j<1<<n;j+=(k<<1))
			for(int i=j;i<j+k;i++){
				int p=mx1[i],q=mx2[i],r=mx1[i+k],s=mx2[i+k];
				if(p>r){
					mx1[i+k]=p; mx2[i+k]=std::max(q,r);
				}
				else{
					mx1[i+k]=r; mx2[i+k]=std::max(p,s);
				}
			}
	int cur=0;
	for(int i=1;i<1<<n;i++){
		cur=std::max(cur,mx1[i]+mx2[i]);
		writeln(cur);
	}
	return 0;
}

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


int main(){

    int a,b,c,x,p;
    deque <int>  deq;
    deque <int>:: iterator it;
     scanf("%d ",&a);
    for(int k=0;k<a;k++){
    scanf("%d",&b);
    if (b==0){
            scanf("%d",&c);
            if(c==0)

            {
                scanf("%d",&x);
            
                deq.push_front(x);
            }
            else if(c==1){
                scanf("%d",&x);
                deq.push_back(x);
            }

            }
    else if (b==1 && !deq.empty()){
             scanf("%d",&p);
            cout<<deq.at(p)<<endl;
    }

    else if (b==2 && !deq.empty()){
            scanf("%d",&c);
            if(c==0)
            {
                deq.pop_front();
            }
            else if(c==1){
                deq.pop_back();
            }

    }




    }


    return 0;



}



Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a,b,c;
  cin >> a >> b >> c;
  if (a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
      cout << "YES" << endl;
  }else{
      cout << "NO" << endl;
  }
}


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

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


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


int main() {

	ll N;
    cin >>N;

    ll ans=0;

    repn(i,N){
        ll l,r;
        cin >>l>>r;
        ans+=r-l+1;
    }

    cout <<ans;

}


Measured memory_bytes: 256
N, K = map(int, input().split())
if (N -1)*(N -2)//2 < K:
    print(-1)
    exit()
else:
    M = (N -1)*(N -2)//2 - K + (N - 1)
    print(M)
    for i in range(1,N+1):
        for j in range(i+1,N+1):
            print(i,j)
            M-=1
            if M ==0:
                exit()


Measured memory_bytes: 3608
package main

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

var r = bufio.NewReaderSize(os.Stdin, 100000)
var tokens []string
var nextToken int

func nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := r.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func next() string {
	for nextToken >= len(tokens) {
		line := nextLine()
		tokens = strings.Fields(line)
		nextToken = 0
	}
	r := tokens[nextToken]
	nextToken++
	return r
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	sums := make([]int, n+1)
	for i := 0; i < n; i++ {
		sums[i+1] = sums[i] + nextInt()
	}

	// 累積和の値によるマップ
	// 累積和が同じ = 差が0
	m := make(map[int]int)
	for _, s := range sums {
		m[s]++
	}

	c := 0
	for _, count := range m {
		c += count * (count-1) / 2
	}

	fmt.Println(c)
}


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

int main()
{
  int N, l, r;
  cin >> N;
  int res = 0;
  for(int i = 0; i < N; i++)
  {
    cin >> l >> r;
    res += r - l + 1;
  }
  cout << res << endl;
}


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

int n,arr[100007],dp[100007];

int solve(int y)
{
    if(dp[y]!=-1) return dp[y];

    if(y+1<n)
    {
        dp[y]=solve(y+1)+abs(arr[y]-arr[y+1]);
    }
    else dp[y]=0;
    if(y+2<n)
    {
        dp[y]=min(solve(y+2)+abs(arr[y]-arr[y+2]),dp[y]);
    }
    return dp[y];
}

int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&arr[i]);
    memset(dp,-1,sizeof(dp));
    printf("%d\n",solve(0));
    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

string a,b;

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

  cin >> a >> b;
  int n = stoi(a+b);
  int sq = (int)sqrt(n);
  cout << (sq*sq == n ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	char word[1000];
	char word1[1000];
	char word2[1000];

	scanf("%s", word);		/* ?????????????????????s????????? */
	scanf("%s", word1);		/* ?????????????????????p????????? */

	strcpy(word2, word);	/* ????´¢????±???¨???????????????s????????\ */
	strcat(word2, word);

	if(strstr(word2, word1) != NULL) {
		printf("Yes\n");	/* p???????????????????????? */
	}else{
		printf("No\n");		/* p??????????????????????????? */
	}

	return 0;
}

Measured memory_bytes: 544
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ld a, b;
	cin >> a >> b;

	ll c = a * b;
	co(c);

	return 0;
}


Measured memory_bytes: 3732
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

signed main() {
    int n, m;
    cin >> n >> m;
    vector<string> t(n);
	rep(i,n) cin>>t[i];
	rep(i,n) {
            cout << t[i] << endl;
            cout << t[i] << endl;
        }
}

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

int main() {
  vector<int> x(3);
  int five = 0, seven = 0;
  for(int i = 0; i < 3; i++){
    cin >> x.at(i);
    if(x.at(i) == 5) five++;
    if(x.at(i) == 7) seven++;
  }
  
  if(five == 2 && seven == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
  return 0;
}



Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ok = 1e10;
    ll ng = 0;
    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        ll cnt = 0;
        for(int i=0;i<n;i++){
            if(mid >= a[i])continue;
            // a[i]をmid以下にするのに必要な操作回数を足す
            // x = (a[i]+mid-1)/mid;
            cnt += ((a[i]+mid-1)/mid - 1);
        }
        if(cnt<=k){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    cout << ok << endl;
}

Measured memory_bytes: 4744
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B, C, D;
  cin >> N;
  
  D = N % 10;
  C = (N % 100 - D) / 10;
  B = (N % 1000 - C * 10 - D) / 100;
  A = (N - B * 100 - C *10 - D) / 1000;
 
  if (B == C) {
    if (A == B || B == D){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  
  else {
    cout << "No" << endl;
  }
}

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

int main()
{
  string S;
  int min=754;
  cin >> S;
  rep(i, S.size()-2){
    int x = stoi(S.substr(i,3));
    if (abs(x-753)<min){
      min=abs(x-753);
    }
  }
  cout << min << endl;
}

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

int main(){
  int a, n, m, sum = 0;
  scanf("%d %d", &n, &m);
  for(int i = 0;i < m;i++){
    scanf("%d", &a);
    sum += a;
  }
  if(sum <= n){
    printf("%d", n - sum);
  }
  else{
    printf("-1");
  }

  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int A, B;
  cin >> A >> B;

  rep(X,10000000){
    int a = X * 8 / 100;
    int b = X * 10 / 100;

    if(a == A && b == B){
      cout << X << endl;
      return 0;
    }
    
  }

  cout << -1 << endl;
  return 0;
}



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

int main(){
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    
    vector<int>c(n);
    c[1]=abs(v[1]-v[0]);
    c[0]=0;
    for(int i=2;i<n;i++){
        if((c[i-1]+abs(v[i]-v[i-1]))>(c[i-2]+abs(v[i]-v[i-2]))){c[i]=(c[i-2]+abs(v[i]-v[i-2]));}
        else {
            c[i]=(c[i-1]+abs(v[i]-v[i-1]));
            // s[i]=i-1;
        }
    }
    cout<<c[n-1];
    
    
    
}
        

Measured memory_bytes: 1024
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int a, b, ans;
int main() {
	cin >> a;
	for (int i = 0; i < a; ++i) {
		cin >> b;
		if (b % 2 == 0) { ++ans; }
	}
	cout << ans << endl;
}


Measured memory_bytes: 3112
S=list(input())
A=S.count(S[0])
B=S.count(S[1])
C=S.count(S[2])
D=S.count(S[3])
if (A==B==2 or A==C==2 or A==D==2) and (B==C==2 or B==D==2):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    ans_dict = {"aaaaaaaaaaa": 0}
    for _ in range(n):
        tmp_input = s_input()
        if tmp_input in ans_dict:
            ans_dict[tmp_input] += 1
        else:
            ans_dict[tmp_input] = 1

    m = i_input()
    for _ in range(m):
        tmp_input = s_input()
        if tmp_input in ans_dict:
            ans_dict[tmp_input] -= 1

    print(max(ans_dict.values()))

if __name__ == '__main__':
    main()


Measured memory_bytes: 77172
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int i,j,flg;
	char a[4],b[4];
	cin>>a>>b;
	j=2; flg=1;
	for(i=0;i<3;i++){
		if(a[i]!=b[j]){
			flg=0;
			break;
		}
		j--;
	}
	if(flg==1) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256