akhauriyash/Code-Regression huggingface dataset:
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int x[4],y[4],a,b;
int main()
{
	cin>>x[1]>>y[1]>>x[2]>>y[2];
	a=x[2]-x[1];
	b=y[2]-y[1];
	x[3]=x[2]-b;
	y[3]=y[2]+a;
	x[4]=x[3]-a;
	y[4]=y[3]-b;
	cout<<x[3]<<" "<<y[3]<<" "<<x[4]<<" "<<y[4]<<endl;
//	system("pause");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    #include <iostream>
    #include <string>
    using namespace std;
    int main()
    {
    	int n, m, a;
    	while(scanf("%d", &n)!= EOF)
    	{
    		m = floor(sqrt(n) );
    	    a = m * m;
    	    printf("%d\n", a);
    	}
    	return 0;
    }

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

int main() {
	int x;
	vector<int> vec(4);
	vector<int> value(4);
	for (int i = 0; i < 4; i++) {
		cin >> x;
		vec.at(i) = x;
	}
	value.at(0) = vec.at(1) + vec.at(2) - vec.at(3);
	value.at(1) = vec.at(2) + vec.at(3) - vec.at(0);
	value.at(2) = vec.at(0) + vec.at(1) - vec.at(3);
	value.at(3) = vec.at(1) + vec.at(2) - vec.at(0);
	for (int i = 0; i < 4; i++) {
		cout << value.at(i) << " ";
	}
}

Measured memory_bytes: 3636
#include"iostream"
#include"cstdio"
using namespace std;
int main()
{
	long long int a,b,c;
	cin>>a>>b>>c;
	if(a%2==0 || b%2==0 || c%2==0)
	{
		cout<<0;
		return 0;
	}
	if(a==b && a==c)
	{
		cout<<a*a;
		return 0;
	}
	if(a>b && a>c)
	{
		cout<<b*c;
		return 0;
	}
	if(c>b && c>a)
	{
		cout<<b*a;
		return 0;
	}
	if(b>a && b>c)
	{
		cout<<a*c;
		return 0;
	}
	if(a==b && a<c)
	{
		cout<<a*b;
		return 0;
	}
	if(c==b && c<a)
	{
		cout<<c*b;
		return 0;
	}
	if(a==c && a<b)
	{
		cout<<a*c;
		return 0;
	}
	if(a==c && a>b)
	{
		cout<<a*b;
		return 0;
	}
	if(a==b && a>c)
	{
		cout<<a*c;
		return 0;
	}
	if(b==c && b>a)
	{
		cout<<a*b;
		return 0;
	}
}

Measured memory_bytes: 256
def main():
    x1, y1, x2, y2 = map(int, input().split())
    x4 = x1 - (y2 - y1)
    y4 = y1 + x2 - x1
    x3 = x4 - (y1 - y4)
    y3 = y4 + x1 - x4
    print("{} {} {} {}".format(x3, y3, x4, y4))
main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
 cin >>N;

    vector<int> vec(N);
    for (int i = 0; i < vec.size(); i++) {
        cin>> vec.at(i);
    }
      sort(vec.begin(), vec.end()); 
    reverse(vec.begin(), vec.end()); 
  int count_b=0,count_a=0;
  for(int i=0;i<N;i++){
  if(i % 2==0)count_a += vec[i];
    else count_b +=vec[i];
  }
  cout <<count_a-count_b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

const int mod = 1000000007;
struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if(!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if(t&1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;  
    }
    mint operator()(int n, int k){
        if(k < 0 || n < k) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
}comb(10000);


int main(){
    int s;
    cin >> s;
    if(s <= 2){
        cout << 0 << endl;
        return 0;
    }
    int n = s / 3;
    mint ans = 0;
    for(int i = 1; i <= n; i++){
        int nokori = s - i * 3;
        ans += comb(nokori + i - 1, nokori);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3756
import java.util.*;

class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        if (x >= 1 && x <= 100 && y >= 1 && y <= 100) {
            if (x - (y * 2) >= 0) {
                System.out.println(x - (y * 2));
            } else {
                System.out.println(0);
            }
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  double A,B,H,M;
  cin >> A >> B >> H >> M;
  double pi = 3.14159265358979;
  double time = H * 60 + M;
  double Hc = (time / 720) * 360;
  double Mc = (time / 60) * 360;
  double t = (max(Mc,Hc) - min(Mc,Hc));
  t *= (pi) / (180);
  t = min(t,360-t);
  double ans = (A * A) + (B * B) - (2 * A * B * cos(t));
  ans = sqrt(ans);
  cout << setprecision(120) << ans << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void)
{
  int n, cnt[112345] = {0}, maxa = -INF;
  cin >> n;
  REP(i, n) {
    int a;
    cin >> a;
    cnt[a]++;
    maxa = max(maxa, a);
  }

  ll ope = 0, twi = 0;
  FOR(i, 1, maxa+1) {
    ope += (cnt[i]-1)/2;
    cnt[i] = (cnt[i]-1)%2+1;
    if(cnt[i] == 2) twi++;
  }

  ope += twi / 2;
  if(twi%2 == 1) ope++;

  cout << n-ope*2 << endl;

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <math.h>

using namespace std;

int main(){
    int n,ct = 0;
    long double ans = 0.0;
    cin >> n;
    
    vector<pair<int,int>>v(n);
    vector<int>perm(n);

    for(int i = 0;i < n;i++){
        cin >> v[i].first >> v[i].second;
        perm[i] = i+1;
    }

    do{
        ct++;
        for(int i = 0;i < n-1;i++){
            int x1,x2,y1,y2;
            x1 = v[perm[i]-1].first;x2 = v[perm[i+1]-1].first;
            y1 = v[perm[i]-1].second;y2 = v[perm[i+1]-1].second;
            ans += sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        }


    }while(next_permutation(perm.begin(),perm.end()));

    cout << fixed << setprecision(14) << ans/ct << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  int n, k ;
  cin >> n >> k ;
  vector<int> x(n) ;
  int ans = 0 ;
  REP(i,n){
    cin >> x.at(i) ;
  }
  REP(i,n){
    ans += 2*min(k-x.at(i),x.at(i)) ;
  }
  
  cout << ans <<endl ;
    
  return 0 ;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Maxn 4000007
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    int n;
    cin>>n;
    ll sum = 0;
    vi v(n);
    for(int i = 0; i < n; i++)cin>>v[i];
    int mn = INT_MAX;
    for(int i = 1; i <= 100; i++){
        int sum = 0;
        for(int j = 0; j < n; j++){
            sum+=(v[j]-i)*(v[j]-i);
        }  
        mn=min(mn, sum);
    }
    cout<<mn;
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline().strip()


H, W = map(int, input().split())
S = [input() for _ in range(H)]

dp = [[float("inf") for _ in range(W)] for _ in range(H)]

dp[0][0] = 1 if S[0][0] == "#" else 0
d = [(0, 1), (1, 0)]
for i in range(H):
    for j in range(W):
        for dx, dy in d:
            ni = i + dx
            nj = j + dy
            if ni < H and nj < W:
                if S[i][j] == "#" and S[ni][nj] == "#":
                    tmp = dp[i][j]
                else:
                    if S[ni][nj] == "#":
                        tmp = dp[i][j] + 1
                    else:
                        tmp = dp[i][j]
                if tmp < dp[ni][nj]:
                    dp[ni][nj] = tmp

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


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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


signed main(){
    int n;
    cin >> n;
    vector<int> c(n - 1), s(n - 1), f(n - 1);
    for(int i = 0; i < n - 1; ++i)
        cin >> c[i] >> s[i] >> f[i];
    for(int st = 0; st < n; ++st){
        vector<int> ans(n, MOD);
        ans[st] = 0;
        for(int i = st; i < n - 1; ++i){
            int tim = max(ans[i], s[i]);
            if(tim % f[i] != 0)
                tim += (f[i] - (tim % f[i]));
            chmin(ans[i + 1], tim + c[i]);
        }
        cout << ans.back() << endl;
    }
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
typedef long long ll;
void bibs_swap(vector<int>& v, int k)
{
	rep(i, v.size()-1) if(v.at(i)%k>v.at(i+1)%k) swap(v.at(i), v.at(i+1));
}

void show(vector<int> v)
{
	rep(i, v.size()) cout << v.at(i) << endl;
}

int main(void)
{
	double a, b, c, d, e, f, ans_x, ans_y;
	cin >> a >> b >> c >> d;
	double p1p2_inc;
	if(a-c != 0) p1p2_inc = (b-d)/(a-c);
	else p1p2_inc = 0;
	double px_inc;
	if(p1p2_inc != 0)  px_inc = -1/p1p2_inc;
	else  px_inc = 0;
	double p1p2_sec;
	if(a==0 && b==0) p1p2_sec = -p1p2_inc*c + d;
	else p1p2_sec = -p1p2_inc*a + b;
	int q;
	cin >> q;
	rep(i, q)
	{
		cin >> e >> f;
		if(a==c) cout << a << " " << f << endl;
		else if(b==d) cout << e << " " << b << endl;
		else
		{
		    double px_sec = -px_inc*e + f;
		    ans_x = -(p1p2_sec - px_sec) / (p1p2_inc - px_inc);
		    ans_y = p1p2_inc*ans_x + p1p2_sec;
		    printf("%.9f %.9f\n", ans_x, ans_y);
		}
	}
	return 0;
}



Measured memory_bytes: 3272
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << '\n'

typedef int64_t Int;
const double pi = M_PI;

using namespace std;

using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
int N;
Graph G(N);
vector<int> color;

void dfs(int v, int p, int cur) {
    color[v] = cur;

    for (auto n : G[v]) {
        if (n.first == p) {
            continue;
        }

        if (n.second & 1)
            dfs(n.first, v, 1 - cur);
        else
            dfs(n.first, v, cur);
    }
}

int main() {
    cin >> N;

    G.assign(N, vector<Edge>());
    for (int i = 0; i < N - 1; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;

        G[u].push_back(Edge(v, w));
        G[v].push_back(Edge(u, w));
    }

    color.assign(N, 0);
    dfs(0, -1, 0);

    for (int v = 0; v < N; v++) {
        cout << color[v] << endl;
    }
}


Measured memory_bytes: 8960
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
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 long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	double ans=0,bot,sit,t;
	int i,n,k;
	cin>>n>>k;
	for(i=1;i<=n;i++){
		bot=sit=1;
		t=max(0.0,ceil(log2((double)k/(double)i)));
//		cout<<log2(k/i)<<" "<<t<<endl;
		bot=pow(2,t);
		bot*=n;
//		cout<<sit<<" "<<bot<<endl;
		ans+=sit/bot;
//		cout<<sit/bot<<endl;
	}
	printf("%.11f\n",ans);
	
	
	
	
	
	
	
	
	
	
	
	
//////////////////////////////////////////////////////
return 0;}











Measured memory_bytes: 256
let x, y = Scanf.sscanf (read_line()) "%d %d" (fun x y -> x,y)
let rec loop turu =
  let rec loop2 kame =
  if turu + kame > x then "No" else 
    if turu * 2 + kame * 4 = y && turu + kame = x then "Yes" else loop2 (kame+1)
  in if turu > x then "No" else if loop2 0 = "Yes" then "Yes" else loop (turu+1)
let _ = print_endline @@ loop 0

Measured memory_bytes: 3748
#!/usr/bin/env python3
#ABC69 C

n = int(input())
a = list(map(int,input().split()))

total = 0
for i in a:
    if i % 2 == 0 and i % 4 != 0:
        total += 1/2
    elif i % 4 == 0:
        total += 1
if total >= n//2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 62576
n = int(input())
task = [[int(x) for x in input().split()] for i in range(n)]
task.sort(key=lambda x:x[1])
check = True;time = 0
for i in range(n):
    t,f = task[i]
    time += t
    if time <= f:continue
    else:check = False;break
if check:
    print('Yes')
else:
    print('No')

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

#define pe pair<int, int>
#define fi first
#define se second
#define mp make_pair

using namespace std;

const int MAX_N = 3010;
const long long MOD = 1000000007;

vector<pe> ops;

class cmp {
public:
  inline bool operator()(const pe &a, const pe &b) {
    if(a.se == b.se) {
      return a.fi > b.fi;
    }
    return a.se > b.se;
  }
};

int le[MAX_N];
int ri[MAX_N];

long long d[MAX_N][MAX_N];

string s;
string copie;

int main()
{
  int n, m;
  cin >> n >> m >> s;

  for(int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    ops.push_back(mp(a, b));
  }

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

  s = " " + s;
  copie = s;

  for(auto it : ops) {
    int cnt0 = 0;
    for(int i = it.fi; i <= it.se; i++) {
      cnt0 += (s[i] == '0');
    }

    for(int i = it.fi; i < it.fi + cnt0; i++) {
      s[i] = '0';
    }
    for(int i = it.fi + cnt0; i <= it.se; i++) {
      s[i] = '1';
    }
  }
  int cnt = 0;
  for(int i = 1; i <= n; i++) {
    if(s[i] == '1') {
      ri[++cnt] = i;
    }
  }


  s = copie;
  cnt = 0;

  for(auto it : ops) {
    int cnt1 = 0;
    for(int i = it.fi; i <= it.se; i++) {
      cnt1 += (s[i] == '1');
    }

    for(int i = it.fi; i < it.fi + cnt1; i++) {
      s[i] = '1';
    }
    for(int i = it.fi + cnt1; i <= it.se; i++) {
      s[i] = '0';
    }
  }

  cnt = 0;
  for(int i = 1; i <= n; i++) {
    if(s[i] == '1') {
      le[++cnt] = i;
    }
  }

  d[0][0] = 1;
  for(int i = 1; i <= n; i++) {
    d[i][0] = d[i - 1][0];
    for(int j = 1; j <= min(cnt, i); j++) {
      if(i >= le[j] && i <= ri[j]) {
        d[i][j] += d[i - 1][j - 1];
      }
      d[i][j] = (d[i][j] + d[i - 1][j]) % MOD;
    }
  }

  cout << d[n][cnt] << '\n';

  return 0;
}


Measured memory_bytes: 68992
#include <stdio.h>

int main(void){
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double a12, a34;
	int n;
	int i;

	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		if(x2 != x1){
			a12 = (y2 - y1) / (x2 - x1);
		}else{
			if(x4 == x3){
				printf("YES\n");
				continue;
			}else{
				printf("NO\n");
				continue;
			}
		}
		if(x4 != x3){
			a34 = (y4 - y3) / (x4 - x3);
		}else{
			printf("NO\n");
			continue;
		}

		if(a12 == a34){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>
#include <fstream> 
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <math.h>
#include <cmath>
using namespace std;
int main(){
   int N,K,X,Y;
   cin >> N >> K >> X >> Y;
   int sum = 0;
   if(N <= K){
   sum = N*X;	
   }else{
   sum = K*X + (N - K)*Y;	
   }
   cout << sum << endl;    
}

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

int main()
{
	string S;
	int ans = 0;

	cin >> S;

	int s = S.size();

	for (int n = 0; n < s; n++) {
		for (int nn = n+1; nn < s; nn++) {
			if (S[n] == S[nn])ans = 1;
		}
	}

	if (ans)cout << "no";
	else cout << "yes";

	return 0;
}

Measured memory_bytes: 256
from collections import deque
N,M = map(int,input().split())
G = [[] for i in range(N+1)]
for i in range(M):
  x,y,z = map(int,input().split())
  G[x].append(y)
  G[y].append(x)

cnt = 0
seen = [False]*(N+1)
for i in range(1,N+1):
  if seen[i] == False:
    seen[i] = True
    cnt += 1
    d = deque([i])
    while len(d)>0:
      v = d.popleft()
      for j in G[v]:
        if seen[j] == False:
          seen[j] = True
          d.append(j)
###
print(cnt)

Measured memory_bytes: 23900
# define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main(){
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    int flg = 0;

    scanf("%d%d%d%d", &a, &b, &c, &d);

    if (d >= abs(a - c)){
        flg = 1;
    }
    else if ((d >= abs(a - b)) && (d >= abs(b - c))){
        flg = 1;
    }
    else{
        // NOP;
    }

    if (1 == flg){
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 128
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // ----------------------
    int x , b ;
    cin >> x >> b; 
    if(x < b){
        cout << 0 << endl ;
    }
    else{
        cout << 10 << endl ;
    }
    return 0 ;
}

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

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000

using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    string a = "";
    ll result = 0;
    int k = 0;
    REP(i, pow(2, s.size() - 1)){
        REP(j, s.size()){
            a += s[k];
            if (i & (1 << j)){
                result += atoll(a.c_str());
                a = "";
            }
            k++;
        }
        k = 0;
        result += atoll(a.c_str());
        a = "";
    }
    cout << result;
}

Measured memory_bytes: 256
n=int(input())
num=[]
def ap(num1):
    num.append(num1)
for i in range(n):
    a=int(input())
    ap(a)
num.sort()
num1=num[0]
num2=1
ans=0
for i in range(n-1):
    if num[i+1]==num1:
        num2+=1
    else:
        num1=num[i+1]
        if num2%2==1:
            ans+=1
        num2=1
if num2%2==1:
    ans+=1
print(ans)


Measured memory_bytes: 13344
def diff(x, y):
    return x**2 + y**2

N, D = map(int, input().split())
D = D**2
cnt = 0

for _ in range(N):
    x, y = map(int, input().split())
    d = x**2 + y**2
    if d <= D:
        cnt += 1

print(cnt)

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

#define ll long long
#define ull unsigned long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()

//ofstream out("debug.txt");

const int MxN = 1e5, md = 1e9 + 7;

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

    int n;
    cin >> n;
    vl x(n), y(n);
    for (int i = 0; i < n; ++i)
        cin >> x[i] >> y[i];
    ll ans = 0, mi, cur;
    for (ll a : {1, -1})
        for (ll b : {1, -1})
        {
            mi = a * x[0] + b * y[0];
            for (ll i = 1; i < n; ++i)
            {
                cur = a * x[i] + b * y[i];
                ans = max(ans, cur - mi);
                mi = min(mi, cur);
            }
        }
    cout << ans << '\n';
}

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

int main() {
    int n, k, sorted = 0, result = 0;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    deque<pair<int, int>> increase, decrease;
    for (int i = 0; i < k; i++) {
        while (!increase.empty() && increase.back().first > p[i]) {
            increase.pop_back();
        }
        increase.emplace_back(p[i], i);
        while (!decrease.empty() && decrease.back().first < p[i]) {
            decrease.pop_back();
        }
        decrease.emplace_back(p[i], i);
    }
    if (increase.size() == k) {
        sorted++;
    } else {
        result++;
    }
    for (int i = 1; i + k <= n; i++) {
        while (decrease.front().second < i) {
            decrease.pop_front();
        }
        while (!decrease.empty() && decrease.back().first < p[i + k - 1]) {
            decrease.pop_back();
        }
        decrease.emplace_back(p[i + k - 1], i + k - 1);
        auto t = increase.front().first;
        while (increase.front().second < i) {
            increase.pop_front();
        }
        while (!increase.empty() && increase.back().first > p[i + k - 1]) {
            increase.pop_back();
        }
        increase.emplace_back(p[i + k - 1], i + k - 1);
        if (increase.size() == k) {
            sorted++;
        } else if (t != p[i - 1] || decrease.front().first != p[i + k - 1]) {
            result++;
        }
    }
    if (sorted > 0) {
        result++;
    }
    cout << result;
    return 0;
}

Measured memory_bytes: 2688
m,d=map(int,input().split())
if d<22 or m<4 :
    print(0)
    exit()

cnt=0

for i in range(4,m+1):
    for j in range(2,i+1):
        if i%j==0 and i%(i//j)==0 and i>1 and i//j>1:
            tmp=int(str(j)+str(i//j))
            if tmp<=d:
                cnt+=1
print(cnt)

Measured memory_bytes: 3064
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    f = [0]*n
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
        f[a] += 1
        f[b] += 1
    a = LI()
    b = LI()
    c = [b[i]-a[i] for i in range(n)]
    d = [0]*n
    d[0] = 1
    q = deque([0])
    while q:
        x = q.popleft()
        nd = d[x] + 1
        for y in v[x]:
            if not d[y]:
                d[y] = nd
                q.append(y)
    V = list(range(n))
    V.sort(key = lambda x:-d[x])
    s = [1]*n
    for x in V:
        for y in v[x]:
            if d[y] < d[x]:
                s[y] += s[x]
    V = list(range(n))
    V.sort(key = lambda x:s[x])
    ans = 0
    for x in V:
        m = 0
        for y in v[x]:
            if s[y] < s[x]:
                if m < c[y]:
                    m = c[y]
        ans += m
        c[x] += m*f[x]
        for y in v[x]:
            if s[y] < s[x]:
                if c[y] < m:
                    res = m-c[y]
                    ans += res*s[y]
                    c[x] -= res
            else:
                c[y] -= m
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 51024
#include<stdio.h>
#include<string.h>
int main(){
  char z[21];
  int i,j;
  scanf("%s",z);
  int n = strlen(z);
  if(n<=20){
    for(j=n;j>0;j--){
      printf("%c",z[j-1]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 520
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }




ll N;

vector <ll> P;

ll S[2 * 100005];
int main() {
	cin >> N;
	P.resize(N);
	rep(i, N) {
		cin >> P[i];

	}

	if (N == 1) {
		cout << ((P[0] == 0) ? 0 : -1) << endl;

		return 0;
	}
	
	rep(i, N-1){

		if (P[i] > i || P[i + 1] > i + 1 || P[i+1] - P[i] > 1) {

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



	}

	ll num = 0;
	rep(i, N-1) {

		if (P[i] >= P[i + 1]) {
			num += P[i+1];
		}
		else if(P[i+1] != 0){
			num += 1;
		}
	

	}
	cout << num << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
ll h[301];
ll dp[301][301];//一番右端がi,削除していない列の数がj
//dp[i][j]の更新
void calc(int i,int j)
{
	//その前に生き残った行を全探索
	if(j>0)
	{
		for(int a=0;a<i;a++)
			dp[i][j]=min(dp[i][j],dp[a][j-1]+max(0LL,h[i]-h[a]));
	}else if(i==0){
		dp[i][j]=0;
	}
}
int main()
{
	int n,k;
	ll ans=1e14-1;
	cin>>n>>k;
	h[0]=0;
	for(int i=1;i<n+1;i++)
	{
		cin>>h[i];
	}
	fill(dp[0],dp[301],1e14-1);
	dp[0][0]=0;
	for(int i=1;i<n+1;i++)
	{
		for(int j=0;j<i+1;j++)
			calc(i,j);
	}
	for(int i=0;i<n+1;i++)
	{
		for(int j=n-k;j<n+1;j++)
		{
			//cerr<<dp[i][j]<<" ";
			ans=min(ans,dp[i][j]);
		}
		//cerr<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=20;
const int mod=1e9+7;
int n,m,q,hbit[1<<N];
int limit[N+1][N+1],dp[N+1][1<<N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

void init(){
	for(int i=2; i<1<<n; ++i){
		hbit[i]=hbit[i>>1]+1;
	}
}

int main(){
#ifdef LOCAL
	//freopen("d.in","r",stdin);
#endif
	memset(limit,-1,sizeof(limit));
	n=nxi(),m=nxi(),q=nxi();
	--n;
	init();
	for(int i=1; i<=q; ++i){
		const int a=nxi(),b=nxi(),c=nxi();
		limit[a][b]=c;
	}
	dp[n][0]=1;
	for(int i=1; i<=m; ++i){
		memcpy(dp[0],dp[n],sizeof(dp[0]));
		for(int j=1; j<=n; ++j){
			memset(dp[j],0,sizeof(dp[j]));
		}
		for(int j=0; j<n; ++j){
			for(int k=0; k<1<<n; ++k){
				if(!dp[j][k]) continue;
				if((k>>j&1)==0&&limit[i][j+1]!=1){
					dp[j+1][k]=(dp[j+1][k]+dp[j][k])%mod;
				}
				if(limit[i][j+1]!=0){
					int lbit=((k>>j)&-(k>>j))<<j;
					int tgt=k^(1<<j)^lbit;
					dp[j+1][tgt]=(dp[j+1][tgt]+dp[j][k])%mod;
				}
			}
		}
	}
	lint ans=0;
	for(int i=0; i<1<<n; ++i){
		ans+=dp[n][i];
	}
	printf("%lld\n",ans%mod);
	return 0;
}


Measured memory_bytes: 88320
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    int M = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        int p;
        cin >> p;
        ans += p;
        M = max(M, p);
    }
    ans -= M / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i, a, b) for (Re int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (Re int i = (a); i >= (b); --i)
#define edge(i, u) for (Re int i = head[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define Re register
#define pb push_back
#define F first
#define S second
#define ll long long
#define lowbit(x) (x & -x)
#define N 105
int n, ans;
char a[N], b[N], c[N];
int main ()
{
    scanf("%d", &n);
    scanf("%s", a + 1);
    scanf("%s", b + 1);
    scanf("%s", c + 1);
    fo (i, 1, n)
    {
        if (a[i] == b[i] && b[i] == c[i])
        {
            continue;
        }
        else
        {
            if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i])
            {
                ++ans;
            }
            else
            {
                ans += 2;
            }
        }
    }
    printf("%d", ans);
}

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

const int MAX_N = 1000001;
const int INF = 1<<27;
vector<int> N3, N4;
int T[2][MAX_N];

void makeN4() {
  for(int n = 1; ; ++n) {
    int s = n*(n+1)*(n+2)/6;
    if(s >= MAX_N) break;
    N4.push_back(s);
  }
}

void solve(bool oddOnly) {
  int *t = T[oddOnly];
  fill(t, t+MAX_N, INF);
  t[0] = 0;
  /*
  for(int j = 0; j < N4.size(); ++j) {
    if(oddOnly && N4[j]%2 == 0) continue;
    for(int i = N4[j]; i < MAX_N; ++i) {
      t[i] = min(t[i], t[i-N4[j]] + 1);
    }
  }
  */
  for(int i = 1; i < MAX_N; ++i) {
    for(int j = 0; j < N4.size() && N4[j] <= i; ++j) {
      if(oddOnly && N4[j]%2 == 0) continue;
      t[i] = min(t[i], t[i-N4[j]] + 1);
    }
  }

}

int main() {
  makeN4();
  solve(false);
  solve(true);
  int N;
  while(cin >> N && N) {
    cout << T[0][N] << " " << T[1][N] << endl;
  }
  return 0;
}

Measured memory_bytes: 8604
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;

int main()
{
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            if(n - r * i - g * j >= 0 && (n - r * i - g * j) % b == 0){
                ans++;
            }
        }
    }
    cout << ans;
}

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

int main(){
    int N,X;
    cin >> N >> X;
    vector<int> L(N);
    for(int i=0;i<N;i++)
        cin >> L[i];
    vector<int> jump(N+1);
    jump[0] = 0;
    int count = 1;
    for(int i=1;i<=N;i++){
        jump[i] = jump[i-1]+L[i-1];
        if(jump[i] > X) break;
        else count++;
    }
    cout << count << endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif



int main(void)
{
	ll n; cin >> n;
	vector<ll> h(n);
	rep(i, 0, n)
		cin >> h[i];

	ll ans = 0;
	ll count = 0;
	rep(i, 0, n-1)
	{
		if (h[i] >= h[i + 1])
			count++;
		else
			count = 0;
		ans = max(ans, count);
	}

	cout << ans;
	return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

int N;
string S;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> S;
	N = S.size();
	FOR(i,0,N){
		if(i + 1 < N && S [i] == S [i + 1]){
			cout << i + 1 << ' ' << i + 2 << endl;
			return 0;
		}
		else if(i + 2 < N && S [i] == S [i + 2]){
			cout << i + 1 << ' ' << i + 3 << endl;
			return 0;
		}
	}

	cout << -1 << ' ' << -1 << endl;

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	vector<int> a(1000001, -1);
	int cur = 0, k;
	cin >> k;
	for (int i = 1;; ++i)
	{
		cur = (cur * 10 + 7) % k;
		if (cur == 0)
			return cout << i << '\n', 0;
		if (a[cur] != -1)
			return cout << -1 << '\n', 0;
		a[cur] = i;
	}
	return 0;
}

Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
    int m, d;
    cin >> m >> d;
    int ans = 0;
    for (int i = 1; i <= d; i++){
        int m1 = i / 10;
        int d1 = i % 10;
        if (m1 * d1 <= m && m1 * d1 >= 4 && m1 >=2 && d1 >= 2){
            // cout << m1 << d1 << endl;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.TreeMap;
import java.math.BigDecimal;
import java.math.BigInteger;
    
public class Main{
 
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;
 
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
for(int cnt=1;;cnt++){
 int x=ir.nextInt();
 if(x==0) break;
 out.println("Case "+cnt+": "+x);
}
out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;
 
 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
  
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }
 
 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}

 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}

 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public double nextDouble(){return Double.parseDouble(next());}
 
 public BigInteger nextBigInteger(){return new BigInteger(next());}
 
 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }
 
 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

Measured memory_bytes: 28872
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
const ll MOD = 998244353;
int n;
int a[MAX_N];

ll is_ok(ll x){
    srep(i,x,n){
        if(i/x%2 == 1){
            if(a[i] == 1 && a[i%x] == 1)return 1;
            if(a[i] == 0 && a[i%x] == 0)return 0;
        }else{
            if(a[i] == 1 && a[i%x] == 0)return 1;
            if(a[i] == 0 && a[i%x] == 1)return 0;
        }
    }
    return 1;
}

ll how_many(ll x){
    ll two = 1;
    ll res = 1;
    drep(i,x){
        if(a[i] == 1){
            res += two;
            res %= MOD;
        }
        two *= 2;
        two %= MOD;
    }
    return res - 1;
}


int main() {
    cin >> n;
    string s; cin >> s;
    rep(i,n)if(s[i] == '1')a[i] = 1;
    ll ans = 0;
    vector<pair<ll,ll>> v;
    srep(i,1,n+1){
        if(n % i == 0 && (n/i)%2 == 1){
            ll tmp = how_many(i) + is_ok(i);
            tmp %= MOD;
            rep(j,v.size()){
                if(i % v[j].first == 0){
                    tmp += MOD - v[j].second;
                    tmp %= MOD;
                }
            }
            ans += tmp * i * 2;
            ans %= MOD;
            v.push_back(P(i,tmp));
        }
    }

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


Measured memory_bytes: 1412
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = IntArray(N)
    (0 until N).forEach {
        A[it] = readLine()!!.toInt()
    }

    val sotrtedA = A.sortedDescending()

    A.forEach {
        val max = sotrtedA[0]
        val secondMax = sotrtedA[1]

        if (it != max) {
            println(max)
        } else {
            println(secondMax)
        }
    }
}

Measured memory_bytes: 59136
#include<stdio.h>

int main(){
  int a,b,c,x,y,z,e,f,g;
  scanf("%d%d%d",&a,&b,&c);
  x=a,y=b,z=c;
  if(x>y){
    x=b,y=a;
  }
  if(y>z){
    z=y,y=c;
    if(x>y){
      y=x,x=c;
    }
  }
  printf("%d %d %d\n",x,y,z);
}

Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#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 <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

  vector<int> A(M);
  rep(i,M) cin>>A[i];  

  map<int,int> r;

  rep(i,M) ++r[A[i]];

  int S=0,T=0;

  for(int i=0;i<=X;++i) S+=r[i];

  for(int j=X;j<=N;++j) T+=r[j];

  cout<<min(S,T)<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){

  long long x, coord = 0;
  scanf("%lld", &x);

  int t = 1;
  while(coord < x){
    coord += t;
    if(coord >= x){
      printf("%d\n", t);
      break;
    }
    t++;
  }


  return 0;
}


Measured memory_bytes: 128
package main

import (
	"fmt"
)

func main() {

	var n int
	fmt.Scanf("%d", &n)

	p := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &p[i])
	}

	var count int = 0
	for i := 1; i < n-1; i++ {
		if (p[i-1] <= p[i] && p[i] <= p[i+1]) || (p[i-1] >= p[i] && p[i] >= p[i+1]) {
			count++
		}
	}

	fmt.Println(count)
}


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

using namespace std;

int main() {
    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;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
	long long x, y, a, b, c, sum = 0; 
	cin >> x >> y >> a >> b >> c;
	
	deque<long long> p(a), q(b), r(c);
	deque<long long> red(x), green(y);
	
	for (int i = 0; i < a; i++) cin >> p[i];
	for (int i = 0; i < b; i++) cin >> q[i];
	for (int i = 0; i < c; i++) cin >> r[i];
	
	sort(p.begin(), p.end(), greater<long long>());
	sort(q.begin(), q.end(), greater<long long>());
	sort(r.begin(), r.end(), greater<long long>());
	
	for (int i = 0; i < x; i++) red[i] = p[i];
	for (int i = 0; i < y; i++) green[i] = q[i];
	
	while (!r.empty()) {
		if (green.back() > red.back()) {
			if (r.front() > red.back()) {
				red.pop_back();
				red.push_front(r.front());
			}
		}
		else {
			if (r.front() > green.back()) {
				green.pop_back();
				green.push_front(r.front());
			}
		}
		
		r.pop_front();
	}
	
	for (int i = 0; i < x; i++) sum += red[i];
	for (int i = 0; i < y; i++) sum += green[i];
	
	cout << sum;
	
	return 0;
}

Measured memory_bytes: 6272
#include<iostream>
#include<string>

int main() {
  std::string N; std::cin >> N;
  if(N[0] == '7' || N[1] == '7' || N[2] == '7') std::cout << "Yes";
  else std::cout << "No";
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int solve(int a, int b) {
    return (b - a) * (b - a);
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll ans = LINF;
    for(int v = -100; v <= 100; v++) {
        ll tot = 0;
        rep(i, n) {
            tot += solve(v, a[i]);
        }
        ans = min(tot, ans);
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;

ll d, s;

int main()
{
	int n; scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		ll a, b;
		scanf("%lld %lld", &a, &b);
		d += b; s += b * a;
	}
	printf("%lld\n", (ll)(d - 1 + ceil((s - 9) / 9.0)));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char c[3]={'r','g','b'};
main(){
  string w;
  while(cin>>w,w[0]!='0'){
    unordered_set<string>a;
    a.insert(w);
    queue<pair<string,int> >q;
    q.push(make_pair(w,0));
    while(!q.empty()){
      pair<string,int>ww=q.front();q.pop();
      string s=ww.first;//cout<<s<<endl;
      int d=ww.second;//cout<<d<<endl;
      int cc=0;
      for(int i=0;i<s.size()-1;i++)if(s[i]!=s[i+1])cc++;
      if(!cc){cout<<d<<endl;goto L;}
      for(int i=0;i<s.size()-1;i++){
        if(s[i]!=s[i+1]){
          int p=0;
          for(int k=0;k<3;k++)
            for(int j=0;j<3;j++)
              if(s[i]==c[k]&&s[i+1]==c[j])p=k+j;
          string t=s;
          if(p==3)t[i+1]=t[i]='r';
          else if(p==2)t[i+1]=t[i]='g';
          else t[i+1]=t[i]='b';
          if(!a.count(t)){//cout<<t<<endl;
            q.push(make_pair(t,d+1));
            a.insert(t);
          }
        }
      }
    }
    cout<<"NA"<<endl;
    L:;
  }
}

Measured memory_bytes: 4200
#include <stdio.h>

int main(int argc, char const* argv[])
{
  char buf[64];
  int n;
  fgets(buf, 64, stdin);
  sscanf(buf, "%d", &n);

  printf("%d\n", ((n + 999) / 1000) * 1000 - n);
  return 0;
}

Measured memory_bytes: 2052
N, K = map(int, input().split())
ans = 0
M1 = []
M2 = []
M1 = [a for a in range(N+1) if a % K == 0]
M1.pop(0)
if K % 2 == 0:
    M2 = [a for a in range(N+1) if a % K == K//2]
print(len(M1)**3 + len(M2)**3)


Measured memory_bytes: 10936
#B
a, b, c, k = map(int, input().split())
ans=0
if a < k:
    ans += 1 * a
    k -= a
    if b < k:
        k -= b
        if c < k:
            ans += -1 * (c - k)
        else:
            ans += -1 * k
else:
    ans+=1*k
print(ans)


Measured memory_bytes: 9172