akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

const int MAX = 100000;
vector<int> G[MAX];

class DisjointSet{
public:
    vector<int> rank, parent;
    DisjointSet();
    DisjointSet(int size){
        rank.resize(size,0);
        parent.resize(size,0);
        for (int i=0; i<size; i++) {
            makeSet(i);
        }
    }

//    bool same(int u,int v){
//        if (parent[u] == parent[v]) {
//            return true;
//        }else{
//            return false;
//        }
//    }
    bool same(int u,int v){
        int x = findSet(u); int y= findSet(v);
        return x==y;
    }
    
    void unite(int u,int v){
        int x = findSet(u);int y= findSet(v);
        if(rank[x]<rank[y]){
            parent[x] = y;
        }else{
            parent[y] = x;
            if(rank[x]==rank[y]){
                rank[x]++;
            }
        }
    }
    // ????????????????????????
    int findSet(int u){
        
        if(u!=parent[u])
            parent[u] = findSet(parent[u]);
        
        return parent[u];
    }
private:
    void makeSet(int i){
        rank[i] = 0;
        parent[i] = i;
    }
};
    
int main(int argc, const char * argv[]) {
    
    int n,m;
    cin >> n >> m;
    DisjointSet ds(n);
    
    for(int i=0;i<m;i++){
        int s,t;
        cin >> s >> t;
        ds.unite(s, t);
    }
    int q;
    cin >> q;
    for(int i=0;i<q;i++){
        int s,t;
        cin >> s >> t;
        if(ds.same(s, t)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}

Measured memory_bytes: 6016
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define T int t = 0; cin >> t; while(t--)
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef long double lld;
const ll mod = 1e9 + 7;
const ll mx = 5e5 + 5;
ll fact[mx];

ll power(ll x, ll y){
    ll res = 1;
    while(y > 0){
        if(y & 1LL)res = (res * x) % mod;
        y = y >> 1LL;
        x = (x * x) % mod;
    }
    return res;
}
ll inverse(ll a){
    return power(a, mod - 2) % mod;
}
void initialize(){
    fact[0] = fact[1] = 1;
    for(ll i = 2; i < mx; ++i)fact[i] = (i * fact[i - 1]) % mod;
}
ll find_ans(ll n, ll r){
    ll ans = fact[n];
    ans = (ans * inverse(fact[r])) % mod;
    ans = (ans * inverse(fact[n - r])) % mod;
    return ans;
}

void input(){
    initialize();
    ll n, k;
    cin >> n >> k;
    if(n >= k + 2){
        ll ans = find_ans(2 * n - 1, n)  % mod;
        for(ll i = k + 1; i <= n - 1; ++i){
            ans = (ans - (find_ans(n - 1, n - i - 1) * find_ans(n, i) % mod) + mod) % mod;
        }
        cout << ans << endl;
    }else{
        cout << find_ans(2 * n - 1, n) << endl;
    }

}
int main(){
    input();
    return 0;
}

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

#define ll long long

int main(){
    ll n,m,sum=0,f=0;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
    }
   // sort(a,a+n);
    ll x=sum/(4*m);
    ll y=sum%(4*m);
    if(y>0)
    x++;
    for(int i=0;i<n;i++){
        if(a[i]>=x){
            f++;
        }
        if(f==m)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
	return 0;
}

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

int main(void)
{
  int n;
  char x[10][15];
  char u[10][4];
  double ans = 0.0;

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s %s", x[i], u[i]);
    if (u[i][0] == 'J')
      ans += (double)atoi(x[i]);
    else
      ans += atof(x[i]) * 380000.0;
  }

    printf("%f\n", ans);
}

Measured memory_bytes: 128
from sys import stdin

n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
lc = [list(map(int,stdin.readline().rstrip().split())) for _ in range(m)]

for i in range(n):
    kyo = []
    for j in range(m):
        kyo.append(abs(li[i][0]-lc[j][0])+abs(li[i][1]-lc[j][1]))
    print(kyo.index(min(kyo))+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
using vvp = vector<vector<P>>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    ll n, m, r;
    cin >> n >> m >> r;
    
    ll a, b, c;
    vector<pair<P, ll>> e(m);
    REP(i, m) {
        cin >> a >> b >> c;
        e[i] = {{a, b}, c};
    }

    vll res(n, inf);
    res[r] = 0;

    REP(i, n) {
        REP(j, m) {
            a = e[j].first.first, b = e[j].first.second, c = e[j].second;
            if (res[a] == inf) continue;
            if (chmin(res[b], res[a] + c)) {
                if (i == n - 1) {
                    cout << "NEGATIVE CYCLE" << endl;
                    return 0;
                }
            }
        }
    }
    REP(i, n) {
        if (res[i] == inf) cout << "INF" << endl;
        else cout << res[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3228
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include<type_traits>

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;
constexpr ll LONGINF = 1050000000000000000;


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

	vector<vector<int>> imos(C, vector<int>(100000, 0));

	for (int i = 0; i < N; i++) {
		int s, t, c; cin >> s >> t >> c;
		s --; t--; c--;
		if (s) {
			s--;
		}
		imos[c][s] += 1;
		imos[c][t] -= 1;
	}

	for (int i = 0; i < C; i++) {
		for (int j = 1; j < 100000; j++) {
			imos[i][j] += imos[i][j - 1];
		}
	}
	int ans = 0;
	for (int j = 0; j < 100000; j++) {
		int tmp = 0;
		for (int i = 0; i < C; i++) {
			if (imos[i][j]) {
				tmp++;
			}
		}
		ans = max(ans, tmp);
	}

	cout << ans << endl;




	return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int i = v.size()/2;
  if (v[i-1] == v[i]) {
    cout << 0 << endl;
  } else {
    cout << v[i] - v[i-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
#define PB push_back

#define N 100'005
int n, k;
int h[N];
int a[N];

int main(){
	scanf("%d%d", &n, &k);
	REP(i, n) scanf("%d", h+i);
	a[0] = 0;
	FOR(i, 1, n){
		a[i]=INT_MAX;
		FOR(j, 1, min(k, i)+1){
			SML(a[i], a[i-j]+abs(h[i-j]-h[i]));
		}
	}
	printf("%d\n", a[n-1]);
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
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 = 1000000;

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

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

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




int main() {
	char c;
	cin >> c;
	char d = c + 1;
	cout << d;
	

	system("PAUSE");


}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int num=1e9+7;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> a(n);
    for(int i=0; i<n-1; i++){
        int tmp;
        cin >> tmp;
        tmp--;
        a[tmp].push_back(i);
    }
    int ans[n];
    for(int i=0; i<n; i++){
        ans[i]=a[i].size();
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 14812
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1&&b==2||b==1&&a==2)
    {
        cout<<3<<endl;
    }
    else if(a==1&&b==3||a==3&&b==1)
    {
        cout<<2<<endl;
    }
    else
    {
        cout<<1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3548
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    A = [format(a, "b")[::-1] for a in A]
    a_sum = [int()]*60

    for a in A:
        for i, r_a in enumerate(a):
            if r_a == "1":
                a_sum[i] += 1

    a_sum = [a_s_*(2**i)%MOD for i, a_s_ in zip(range(60), a_sum)]
    a_acc_sum = [_ for _ in a_sum]
    
    for x in range(1,60):
        a_acc_sum[x] = a_acc_sum[x-1] + a_acc_sum[x] 
    
    ans = 0
    for a in A:
        for i, r_a in enumerate(a):
            if r_a == "0":
                ans += a_sum[i]
        
        ans += a_acc_sum[59] - a_acc_sum[i]

        # for ic in range(i+1,60):
            # ans+=a_sum[ic]
            # ans%=MOD

    print(ans%MOD)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 181252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
   vector<ll>A(5);
   ll ans=0;
   ll m=10;
   rep(i,5){
       cin>>A[i];
      	ll d=A[i];
          d%=10;
     	if(d==0){	
          d+=10;
        }
     if(d<m){
       m=d;
     }
     if(A[i]%10!=0){
       A[i]=A[i]/10*10+10;
     }
       ans+=A[i];
   }
        cout<<ans-(10-m)<<endl;
}


Measured memory_bytes: 3572
#include <iostream>
#include<cstdio>
using namespace std;
int main()
{
   char a[5],b[5];
  while(~scanf("%s%s",a,b))
    {

    if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0])
    printf("YES\n");
   else
    printf("NO\n");


    }


    return 0;
}


Measured memory_bytes: 256
// Probably getting a WA/Tle
// Still trying
// Apna time ayega

#include<bits/stdc++.h>
#define ll long long int
#define FastRead ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);
using namespace std;
int main()
{
    ll n,l,a,b,c,m,k,i,j,s,mn=INT_MAX;
    cin>>n>>m;
    set< ll >st;
    vector< ll >v;
    for(i=0;i<m;i++){
        cin>>a;
        v.push_back(a);
    }
    for(i=0;i<v.size()-1;i++){
        a=v[i]+(n-v[i+1]);
        if(i==0){
            b=v[m-1]-v[i];
        }
        else{
            b=n+v[i-1];
        }
        s=min(a,b);
        mn=min(mn,s);
    }
    cout<<mn<<endl;

    return 0;
}


Measured memory_bytes: 2420
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>

int main() {
  size_t N;
  scanf("%zu", &N);

  char buf[1024];
  scanf("%s", buf);
  std::string s = buf;

  size_t D;
  scanf("%zu", &D);

  std::vector<size_t> one, zero;
  for (size_t i = 0; i < N; ++i) {
    if (s[i] == '0') {
      zero.push_back(i);
    } else {
      one.push_back(i);
    }
  }

  std::reverse(one.begin(), one.end());
  zero.insert(zero.end(), one.begin(), one.end());
  for (size_t i = 0; i < D; ++i)
    s[zero[i]] ^= 1;

  printf("%s\n", s.c_str());
}



Measured memory_bytes: 2844
n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
cum = [A[0]]
for i in range(1, n):
    cum.append(cum[-1] + A[i])
ans = 0
for i in range(n-1):
    ans += A[i] * (cum[-1] - cum[i])
    ans %= mod
print(ans)

Measured memory_bytes: 31608
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    ans = 0
    for a in range(1, n+1):
        for b in range(1, n+1):
            tmp = gcd(a, b)
            for c in range(1, n+1):
                ans += gcd(tmp, c)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 68416
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  ll a,b;
  cin >> a >> b;
  ll c,d;
  cin >> c >> d;  
  
  ll sum = 0,dif = 0;
  
  ll gc = gcd(c,d);
  ll e = d / gc;
  e *= c;
  
  sum += b;
  sum -= b/c;
  sum -= b/d;
  sum += b/e;
  
  dif += a;
  dif -= a/c;
  dif -= a/d;
  dif += a/e;
  
  ll ans = sum - dif;
  if(a % c != 0 && a % d != 0) ans++;
  cout << ans << endl;           
              
}

Measured memory_bytes: 3604
n = int(input())
s = list(input())

t = []

for c in s:
    if ord(c) + n > ord("Z") :
        t.append(chr(ord("A") + (ord(c) + n - ord("Z") - 1)))
    else:
        t.append(chr(ord(c) + n))

print("".join(t))

Measured memory_bytes: 66356
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w; cin >> h >> w;
    int n; cin >> n;
    int a[n];
    rep(i, n){
        cin >> a[i];
    }

    int c[h][w];
    int sum = 0;
    rep(i, n){
        rep(j, a[i]){
            int ii = (sum + j) / w;
            int jj = (sum + j) % w;
            // cout << ii << " " << jj << endl;

            c[ii][jj] = i+1;
        }
        sum += a[i];
    }

    rep(i, h){
        if(i % 2 == 1){
            reverse(c[i], c[i]+w);
        }
    }

    rep(i, h){
        rep(j, w){
            cout << c[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
import sys

N,Y = map(int ,input().split())

for x in range(N+1):
	for y in range(N+1-x):
		if (Y - 10000*x - 5000*y)//1000 == N-x-y:
			z = N-x-y
			for i in [x,y,z]:
				print(i,end = " ")
			sys.exit()

print("-1 -1 -1")

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

using namespace std;

int main(){
  long long int n,m,i, k;
  while(cin >> n >> m, n != 0 || m != 0) {
    vector<long long int> v(20100,0);
    long long int cnt = 1, data[20100][10] = {};
    long long int in[20100] = {};
    in[1] = 1;
    k = 0;
    for(i = 0; i < m; i++) {
      long long int t,s,g;
      cin >> t >> s >> g;
      data[i][0] = s;
      data[i][1] = g;
      v[k++] = t;
    }
    for(i = 0; i < m - 1; i++) {
      for(int j = m - 1; j > i; j-- ) {
	if(v[i] > v[j]) {
	  swap(v[i], v[j]);
	  swap(data[i], data[j]);
	}
      }
    }
    //    sort(v.begin(), v.begin() + m);
    for(i = 0; i < m; i++) {
      if(in[data[i][0]]){
	  if(in[data[i][1]] == 0)
	    {
	      cnt++;
	      in[data[i][1]] = 1;
	    }
	}
    }
      
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#define ALL(X) X.begin(), X.end()
#define SZ(A) int((A).size())
#define RALL(X) X.rbegin(), X.rend()
#define FOR(B) for (size_t i = 0; i < B; i++)
#define FOR2(B) for (size_t j = 0; j < B; j++)
#define FORE(B) for (size_t i = 1; i <= B-1; i++)
#define FORC(A, B) for (size_t i = A; i < B; i++)
#define PRINT(X) cout << X << endl
#define PRINTALL(E, X) { FOR(X) {cout << E[i] << endl; } }
#define PRINTSIDE(E, X) { FOR(X) {cout << E[i] << " ";} }
#define READALLI(V, N) FOR(N) {int x; cin >> x; V.push_back(x); }
#define READALL(V, N) FOR(N) {LL x; cin >> x; V.push_back(x); }
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXN 100000
#define SQRSIZE  317
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll>VL;
typedef vector<pii> vpii;
typedef map<int, int> mii;
typedef map<char, int>mci;
typedef map<string, int> msi;
typedef set<int> si;
const int INF = (1 << 30);

int main() {
   int n, m, x, y;
   n = m = x = y = 0;
   cin >> n >> m >> x >> y;
   vi Xs;
   vi Ys;
   FOR(n){
       int q = 0;
       cin >> q;
       Xs.push_back(q);
   }

    FOR(m) {
        int q = 0;
        cin >> q;
        Ys.push_back(q);

    }
   sort(Ys.begin(), Ys.end());
   sort(Xs.begin(), Xs.end());

    for(int q = x + 1; q <= y; q++){
        if(Xs[Xs.size() - 1] < q && Ys[0] >= q){
            cout << "No War\n";
            return 0;
        }
    }
    cout << "War\n";
    return 0;
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef LOCAL
    #define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define debug(...) 42
    #define eprintf(...) 42
#endif
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIGN(x) (((x)>0)?1:(((x)<0)?-1:0))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
#define vv(t) vector< t > 
#define CHC(mp, x) if(mp.end() != mp.find(x))
#define CHCV(mp, x) if(mp.end() != find(ALL(mp), x))
template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}
#define fi first
#define se second
#pragma endregion

const string YES = "Yes";
const string NO = "No";

void Main();
void solve(long long a, long long b);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
}

void solve(long long a, long long b){
    stringstream ss;
    ss << a << b;
    ll x;
    ss >> x;
    ll n=(ll)sqrt(x);
    cout << ((n*n==x)?YES:NO) << endl;
}



Measured memory_bytes: 256
x, y, z = map(int, input().split())
"""
箱 
A
 と箱 
B
 の中身を入れ替える
箱 
A
 と箱 
C
 の中身を入れ替える
"""

hoge = x
x = y
y = hoge

hoge = x
x = z
z = hoge

print(x, y, z)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	cin>>n;
	int arr[n];
	long long int mark[100001]={0};
	for(int i=0;i<n;i++){
		cin>>arr[i];
		mark[arr[i]]++;
	}
	long long int sum=0;
	for(int i=1;i<=100000;i++)
	sum+=mark[i]*i;
	int q;
	cin>>q;
	int a,b;
	for(int i=1;i<=q;i++){
		cin>>a>>b;
		sum-=mark[a]*a;
		sum+=mark[a]*b;
		mark[b]+=mark[a];
		mark[a]=0;
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 4708
#include <iostream>

using namespace std;

int main(){
  int K, X;
  cin >> K >> X;
  int st = max(-1000000, X - K + 1);
  int ed = min(1000000, X + K - 1);
  for (int i=st; i<=ed; i++){
    cout << i << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include<deque>
#include<iomanip>

#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
typedef unsigned long long ull;
typedef pair<ll, int> pr;

ll a[100001];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double x,y;
    cin>>x>>y;
    cout<< setprecision(12) <<x/y;
    return 0;
}

Measured memory_bytes: 256
var readline = require('readline')
var reader = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

var lines = [];
reader.on('line', function(line) {
  lines.push(line);
});

reader.on('close', function() {
  var N = Number(lines[0]);
  var H = lines[1].split(' ').map(Number), ans=0, k=0;
  for(var i=1; i<N; ++i) if(H[i-1]>=H[i]) { ++k; ans=Math.max(ans,k); } else { k=0; }
  console.log(ans);
});

Measured memory_bytes: 27468
class Node
  def initialize(id)
    @id = id
    @parent = -1
    @sibling = -1
    @depth = 0
    @height = 0
    @type = nil
    @children = []
  end

  attr_accessor :id, :parent, :sibling, :depth, :height, :type, :children

  def degree
    return @children.size
  end
end

def find_root(node_map)
  node_index = node_map.values.index {|item| item.degree == 0}
  parent_index = node_index
  while parent_index > -1 
    node_index = parent_index
    parent_index = $node_map[node_index].parent
  end
  return $node_map[node_index]
end

def assign(node, depth)
  if (node.parent == -1) then
    node.type = "root"
  else
    node.type = (node.children.size > 0) ? "internal node" : "leaf"
  end

  if (node.children.size == 2) then
    $node_map[node.children[0]].sibling = node.children[1]
    $node_map[node.children[1]].sibling = node.children[0]
  end

  node.depth = depth

  node.children.each do |index|
    assign($node_map[index], depth+1)
  end
end

def assign_height(node_map)
  node_map.values.each do |node|
    if node.type == "leaf" then
      height = 0
      parent_node = node
      while parent_node.parent > -1
        parent_node = node_map[parent_node.parent]
        height += 1
        parent_node.height = [parent_node.height, height].max
      end
    end
  end
end

n = gets.chomp.to_i
$node_map = {}
n.times do |index|
  $node_map[index] = Node.new(index)
end

n.times do
  array = gets.chomp.split.map(&:to_i)
  array[1..2].each do |item|
    if (item > -1) then
      $node_map[array[0]].children << item
      $node_map[item].parent = array[0]
    end
  end
end

root = find_root($node_map)
assign(root, 0)
assign_height($node_map)

$node_map.each do |key, node|
  puts "node #{node.id}: parent = #{node.parent}, sibling = #{node.sibling}, degree = #{node.degree}, depth = #{node.depth}, height = #{node.height}, #{node.type}"
end

Measured memory_bytes: 8812
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
const int INF = 1e9;

int main() {
  int n,ans=1;
  cin>>n;
  string s;
  cin>>s;
  for(int i=1;i<n;i++){
    if(s[i]!=s[i-1]) ans++;
  }
  cout<<ans;
}

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

using namespace std;

const int N = 2e5 + 1;
const int mod = 1e9 + 7;

int h, w, a, b;
int fact[N];

void add(int &x, const int &y) { x += y; x -= (x >= mod ? mod : 0); }
void sub(int &x, const int &y) { x -= y; x += (x < 0 ? mod : 0); }
int mul(const int &x, const int &y) { return 1ll * x * y % mod; }

int Pow(int x, int y) {
    if (y == 0) return 1;
    if (y == 1) return x % mod;
    int tmp = Pow(x, y / 2);
    tmp = mul(tmp, tmp);
    return y & 1 ? mul(tmp, x) : tmp;
}

int path(int x, int y) {
    return mul(fact[x + y - 2], Pow(mul(fact[x - 1], fact[y - 1]), mod - 2));
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    fact[0] = 1;
    for (int i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
    cin >> h >> w >> a >> b;
    int res = path(h, w);
    for (int i = h - a + 1; i <= h; i++)
        sub(res, mul(path(i, b), path(h - i + 1, w - b)));
    cout << res;
}


Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rg register
#define usn unsigned
#define llint long long
using namespace std;
const int N=1008611;

struct ios{
	template <typename _tp>
	inline ios operator >> (_tp &x){
		x = 0;int f = 1;char c = getchar();
		for(;c<'0'||c>'9';c=getchar()) if(c=='-') f = -1;
		for(;c<='9'&&c>='0';c=getchar()) x = (x<<1)+(x<<3)+(c^48);
		x *= f;
		return *this;
	}
	template <typename _tp>
	inline ios operator << (_tp x){
		char s[66];int dgt = 0;
		if(x==0) putchar('0');
		if(x<0) putchar('-'),x = -x;
		while(x) ++dgt,s[dgt] = x%10+'0',x/=10;
		while(dgt) putchar(s[dgt]),--dgt;
		return *this;
	}
	inline ios operator << (char x){
		putchar(x);
		return *this;
	}
}io;

int n,mst[N],hro[N];
llint ans;

int main()
{
	io >> n;
	for(rg int i=1;i<=n+1;++i){
		io >> mst[i];
	}
	for(rg int i=1;i<=n;++i){
		io >> hro[i],ans += min(hro[i],mst[i]+mst[i+1]);
		if(hro[i]<=mst[i]) mst[i] -= hro[i];
		else{
			hro[i] -= mst[i],mst[i] = 0;
			mst[i+1] = max(0,mst[i+1]-hro[i]);
		}
	}
	io << ans << '\n';
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  ll N,ans=0;
  cin >> N;
  vector<ll> A(N),B(1000001,0);;
  rep(i,N) cin >> A.at(i);
  sort(all(A));
  
  rep(i,N){
    if(B.at(A.at(i))==0){
      if(i!=0&&A.at(i-1)==A.at(i)){
        ans+=0;
      }else if(i!=N-1&&A.at(i+1)==A.at(i)){
        ans+=0;
        ll t=2;
        while(t*A.at(i)<=1000000){
          B.at(t*A.at(i))=1;
          t++;
        }
      }else{
        ans++;
        ll t=2;
        while(t*A.at(i)<=1000000){
          B.at(t*A.at(i))=1;
          t++;
        }
      }
    }
  }
   cout << ans << endl;   
  
}

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

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

		String s = sc.nextLine();
		char c[] = s.toCharArray();
		Arrays.sort(c);

		if (c[0] == c[1] && c[1] != c[2] && c[2] == c[3]) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
ll dp[51][51][2501];
int main()
{

    ll N, A;
    cin >> N >> A;
    vector<ll> x(N + 1);
    rep(i, N) cin >> x[i + 1];

    dp[0][0][0] = 1;
    repd(j, 1, N + 1) {
        rep(k, N + 1) {
            rep(s, 2501) {
                dp[j][k][s] = dp[j - 1][k][s];
                if (k >= 1 && s >= x[j]) {
                    dp[j][k][s] += dp[j - 1][k - 1][s - x[j]];
                }
            }
        }
    }

    ll ans = 0;
    repd(k, 1, N + 1) {
        ans += dp[N][k][k * A];
    }

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

Measured memory_bytes: 50048
#include<stdio.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i = 0;i < n;i++)
#define PRN(n) printf("%d\n",n)
#define PRS(s) printf("%s\n",s)
int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if((10*b+c)%4){
    PRS("NO");
  }else{
    PRS("YES");
  }
  return 0;
}
/*
scanf("%d",&n);
scanf("%d %d",&a,&b);
*/

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

const int maxn = 2E+5 + 5;

int k, n, ans = 0x3f3f3f3f;
int a[maxn];

int main()
{
	scanf("%d%d", &k, &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", &a[i]), ans = min(ans, k - a[i] + a[i - 1]);
	
	ans = min(ans, a[n] - a[1]);
	
	printf("%d", ans);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

vector<int> eratos(int n);

int main()
{
    ll n;
    cin >> n;
    vector<int> prime = eratos((int)sqrt((double)n+9));
    ll cnt = 0;
    ll left = n;
    int ind = 0, p_size = prime.size();
    ll z = prime[0], nowz = prime[0];
    while(left!=1&&ind<p_size){
        while(true){
            if (left % nowz != 0)
            {
                break;
            }
            left /= nowz;
            //cout << left << endl;
            nowz *= z;
            cnt++;
        }
        ind++;
        if(ind==p_size){
            break;
        }
        z = prime[ind];
        nowz = prime[ind];
    }
    if(left<prime[p_size-1]){
        cout << cnt << endl;
    }else{
        cout << cnt + 1 << endl;
    }
    
    return 0;
}

vector<int> eratos(int n){
    vector<bool> prime(n, true);
    vector<int> primebox;
    prime[0] = false;
    prime[1] = false;
    rep2(i, 2, n){
        if(prime[i]==true){
            primebox.push_back(i);
            int out = i*2;
            while(out<n){
                prime[out] = false;
                out += i;
            }
        }
    }
    return primebox;
}

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

int main() {
  long long k, a, b;
  cin >> k >> a >> b;
  
  long long ans = 1;
  if(b - a <= 2) ans += k;
  else{
    k -= a - 1;
    ans += (b - a) * (k / 2) + a - 1;
    if(k % 2) ans += 1;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) for(auto _x:_v){cout<<_x<<" ";}cout<<endl
#define printVS(_vs) for(auto _x : _vs){cout << _x << endl;}
#define printVV(_vv) for(auto _v:_vv){for(auto _x:_v){cout<<_x<<" ";}cout<<endl;} cout << endl;
#define printP(_p) cout << _p.first << " " << _p.second << endl
#define printVP(_vp) for(auto _p : _vp) printP(_p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

ll powmod (ll a, ll p) {
	ll ans = 1;
	ll mul = a;
	for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
		if ((p & 1) == 1) ans = (ans * mul) % mod;
	}
	return ans;
}

ll revmod(ll x) {
	return powmod(x, mod - 2);
}

// 約数を列挙(12 -> {1, 2, 3, 6, 12}, 8 -> {1, 2, 4, 8})
vector<int> divisor(int n) {
    vector<int> res;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.emplace_back(i);
            if (i != n / i) res.emplace_back(n / i);
        }
    }
    sort(all(res));
    return res;
}


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

    int n, k;
    cin >> n >> k;

    map<int, int> num;
    auto divs = divisor(n);
    rep(i, divs.size()) {
        int d = divs[i];
        num[d] = powmod(k, (d + 1) / 2);
        rep(j, i) {
            int d2 = divs[j];
            if (d % d2) continue;
            (num[d] = num[d] + mod - num[d2]) %= mod;
        }
    }
    // printVP(num);

    int ans = 0;
    for (auto p : num) {
        (ans += ((p.first * p.second) % mod * revmod(p.first & 1 ? 1 : 2)) % mod) %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
N = int(input())
neig = [[] for _ in range(N)]

for _ in range(N - 1):
    a, b, c = map(int, input().split())
    neig[a - 1].append((b - 1, c))
    neig[b - 1].append((a - 1, c))

Q, K = map(int, input().split())

S, D = [(K - 1, K - 1)], [0] * N
while len(S) > 0:
    p, pp = S.pop()
    for c, d in neig[p]:
        if not c == pp:
            D[c] = D[p] + d
            S.append((c, p))

for _ in range(Q):
    x, y = map(int, input().split())
    print(D[x - 1] + D[y - 1])


Measured memory_bytes: 46120
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import deque

    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    cur = max(a)
    a = a[:n - 1]

    neg = []
    pos = []

    for x in a:
        if x <= 0:
            neg.append(x)
        else:
            pos.append(x)

    seq = []

    if pos:
        pos_que = deque()
        pos_que.extend(pos)
        if neg:
            cur2 = neg.pop()
        else:
            cur2 = pos_que.popleft()
        while pos_que:
            y = pos_que.popleft()
            seq.append([cur2, y])
            cur2 = cur2 - y
        seq.append([cur, cur2])
        cur -= cur2

    for y in neg:
        seq.append([cur, y])
        cur = cur - y

    print(cur)
    for i in range(n - 1):
        print(*seq[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 100984
void main()
{
    long d, n;
    rdVals(d, n);

    writeln(n == 100 ? (n + 1) * 100 ^^ d : n * 100 ^^ d);
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
S=input()
if 'C' in S and 'F' in S:
    l=S.index('C')
    r=-1
    for i in reversed(range(len(S))):
        if S[i]=='F':
            r=i
            break
    if r==-1 or l>=r:
        print('No')
    else:
        print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(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 = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	int N; cin >> N;
	vector<int>x(N);
	vector<int>y(N);
	REP(i, N) {
		cin >> x[i];
		y[i] = x[i];
	}
	sort(y.begin(), y.end());
	int mid1 = y[N / 2 - 1];
	int mid2 = y[N / 2];
	REP(i, N) {
		if (x[i] >= mid2) {
			print(mid1);
		}
		else print(mid2);
	}


	return 0;
}


Measured memory_bytes: 3712
// Finding Missing Cards
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_B
//
// Accepted

use std::io::{BufRead, stdin};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();

    let n: i32 = buf.trim().parse().unwrap();

    let mut cards: [[bool; 13]; 4] = [[false; 13]; 4];

    for _ in 0..n {
        let mut buf = String::new();
        stdin.read_line(&mut buf).unwrap();

        let mut data = buf.split_whitespace();

        *cards
            .get_mut(match data.next().unwrap() {
                "S" => 0,
                "H" => 1,
                "C" => 2,
                "D" => 3,
                _ => unreachable!()
            }).unwrap()
            .get_mut(data.next().unwrap().parse::<usize>().unwrap() - 1).unwrap() = true;
    }

    for (suit, cards) in cards.iter().enumerate() {
        for (rank, exists) in cards.iter().enumerate() {
            if !*exists {
                println!("{} {}", match suit {
                    0 => "S",
                    1 => "H",
                    2 => "C",
                    3 => "D",
                    _ => unreachable!()
                }, rank + 1);
            }
        }
    }
}


Measured memory_bytes: 5036
input = gets.split(" ")
n = input.length()
words = Hash.new(0)
frequent = input[0]
frequency = 1
longest = input[0]
for i in 0..(n-1)
  words[input[i]] += 1
  if words[input[i]] > frequency
    frequent = input[i]
    frequency = words[input[i]]
  end
  if input[i].size > longest.size
    longest = input[i]
  end
end
print "#{frequent}", " ", "#{longest}", "\n"

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

using namespace std;

int main() {

	long x;
	cin >> x;

	x = abs(x);

	long i = 1;
	long counter = 0;
	while (1) {
		counter += i;
		if (counter >= x) {
			cout << i << endl;
			return 0;
		}
		if (counter > x) {
			long dist;
			long addcount;
			counter = counter - i - (i - 1);
			i = i - 2;
			dist = x - counter;
			addcount = dist - i;
			cout << i + addcount << endl;
			return 0;
		}
		i++;
	}

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    cin >> N >> M;
    if(N <= 9 && M <= 9){
        cout << N * M << endl;
    }
    else cout << "-1\n";
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i,N) cin >> a[i];
    vector<vector<int>> G(N);
    REP(i,N-1){
        int u, v;
        cin >> u >> v;
        --u, --v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    vector<int> ans(N, INF), dp(N+1, INF);
    dp[0] = -INF;
    auto dfs = [&](auto && self, int cur, int par)->void{
        int idx = lower_bound(dp.begin(), dp.end(), a[cur]) - dp.begin();
        int tmp = dp[idx];
        dp[idx] = a[cur];
        ans[cur] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin() - 1;
        for(auto nv : G[cur]){
            if(nv == par) continue;
            self(self, nv, cur);
        }
        dp[idx] = tmp;
    };
    dfs(dfs, 0, -1);
    for(auto x : ans) cout << x << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 30932
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<map>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin >> n;
    vector<long long> a(86);
    a[0] = 2;
    a[1] = 1;
  
    for(int i = 2;i <= 86;i++){
        a[i] = a[i-2] + a[i-1];
    }

    cout << a[n] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

typedef long long int64;


int main() {
    int64 n,m;
    int64 ac,wa;

    ac = wa = 0;

    cin >> n >> m;
    vector<bool> close(n+1,false);
    map<int,int> cnt;

    for (int64 i=0; i<m; i++) {
        int64 p;
        string s;
        cin >> p >> s;
        if (close[p]) continue;

        if (s == "AC") {
            ac++;
            close[p] = true;
        }
        else if (s == "WA") cnt[p]++;

    }

    for (int i=1; i<=n; i++) {
        if (close[i]) wa += cnt[i];
    }

    cout << ac << " " << wa << endl;
}

Measured memory_bytes: 4992
#!/usr/bin/env python3
import sys


def solve(N: int, D: int, X: "List[int]", Y: "List[int]"):
    d2 = D**2
    c = 0
    for i in range(N):
        x = X[i]
        y = Y[i]
        if x**2+y**2 <= d2:
            c+=1
    print(c)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = [int()] * (N)  # type: "List[int]"
    Y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, D, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 77464
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

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


Measured memory_bytes: 256