akhauriyash/Code-Regression huggingface dataset:
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int[] a;
	while (a = readln.split.map!(to!int).array, a[0]) {
		int cnt;
		bool f[10];
		
		void solve (int c, int sum, int l) {
			if (c == a[0]) {
				if (sum == a[1]) cnt++;
				return;
			}
			foreach (i; l..10) {
				if (f[i]) continue;
				f[i] = 1;
				solve(c+1, sum+i, i+1);
				f[i] = 0;
			}
		}
		solve(0, 0, 0);
		cnt.writeln;
	}
}

Measured memory_bytes: 1048
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

void solve()
{

}

int main()
{ios_base::sync_with_stdio(false);
cin.tie(0);
int x;
cin>>x;
x-=400;
x/=200;
ol(8-x);
return 0;
}



Measured memory_bytes: 3656
program ABC169B
    implicit none
    integer(8)::N,i
    integer(16)::ans
    integer(8),allocatable,dimension(:)::A
    read*,N
    allocate(A(N))
    read*,A
    call heapsort(N,A)
    if(A(1)==0)then
        print'(i0)',0
    else
        ans=1
        do i=1,N
            ans=ans*A(i)
            if(ans>10_8**18)then
                ans=-1
                exit
            end if
        end do
        print'(i0)',ans
    end if
end program ABC169B

subroutine heapsort(n,array)
    implicit none
    integer(8),intent(in) :: n
    integer(8),intent(inout) :: array(1:n)
   
    integer(8) ::i,k,j,l
    integer(8) :: t
   
    if(n.eq.1)return
  
    l=n/2+1
    k=n
    do while(k.ne.1)
       if(l.gt.1)then
          l=l-1
          t=array(L)
       else
          t=array(k)
          array(k)=array(1)
          k=k-1
          if(k.eq.1) then
             array(1)=t
             exit
          endif
       endif
       i=l
       j=l+l
       do while(j.le.k)
          if(j.lt.k)then
             if(array(j).lt.array(j+1))j=j+1
          endif
          if (t.lt.array(j))then
             array(i)=array(j)
             i=j
             j=j+j
          else
             j=k+1
          endif
       enddo
       array(i)=t
    enddo
  
    return
end subroutine heapsort

Measured memory_bytes: 3928
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	Scanner sc = new Scanner(System.in);

	int INF = 1 << 28;
	double EPS = 1e-6;

	int n;
	P[] ps;
	double rad;

	void run() {
		n = sc.nextInt();
		ps = new P[n];
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int z = sc.nextInt();
			ps[i] = new P(x, y, z);
		}
		rad = sc.nextInt();
		solve();
	}

	void solve() {
		int max = 1;
		for (int trial = 0; trial < 10; trial++) {
			Random rand = new Random(trial * trial * trial);
			double d1 = rand.nextDouble() * PI, d2 = rand.nextDouble() * PI, d3 = rand
					.nextDouble()
					* PI;
			for (int i = 0; i < n; i++) {
				ps[i] = ps[i].div(ps[i].norm());
				P p = ps[i];
				double cos = cos(d1), sin = sin(d1);
				p = new P(p.x * cos - p.y * sin, p.x * sin + p.y * cos, p.z);
				cos = cos(d2);
				sin = sin(d2);
				p = new P(p.x, p.y * cos - p.z * sin, p.y * sin + p.z * cos);
				cos = cos(d3);
				sin = sin(d3);
				p = new P(p.z * sin + p.x * cos, p.y, p.z * cos - p.x * sin);
				ps[i] = p;
			}
			rad = toRadians(rad);
			double cos = cos(rad), sin = sin(rad);

			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					P P = ps[i], Q = ps[j];
					double A, B, C, D;
					{
						double a = -(P.x * Q.z - Q.x * P.z);
						double b = (Q.z - P.z) * cos * cos;
						double c = (P.y * Q.z - Q.y * P.z);
						A = a / c;
						B = b / c;
					}
					{
						double a = -(P.x * Q.y - Q.x * P.y);
						double b = (Q.y - P.y) * cos * cos;
						double c = (P.z * Q.y - Q.z * P.y);
						C = a / c;
						D = b / c;
					}
					for (double vx : quad(1 + A * A + C * C,
							2 * (A * B + C * D), B * B + D * D - cos * cos)) {
						double vy = A * vx + B, vz = C * vx + D;
						P v = new P(vx, vy, vz);
						int count = 0;
						for (int k = 0; k < n; k++) {
							double acos = acos(v.dot(ps[k])
									/ (v.norm() * ps[k].norm()));
							if (abs(acos) < rad + EPS) {
								count++;
							}
						}
						max = max(max, count);
					}
				}
			}
		}
		println(max + "");
	}

	double[] quad(double a, double b, double c) {
		double D = b * b - 4 * a * c;
		if (D + EPS < 0) {
			return new double[0];
		}
		D = max(D, 0);
		return new double[] { (-b - sqrt(D)) / (2 * a), 2 * c / (-b - sqrt(D)) };
	}

	class P {
		double x, y, z;

		P(double x, double y, double z) {
			this.x = x;
			this.y = y;
			this.z = z;

		}

		double dot(P p) {
			return x * p.x + y * p.y + z * p.z;
		}

		P div(double d) {
			return new P(x / d, y / d, z / d);
		}

		double norm() {
			return sqrt(x * x + y * y + z * z);
		}
	}

	void debug(Object... os) {
		System.err.println(deepToString(os));
	}

	void println(String s) {
		System.out.println(s);
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
void vprint() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}
template <class T> void mprint(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << "";
        }
    }
}

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

    int H, W;
    cin >> H >> W;
    vector<vector<char>> m(H, vector<char>(W));
    REP(i, H) REP(j, W) cin >> m[i][j];

    vector<int> dx = {-1, 1, 0, 0};
    vector<int> dy = {0, 0, -1, 1};
    auto exist     = [](int H, int W, int nx, int ny) -> bool {
        if (nx < 0 || W <= nx || ny < 0 || H <= ny)
            return false;
        else
            return true;
    };
    REP(y, H) {
        REP(x, W) {
            bool ng = true;
            if (m[y][x] == '#') {
                REP(i, 4) {
                    int nx = x + dx[i];
                    int ny = y + dy[i];
                    if (exist(H, W, nx, ny)) {
                        if (m[ny][nx] == '#')
                            ng = false;
                    }
                }
                if (ng) {
                    print("No");
                    return 0;
                }
            }
        }
    }
    print("Yes");

    return 0;
}

Measured memory_bytes: 256
import bisect

N, M = map(int, input().split())
PY = []
array = [[] for _ in range(N)]

for _ in range(M):
    P, Y = map(int, input().split())
    PY.append([P, Y])
    array[P-1].append(Y)
    
for i in range(N):
    array[i].sort()

for p, y in PY:
    n = bisect.bisect_left(array[p-1], y) + 1
    print('%06d%06d' % (p, n))


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

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
  #define DFUNC(fname, ...) fname(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DFUNC(fname, ...)
#endif

ll mPrime = int(1e9) + 7;

ll mAdd(ll x, ll y) {
  ll z = x + y;
  if (z < mPrime)  return z;
  else             return (z - mPrime);
}

ll mSub(ll x, ll y) {
  ll z = x - y;
  if (z >= 0)  return z;
  else         return (z + mPrime);
}

ll mMul(ll x, ll y) {
  return (x * y) % mPrime;
}

ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

ll mInv(ll x) {
  ll s, t;
  eGCD(x, mPrime, s, t);
  return s < 0 ? s + mPrime : s;
}

// Combination.  This is only for one-shot.
ll combi(ll n, ll r) {
  if (n-r < r) { return combi(n, n-r); }
  ll x = 1;
  ll y = 1;
  for (ll i = 0; i < r; i++) {
    x = mMul(x, n-i);
    y = mMul(y, r-i);
  }
  return mMul(x, mInv(y));
}

ll N, M, K;

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> N >> M >> K;

  ll s1 = 0;
  for (ll n = 1; n <= N-1; n++) {
    s1 = mAdd(s1, mMul(n, (N - n)));
  }
  s1 = mMul(s1, mMul(M, M));

  ll s2 = 0;
  for (ll m = 1; m <= M-1; m++) {
    s2 = mAdd(s2, mMul(m, M - m));
  }
  s2 = mMul(s2, mMul(N, N));

  ll s = mAdd(s1, s2);
  ll answer = mMul(s, combi(N*M - 2, K-2));
  cout << answer << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011

ll n, i, l, r, auxl, auxr;
ll a[maxN], d;

int main()
{
    //freopen("test.in","r",stdin);

    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];

    l = r = 2;
    for (i = n; i > 0; i--) {
        d = a[i];

        auxl = (l + d - 1) / d;
        auxr = r / d;

        if (auxl > auxr) {
            cout << -1;
            return 0;
        }

        l = auxl * d;
        r = auxr * d + d - 1;
    }

    cout << l << ' ' << r;


    return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
aabs = [i if i>=0 else i*(-1) for i in a]
MIN = min(aabs)
ans = 0
mcount = 0

for i in range(n):
  if a[i] < 0:
    mcount += 1
    
if mcount%2 == 0:
  for i in a:
    ans += abs(i)
  print(ans)
else:
  for i in a:
    ans += abs(i)
  print(ans - 2*MIN)

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	vector<int> a(n + 1), b(n);
	for (int i = 0; i < n + 1; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	long long ans = 0;
	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];
			a[i] -= b[i];
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 3992
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        if (n % 2 == 1 || n == 1)
        {
            Console.WriteLine("No");
            return;
        }
        var str = s.Substring(0, n / 2);
        Console.WriteLine(s.EndsWith(str) ? "Yes" : "No");
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = 10000000;
const long long INFL = (1LL<<50);
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

struct UnionFind {
    // UnionFind u(n) 宣言
    // u.unionSet(x,y) 併合
    // u.findSet(x,y) -> {true, false}
    // u.root(x) xのroot. data[x]を参照。併合前はxそのもの、併合後は同一union
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

int main() {
    int n;cin>>n;
    vector<pii> city(n);
    rep(i,n)cin>>city[i].first>>city[i].second;
    
    map<pii,int> mp;
    map<int,pii> mpinv;
    rep(i,n){mp[city[i]] = i;mpinv[i] = city[i];}
    
    vector<vector<pair<int,int>>> d(n);
    multimap<int,pair<int,int>> edg;
    sort(all(city),[&](pii p1, pii p2){return p2.first > p1.first;});
    for(auto i = 0; i<n-1;i++) {
        edg.insert(make_pair(city[i+1].first-city[i].first,make_pair(mp[city[i]],mp[city[i+1]]))) ;
    }
    
    sort(all(city),[&](pii p1, pii p2){return p2.second > p1.second;});
    for(auto i = 0; i<n-1;i++) {
       edg.insert(make_pair(city[i+1].second-city[i].second,make_pair(mp[city[i]],mp[city[i+1]]))) ;
    }
    
    UnionFind u(n);
    ll ans = 0;
    for(auto x:edg){
        if(!u.findSet(x.second.first,x.second.second)){
            u.unionSet(x.second.first,x.second.second);
            ans +=x.first;
        }
    }
    cout<<ans<<endl;

    return 0;
}












Measured memory_bytes: 28828
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int K;
    cin>>K;

    if(K%7==0){
        K/=7;
    }
    int x=1;
    int y=1;
    int ans=0;
    if(K%2==0){
        cout << -1 << endl;
        return 0;
    }
    while(ans<=1000000){
        ans++;
        if(y%K==0){
            cout << ans << endl;
            return 0;
        }
        x=x*10;
        x%=K;
        y=y+x;
    }
    cout << -1 << endl;

    



}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define f(a,b) for(int i = a; i < b; i++)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<ll,pair<ll,ll>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MAXN = 500005;
using namespace std;
int arr[MAXN],dp[MAXN];
int main() {
  /* ifstream cin("input.txt");
   ofstream cout("output.txt");*/
   ll n,count=0;cin>>n;
   int arr[n];
   for(int i=0;i<n;i++){
   		cin>>arr[i];
   		if((i+1)&1){
   			if(arr[i]&1){
   				count++;
   			}
   		}
   }
   cout<<count<<endl;
   return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
#define int long long
#define MOD 1e9+7
typedef pair<int,int> P;
typedef pair<int,P> PP;

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


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

int main(){
	int w, h;
	while(1){
		int maizu[100][100] = {};
		cin>>w>>h;
		if(w == 0  && h == 0) break;
		for(int i = 0; i <= 2 * w; i++){
			maizu[0][i] = 1;
			maizu[h*2][i] = 1;
		}
		for(int i = 0; i <= 2 * h; i++){
			maizu[i][0] = 1;
			maizu[i][w*2] = 1;
		}
		
		for(int i = 1; i < 2 * h; i++){
			if(i%2 == 1){
				for(int j = 1; j < w; j++){
					cin>>maizu[i][j*2];
				}
			}else{
				for(int j = 1; j <= w; j++){
					cin>>maizu[i][j*2-1];
				}
			}
		}
		maizu[1][1] = 2; //maizu[2*h-1][2*w-1];
		
		
		while(1){
			int f = 0;
			for(int i = 1; i < 2 * h; i += 2){
				for(int j = 1; j < w * 2; j += 2){
					if(maizu[i][j] != 1 && maizu[i][j] != 0){
						if(maizu[i][j+1] == 0 && maizu[i][j+2] == 0){f++;
							maizu[i][j+2] = maizu[i][j]+1;
						}
						if(maizu[i][j-1] == 0 && maizu[i][j-2] == 0){f++;
							maizu[i][j-2] = maizu[i][j]+1;
						}
						if(maizu[i+1][j] == 0 && maizu[i+2][j] == 0){f++;
							maizu[i+2][j] = maizu[i][j]+1;
						}
						if(maizu[i-1][j] == 0 && maizu[i-2][j] == 0){f++;
							maizu[i-2][j] = maizu[i][j]+1;
						}
					}
				}
			}
			if(f == 0)break;
		}
		
		/*for(int i = 0; i <= 2 * h; i++){
			for(int j = 0; j <= 2 * w; j++){
				cout<<maizu[i][j];
			}cout<<endl;
		}*/
		
		if(maizu[2*h-1][2*w-1] != 0){
			cout<<maizu[2*h-1][2*w-1] - 1<<endl;	
		} else{
			cout<<0<<endl;
		}
		
		
		
	}
	return 0;
}


Measured memory_bytes: 3000
X = str(input())
n = len(X)-1
ans = 0

for i in range(2**n):
  l = X[0]
  for j in range(n):
    if (i>>j & 1) == 1:
      l += "+"
    l += X[j+1]
  #Xのjが入ってる番目の隙間でsplit
  num = map(int,l.split("+"))
  ans += sum(num)
print(ans)


Measured memory_bytes: 9080
package main
 
import (
	"fmt"
)

func main() {
	var a int
	var b string
	var o string
	fmt.Scan(&a)
	fmt.Scan(&b)
	numberList := map[int]string{1:"A", 2:"B", 3:"C", 4:"D", 5:"E", 6:"F", 7:"G", 8:"H", 9:"I", 10:"J", 11:"K", 12:"L", 13:"M", 14:"N", 15:"O", 16:"P", 17:"Q", 18:"R", 19:"S", 20:"T", 21:"U", 22:"V", 23:"W", 24:"X", 25:"Y", 26:"Z"}
	stringList := map[string]int{"A":1, "B":2, "C":3, "D":4, "E":5, "F":6, "G":7, "H":8, "I":9, "J":10, "K":11, "L":12, "M":13, "N":14, "O":15, "P":16, "Q":17, "R":18, "S":19, "T":20, "U":21, "V":22, "W":23, "X":24, "Y":25, "Z":26}
	for _, v := range b {
		k, _ := stringList[string(v)]
		k = k + a
		if k > 26 {
			k = k - 26
		}
		j, _ := numberList[k]
		o += j
	}
	fmt.Print(o)
}

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

using namespace std;
typedef long long ll;

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int cnt = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

ll n, sum;
int main() {
	scanf("%lld", &n);
	for (ll i = 1; i < n;) {
		ll div = n / i, mod = n % i;
		ll cnt = (mod + div) / div;

		if (mod >= div && (n % div == mod % div)) {
			ll dif = (mod - div) / div;
			if (n / (i + dif) == n % (i + dif))
				sum += i + dif;
		}
		i += cnt;
	}
	printf("%lld\n", sum);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<cstdio>
#include<queue>
#include<utility>
#include<stack>

using namespace std;

int x;


int main() {
  cin >> x;

  int t;
  for(t = 1;  t <= x; t++) {
    if(t*(t+1)/2 >= x) break;
  }

  cout << t << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
int N,T,L,i,m[100],n[100],r;main(){for(std::cin>>N>>T>>L>>L;i<N;i++)std::cin>>m[i]>>n[i];for(i=0;m[i]+n[i];++i%=N){if(m[i]){m[i]--;T++;r++;}else{n[i]--;r+=10;}if(T>L)break;if(r>8){T-=(r+1)%10;m[i]+=(r+1)%10;r=0;}if(T<0)break;}std::cout<<i+1<<"\n";}

Measured memory_bytes: 1168
//https://atcoder.jp/contests/aising2019/tasks/aising2019_b
//B - Contests
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
    ll N; cin>>N;
    ll A,B; cin>>A>>B;
    vector<ll> pn(N+1);
    unordered_map<ll,ll> tbl;
    tbl[0]=0;
    tbl[1]=0;
    tbl[2]=0;
    FOR(i,1,N+1){
        ll p; cin>>p;
        pn.at(i)=p;
        ll no=-1;
        if (p<=A){
            no=0;
        }else if(p>=A+1 && p <=B){
            no=1;
        }else if(p>=B+1){
            no=2;
        }else{
            assert(0);
        }
        tbl[no]++;
    }    
    ll ans=min(tbl[0],tbl[1]);
    ans=min(ans,tbl[2]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using dijkstra = priority_queue<T, vector<T>, greater<T>>;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fbo find_by_order  // k th index
#define ook order_of_key   // strictly smaller than k
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define max_ull 18446744073709551615
#define max_ll 9223372036854775807
#define lead_zero(x) __builtin_clzll(x)
#define trail_zero(x) __builtin_ctzll(x)
#define total_1s(x) __builtin_popcountll(x)
#define first_1(x) __builtin_ffsll(x)
#define log2_(x) __builtin_clz(1) - __builtin_clz(x)
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define QUERY           \
    int test;           \
    scanf("%d", &test); \
    for (int _T = 1; _T <= test; _T++)
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define all(v) v.begin(), v.end()
#define reunique(v) v.resize(std::unique(all(v)) - v.begin())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define ff first
#define ss second
#define MERGE(v1, v2, v) merge(all(v1), all(v2), back_inserter(v))
#define MP make_pair
#define EB emplace_back
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define in_range(v, r, l) upper_bound(all(v), r) - lower_bound(all(v), l)
#define LCM(a, b) (a / __gcd(a, b)) * b;

ll rdn(int y, int m, int d) {
    /* Rata Die day one is 0001-01-01 */
    if (m < 3)
        y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306;
}
/* Direction arrays */
/*int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};                             */  // 4Direction
/*int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1};         */  // 8Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};     */  // KnightDirection
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};                */  // HexagonalDirection
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */
const int N = 3009;
int coin[N];
ll dp[N][N][3];
int mod = 998244353 ;
int main() {
    int n,s;
    cin>>n>>s;
    for(int i=1;i<=n;i++){
        scanf("%d",&coin[i]);
    }
    dp[0][0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=s;j++){
            dp[i][j][0]+=dp[i-1][j][0];
            dp[i][j][1]+=dp[i-1][j][0]+dp[i-1][j][1];
            dp[i][j][2]+=dp[i-1][j][0]+dp[i-1][j][1]+dp[i-1][j][2];
            
            dp[i][j][0]%=mod;
            dp[i][j][1]%=mod;
            dp[i][j][2]%=mod;
            if(j+coin[i]<=s){
                dp[i][j+coin[i]][1] += dp[i - 1][j][0] + dp[i - 1][j][1];
                dp[i][j+coin[i]][2] += dp[i - 1][j][0] + dp[i - 1][j][1];
                
                dp[i][j+coin[i]][1] %= mod;
                dp[i][j+coin[i]][2] %= mod;
            }
        }
        
    }
    cout<<dp[n][s][2]<<"\n";
}


Measured memory_bytes: 211840
use std::io::BufRead;

fn main() {
  let stdin = std::io::stdin();
  let mut lines = stdin.lock().lines();

  loop {
    let n = lines.next().unwrap().unwrap();
    if n == "0" {
      break;
    }
    let v = lines.next().unwrap().unwrap()
      .split_whitespace()
      .map(|x| x.parse::<f64>().unwrap())
      .collect::<Vec<_>>();
    let average = v.iter().sum::<f64>() / v.len() as f64;
    let deviation = v.iter()
      .map(|x| (x - average).powi(2))
      .sum::<f64>() / v.len() as f64;
    println!("{}", deviation.sqrt());
  }
}


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


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

        int num = 0;
        int sum = 0;
        for (int i = 1; i <= n; ++i){
                cin >> p ;
                if ((p-i)!=0) {
                        num += 1;
                        sum += (p-i);
                }
        }
        if (num == 0){
                cout << "YES" << endl;
        }
        else if ((num == 2)&&(sum == 0)){
                cout << "YES" << endl;
        }else{
                cout << "NO" << endl;
        }
}

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

res=[]
for i in range(N-K+1):
  tmp = min(abs(x[i]),abs(x[i+K-1]))+x[i+K-1]-x[i]
  res.append(tmp)
  
print(min(res))

Measured memory_bytes: 20060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	int a[3];
	int s = 3;
	for (int i = 0;i<3;i++){
		scanf("%d", &a[i]);
	}
	if (a[0] == a[1])
	{
		s--;
		if (a[1] == a[2]) s--;
	}
	else {
		if (a[0] == a[2]) s--;
		if (a[1] == a[2]) s--;
	}
	printf("%d\n", s);
	return 0;
}

Measured memory_bytes: 128
//Moh_K_Imar .......
//26/08/2020  ... 3,25.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a;
    cin>>a;
    ld counter=0;
    for(ll i=1;i<=a;i++){
        if(i%2==1)counter++;
    }
    cout<<setprecision(10)<<fixed<<counter/a<<endl;

    return 0;
}



Measured memory_bytes: 3780
import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

def get_lcm(num):
    return reduce(lambda x,y:(x * y) // fractions.gcd(x, y), num, 1)

def main():
    K = int(input())
    if 0<=K<=10:
        print(K)
        exit()

    lunlun = [i for i in range(1,10)]
    m = 0

    while len(lunlun) < K:
        x = lunlun[m]
        btm = x % 10

        if btm - 1 >= 0:
            lunlun.append(10*x+btm-1)

        lunlun.append(10*x+btm)

        if btm + 1 < 10:
            lunlun.append(10*x+btm+1)

        m += 1

    print(lunlun[::-1][len(lunlun)-K])

if __name__ == "__main__":
  main()


Measured memory_bytes: 22056
import sys
input = sys.stdin.readline

R, C, N = map(int, input().split())
right = []
top = []
left = []
bottom = []
for i in range(N):
    x1, y1, x2, y2 = map(int, input().split())
    # if both points are on the edge
    if (x1 in (0, R) or y1 in (0, C)) and (x2 in (0, R) or y2 in (0, C)):
        if x1 == 0:
            top.append((y1, i))
        elif x1 == R:
            bottom.append((y1, i))
        elif y1 == 0:
            left.append((x1, i))
        elif y1 == C:
            right.append((x1, i))

        if x2 == 0:
            top.append((y2, i))
        elif x2 == R:
            bottom.append((y2, i))
        elif y2 == 0:
            left.append((x2, i))
        elif y2 == C:
            right.append((x2, i))
left.sort(key=lambda p: p[0])
bottom.sort(key=lambda p: p[0])
right.sort(key=lambda p: -p[0])
top.sort(key=lambda p: -p[0])
points = left + bottom + right + top
stack = []
for x, i in points:
    if not stack or stack[-1] != i:
        stack.append(i)
    else:
        stack.pop()
print('NO' if stack else 'YES')

Measured memory_bytes: 104576
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Bool
import Data.Fixed
import Data.Tuple
import Data.Ratio
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V
 
getI = read <$> getLine :: IO Int
getIs = map read . words <$> getLine :: IO [Int]
getD = read <$> getLine :: IO Double
getDs = map read . words <$> getLine :: IO [Double]
getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]
 
type Row = Integer
type Col = Integer
type PointI = (Integer, Integer)
type Point = (Int, Int)
 
mmm = 1000000007
fact n
    | n < 1 = 1
    | True = foldr1 (*) [1..n]
fi = fromInteger
fig = fromIntegral
rf = realToFrac
 
(.<.) f g -- combination
    | f < g = 0 
    | g < 1 || f < 1 = 1
    | True = foldr1 (*) (take g [f,f-1..]) `div` fact g
(.>.) f g --combination with repetition
    | g < 1 || f < 1 = 1
    | True = fact (f + g - 1) `div` (fact (f - 1) * fact g)
comb = (.<.)
combWp = (.>.)
 
unique a = unique_ (reverse . sort $ a) [] Nothing
    where
        unique_ [] arr _ = arr
        unique_ (x:xs) arr n
            | n == Just x = unique_ xs arr n
            | otherwise = unique_ xs (x:arr) $ Just x
 
zeroume keta num
    | (length . show $ num) > keta = show num
    | otherwise = do 
        let zeros = take keta $ repeat '0'
        reverse . take keta $ (reverse . show $ num) ++ zeros
 
i2b num
    | num < 2 = show num
    | otherwise = i2b_ num []
        where
            i2b_ num str
                | num == 0 = str
                | num == 1 = '1':str
                | otherwise = do
                    let next = num `div` 2
                    let this = if odd num then '1' else '0'
                    i2b_ next (this:str)
 
mapIncr = mapPlus 1
mapPlus n Nothing = Just n
mapPlus n a = (+) n <$> a
 
countIf f = length . filter f
 
-- 
--
--

main = do
  time <- getI
  words <- replicateM time getLine
  let noDpl = length words == (length $ unique words)
      shiriTotteru = all (\(x, y) -> last x == head y) $ zip words (tail words)
  putStrLn $ bool "No" "Yes" (noDpl && shiriTotteru)


Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a,b,c,d,i,k;
  cin>>a>>b>>c>>d;
  if(a==1 && b==31) cout<<"1"<<endl;
  else if(a==2 && b==28) cout<<"1"<<endl;
  else if(a==3 && b==31) cout<<"1"<<endl;
  else if(a==4 && b==30) cout<<"1"<<endl;
  else if(a==5 && b==31) cout<<"1"<<endl;
  else if(a==6 && b==30) cout<<"1"<<endl;
  else if(a==7 && b==31) cout<<"1"<<endl;
  else if(a==8 && b==31) cout<<"1"<<endl;
  else if(a==9 && b==30) cout<<"1"<<endl;
  else if(a==10 && b==31) cout<<"1"<<endl;
  else if(a==11 && b==30) cout<<"1"<<endl;
  else if(a==12 && b==31) cout<<"1"<<endl;
  else cout<<"0"<<endl;

return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
using namespace std;
typedef long long int llint;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b < c) {
		swap(b, c);
	}
	if (a < b) {
		swap(a, b);
	}
	if (b < c) {
		swap(b, c);
	}
	if (a == b + c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

class binarySearch{
    public:
    int l;
    int r;
    int m;
    
    binarySearch(int left, int right){
        l = left;
        r = right;
        m = (l+r)/2;
    }
    
    int middle(){
       return m; 
    }
    int right(){
        return r;
    }
    int left(){
        return l;
    }
    
    void m_l(){//mがxより小さい時
        l = m+1;
        m = (l+r)/2;
    }
    
    void m_r(){//mがxより大きい時
        r = m;
        m = (l+r)/2;
    }
};


int main(){
    int n;
    cin >> n;
    int S[n];
    for(int i=0; i<n; i++){
        cin >> S[i];
    }
    
    int q;
    cin >> q;
    int T[q];
    for(int j=0; j<q; j++){
        cin >> T[j];
    }
    
    int count=0;
    for(int k=0; k<q; k++){
        binarySearch B(0,n-1);
        while(B.right() != B.left()){
            if(S[B.middle()] == T[k]){
                count++;
                break;
            } else if(S[B.middle()] < T[k]){
                B.m_l();
            } else {
                B.m_r();
            }
        }
        if(B.right() == B.left() && S[B.right()] == T[k]){
            count ++;
        }
    }
    cout << count << endl;
}



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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

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

int main() {
    ios_base::sync_with_stdio(false);
    int n, x;
    cin >> n >> x;
    int ans = 0;
    fori(i, 0, n) {
        int cur;
        cin >> cur;
        ans = __gcd(ans, abs(x - cur));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag,
         tree_order_statistics_node_update>;
*/



int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n, m;
	cin >> n >> m;
	vector<int> A(2*n);
	for(int& x:A)
		cin >> x;
	sort(A.begin(), A.end());
	int border = lower_bound(A.begin(), A.end(), m-A.back()) - A.begin();
	if(border % 2 == 1) border++;
	for(int i=0; border + i < 2*n - 1 - i; i++) {
		while(border + i < 2*n - 1 - i and A[border+i] + A[2*n - 1 - i] < m)
			border += 2;
	}
	
	int res = 0;
	border = min(border, 2*n);
	for(int i=0; i<min(border, 2*n); i++) {
		res = max(res, (A[i] + A[border-i-1]) % m);
	}
	for(int i=0; border+i < 2*n; i++) {
		res = max(res, (A[border+i] + A[2*n-1-i]) % m);
	}
	
	cout << res << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll a,b,c,k;cin>>a>>b>>c>>k;
    ll sum = a;
    if(sum>=k){
        cout<<k<<endl;
        return 0;
    }
    sum+=b;
    if(sum>=k){
        cout<<a<<endl;
        return 0;
    }
    a-=(k-sum);
    cout<<a<<endl;
    return 0;

}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>
using namespace std;

int main() {
    stack<int> S;
    string x;
    getline(cin,x);
    for(int i=0; i<x.size(); i++){
        if(x[i] == '+' || x[i] == '-' || x[i] == '*') {
            int b = S.top(); S.pop();
            int a = S.top(); S.pop();
            if(x[i] == '+') S.push(a+b);
            else if(x[i] == '-') S.push(a-b);
            else S.push(a*b);
            i++;
        } else {
            int a = 0;
            while(x[i] != ' ') {
                a = a*10 + (int)(x[i] - '0');
                i++;
            }
            S.push(a);
        }
    }
    int ans = S.top(); S.pop();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3172
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;

typedef long long ll;

long long n, ans;

int len(long long x){
      int cnt = 0;
      while(x){
            cnt ++;
            x /= 10;
      }
      return cnt;
}

int fir(long long x){
      while(x > 9){
            x /= 10;
      }
      return x;
}

int main(){
      cin >> n;

      ans = (len(n) - 1) * 9 + fir(n) - 1;

      int cnt = 0, sum = 0;

      while(n){
            if(n % 10 != 9) cnt ++;
            sum += n % 10;
            n /= 10;
      }

      if(cnt == 0) ans = max(ans, len(n) * 1ll  * 9);

      cout << max(ans, sum * 1ll) << endl;
}


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

int main(){
long a,b,c;
int n,i,sum,lon;


cin>>a>>b>>c;
a=a-c;
lon=c+b;
sum=a/lon;

cout<<sum;

return 0;
}

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

using ll = long long;

const int N = 605;
const int MOD = 1e9 + 7;

int to[N], sum[N];
ll dp[N][N], g[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, m; cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        to[u] = v; to[v] = u;
        sum[u]++; sum[v]++;
    }
    n *= 2; g[0] = 1;
    for (int i = 1; i <= n; i++)
        sum[i] += sum[i - 1];
    for (int i = 2; i <= n; i += 2)
        g[i] = g[i - 2] * (i - 1) % MOD;
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j += 2) {
            bool flag = 0;
            for (int k = i; k <= j; k++)
                if (to[k] && (to[k] < i || to[k] > j))
                    flag = 1;
            if (flag) continue;
            dp[i][j] = g[j - i + 1 - sum[j] + sum[i - 1]];
            for (int k = i + 1; k < j; k += 2)
               (dp[i][j] -= dp[i][k] * g[j - k - sum[j] + sum[k]]) %= MOD;
        }
    m *= 2; ll res = 0;
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j += 2)
            (res += dp[i][j] * g[n - j + i - 1 - m + sum[j] - sum[i - 1]]) %= MOD;
    cout << (res + MOD) % MOD << '\n';
}

Measured memory_bytes: 6408
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

int MOD = 998244353;
// int MOD = 1000000007;


//----------------------------------------------------------------
signed main(){

	ll  n;
	cin >> n;

	vll ans(n);

	rep(i,n){
		int a ;
		cin >> a;
		a--;
		ans[a] = i;
	}
	rep(i,n)cout << ans[i]+1 << " ";cout << endl;

	return 0;
}

//----------------------------------------------------------------

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2017-final.contest.atcoder.jp/tasks/ddcc2017_final_b
// rm -r -f test;oj dl https://abc142.contest.atcoder.jp/tasks/abc142_b

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

    string c;
    int tmp, ans = INT_MAX;
    for(int i=1; i<s.length()-1; i++){
        c = s.substr(i-1, 3);
        tmp = stoi(c);
        ans = min(ans, abs(753-tmp));
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
 
min = [a, b, c, d, e].min
 
p (n.to_f/min).ceil + 4

Measured memory_bytes: 1788
import sys
import collections

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
A = inl()
A.sort()


def solve():
    K = A[-1]
    if A[0] == K:
        return K == N - 1 or (K >= 1 and 2 * K <= N)
    if A[0] != K - 1:
        return False
    counter = collections.Counter(A)
    d = counter[K - 1]
    if K <= d:
        return False
    if N - d <= 1:
        return False
    return 2 * (K - d) <= N - d


print("Yes" if solve() else "No")


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

using namespace std;

int main (){

	int a,b;
  	cin>>a>>b;
  	double ans=0;
  	
  	ans=ceil((double)(b-a)/(a-1)+1);
  	
  	cout<<(int)ans<<endl;
  
  
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#ABC120C

import sys
#import math

hoge = input()
n = len(hoge)

sum=0
i=0

while(1):
#	print(i)
	if(i>=n-1):
		break
	if(hoge[i]!=hoge[i+1]):
#		print("hoge:{} i:{} {} {}".format(hoge,i,hoge[i],hoge[i+1]))
		newhoge=hoge[0:i]+hoge[i+2:n]
		hoge=newhoge
		i-=1
		if(i<0):
			i=0
		n-=2
#		n=len(hoge)
		sum+=2
	else:
		i+=1


#	print(i)
#	print("---")


print(sum)


Measured memory_bytes: 3432
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int n,a[202020],mp[1010],ans=0,sum[1010];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
	
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		mp[a[i]]++;
	}
	for(int i=1;i<=1000;i++){
		sum[i] = sum[i-1]+mp[i];
	}
	for(int i=1;i<=1000;i++){
		for(int j=i+1;j<=1000;j++){
			ans+= mp[i]*mp[j]*(sum[min(i+j-1,1000LL)]-sum[max(j,i)]);
		}
	}
	//cout << ans << endl;
	for(int i=1;i<=1000;i++){
		ans+= (mp[i]*(mp[i]-1)/2)*(sum[min(i+i-1,1000LL)]-mp[i]);
		ans+= ( mp[i]*(mp[i]-1)*(mp[i]-2) )/6;
	}
	cout << ans << endl;
 

return 0;
}
///....


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

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

#define dist(s) get<0>(s)
#define x(s) get<1>(s)
#define y(s) get<2>(s)

inline int norm(int x, int y) {
	return x * x + y * y;
}

void solve() {
	tuple<int, int, int> current(0, 0, 0);
	tuple<int, int, int> ans(current);

	for(int dx, dy; cin >> dx >> dy && (dx | dy);) {
		x(current) += dx;
		y(current) += dy;
		dist(current) = norm(x(current), y(current));
		chmax(ans, current);
	}

	cout << x(ans) << " " << y(ans) << endl;
}

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

	int t;
	cin >> t;
	while(t--) solve();

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v1 = vector<T>;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

int main() {
    int N;
    cin >> N;
    int temp = N % 10;
    vector<int> hon, pon, bon;
    hon = {2, 4, 5, 7, 9};
    pon = {0, 1, 6, 8};
    for (auto a : hon) {
        if (a == temp) {
            cout << "hon" << endl;
            return 0;
        }
    }
    for (auto a : pon) {
        if (a == temp) {
            cout << "pon" << endl;
            return 0;
        }
    }
    cout << "bon" << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  ll N, M;
  cin >> N >> M;
  ll a, b;
  map<ll, ll> m{};
  map<ll, ll>::iterator ite;
  for(int i = 0; i < N; i++){
    cin >> a >> b;
    ite = m.find(a);
    if(ite == m.end()) m[a] = b;
    else m[a] += b;
  }
  ll ans = 0;
  for(ite = m.begin(); ite!= m.end(); ++ite){
    if(M - ite->second > 0){
      ans += ite->second*ite->first;
      M -= ite->second;
    } else {
      ans += M*ite->first;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6528