akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#define MAX 100005
using namespace std;

int x[MAX],n;
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++)
        cin>>x[i];

    int maxim=x[1];
    for (int i=2; i<=n; i++)
        maxim=max(maxim,x[i]);

    int ppp=1;
    if (x[1]==maxim)
        ppp=2;
    int nr=x[ppp],apr;
    if (maxim%2==0)
        apr=abs(maxim/2-x[ppp]);
    else
    {
        if (x[ppp]<maxim/2)
            apr=maxim/2-x[ppp];
        else if (x[ppp]>maxim/2+1)
            apr=x[ppp]-maxim/2-1;
        else
            apr=0;
    }
    for (int i=1; i<=n; i++)
    {
        if (x[i]==maxim)
            continue;
        int aprcur;
        if (maxim%2==0)
            aprcur=abs(maxim/2-x[i]);
        else
        {
            if (x[i]<maxim/2)
                aprcur=maxim/2-x[i];
            else if (x[i]>maxim/2+1)
                aprcur=x[i]-maxim/2;
            else
                aprcur=0;
        }
        if (aprcur<apr)
            apr=aprcur,nr=x[i];
    }
    cout<<maxim<<" "<<nr;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int count=0,a=1;
  for(int i=0;i<n;i++)
  {
    int m;
    cin>>m;
    if(m!=a)
        count++;
    else
         a++;
  }
  if(a!=1)
     cout<<count<<endl;
  else
     cout<<"-1"<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

			int N = scan.nextInt();

			long[]a = new long[N];
			long[]b = new long[N];
			long[]c = new long[N];

			long[][]dp = new long[N][3];

			for(int i = 0;i<N;i++) {
				a[i] = scan.nextLong();
				b[i] = scan.nextLong();
				c[i] = scan.nextLong();
			}

			dp[0][0] = a[0];
			dp[0][1] = b[0];
			dp[0][2] = c[0];

			for(int i = 1;i<N;i++) {
				for(int j = 0;j<3;j++) {
					if(j==0) {
						dp[i][0] = Math.max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
					}else if(j==1) {
						dp[i][1] = Math.max(dp[i-1][2]+b[i],dp[i-1][0]+b[i]);
					}else {
						dp[i][2] = Math.max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
					}

				}

			}


			System.out.println(Math.max(dp[N-1][0], Math.max(dp[N-1][1], dp[N-1][2])));





		}


	}


}


Measured memory_bytes: 66768
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a = [0] + a + [0]
s = 0
for i in range(n + 1):
    s += abs(a[i] - a[i + 1])
for i in range(n):
    print(s + abs(a[i] - a[i + 2]) - abs(a[i] - a[i + 1]) -
          abs(a[i + 1] - a[i + 2]))


Measured memory_bytes: 20544
//#include <bits/stdc++.h>
// utility
#include <bitset>
#include <tuple>
#include <typeinfo>
// error handling
#include <cassert>
// string
#include <cctype>
#include <cstring>
#include <string>
// container
#include <array>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// algorithm
#include <algorithm>
// iterator
#include <iterator>
// math
#include <cmath>
#include <complex>
#include <numeric>
#include <random>
// i/o
#include <cstdio>
#include <iomanip>
#include <iostream>

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]) == typeid(INF) and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N;
  cin >> N;
  vector<int> v(N);
  rep(i, 0, N) { cin >> v[i]; }
  int ans = 0;
  vector<int> w(v);
  sort(all(w));
  rep(i, 0, N) v[i] = lower_bound(all(w), v[i]) - w.begin();
  dump(v);
  rep(i, 0, N) { ans += i % 2 != v[i] % 2; }

  cout << ans/2 << endl;

  return 0;
}


Measured memory_bytes: 1280
n,k=(int(i) for i in input().split())
e = [[int(i) for i in input().split()] for j in range(n)]
#print(n,k,e)
maxv=0
for i in range(n):
    maxv+=e[i][1]
#print(maxv)

dp = [[0 for i in range(maxv+1)] for j in range(n+1)]
#print(dp)

for i in range(1, maxv+1):
    dp[0][i] = float('inf')
#print(dp)

for j in range(n):
    for i in range(1, maxv+1):
        if i < e[j][1] :
            dp[j + 1][i] = dp[j][i]
        else:
            dp[j + 1][i] = min(dp[j][i], dp[j][i - e[j][1]] +e[j][0])
#print(dp)
ans = 0
for i in range(maxv+1):
    if dp[n][i] <= k and ans < i:
        ans = i
        
print(ans)

Measured memory_bytes: 321232
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
  int N,s1,s2,s3,s4;
  cin>>N;
  s1=N/1000;
  s2=(N-s1*1000)/100;
  s3=(N-s1*1000-s2*100)/10;
  s4=N-s1*1000-s2*100-s3*10;
  
  if (((s1==s2)&&(s2==s3))||((s2==s3)&&(s3==s4)))
	cout<<"Yes"<<endl;
  else 
    cout<<"No"<<endl;

}

Measured memory_bytes: 256
n = int(input())
def f(a, b):
    return max(len(str(a)), len(str(b)))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

l = make_divisors(n)

ans = 10**10
for v in l:
    ans = min(ans, f(v, n//v))
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> ii;
typedef vector <int> vi;
typedef double ld;
#define X first
#define Y second
#define mk make_pair
#define pb push_back
#define Rep(i, n) for(int i = 0; i < int(n); i ++)
#define Rep1(i, n) for(int i = 1; i <= int(n); i ++)
#define all(x) (x).begin(), (x).end()
const int MOD = (int) 1e9 + 7;
const ll base =  31;
void MAIN();
int main(){
    //freopen("input.txt", "r", stdin);
    ios:: sync_with_stdio(false); cin.tie(0);
    MAIN();
    return 0;
}
////////////////////////////////////////////////////////////////////////

const int N = 100032;

int n, m, k, p, ans[N];
vector <ii> G[N], Q[N];
int d[N];
ii x[N];
vector <int> in[N];
int par[N], sz[N], cur;

int Find(int u){
    if(u == par[u]) return u;
    return par[u] = Find(par[u]);
}

void Union(int u, int v){
    u = Find(u); v = Find(v);
    if(u == v) return;
    if(sz[u] >= sz[v]) swap(u, v);
    Rep(i, in[u].size()){
        int a = in[u][i];
        in[v].pb(a);
        Rep(j, Q[a].size()){
            int b = Q[a][j].X;
            if(Find(b) == v){
                ans[Q[a][j].Y] = cur;
            }
        }
    }
    sz[v] += sz[u];
    par[u] = v;
}

void MAIN(){
    cin >> n >> m >> k >> p;
    while(m --){
        int u, v, c;
        cin >> u >> v >> c;
        G[u].pb(ii(v, c));
        G[v].pb(ii(u, c));
    }
    priority_queue <ii> q;
    memset(d, 0x3f, sizeof d);
    while(k --){
        int u;
        cin >> u;
        d[u] = 0;
        q.push(ii(d[u], u));
    }
    while(!q.empty()){
        int u = q.top().Y, r = -q.top().X;
        q.pop();
        if(d[u] != r) continue;
        Rep(i, G[u].size()){
            int v = G[u][i].X, c = G[u][i].Y;
            if(d[v] > d[u] + c){
                d[v] = d[u] + c;
                q.push(ii(-d[v], v));
            }
        }
    }
    for(int i = 1; i <= n; i ++){
        x[i] = ii(-d[i], i);
        par[i] = i;
        sz[i] = 1;
        in[i].pb(i);
    }
    Rep(i, p){
        int s, t;
        cin >> s >> t;
        if(s == t) ans[i] = d[s];
        else {
            Q[s].pb(ii(t, i));
            Q[t].pb(ii(s, i));
        }
    }
    sort(x + 1, x + n + 1);
    memset(ans, 0xff, sizeof ans);
    for(int i = 1; i <= n; i ++){
        cur = -x[i].X;
        int u = x[i].Y;
        Rep(i, G[u].size()){
            int v = G[u][i].X;
            if(d[v] < d[u]) continue;
            Union(u, v);
        }
    }
    Rep(i, p) cout << ans[i] << "\n";
}

Measured memory_bytes: 24624
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>

using ll = long long;

using namespace std;

using P = pair<string, char>;
#define fi first
#define se second

int main() {
    int n;
    cin >> n;
    set<P> s[n+1];
    s[0].insert({"", 'a'});
    for (int i=0; i<n; i++) {
        for (auto &p:s[i]) {
            for (char c='a'; c<=p.se; c++) {
                s[i+1].insert({p.fi + c, max((char)(c+1), p.se)});
            }
        }
    }
    for (auto &p:s[n]) cout << p.fi << '\n';
    return 0;
}

Measured memory_bytes: 17408
#include <iostream>
#include <vector>

int main() {
    int h, w, ny, nx;
    std::cin >> h >> w;
    std::vector<std::vector<char>> vec(h+1, std::vector<char>(w+1, '?'));
    int dy[] = {1,-1, 0, 0};
    int dx[] = {0, 0, 1, -1};
    for (int i = 0; i < h; i++) {
        for (int p = 0; p < w; p++) {
            std::cin >> vec[i][p];
        }
    }

    for (int i = 1; i <= h; i++) {
        for (int p = 1; p <= w; p++) {
            if (vec[i][p] == '#') {
                bool paintable = false;
                for (int k = 0; k < 4; k++) {
                    ny = i + dy[k];
                    nx = p + dx[k];
                    if (ny <= 0 || nx <= 0 || ny > h || nx > w) {
                        paintable = true;
                        continue;
                    }
                    else if (vec[ny][nx] == '#') {
                        paintable = true;
                    }
                }
                if (!paintable) {
                    std::cout << "No" << std::endl;
                    return 0;
                }
            }
        }
    }
    std::cout << "Yes" << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 *
 * @author cs18097
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n+1];
        int[] b = new int[n];
        long ans = 0;
        for(int i = 0;i < n+1;i++){
            a[i] = sc.nextInt();
        }
        for(int i = 0;i < n;i++){
            b[i] = sc.nextInt();
        }
        for(int i = 0;i< n;i++){
            if(a[i] < b[i]){
                ans += a[i];
                b[i] -= a[i];
                if(a[i+1]<b[i]){
                    ans += a[i+1];
                    a[i+1]=0;
                }else{
                    ans += b[i];
                    a[i+1] -= b[i];
                }
            } else {
                ans += b[i];
            }
        }
        System.out.print(ans);
    }
    
}


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

main()
{
  while(1){
    int n,r; cin >> n >> r;
    if(n == 0) break;
    vi a(n);
    rep(i,n) a[i] = n-i;
    rep(i,r){
      int p,c; cin >> p >> c;
      vi C(c);
      FOR(j,p-1,p+c-1) C[j-p+1] = a[j];
      ROF(j,p-1,0) a[j+c] = a[j];
      rep(j,c) a[j] = C[j];
    }
    cout << a[0] << endl;
  }      
}


Measured memory_bytes: 3008
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    cin >> c;
    cout << (char)((int)c + 1) << "\n";
    return 0;
}

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

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

	while (true) {
		C -= B;
		if (C <= 0) {
			std::cout << "Yes" << '\n';
			return 0;
		}
		A -= D;
		if (A <= 0) {
			std::cout << "No" << '\n';
			return 0;
		}
	}
}


Measured memory_bytes: 3636
program main
  implicit none
  integer(8) i, a, b, a1, b1
  read(*, *)a, b
  a1 = a
  b1 = b
  !read(*, *) (L(i), i = 1,N)
  !ユークリッドの互除法でaとbの最大公約数を求めます。
  do
    if (a == b) then
      exit
    elseif (a > b) then
      a = a-b
    else
      b = b-a
    end if
  end do
      

  write(*, *) (a1*b1)/a
end program main


Measured memory_bytes: 640
#include <iostream>
#include <stack>
#include <cstring>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

stack <int> st1;
stack <pair<int, int> > st2;
vector <int> ve;
string str;
int ans;

int main(void) {
    cin >> str;
    for (int i = 0; i < str.length(); i ++) {
        if (str[i] == '\\') {
            st1.push(i);
        }
        else if (str[i] == '/') {
            if (!st1.empty()) {
                int a = i - st1.top();
                int j = st1.top();
                st1.pop();
                ans += a;
                while (!st2.empty() && st2.top().first > j) {
                    a += st2.top().second;
                    st2.pop();
                }
                st2.push(make_pair(j, a));
            }
        }
    }
    while (!st2.empty()) {
        ve.push_back(st2.top().second);
        st2.pop();
    }
    cout << ans << endl << ve.size();
    for (int i = ve.size() - 1; i >= 0; i --) {
        cout << ' ' << ve[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3280
# = int(input())
A, B = input().split()
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

B = int(float(B)*1000)
A = int(A)

AB = A*B//1000

print(AB)


Measured memory_bytes: 9164
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<char, ll> freq;
  string pat = "MARCH";
  REP(i, 0, n) {
    string s;
    cin >> s;
    if (find(pat.begin(), pat.end(), s[0]) != pat.end())
      freq[s[0]] += 1;
  }
  vector<pair<char, ll> > t(freq.begin(), freq.end());
  int m = t.size();
  ll tot = 0;
  REP(i, 0, m) {
    REP(j, i + 1, m) {
      REP(k, j + 1, m) {
	tot += t[i].second * t[j].second * t[k].second;
      }
    }
  }
  cout << tot << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include <set>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)


int main(void)
{
	int ans = 0;
	int n;

	cin >> n;
	vector<int> A(n), B(n),C(n);


	rep(i, n)
	{
		cin >> A[i];
	}


	rep(i, n)
	{
		cin>> B[i];

		ans += B[i];

	}

	rep(i, n-1)
	{
		cin >> C[i];
	}

	rep(i, n-1)
	{

		if (A[i]+1 == A[i + 1] ) ans += C[A[i]-1];
	}

	cout << ans << endl;
}

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

const int N_MAX = 105;

int main(){
    int n;
    cin >> n;
    bool ans = true;
    for(int i = 0; i < n; i++){
        int A;
        cin >> A;
        if (A % 2 == 0){
            if (A % 3 != 0 && A % 5 != 0)ans = false;
        }
    }
    if (ans)cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a, b, c, x, y, price_min, price_ab, price_c_max, price_ab_c;

	scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
	price_ab = a*x + b*y;
	if(x > y){
		price_c_max = x*2*c;
		price_ab_c  = y*2*c + (x-y)*a;
	}else{
		price_c_max = y*2*c;
		price_ab_c  = x*2*c + (y-x)*b;
	}
	if(price_ab > price_c_max){
		if(price_c_max > price_ab_c){
			price_min = price_ab_c;
		}else{
			price_min = price_c_max;
		}
	}else if(price_ab > price_ab_c){
		price_min = price_ab_c;
	}else{
		price_min = price_ab;
	}
	printf("%d\n", price_min);
	return 0;
}

Measured memory_bytes: 128
/*   Then, everything changed when the Fire Nation attacked. */

#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define mod 1000000007
#define fi first
#define se second
using namespace std;
int n;
map<string,int>mp;
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // shuffle(permutation.begin(), permutation.end(), rng);
    cin>>n;
    char lastl;
    for(int i=1;i<=n;++i)
    {
        string s;
        cin>>s;
        if(i==1)
        {
            mp[s]=1;
            lastl=s.back();
            continue;
        }
        if(s[0]!=lastl)
        {
            cout<<"No";
            return 0;
        }
        if(mp[s])
        {
            cout<<"No";
            return 0;
        }
        mp[s]=1;
        lastl=s.back();
    }
    cout<<"Yes";
    return 0;
}


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

using namespace std;
const int IINF = INT_MAX;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000000000
int n;

int main(){
    string s; cin >> s;
    
    rep(i,2){
    	if(s[i] != s[i+1]){
    		cout << "Yes" << endl;
    		return 0;
    	}
    }
    
    cout << "No" << endl;
    return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main(){
	int n,a,b;
	cin>>n>>a>>b; 
	int sum = a+b; 
	int ans = 0; 
	ans = (n/sum) * a; 
	n %= (a+b); 
	ans += min(a,n); 
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A1 = sc.nextInt();
		int A2 = sc.nextInt();
		int A3 = sc.nextInt();
		sc.close();
		String ans = "";
		if(A1 + A2 + A3 >= 22) ans = "bust";
		else ans = "win";
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

ll Pow(ll n, ll k) {
	ll ans = 1, a = n % MOD;
	while (k > 0) {
		if (k & 1) {
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		k >>= 1;
	}
	return ans;
}

ll Inverse(ll a) {
	return Pow(a, MOD - 2);
}

ll Combi(ll n, ll a, vector<ll>& k) {
	chmin(a, n - a);
	if (a == 0)
		return 1;
	ll ans = k[n] * Inverse(k[a]);
	ans %= MOD;
	ans *= Inverse(k[n - a]);
	ans %= MOD;
	return ans;
}

void Init(vector<ll> &k) {
	k[0] = 1;
	for (int i = 1; i < k.size(); i++) {
		k[i] = k[i - 1] * i;
		k[i] %= MOD;
	}
	return;
}

int main(void) {
	ll num, i, a, ans = 0;
	vector<ll> k(400001);
	Init(k);
	cin >> num >> a;
	chmin(a, num - 1);
	if (a == num - 1) {
		ans = Combi(2 * num - 1, num - 1, k);
	}
	else {
		rep(i, a + 1) {
			ans += Combi(num, i, k) * Combi(num - 1, i, k) % MOD;
			ans %= MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;

typedef long long ll;

typedef long double ld;


ll N, M, K, Q, A, B, C;

long double prob = 0;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> K;
	for (int i = 1; i <= N; ++i){
		int x = i;
		ld de = (ld)((ld)1/(ld)N);
		ld half = 1;
		while (x < K){
			x *= 2;
			half *= 0.5;
		}
		prob += de*half;
	}
	cout << setprecision(16) << prob << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k,x,mi,mx;
int main(){
	scanf("%d%d",&k,&x);
	mi=max(-100000,x-k+1);
	mx=min(1000000,x+k-1);
	for(int i=mi;i<=mx;i++)printf("%d ",i);
}


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

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

    int b[m], A[n][m];
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < m; ++i) {
            cin >> t;
            A[j][i] = t;
        }
    }

    for (int i = 0; i < m; ++i) {
        cin >> t;
        b[i] = t;
    }

    for (int j = 0; j < n; ++j) {
        int x = 0;

        for (int i = 0; i < m; ++i) {
            x += b[i] * A[j][i];
        }

        cout << x << endl;
    }

    return 0;
}

Measured memory_bytes: 1196
N=int(input())
A=list(map(int,input().split()))
 
count=0
score=0

SUM=[0 for i in range(N+1)]
SUM[0]=0
 
for i in range(1,N+1):
    SUM[i]=SUM[i-1]+A[i-1]

    
SUM.sort()



for i in range(1,N+1):
    if SUM[i]==SUM[i-1]:
        count=count+1
    else:
        if count!=0:
            score=score+count*(count+1)//2
        count=0
        
if count!=0:
    score=score+count*(count+1)//2

 
print(score)

Measured memory_bytes: 25976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      cout << i << "x" << j << "=" << (i * j) << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 3112
k=int(input())
x=set()
for i in range(1,10):
	x.add(i)

while len(x)<=10**5:
	y=list(x)
	for i in y:
		j=int(str(i)[-1])
		l=i*10+(j-1)
		m=i*10+j
		r=i*10+(j+1)
		x.add(m)
		if j!=0:
			x.add(l)
		if j!=9:
			x.add(r)

y=sorted(list(x))

print(y[k-1])

Measured memory_bytes: 29884
#define _CRT_SECURE_NO_DEPRECATE
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int         N_MAX = 100000 + 2;
vector<int>       G[N_MAX];
int               n, m;
int               Q;
int               color[N_MAX];

void dfs(int v, int c) {
    color[v] = c;
    int size = G[v].size();
    for (int i = 0; i < size; i++) {
        int to = G[v][i];
        if (!color[to]) dfs(to, c);
    }
}

int main() {
    while (scanf("%d%d", &n, &m) != EOF) {
        memset(color, 0, sizeof(color));
        for (int i = 0; i < n; i++) {
            G[i].clear();
        }
        for (int i = 0; i < m; i++) {
            int from, to;
            scanf("%d%d", &from, &to);
            G[from].push_back(to);
            G[to].push_back(from);
        }
        int c = 1;
        for (int i = 0; i < n; i++) {
            if (!color[i]) {
                dfs(i, c);
                c++;
            }
        }

        scanf("%d", &Q);
        for (int i = 0; i < Q; i++) {
            int from, to;
            scanf("%d%d", &from, &to);
            if (color[from] == color[to])
                puts("yes");
            else
                puts("no");
        }
    }

    return 0;
}



Measured memory_bytes: 13728
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <queue>

using namespace std;



int main(){
  int n;
  cin >> n;
  int i;
  int a[n];
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  int b[n];
  for(i=0;i<n;i++){
    b[a[i]-1] = i+1;
  }
  for(i=0;i<n;i++){
    cout << b[i] << " ";
  }
  cout << endl;

}


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

int main() {
    
    int N;
    cin >> N;
    
    if (N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9) {
        cout << "hon" << endl;
    }
    
    if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) {
        cout << "pon" << endl;
    }
    
    if (N % 10 == 3) {
        cout << "bon" << endl;
    }
    
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  map<int,int> freq;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    freq[x]++;
  }
  int c=0;
  for(auto i:freq)
  {
    if(i.first<i.second)
      c+=abs(i.first-i.second);
    else if(i.first>i.second)
      c+=(i.second);
  }
  cout<<c;
  return 0;
}

Measured memory_bytes: 4736
a, b, c, d = input()

for i in range(2**3):
    op = bin(i)[2:].zfill(3).replace("0", "-").replace("1", "+")
    equation = a + op[0] + b + op[1] + c + op[2] + d
    if eval(equation) == 7:
        print(equation + '=7')
        break

Measured memory_bytes: 9032
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    long long int s[n+5];
    for(long long int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    long long int odd=0;
    long long int even=0;
    for(long long int i=0;i<n;i++)
    {
        if(s[i]%2!=0)
        {
            odd++;
        }
        else
        {
            even++;
        }
    }
    if(odd%2==0)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        if(n==1)
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 4408
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n, k, s;
    cin >> n >> k >> s;
    for(int i = 0; i < n; i++){
        cout << (i < k ? s : (s == 1e9 ? 1 : (int)1e9)) << '\n';
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define pb push_back 
#define x first 
#define y second 
#define MOD 998244353LL

#if 1
#define pi(x) printf("%s = %i; ", #x, x)
#define ps(x) printf("%s = %s; ", #x, x.c_str())
#define pn printf("\n");
#else  
#define pi(x)
#define ps(x)
#define pn
#endif

using namespace std;
typedef long long ll;
typedef pair< int , int > PII;
const int dirx[] = {0,1,0,-1};
const int diry[] = {1,0,-1,0};
inline void debugMode() {
    #ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
    #endif
}

int n, a[100100], b[100100], c[100100];
ll rs;

int main(){
	//debugMode();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	for (int i  = 1; i <= n; i++) cin >> c[i];
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	sort(c + 1, c + n + 1);
	for (int i = 1; i <= n; i++){
		int p1 = upper_bound(a + 1, a + n + 1, b[i] - 1) - a - 1;
		int p2 = upper_bound(c + 1, c + n + 1, b[i]) - c;
		//cout << p1 << " " << p2 << "\n";
		rs += 1LL * (p1) * (n - p2 + 1);
	}
	cout << rs;
	return 0;
}


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

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

  int den = 0;
  int bus = 0;

  if (A >= B) {
    den = B;
  }
  if (A <= B) {
    den = A;
  }
  if (C >= D) {
    bus = D;
  }
  if (C <= D) {
    bus = C;
  }

  cout << den + bus << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <deque>
#include <algorithm>
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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, deque<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }


int N, K;
string S;

using Data = deque<pair<char,int> >;
char conv(char c, int change) {
    if (change & 1) return (c == 'A' ? 'B' : 'A');
    else return c;
}

string recon(const Data &v, int change) {
    string res = "";
    int sum = 0;
    for (auto p : v) {
        sum += p.second;
        for (int i = 0; i < p.second; ++i) res += conv(p.first, change);
    }
    return res;
}

int main() {
    cin >> N >> K >> S;
    Data v;
    for (int i = 0; i < S.size();) {
        int j = i+1;
        while (j < S.size() && S[j] == S[i]) ++j;
        v.push_back({S[i], j-i});
        i = j;
    }
    int LIMIT = (int)S.size() * 10;
    if ((K - LIMIT) & 1) ++LIMIT;
    if (K > LIMIT) K = LIMIT;
    int change = 0;
    for (int i = 0; i < K; ++i) {
        char c = conv(v[0].first, change);
        if (c == 'A') {
            auto p = v[0];
            v.pop_front();
            if (p.second > 1) v.push_front({conv('A', change), p.second - 1});
            v.push_front({conv('B', change), 1});
        }
        else {
            ++change;
            v[0].second--;
            if (v[0].second == 0) v.pop_front();
            v.push_back({conv('A', change), 1});
        }

        //cout << i << ": " << recon(v, change) << ", " << change << endl;
    }
    cout << recon(v, change) << endl;
}


Measured memory_bytes: 2724
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  pair<pair<string,int>,int> a[110];
  for(int i = 0; i < n; i++) {
    string s;
    int tmp;
    cin >> s >> tmp;
    a[i] = make_pair(make_pair(s,tmp*-1),i);
  }
  sort(a,a+n);
  for(int i = 0; i < n; i++) {
    cout << a[i].second+1 << endl;
  }
  return 0;
}


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

const int maxe = 2e5+5;

ll t=1, n, x, k;
ll arr[maxe];
ll dp[maxe];
void solve(){
	cin >> n >> k;
	for(int i = 1; i<=n; i++){
		cin >> arr[i];
	}
	for(int i = 1; i<=n; i++){
		dp[i] = LLONG_MAX;
	}
	dp[1] = 0;
	for(int i = 2; i<=k; i++){
		for(int j = 1; j<i; j++){
			dp[i] = min(dp[i], dp[j] + abs(arr[i]-arr[j]));
		}
	}
	for(int i = k+1; i<=n; i++){
		for(int j = 1; j<=k; j++){
			dp[i] = min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]));
		}
	}
	cout << dp[n];
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	while(t--){
		solve();
	}
    return 0;
}


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

int main (){
  int A ,B;
  std::string op;

  std::cin >> A >> op >> B;

  if(op == "+"){
    std::cout << A + B << std::endl;
  }else if(op == "-"){
    std::cout << A - B << std::endl;
  }else{
    return -1;
  }

  return 0;
}

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

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string cl;
		cin >> cl;
		if ((cl == "P" || cl == "W" || cl == "G")&&i<N-1) {
			continue;
		}
		if ((cl == "P" || cl == "W" || cl == "G") && i == N - 1) {
			cout<<"Three";
		}
		if (cl == "Y") {
			cout << "Four";
			break;
		}
	}
	
}

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

int main(){
    int n, p1=0, p2=0;
    cin >> n;
    for(int i=0;i<n;++i){
        string c1, c2;
        cin >> c1 >> c2;
        if(c1 == c2) {
            p1++;
            p2++;
        } else {
            (c1>c2?p1:p2) += 3;
        }
    }
    cout << p1 << " " << p2 << endl;
    return 0;
}



Measured memory_bytes: 3216
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stdint.h>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef pair<int ,int> pp;
typedef long long ll;
const ll MOD = 1000000007;

int main(){
    int n;
    cin>>n;
    for(int i = 1; i < 10; i++){
        if(n % i == 0 && n / i <10){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int c[55][55],v[55];
int n,A,B;
long long int sum, num, val;
int main(){
	cin>>n>>A>>B;
	for(int i=0; i<=n; i++)
		for(int j=0; j<=i; j++)
			c[i][j] = j==0||j==i?1:c[i-1][j]+c[i-1][j-1];
	for(int i=0; i<n; i++)
		cin>>v[i];
	sort(v,v+n);
	reverse(v,v+n);
	sum = 0;
	num = 1;
	val = 0;
	for(int i=A; i<=B; i++){
		long long int tot = 0;
		long long int AA = 0, BB = 0;
		for(int j=0; j<n; j++)
			if(v[j] == v[i-1])AA++;
		for(int j=0; j<i; j++){
			tot += v[j];
			if(v[j] == v[i-1])BB++;
		}
		long long int qq = c[AA][BB];
		if(tot * num > sum * i){
			sum = tot;
			num = i;
			val = qq;
		}else
		if(tot * num == sum * i){
			val += qq;
		}
	}
	printf("%lf\n", (double)(sum) / num);
	fflush(stdout);
	cout<<val<<endl;
	return 0;
}


Measured memory_bytes: 3788
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
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;}
// clang-format on

ll gcd(ll x, ll y) {
  if (!x || !y)
    return x + y;
  return gcd(y, x % y);
}

void solve(long long A, long long B) {
  ll ans = 0;
  ll g = gcd(A, B);
  for (ll i = 2; i * i <= g; i++) {
    if (g % i == 0) {
      ans++;
      while (g % i == 0)
        g /= i;
    }
  }
  if (g > 1)
    ans++;
  cout << ans + 1 << endl;
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Общий файл. 
#include <ext/pb_ds/tree_policy.hpp> // Содержит класс tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

ll Pow(ll a, ll b) {
    ll x = 1, y = a;
    while (b) {
        if (b % 2) {
            x = x * y % MOD;
        }
        y = y * y % MOD;
        b /= 2;
    }
    return x;
}

ll Inv(ll x) {
    return Pow(x, MOD - 2);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> fact(n + 1);
    fact[0] = 1;
    fore(i, 1, n) fact[i] = fact[i - 1] * i % MOD;
    vector<int> p(n);
    ordered_set frees;
    forn(i, 0, n) frees.insert(i);
    forn(i, 0, n) {
        cin >> p[i];
        --p[i];
        if (p[i] != -1)
            frees.erase(p[i]);
    }
    ordered_set ps;
    int free = 0;
    forn(i, 0, n) if (p[i] == -1) ++free;
    ll ans = 0;
    ll freeAfter = 0;
    ll avg = 0;
    ford(i, 0, n) {
        if (p[i] == -1) {
            ll cnt = avg * Inv(free) % MOD;
            cnt += freeAfter * Inv(2);
            cnt %= MOD;
            ans = (ans + cnt * fact[free] % MOD * fact[n - 1 - i]) % MOD;
            ++freeAfter;
        } else {
            ll cnt = ps.order_of_key(p[i]);
            ps.insert(p[i]);
            ll add = freeAfter * frees.order_of_key(p[i]) % MOD * Inv(free) % MOD;
            ll rez = (cnt + add) * fact[free] % MOD * fact[n - 1 - i];
            ans = (ans + rez) % MOD;
            avg += free - frees.order_of_key(p[i]);
            if (avg >= MOD) avg -= MOD;
        }
    }
    ans += fact[free];
    ans %= MOD;
    cout << ans << '\n';
}


Measured memory_bytes: 29568
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1000000000;



int main(){
    int N,K;cin >> N >> K;
    vector<P> pp;
    for (int i = 0; i < N; i++) {
        LL t,d;
        cin >> t >> d;
        pp.pb(P(d,t));
    }
    vector<LL> p(N+1,0);
    priority_queue<LL,vector<LL>,greater<LL>> q;
    sort(ALL(pp),greater<P>());
    vector<bool> x(N+1,false);
    LL sum=0,c=0;
    for (int i = 0; i < N; i++) {
        if(i<K){
            sum+=pp[i].fs;
            if(x[pp[i].sc]) q.push(pp[i].fs);
            else{
                x[pp[i].sc]=true;
                c++;
            }
            p[c]=sum;
        }
        else{
            if(q.empty()) break;
            if(!x[pp[i].sc]){
               c++; 
               x[pp[i].sc]=true;
               sum-=q.top();q.pop();
               sum+=pp[i].fs;
               p[c]=sum;
            }
        }
    }
    LL ans=0;
    for (LL i = 0; i <= N; i++) {
        if(p[i]==0) continue;
        ans=max(ans,p[i]+i*i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3440
n = int(input())
t, a = map(int, input().split())
list = [int(i) for i in input().split()]

dif_list = []

for i in range(n):
    t_i = t - list[i] * 0.006
    t_i_dif = abs(a - t_i)
    dif_list.append(t_i_dif)

Min = min(dif_list)
print(dif_list.index(Min) + 1)


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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if((A == B && B != C) || (A == C && B != C) || (C == B && A != C)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.ByteString.Char8 as BS

main = do
  [a,b] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  if even (a - b)
    then print $ (a + b) `quot` 2
    else putStrLn "IMPOSSIBLE"


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define RST(a) memset(a, 0, sizeof(a))
#define RSTV(a, v) memset(a, v, sizeof(a))
#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
const int INF = 0x3f3f3f3f, qhqh = 1000000007;
struct E {
  int u, v;
};
bool visited[100001];
vector<int> prepath[100001], path[100001];
ll result = 1;
int k;
void buildtree(int c, bool root = 1, int pos = 1) {
  result = result * c % qhqh;
  visited[pos] = 1;
  int cnt = !root;
  for (auto &p : prepath[pos])
    if (!visited[p]) ++cnt, buildtree(k - cnt, 0, p);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n >> k;
  FOR(i, 0, n - 1) {
    int u, v;
    cin >> u >> v;
    prepath[u].push_back(v);
    prepath[v].push_back(u);
  }
  buildtree(k);
  cout << result;
}

Measured memory_bytes: 10496
N = int(input())
A = list(map(int,input().split()))
V = [0]*(N+1)
A_sum = A[:] #その深さ以降で必要な葉の数

if N == 0:
    if A[0] == 1:
        print(1)
    else:
        print(-1)
    exit()

for i in range(N,0,-1):
    A_sum[i-1] += A_sum[i]
#print(A_sum)
V[0] = 1

for i in range(1,N+1):
    if A[i] > 2*(V[i-1] - A[i-1]):
        print(-1)
        exit()
    V[i] = min(2*(V[i-1] - A[i-1]), A_sum[i])
ans = sum(V)
print(ans)

Measured memory_bytes: 83436
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
    long long n, m, d;
    cin >> n >> m >> d;

    if (d == 0) {
        cout << setprecision(8) << (m - 1) * 1.0 / n << endl;
    } else {
        cout << setprecision(8) << ((n - d) * 2 * (m - 1)) * 1.0 / (n * n);
    }

    return 0;
}

Measured memory_bytes: 888
#include<cstdio>
#include<cstring>
using namespace std;
char a[1005];
int main()
{
	scanf("%s",a+1);
	for(int i=1;i<=strlen(a+1);i++)
	{
		if(a[i]=='9'){printf("Yes\n");return 0;}
	}
	printf("No\n");
}

Measured memory_bytes: 128
import java.util.Scanner;
 
public class Main {
    
    public static void main(String[] args) throws Exception{    
        Scanner sc = new Scanner(System.in);
        
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        
        long c = 0;
        
        if(a%x == 0){
        	c++;
        }
        
        c += b/x - a/x;
        
        System.out.println(c);
        
        sc.close();
    }
}

Measured memory_bytes: 9800
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

#define mem(ar,a)       memset(ar,a,sizeof ar)
#define iOS               ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define pb(x)           push_back(x)
#define all(c)          c.begin(), c.end()
#define ff              first
#define ss              second
#define nl              '\n'

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

    int sum=0;
    for(int i=0;i<s.size();i++){
        sum+=(s[i]-'0');
    }
    if(sum%9==0)
        cout<<"Yes";
    else
        cout<<"No";
}



Measured memory_bytes: 3728
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll a, b, c; cin >> a >> b >> c;
    bool ok = true;
    ok &= a == b;
    ok &= b == c;
    ok &= a == c;
    cout << (ok ? "Yes" : "No") << endstr;
    return 0;
}


Measured memory_bytes: 256
a = input()
b = input()
c = input()
d = {
  'a':a, 
  'b':b,
  'c':c
}
n = 'a'
while(True):
  if d[n] == '':
    break
  nx = d[n][0]
  d[n] = d[n][1:]
  n = nx

print(n.upper())

Measured memory_bytes: 3060
S = input()
mojidic = {}
for i in range(4):
    if S[i] in mojidic.keys():
        mojidic[S[i]] += 1
    else:
        mojidic[S[i]] = 1
mvalue = list(mojidic.values())
if mvalue == [2,2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

int gcd(int n, int m) {
  if(n < m) swap(n, m);
  if(m == 1) return 1;
  else if(m == 0) return n;
  else return gcd(m, n%m);
}

signed main() {
  int N, X; cin >> N >> X;
  vector<int> x(N);
  rep(i, N) {
    int xx; cin >> xx;
    x[i] = abs(xx-X);
  }
  sort(all(x));
  
  
  int ans = x[0];
  
  rep(i, N) {
    ans = gcd(ans, x[i]);
  }
  
  cout << ans << endl;
  

}


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

#define MOD 1000000007

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

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

	// all = B塊とRの並べ方(0オリジンだけど+1して考えてね)
	// bdearl = B塊にBを並べる方法
	// *****重要*****
	// modしてある値ね。
	vector<long long> all(k), bdeal(k);
	all[0] = n - k + 1;
	bdeal[0] = 1;
	cout << (all[0] * bdeal[0]) % MOD << endl;
	for (int i = 1; i < k; i++) {
		all[i] = (all[i - 1] * (n - k + 2 - (i + 1))) % MOD * modinv(i + 1, MOD) % MOD;
		bdeal[i] = (bdeal[i - 1] * (k - i)) % MOD * modinv(i, MOD) % MOD;
		cout << (all[i] * bdeal[i]) % MOD << endl;
	}


	return 0;
}

Measured memory_bytes: 256