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

int main()
{
  int n,ans=0,mid;
  vector<int> all;
  cin>>n;
  for(int i = 0;i<n;i++)
  {
    int tmp;
    cin>>tmp;
    all.push_back(tmp);
  }
  sort(all.begin(),all.end());
  mid=n/2 - 1;
  ans=all.at(mid+1)-all.at(mid);
  if(ans<0)
    ans=0;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

	lli a, b, k;
	cin >> a >> b >> k;

	cout << max(0LL, a - k) << " " << MAXMIN(0LL,a + b - k,b) << endl;

	return 0;
}


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

int gcd(int a,int b){
    while(a!=b){
        if(a>b){
            if(a%b==0) return b;
            else a=a%b;
        }
        if(a<b){
            if(b%a==0) return a;
            else b=b%a;
    }
    }
    return a;
}

int main(){
    
    int N;
    cin>>N;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S.at(i);
    }
    for(int i=1;i<N;i++){
        S.at(i)=gcd(S.at(i-1),S.at(i));
    }
    cout<<S.at(N-1)<<endl;
}
    


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

import collections
def main():
    N,W = map(int, input().split())
    I = collections.deque()
    for _ in range(N):
        I.append(tuple(map(int, input().split())))

    MV = 1 + N*(10**3)
    dp = [[0]*MV for _ in range(N+1)]
    inf = 2*10**9
    for j in range(MV):
        dp[0][j] = inf
    dp[0][0] = 0
    
    for i in range(N):
        w,v = I.popleft()
        for j in range(MV):
            if j < v:
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = min(dp[i][j], dp[i][j-v] + w)
    ans = 0
    for v,w in enumerate(dp[N]):
        if w <= W:
            ans = v
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 118128
#include <iostream>
#include <vector>
#include <cassert>

using ll = long long;

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const modulo = 1000000007;
int const sigma = 15;

class Mint{
private:
  void gcd(int a, int b, int &x, int &y) {
    if(b == 0) {
      x = 1;
      y = 0;
    } else {
      gcd(b, a % b, x, y);
      int aux = x;
      x = y;
      y = aux - a / b * y;
    }
  }
public:
  int number;
  Mint(ll number_ = 0) {
    number = number_ % modulo;
  }
  Mint operator + (Mint a) {
    return (number + a.number);
  }
  Mint operator - (Mint a) {
    return (modulo + number - a.number);
  }
  Mint operator * (Mint a) {
    return (1LL * number * a.number);
  }
  Mint operator / (Mint a) {
    int x, y;
    gcd(a.number, modulo, x, y);
    x %= modulo;
    if(x < 0)
      x += modulo;
    return 1LL * number * x;
  }
  friend std::ostream& operator << (std::ostream& output, Mint a) {
    output << a.number;
    return output;
  }
};

Mint comb(int n, int k) {
  if(0 <= k && k <= n) {
    Mint result(1);
    for(int i = n - k + 1; i <= n; i++)
      result = result * i;
    for(int i = 1;i <= k; i++)
      result = result / i;
    return result;
  }
  return 0;
}

Mint eval(int n) {
  if(n < 0)
    return 0;
  else {
    return comb(n / 2 + sigma, sigma);
  }
}

void solve() {
  int n;
  std::cin >> n;
  Mint result(0);
  for(int i = 0; i <= 10; i++) 
    result = result + eval(n - 5 - i) * comb(10, i);
  std::cout << result << '\n';
}

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

  int t;
  std::cin >> t;
  for(int testcase = 1; testcase <= t; testcase++)
    solve();
  return 0;
}


Measured memory_bytes: 3664
#include<stdio.h>
#include<string.h>
int main()
{
    char arr[6];
    scanf("%s",&arr);
    if(arr[2]==arr[3]&&arr[4]==arr[5])
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}



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

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


    long long kabu = 0;
    long long kane = 1000;
    for(int i =0; i<N;){

        while (A[i] >= A[i+1] && i<N-1){
            i++;
        }

        if(kane ==1000 && i == N-1 ){
            cout <<1000 << endl;
            return 0;
        }

        kabu = kane/A[i];
        kane =  kane - kabu*A[i];
        //cout <<"buy" << i <<" " << kane << " " << kabu <<endl;

        while (A[i] <= A[i+1]&& i<N-1){
            i++;
        }

        kane = kane + kabu*A[i];
        kabu = 0;
        //cout <<"bought" << i <<" " << kane << " " << kabu << endl;

        i++;
    }

    cout << kane << endl;

}


Measured memory_bytes: 3624
#include<stdio.h>
int  main()
{
    int k,x,i;
     while(scanf("%d%d",&k,&x)==2)
       {
           for(i=(x-k+1);i<=(x+k-1);i++)
           {printf("%d ",i);}
        printf("\n");

       }
  return 0;
}


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

int main() {
    int five = 0, seven = 0;
    rep(i, 3) {
        int a;
        cin >> a;
        if (a == 5) five++;
        if (a == 7) seven++;
    }

    bool ok = false;
    if (five == 2 && seven == 1) ok = true;

    if (ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

typedef long long ll;

ll N, M;
vector<vector<ll>> S;
vector<ll> P;
ll R;

int main() {
  cin >> N >> M;
  S.resize(M);
  for (ll i = 0; i < M; ++i) {
    ll k;
    cin >> k;
    for (ll j = 0; j < k; ++j) {
      ll s;
      cin >> s;
      --s;
      S[i].push_back(s);
    }
  }
  P.resize(N);
  for (ll i = 0; i < M; ++i) {
    cin >> P[i];
  }
  for (ll a = 0; a < (1 << N); ++a) {
    bool ok = true;
    for (ll i = 0; i < M; ++i) {
      ll cnt = 0;
      for (ll s : S[i]) {
        if (a & (1 << s)) ++cnt;
      }
      if (cnt % 2 != P[i]) ok = false;
    }
    if (ok) ++R;
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() {
	int H = 0;
	int W = 0;
	cin >> H >> W;
	char s[50][50];
	string s_;
	for (int i = 0; i < H; i++) {
		cin >> s_;
		for (int j = 0; j < W; j++)s[i][j] = s_[j];
	}
	bool flag = true;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '#') {
				if (i != 0) {
					if (s[i - 1][j] == '#') { flag = false; continue; }
					else flag = true;
				}
				if (i != H - 1) {
					if (s[i + 1][j] == '#') { flag = false; continue; }
					else flag = true;
				}
				if (j != 0) {
					if (s[i][j - 1] == '#') { flag = false; continue; }
					else flag = true;
				}
				if (j != W - 1) {
					if (s[i][j + 1] == '#') { flag = false; continue; }
					else flag = true;
				}
				if (flag) {
					cout << "No" << endl;
					return 0;
				}
			}

		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  int n; cin >> n;
  int a=n,fn=0;
  while(a>0){
    fn += a%10;
    a = a/10;
  }
  if(n%fn==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;

int main(){

    int n; cin >> n;

    vector<int> va;
    vector<int> vb;
    int minsum = 1e6;
    for(int i=1; i<n; i++){
        int a = i;
        int b = n - a;
        va.clear();
        vb.clear();
        while(a != 0){
            va.push_back(a%10);
            a /= 10;
        }
        while(b != 0){
            vb.push_back(b%10);
            b /= 10;
        }

        int sum = accumulate(va.begin(), va.end(), 0) + accumulate(vb.begin(), vb.end(), 0);
        if(sum < minsum){
            minsum = sum;
        }
    }

    cout << minsum;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b
def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

def main():
    x = int(input())

    if x == 0:
        print(1)
    else:
        print(0)




if __name__ == '__main__':
    main()


Measured memory_bytes: 9924
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

#define loop(i, _l, _r) for(register int i = (_l), r = (_r); i <= r; i++)
#define repeat(n) for(int _____ = (n); _____; _____--)

const int P = 998244353;

int inv(long long x)
{
	long long ans = 1;
	for(int i = 0; 1<<i <= P-2; i++) {
		if((1<<i) & (P-2))
			ans = ans * x % P;
		
		x = x * x % P;
	}
	
	return ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	static int f[1000005];
	
	loop(d, 1, 1e6) {
		f[d] = (f[d] + inv(d)) % P;
		
		for(int x = 2*d; x <= 1e6; x += d)
			f[x] = ((f[x] - f[d]) % P + P) % P;
	}
	
	
	int n;
	cin >> n;
	
	static int a[1000005];
	int sa = 0;
	repeat(n) {
		int x;
		cin >> x;
		
		a[x]++;
		sa = (sa + x) % P;
	}
	
	static int b[1000005];
	loop(k, 1, 1e6) {
		for(int x = k; x <= 1e6; x += k)
			b[k] = (b[k] + (long long)a[x] * x) % P;
	}
	
	int ans = 0;
	loop(k, 1, 1e6)
		ans = (ans + (long long)f[k] * b[k] % P * b[k]) % P;
	
	cout << (ans - sa + P) % P * (long long)inv(2) % P;
}


Measured memory_bytes: 12032
import sys
input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    cum = [0]
    for num in a:
        cum.append(cum[-1]+num)
    M = 0
    for i in range(N-K+1):
        M = max(M,cum[i+K]-cum[i])
    
    print((M+K)/2)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 21192
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
int main() {
    int N, x;
    int m = 0;
    cin >> N;
    int total = 0;
    for (int i = 0; i < N; i++) {
        cin >> x;
        total += x;
        m = max(m, x);
    }
    if (m < total - m) {
    	cout << "Yes" << endl;
    }
    else {
    	cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import collections
def solve(n, s_list):

    counter = collections.Counter()
    for s in s_list:
        counter[s[0]] += 1


    if len(counter.keys()) == 4:
        return "Four"
    else:
        return "Three"


if __name__ == "__main__":
    n = int(input())
    s_list = [i for i in input().split()]
    print(solve(n, s_list))



Measured memory_bytes: 3316
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>  
#include<cstdio>  
#include<fstream>  
#include<iomanip>
#include<algorithm>  
#include<cmath>  
#include<deque>  
#include<vector>  
#include<assert.h>
#include<bitset>
#include<queue>  
#include<string>  
#include<cstring>  
#include<map>  
#include<stack>  
#include<set>
#include<functional>
#define pii pair<int, int>
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define eps 0.00000001
#define mst(a,i) memset(a,i,sizeof(a))
#define all(n) n.begin(),n.end()
#define lson(x) ((x<<1))  
#define rson(x) ((x<<1)|1) 
#define inf 0x3f3f3f3f
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int i, j, k, m, n;
	cin >> n >> m;
	if (abs(n - m) > 1)
	{
		cout << "0" << endl;
		return 0;
	}
	ll ans = 1;
	if (n == m)
	{
		for (int i = 1; i <= n; ++i)
			ans = (ans*i) % mod;
		ans = (ans * ans) % mod;
		ans = (ans * 2) % mod;
	}
	else
	{
		int temp = min(n, m);
		for (int i = 1; i <= temp; ++i)
			ans = (ans*i) % mod;
		ans = (ans*ans)%mod;
		ans = (ans*(temp + 1)) % mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio;

void main(){
	int m, n, ans;
	while (readf("%d", &m), m) {
		readf(" %d\n", &n);
		ans = 0;
		foreach (i; m..n+1) ans += hamming(i);
		writeln(ans);
	}
}

int hamming(int n) {
	if (n%2 == 0) return hamming(n/2);
	else if (n%3 == 0) return hamming(n/3);
	else if (n%5 == 0) return hamming(n/5);
	else return n == 1 ? 1 : 0;
}

Measured memory_bytes: 980
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main implements Runnable {
	public static void main(String[] args) throws FileNotFoundException {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
	}

	int n, m;
	int[] a, b;
	ArrayList<Integer>[] g;
	final long MODULO = 1000003;

	@SuppressWarnings("unchecked")
	void solver() throws FileNotFoundException {
		Scanner sc = new Scanner(System.in);
		while (true) {
			n = sc.nextInt();
			m = sc.nextInt();
			if (n == 0 && m == 0)
				break;
			a = new int[m];
			b = new int[m];
			g = new ArrayList[n];
			for (int i = 0; i < n; ++i) {
				g[i] = new ArrayList<>();
			}
			for (int i = 0; i < m; ++i) {
				a[i] = sc.nextInt();
				b[i] = sc.nextInt();
				--a[i];
				--b[i];
				g[Math.min(a[i], b[i])].add(Math.max(a[i], b[i]));
			}
			for (int i = 0; i < n; ++i) {
				g[Math.min(i, (i + 1) % n)].add(Math.max(i, (i + 1) % n));
			}
			for (int i = 0; i < n; ++i) {
				Collections.sort(g[i]);
			}
			System.out.println(f(0, n - 1)[0][0]);
		}
	}

	long[][] f(int src, int dst) {
		long[][] ret = new long[2][2];
		ret[0][0] = 1;
		ret[1][1] = 1;
		for (int i = 0; i + 1 < g[src].size(); ++i) {
			ret = merge(ret, f(g[src].get(i), g[src].get(i + 1)));
			ret[0][0] = (ret[0][0] + ret[1][1]) % MODULO;
		}
		if (g[src].get(g[src].size() - 1) != dst) {
			ret = merge(ret, f(g[src].get(g[src].size() - 1), dst));
		}
		return ret;
	}

	@SuppressWarnings("unchecked")
	public void run() {
		try {
			solver();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	// 0???true???1???false??¨?????????
	long[][] merge(long[][] a, long[][] b) {
		long[][] ret = new long[2][2];
		for (int i = 0; i < 2; ++i) {
			for (int j = 0; j < 2; ++j) {
				ret[i][j] = (a[i][0] * b[1][j] + a[i][1] * b[0][j]) % MODULO;
			}
		}
		return ret;
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 183028
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c,d;
  cin>>a>>b;
  c=max(a,b);
  d=max(c-1,min(a,b));
  cout<<c+d;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'
#define pii pair<int, int>
#define tii tuple<int, int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n; cin>>n;
    int arr[n+1]={0};
    for(int i=1;i<=n;i++){
    	for(int j=i;j<=n;j+=i) arr[j]++;
    }
	int ans=0;
	for(int i=1;i<n;i++) ans+=arr[i];
	cout<<ans<<endl;

}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL t[51], p[51];

LL f(LL n, LL x) {
	assert(inII(x, 0, t[n]));
	
	if(x == 0) { return 0; }
	if(x == t[n]) { return p[n]; }
	LL u = t[n - 1];
	if(inII(x,     1,     u + 1)) { return f(n - 1, x -       1); }
	if(inII(x, u + 2, 2 * u + 2)) { return f(n - 1, x - (u + 2)) + p[n - 1] + 1; }
	
	assert(false);
}

int main() {
	LL n, x;
	cin >> n >> x;
	
	t[0] = 1;
	p[0] = 1;
	inc(i, n) {
		t[i + 1] = 2 * t[i] + 3;
		p[i + 1] = 2 * p[i] + 1;
	}
	
	cout << f(n, x) << endl;
	
	return 0;
}


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

int main() {
  long long n;
  scanf("%lld", &n);

  //a(n) = Sum_{k=1..n} k/2 * floor(n/k) * floor(1 + n/k)
  
  double s=0;
  for(long long i=1;i<=n;i++){
    s += ((double)(i)/2.0)*floor((double)n/i)*floor(1+(double)n/i);
  }
  
  printf("%lld\n", (long long)s);
  return 0;
}

Measured memory_bytes: 2212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            long s = long.Parse(Console.ReadLine());
            string result = "";

            while (s != 0)
            {
                s--;
                long mod = s % 26;
                result = (char)('a' + mod) + result;
                s /= 26;
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27468
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define sys system("pause")
const int maxn=1e5+10;
const int N=2e5+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
int n,m,k,t,du[maxn],rt,mi;
vi e[maxn],ret;
bool vis[maxn];
bool cmp(int x,int y){return du[x]<du[y];}
void dfs(int x)
{
    ret.pb(x);
    vis[x]=true;
    for(int y:e[x])
    {
        if(!vis[y]){dfs(y);break;}
    }
}
int main()
{
    int i,j;
    mi=1e9;
    scanf("%d%d",&n,&m);
    rep(i,1,m)scanf("%d%d",&j,&k),du[j]++,du[k]++,e[j].pb(k),e[k].pb(j);
    rep(i,1,n)if(du[i]&&du[i]<mi)mi=du[i],rt=i;
    dfs(rt);
    reverse(ret.begin(),ret.end());
    for(int x:e[rt])if(!vis[x])dfs(x);
    printf("%d\n",ret.size());
    for(int x:ret)printf("%d ",x);
    return 0;
}


Measured memory_bytes: 10360
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)


a,b =  map(int, input().split())
l = list(map(int, input().split()))
uf = UnionFind(a)
for i in range(b):
    x,y =map(int, input().split())
    x-=1
    y-=1
    uf.union(x, y)  # (3)
ans=0
for i,t in enumerate(l):
    if uf.same(t-1,i):ans+=1

print(ans)


Measured memory_bytes: 14188
//In The Name Of The God

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define X first.first
#define Y first .second
#define A second.first
#define B second.second
#define mp make_pair
#define pb push_back
#define pf push_front
#define P push
#define pob pop_back
#define pof pop_front
#define PO pop
#define rep(i,j,k) for(int i = j ; i <= k ; ++ i)
#define rrep(i,j,k) for(int i = j ; i>=k ; --i)
#define FR(i,j,k) for(int i = j ; i < k ; ++ i )
#define rFR(i,j,k) for(int i = j ; i > k ; -- i )
#define lb(x) x&-x
#define p2(x) (1LL<<x)
#define SZ size()
#define LB lower_bound
#define UB upper_bound
#define IT iterator
#define RIT reverse_iterator
#define E end()
#define BE begin()
#define RE rend()
#define RBE rbegin()
#define UN unsigned

typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll ;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<int,pll> pipl;
typedef pair<pll,int> ppli ;
typedef pair<pll,pll> plpl ;
typedef pair<ll,pii> lpip;
typedef pair<pii,ll> lppi;
typedef pair<pii,pii> lppp;
typedef pair<ll,pll> lpipl;
typedef pair<pll,ll> lppli ;
typedef pair<pll,pll> lplpl ;
typedef vector<int> vi ;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii > stpi;
typedef set<pll> stpl;
typedef vi::IT vit;
typedef vl::IT vlt;
typedef vpi::IT vpit;
typedef vpl::IT vplt;
typedef sti::IT stit;
typedef stl::IT stlt;
typedef stpi::IT stpit;
typedef stpl::IT stplt;
typedef vpi::RIT rvpit;
typedef vpl::RIT rvplt;
typedef sti::RIT rstit;
typedef stl::RIT rstlt;
typedef stpi::RIT rstpit;
typedef stpl::RIT rstplt;

const int MAXN = 500000;
const int SUPERN = 5000000;
const int MAXS = 325;
const int SUPERS = 1000;
const int MD = 1e9+7;
//......Structures.......

//......Variables........
ll a[MAXN],g,n,x;
//......Funcs............
ll sum(ll a,ll b)
{
    return (a+b)%MD;
}
ll mu(ll a,ll b)
{
    return (a*b)%MD;
}
ll mn(ll a,ll b)
{
    return(a-b+MD)%MD;
}
//......Code.............
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    rep(i,1,n)
    {
        cin>>a[i];
    }
    g=a[1];
    rep(i,2,n)
    {
        g=g/__gcd(g,a[i])*a[i];
    }
    cout<<g;
    return 0;
}


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

int main() {
  vector<int> a(3);
  rep(i, 3) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  if ((a[0] == a[1] && a[1] != a[2]) || (a[1] == a[2] && a[0] != a[1])){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

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

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

    vector<int> ans;
    for(int i=1; i<=max(A,B); i++){
        if(A%i==0 && B%i==0){
            ans.push_back(i);
        }
    }

    sort(ans.begin(), ans.end(), greater<int>());
    cout << ans[K-1] << endl;
}

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

typedef long long ll;

int N, K;
ll a[101], pref[101][100001], dp[101][100001];
ll m = 1000000007;

ll interval(int p, int i, int j)
{
    if (i == 0) return pref[p][j];
    ll ans = (pref[p][j] - pref[p][i-1]) % m;
    if (ans < 0) ans += m;
    return ans;
}

int main()
{
    scanf("%d %d", &N, &K);
    for (int i = 1; i <= N; i++)
    {
        scanf("%lld", a + i);
        pref[i][0] = dp[i][0] = 1LL;
    }
    for (int c = 1; c <= K; c++)
    {
        if (c <= a[1]) dp[1][c] = 1;
        pref[1][c] = pref[1][c-1] + dp[1][c];
    }
    for (int p = 2; p <= N; p++)
    {
        for (int c = 1; c <= K; c++)
        {
            dp[p][c] = interval(p-1, c - min((int) a[p], c), c);
            pref[p][c] = (pref[p][c-1] + dp[p][c]) % m;
        }
    }
    printf("%lld\n", dp[N][K]);
    return 0;
}


Measured memory_bytes: 157312
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#define MM 1000000007
using namespace std;
int dp[1000][1000];
int main(void)
{
	char t[1001],b[1001];
	int i,sum,j,lt,lb;
	scanf("%s %s",t,b);
	lt=strlen(t);
	lb=strlen(b);
	for(i=0;i<lb;i++)	{
		for(j=0;j<lt;j++)	{
			dp[i][j]=0;
		}
	}
	for(i=0;i<lt;i++)	{
		if(t[i]==b[0])	dp[0][i]=1;
	}
	for(i=1;i<lb;i++)	{
		sum=0;
		for(j=0;j<lt;j++)	{
			if(t[j]==b[i])	dp[i][j]=sum;
			sum=sum+dp[i-1][j];
			sum%=MM;
		}
	}
	sum=0;
	for(i=0;i<lt;i++)	{
		sum+=dp[lb-1][i];
		sum%=MM;
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 6672
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(stdR.readLine());
        String[] s = stdR.readLine().split(" ");
        int[] D = new int[N];
        for(int i = 0 ; i < N ; i++) {
            D[i] = Integer.parseInt(s[i]);
        }
        if(D[0] != 0) {
            System.out.println("0");
        }else {
            Arrays.sort(D);
            int[] jisuu = new int[D[N - 1] + 1];
            for(int i = 0 ; i < N ; i++) {
                jisuu[D[i]]++;
            }
            if(jisuu[0] != 1) {
                System.out.println(0);
            }else {
                long count = 1;
                for(int i = 1 ; i < jisuu.length ; i++) {
                    if(jisuu[i] == 0) {
                        count = 0;
                        break;
                    }else {
                        for(int j = 1 ; j <= jisuu[i] ; j++) {
                            count *= jisuu[i - 1];
                            count %= 998244353;         
                        }
                    }
                }
                System.out.println(count);
            }
        }
    }
}


Measured memory_bytes: 37516
#include<cstdio>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int t[n];
    int v[n+1];
    for (int i = 0; i < n; i++) scanf("%d", &t[i]);
    for (int i = 0; i < n; i++) scanf("%d", &v[i]);
    v[n] = 0;
    int time[n];
    time[0] = t[0];
    for (int i = 1; i < n; i++) time[i] = time[i-1] + t[i];

    // for (int i = 0; i < n; i++) printf("%d\n",time[i]);

    double speed = 0.5;
    double T = 0.5;
    double ans = 0.5 * 0.5 * 0.5;
    for (double i = 0.5; i < time[n-1]; i += 0.5){
        for (int j = 0; j < n; j++){
            if (time[j] > i){
                bool flag = false;
                for (int k = j; k < n; k++){
                    if (v[k+1] + (time[k] - i) <= speed){
                        // puts("1");

                        ans += (speed + speed - 0.5) * 0.5 * 0.5;
                        speed -= 0.5;
                        flag = true;
                        
                        // printf("%f\n", ans);
                        break;
                    }
                }
                if (flag) break;
                if (speed == v[j]){
                    ans += speed / 2;
                    // printf("%f\n", ans);
                    break;
                }
                else {

                }

                ans += (speed + speed + 0.5) * 0.5 * 0.5;
                speed += 0.5;
                // printf("%f\n", ans);
                break;
            }
        }
        // T++;
        // printf("T = %f\n", i);
        // printf("speed = %f\n", speed);

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

}

Measured memory_bytes: 760
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int M, D, d1, d10, S = 0;
	string day;

	cin >> M;
	cin >> D;

	for (int i = 4; i <= M; i++)
	{
		for (int j = 22; j <= D; j++)
		{
			d1 = j / 10;
			d10 = j - d1 * 10;
			if (i == d1 * d10 && d10 != 1)
			{
				S++;
			}
		}
	}

	cout << S << endl;

	return 0;
}


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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int a1, a2, a3;

signed main()
{
    cin >> a1 >> a2 >> a3;

    int sum = a1 + a2 + a3;
    if (sum >= 22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }

    return 0;
}


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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long
#define mod int(1e9+7)
#define endl '\n'
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi (acos(-1))
#define S second
#define F first
ll fp(ll n , ll p )
{
    if(p==0)
        return 1;
    if(p==1)
        return n ;
    ll res = fp(n,p/2) ;
    res=((res)*(res)) ;
    if(p%2)
        res=(res*n) ;
    return res ;
}

int main()
{
    ENGZ;
    string s;
    cin>>s ;
    ll ans = 0 , f = 0;
    for(int i=sz(s)-1 ; i>=0 ; i--)
    {
        ll dig = s[i]-'0';
        if(f)dig++;
        f = 0 ;
        if(dig > 5)
        {
            ans += 10 - dig ;
            f = 1 ;
        }
        else if(dig == 5 && i>0 && s[i-1]-'0' > 4)
        {
            ans += 10 - dig ;
            f = 1 ;

        }
        else
        {
            ans += dig ;
        }
    }
    if(f)ans++ ;
    cout<<ans <<endl ;
    return 0;
}


Measured memory_bytes: 1948
#include <stdio.h>

int main()
{
	int N, A, B;
  	scanf("%d", &N);
  	if(N==1){
      printf("Hello World\n");
    } else {
      scanf("%d%d", &A, &B);
      printf("%d\n", A+B);
    }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    
    if(a*b*c == 175){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main()
{
  int a[N],n,i,j,minj,b;
  int cnt=0;

  scanf("%d",&n);
  for(i=0 ; i<n ;i++)
    {
      scanf("%d",&a[i]);
    }

  for(i=0 ; i<n ;i++)
    {
      minj=i;
      for(j=i ; j<n ; j++)
	{
	  if(a[j]<a[minj])
	    {
	      minj = j;
	    }
	}
      
      if(i != minj)
	{
	  b=a[i];
	  a[i] = a[minj];
	  a[minj] = b;
	  cnt++;
	}
    }

  for(i=0 ; i<n-1 ; i++)
    {
      printf("%d ",a[i]);
    }
  printf("%d\n%d\n",a[n-1],cnt);
  
  return 0;
}



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

int dp[1000000];
int dp1[1000000];

void init(){

 
  for(int i=0;i<1000000;i++){
    dp[i]=100000;
  }

  dp[0]=0;
  for(int i=1;i<1000000;i++){
    int j=1;
    while(i-j*(j+1)*(j+2)/6>=0){
      dp[i]=min(dp[i],dp[i-j*(j+1)*(j+2)/6]+1);
      j++;
    }
  }
 


  for(int i=0;i<1000000;i++){
    dp1[i]=1000000;
  }
  dp1[0]=0;
  for(int i=1;i<1000000;i++){
    int j=1; 
    while(i-j*(j+1)*(j+2)/6>=0){
      if((j*(j+1)*(j+2)/6)%2)
        dp1[i]=min(dp1[i],dp1[i-j*(j+1)*(j+2)/6]+1);
      j++;
    }
  }

}

void f(int n){
  cout<<dp[n]<<' '<<dp1[n]<<endl;
}


main(){
  int n;
  init();
  while(true){
    cin>>n;
    if(n==0) break;
    f(n);
  }

}



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

int main() {
    long long int N;
    cin >> N;
    long long int result = 0;
    for(long long int i = 1; i <= N; i++) {
        if(i % 3 == 0 || i % 5 == 0) {
            continue;
        }
        result += i;
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3636
n, cap = map(int, input().split())
dp = [0] * (cap + 1)

for _ in range(n):
    v, w = map(int, input().split())
    for k in range(cap - w, -1, -1):
        new_v = dp[k] + v
        if dp[k + w] < new_v:
            dp[k + w] = new_v

print(max(dp))

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

using namespace std;

int main(void) {
	string s;
	int x, y;
	cin >> s;
	cin >> x >> y;
	vector<int> v;
	vector<int> w;
	bool xflag = true;
	int count = 0;
	s += 'T';//番兵
	for(int i = 0; i < s.length(); ++i) {
		if(s[i] == 'F') {
			++count;
		} else if(s[i] == 'T') {
			if(xflag) {
				v.push_back(count);
			} else {
				w.push_back(count);
			}
			xflag ^= true;
			count = 0;
		}
	}

	x -= v[0];
	v[0] = 0;

	const int offset = 100000;
	//dp[i][k] : v[0], ..., v[i]で(k - offset)が作れるか
	vector<vector<bool> > dpv(vector<vector<bool> >(v.size(), vector<bool>(offset * 2, false)));
	dpv[0][offset + v[0]] = true;
	dpv[0][offset - v[0]] = true;
	for(int i = 1; i < v.size(); ++i) {
		for(int k = 0; k < offset * 2; ++k) {
			if(dpv[i - 1][k]) {
				dpv[i][k + v[i]] = true;
				dpv[i][k - v[i]] = true;
			}
		}
	}

	if(w.size() != 0) {
		vector<vector<bool> > dpw(vector<vector<bool> >(w.size(), vector<bool>(offset * 2, false)));
		dpw[0][offset + w[0]] = true;
		dpw[0][offset - w[0]] = true;
		for(int i = 1; i < w.size(); ++i) {
			for(int k = 0; k < offset * 2; ++k) {
				if(dpw[i - 1][k]) {
					dpw[i][k + w[i]] = true;
					dpw[i][k - w[i]] = true;
				}
			}
		}

		if(dpv[v.size() - 1][offset + x] && dpw[w.size() - 1][offset + y]) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	} else {
		if(dpv[v.size() - 1][offset + x] && y == 0) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}
	return 0;
}



Measured memory_bytes: 194432
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		long[] tmp = toLongArray(in);
		System.out.println((tmp[0]*3+tmp[1])/2);

	}

	public static String[] readLineArray(BufferedReader in) throws Exception{
		return in.readLine().split(" ");
	}

	public static long[] toLongArray(String[] tmp) throws Exception{
		long[] ret = new long[tmp.length];
		for(int i=0;i<tmp.length;i++){
			ret[i] = Long.parseLong(tmp[i]);
		}
		return ret;
	}
	public static long[] toLongArray(BufferedReader in) throws Exception{
		return toLongArray(readLineArray(in));
	}
	public static String readLine(BufferedReader in) throws Exception{
		return in.readLine();
	}
	public static long toLong(String tmp) throws Exception{
		long ret = Long.parseLong(tmp);
		return ret;
	}
	public static long toLong(BufferedReader in) throws Exception{
		return toLong(readLine(in));
	}



}


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

int main(){
  string S,T;
  cin >> S >> T;
  if(S[0] == T[2] && S[1] == T[1] && S[2] == T[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())
X=list(map(int,input().split()))
ans=0
for i in range(n-1):
    if (X[i+1]-X[i])*a<b:
        ans+=(X[i+1]-X[i])*a
    else:
        ans+=b
print(ans)

Measured memory_bytes: 20060
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int n;
cin>>n;
vector<int> v(n);
FOR(i,0,n) cin>>v[i];
int mn = 1e9;
FOR(i,1,101){
    int p = i;
    int ans= 0;
    for(auto val : v) ans+=(abs(p-val)*abs(p-val));
    mn = min(ans,mn);
}
cout<<mn;
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  string S;
  cin >> S;
  ll ans=700;
  for (int i=0; i<3; i++) {
    if (S[i]=='o') ans+=100;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		long n = Long.parseLong(sc.next());		//個数（10^10 + 0 ～ +N）
		long k = Long.parseLong(sc.next());		//選ぶ個数（＜＝n+1）

		long ans = 0;

		for(long i = k; i <= n + 1; i++) {
			long max = 0;
			long min = 0;

			min = i * (i - 1) / 2;
			//System.out.print(min);
			max = (n + (n - i + 1)) * i / 2;
			//System.out.print(max);

			ans += ((max - min + 1) % (1000000000 + 7));
			//System.out.println(max + "," + min );
		}

		ans %= (1000000000 + 7);

		System.out.println(ans);

		sc.close();
	}

}

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

int main() {
	int n;
	bool a[4][13];
	for (int i = 0; i < 4; i++)
		for (int j = 0; j < 13; j++)
			a[i][j] = true;
	cin >> n;
	for (int i = 0; i < n; i++) {
		char c;
		int r;
		cin >> c >> r;
		switch (c) {
		case 'S':
			a[0][r - 1] = false;
			break;
		case 'H':
			a[1][r - 1] = false;
			break;
		case 'C':
			a[2][r - 1] = false;
			break;
		case 'D':
			a[3][r - 1] = false;
			break;
		}
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 13; j++) {
			if (a[i][j]) {
				switch (i) {
				case 0:
					cout << "S " << j + 1 << endl;
					break;
				case 1:
					cout << "H " << j + 1 << endl;
					break;
				case 2:
					cout << "C " << j + 1 << endl;
					break;
				case 3:
					cout << "D " << j + 1 << endl;
					break;
				}
			}
		}
	}
}


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

vector<vector<int>> G;
map<int , int> vis , dist;

int dfs(int x)
{
    if(vis[x] == 1)
        return dist[x];
    for(int i=0 ; i<G[x].size() ; i++)
        dist[x] = max(dist[x] , dfs(G[x][i]) + 1);
    vis[x] = 1;
    return dist[x];
}

int main()
{
    int n , m;
    cin>> n >> m;
    G.resize(n+1);
    int ans = 0 , a , b;
    for(int i=0 ; i<m ; i++)
    {
        cin >> a >> b;
        G[a].push_back(b);
    }
    for(int i=1 ; i<=n ; i++)
        ans = max(ans , dfs(i));
    cout << ans;
    return 0;
}

Measured memory_bytes: 19200
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

ll dp[5010][2];
const int BASE = 2505;

int main(){
    int n, a;
    cin >> n >> a;
    vi x(n);
    rep(i, n) cin >> x[i];
    rep(i, n) x[i] -= a;
    dp[BASE][0] = 1;
    int cur = 0, nxt = 1;
    rep(i, n) {
        rep(j, 5010) dp[j][nxt] = dp[j][cur];
        rep(j, 5010) {
            int k = j + x[i];
            if(k >= 0 && k < 5010) dp[k][nxt] += dp[j][cur];
        }
        swap(cur, nxt);
    }
    cout << dp[BASE][cur]-1 << endl;
    return 0;
}

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


def main():
    N = int(input())
    H = [0]*N
    U = [0]*N
    for i in range(N):
        m = int(input())
        for j in range(m):
            x, y = map(int, input().split())
            x -= 1
            if y:
                H[i] += (1 << x)
            else:
                U[i] += (1 << x)

    ans = 0
    for i in range(1 << N):
        h, u = 0, 0
        for j in range(N):
            if (i >> j) & 1:
                h |= (1 << j)
                h |= H[j]
                u |= U[j]
            else:
                u |= (1 << j)
        if not (h & u):
            ans = max(ans, bin(i).count("1"))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
/*
* @Author: hannibal_lecter
* @Date:   2018-09-23 20:41:29
* @Last Modified by:   hannibal_lecter
* @Last Modified time: 2018-09-23 20:45:25
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) ((x)&(-x))
typedef long long ll;
const int maxn = 1e5+5;
const int mod = 1e9+9;
int Case = 1, n, m;
int cnt1[maxn], cnt2[maxn];
void solve(){
    string s,t;
    cin>>s>>t;
    for(int i = 0; i < s.size(); i++) {
    	cnt1[s[i]-'a'+1]++;
    }
    for(int i = 0; i < t.size(); i++) {
    	cnt2[t[i]-'a'+1]++;
    }
    sort(cnt1+1, cnt1+27);
    sort(cnt2+1, cnt2+27);
    for(int i = 1; i <= 26; i++) {
    	if(cnt1[i] != cnt2[i]) {
    		cout<<"No\n";
    		return;
    	}
    }
    cout<<"Yes\n";
    return;
}

int main() {
    //ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    //freopen("/Users/hannibal_lecter/Desktop/code/in.txt", "r", stdin);
    //freopen("/Users/hannibal_lecter/Desktop/code/out.txt","w",stdout);
#endif
    while(Case--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N;
  cin>>N;
  if(N<105) cout<<0<<endl;
  else if(N<135) cout<<1<<endl;
  else if(N<165) cout<<2<<endl;
  else if(N<189) cout<<3<<endl;
  else if(N<195) cout<<4<<endl;
  else cout<<5<<endl;
}


Measured memory_bytes: 3596