akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

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

int N,M,nod,a,b,sol[maxn],cont;
queue<int> Q;
vector<int> G[maxn];

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N >> M;

    for(int i=1;i<=M;i++){
        cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
    }

    sol[1] = 1;
    Q.push(1);
    while(!Q.empty()){
        nod= Q.front();
        Q.pop();
        for(auto ady:G[nod]){
            if(sol[ady])
                continue;
            sol[ady] = nod;
            cont++;
            Q.push(ady);
        }
    }

    if(cont!=N-1){
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";

    for(int i=2;i<=N;i++)
        cout << sol[i] << "\n";














}


Measured memory_bytes: 12920
#include <bits/stdc++.h>
using namespace std;
int main() {
	int A, B, K; 
    cin >> A >> B >> K;
	for (int i = 100; i >= 1; i--) {
    if  (A%i == 0 && B%i == 0) { 
    K--;
	if (K == 0) {
	cout << i << endl;
	}
    }
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
    int i,j,k,a,b,c,x,t=0;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&x);
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            for(k=0;k<=c;k++){
                if(i*500+j*100+k*50==x){
                    t++;
                }
            }
        }
    }
    printf("%d\n",t);
    return 0;
}

Measured memory_bytes: 256
def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
  
N, K = map(int, input().split())
p = 10**9 +7
for i in range(K):
  print((comb(N-K+1,i+1,p)*comb(K-1,i,p))%p)

Measured memory_bytes: 3444
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A = lr()
X = np.array(lr()) - A
dp = np.zeros(3000, np.int64)
dp[1500] = 1 #1500を原点とする
for x in X:
    if x > 0:
        dp[x:] = dp[x:] + dp[:-x]
    elif x == 0:
        dp[:] = dp[:] + dp[:]
    else:
        dp[:x] = dp[:x] + dp[-x:]

print(dp[1500] - 1)
# 11

Measured memory_bytes: 14424
/**
 *      ABC 73 C
 *      author  : kyomukyomupurin
 *      created : 2018-09-08 19:50:48
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; cin >> N;
    int A[N] = {};
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    sort(A, A+ N);
    //int count[N] = {};

    int i = 0;
    int answer = 0;

    while (i < N){      // 普通の配列で個数分布をつくる
        int length = 0; int value = A[i];
        while (i < N && A[i] == value){
            ++length; ++i;
        }
        answer += length % 2;
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 1276
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Stack;


class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	void solve(){
		while(in.hasNext()){
			int n = in.nextInt();
			if(n == -1) return;
			int ans = 1150;
			if(n > 10) ans += Math.min(n - 10, 10) * 125;
			if(n > 20) ans += Math.min(n - 20, 10) * 140;
			if(n > 30) ans += (n - 30) * 160;

			System.out.println(4280 - ans);
		}
	}

	

}

Measured memory_bytes: 26012
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, W[305], DP[305][305];

int DFS(int L, int R){
  if (DP[L][R] != -1) return DP[L][R];

  if (L + 1 == R) return DP[L][R] = 0;
  if (L + 2 == R){
    if (abs(W[L] - W[L + 1]) <= 1) return DP[L][R] = 2;
    else return DP[L][R] = 0;
  }

  int ans = 0;
  if (DFS(L + 1, R - 1) == (R - 1) - (L + 1)){
    ans = DFS(L + 1, R - 1);
    if (abs(W[L] - W[R - 1]) <= 1) ans += 2;
  }

  for (int i = L + 1; i < R; i++){
    ans = max(ans, DFS(L, i) + DFS(i, R));
  }
  return DP[L][R] = ans;
}

int Solve(){
  fill((int*)DP, (int*)(DP + N), -1);
  for (int i = 0; i < N; i++) cin >> W[i];
  cout << DFS(0, N) << endl;
  return 0;
}

int main(){
  while (cin >> N){
    if (N == 0) return 0;
    Solve();
  }

  return 0;
}



Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int>
int mod = 1e9+7; 
int add (int a,int b){
	return ((a%mod)+(b%mod))%mod;
}
int mul (int a,int b){
	return ((a%mod)*(b%mod))%mod;
}
int power (int a,int b){
	int res = 1;
	while(b!=0){
		if(b&1)
			res = mul(res,a);
		b = b/2;
		a = mul(a,a);
	}
	return res;
}
int sub (int a,int b){
	return ((a%mod)-(b%mod)+mod)%mod;
}
const int N = 2e5+1;
int ncr(int n,int r){
	int num = 1;
	int cnt = r;
	int den = 1;
	for(int i = 1;i<=r;i++){
		num = mul(num,n-i+1);
		den = mul(den,cnt--);
	}
	return mul(num,power(den,mod-2));
}
signed main(){
    fast;
    //build();
   	int n,a,b;
   	cin>>n>>a>>b;
   	int total = sub(power(2,n),1);
   	int hatana = add(ncr(n,a),ncr(n,b));
   	int ans = sub(total,hatana);
   	cout<<ans;
}


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

int n, arr[100000];

int solve(int key) {
	int mid, right=n, left=0;
	while(left<right) {
	    mid=(right + left) /2;
		if(key==arr[mid]) return 1;
		if(key<arr[mid]) right=mid;
		else if(key > arr[mid]) left = mid+1;
}
return 0;
}


int main() {
	int key ,q, count=0;
	cin >> n ;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	cin >> q;
	for (int j = 0; j < q; j++) {
			cin >> key;
			if(solve(key)) count++;
		}	
	cout << count << endl;
}


Measured memory_bytes: 3396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <stack>

using namespace std;

void solve()
{
	string s;
	while (getline(cin, s))
	{
		if (s == ".")
		{
			return;
		}
		bool isBalanced = true;
		stack<char> Stack;
		for (int i = 0; i < s.size(); ++i)
		{
			if (s[i] == '(')
			{
				Stack.push('(');
			}
			else if (s[i] == '[')
			{
				Stack.push('[');
			}
			else if (s[i] == ')')
			{
				if (Stack.empty())
				{
					isBalanced = false;
					break;
				}
				char c = Stack.top();
				Stack.pop();
				if (c != '(')
				{
					isBalanced = false;
					break;
				}
			}
			else if (s[i] == ']')
			{
				if (Stack.empty())
				{
					isBalanced = false;
					break;
				}
				char c = Stack.top();
				Stack.pop();
				if (c != '[')
				{
					isBalanced = false;
					break;
				}
			}
		}
		if (isBalanced && Stack.size() == 0)
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
}

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

Measured memory_bytes: 1176
import re

s = input()
t = 'keyence'

for i in range(len(t)):
    ptn = '^' + t[:i] + '.*' + t[i:] + '$'
    # print(ptn)
    m = re.match(ptn, s)
    if m: break

if m:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3188
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <tuple>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
long long int MOD = 1000000000 + 7;
using ll = long long;
ll LARGE = 1000000;


int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> h(n);
	for (ll i = 0; i < n; ++i) {
		cin >> h[i];
	}
	sort(h.begin(), h.end(), greater<ll>());
	for (ll i = 0; i < min(k, n); ++i) {
		h[i] = 0;
	}
	ll sum = 0;
	for (ll i = 0; i < n; ++i) {
		sum += h[i];
	}

	cout << sum << endl;
}


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

int main(){
  int N;
  cin >> N;
  int64_t count=0;
  for(int i=1;i<N+1;i++){
    if(i%3!=0&&i%5!=0){
      count += i;
    }
  }
  cout << count;
}


Measured memory_bytes: 3636
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(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))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n, m;
    cin >> n >> m;
    int maxx = 0;

    vector<int> yaku;
    for(int i=1;i*i<=m;i++){
        if(m % i == 0){
            yaku.push_back(i);
            if(i * i != m)
                yaku.push_back(m / i);
        }
    }
    for(auto t: yaku){
        int mm = m / t;
        if(mm - n < 0)
            continue;
        maxx = max(maxx, t);
    }

    cout << maxx << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second

typedef long long ll;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

void solve1()
{
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i, n) {
        cin >> a[i] >> b[i] >> c[i];
    }

    int dp[n+1][3]; 
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for(int i = 1; i < n+1; i++)
    {
        dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
        dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
        dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
    }

    int ans = max({dp[n][0], dp[n][1], dp[n][2]});

    cout << ans << endl;
}

int main()
{
    solve1();
}


Measured memory_bytes: 5628
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>

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

using namespace std;
 
typedef long long int ll;

const ll INF=(ll)1e18;

int main(){
  int r;
  cin >> r;
  cout << r*r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>

using ll = long long;
const ll INF = (ll)1e18;

ll dy[4] = {  0,  0, -1, +1};
ll dx[4] = { -1, +1,  0,  0};

ll H, W, V;
typedef struct {
  ll from;
  ll to;
  ll cost;
} S_Edge;

template<typename Head> void print(Head head){ std::cout << head << std::endl; }
template<typename Head, typename... Tail> void print(Head head, Tail... tail) {
  std::cout << head << " ";
  print(tail...);
}

ll pos2idx(ll y, ll x) { return y * W + x; }
ll idx2y(ll idx) { return idx / W; }
ll idx2x(ll idx) { return idx % W; }

void make_map(std::vector< std::string >& grid, std::vector< std::vector<S_Edge> >& vedge)
{
  for (ll y = 0; y < H; y++) {
    for (ll x = 0; x < W; x++) {
      for (ll d = 0; d < 4; d++) {
	ll ny = y + dy[d];
	ll nx = x + dx[d];
	if (ny >= 0 && nx >= 0 && ny < H && nx < W) {
	  S_Edge edge;
	  edge.from = pos2idx(y, x);
	  edge.to   = pos2idx(ny, nx);
	  edge.cost = grid[y][x] == grid[ny][nx] ? INF : 1;
	  vedge[pos2idx(y, x)].push_back(edge);
	}
      }
    }
  }
}

ll count_paths_and_upload_visit(ll s, std::vector< std::string >& grid,
				std::vector< std::vector<S_Edge> >& vedge,
				std::vector< bool >& is_visited)
{
  ll cnt[2] = {0, 0};
  std::queue<ll> que;

  que.push(s);
  is_visited[s] = true;
  cnt[0] += grid[idx2y(s)][idx2x(s)] == '#' ? 1 : 0;
  cnt[1] += grid[idx2y(s)][idx2x(s)] == '.' ? 1 : 0;

  while (!que.empty()){
    ll v = que.front(); que.pop();
    for (auto it = vedge[v].begin(); it != vedge[v].end(); it++) {
      if (!is_visited[it->to] && it->cost != INF) {
	que.push(it->to);
	is_visited[it->to] = true;
	cnt[0] += grid[idx2y(it->to)][idx2x(it->to)] == '#' ? 1 : 0;
	cnt[1] += grid[idx2y(it->to)][idx2x(it->to)] == '.' ? 1 : 0;
      }
    }
  }

  return cnt[0] * cnt[1];
}

int main()
{
  std::cin >> H >> W;
  V = H * W;

  std::vector< std::string > grid(H, std::string(W, 'X'));
  for (ll y = 0; y < H; y++) {
    std::cin >> grid[y];
  }

  std::vector< std::vector<S_Edge> > vedge(V);
  make_map(grid, vedge);

  std::vector< bool > is_visited(V);

  ll ans = 0;
  for (ll y = 0; y < H; y++) {
    for (ll x = 0; x < W; x++) {
      if (is_visited[pos2idx(y,x)]) continue;
      ans += count_paths_and_upload_visit(pos2idx(y,x), grid, vedge, is_visited);
    }
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 21760
///
// File:  a.cpp
// Author: ymiyamoto
//
// Created on Sun Dec  3 21:00:01 2017
//
#include <cstdint>
#include <iostream>

using namespace std;

int32_t main()

{
  int32_t N, A, B;
  cin >> N >> A >> B;
  cout << min(N * A, B) << endl;

  return 0;
}


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

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int v[100005];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    vector<int> c(n);
    int ans[n];
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int sum = 0;
    rep(i,n){
        cin >> c[i];
        sum += c[i];
    }
    sort(ALL(c),greater<>());
    int cnt = 0;
    queue<int> q;
    q.push(0);
    v[0] = 1;
    ans[0] = c[cnt];
    sum -= ans[0];
    cnt++;
    while(!q.empty()){
        int now = q.front();q.pop();
        for(int i=0;i<g[now].size();i++){
            int next = g[now][i];
            if(v[next])continue;
            v[next] = 1;
            ans[next] = c[cnt];
            cnt++;
            q.push(next);
        }
    }
    cout << sum << endl;
    rep(i,n)cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <climits>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    
    int a, b;
    cin >> a >> b;
    cout << 6-a-b << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int num[47];

int fib(int n){
  if(num[n]!=0)return num[n];
  else return num[n] = fib(n-1) + fib(n-2);
}

int main(){
  int n;
  cin >> n;
  num[0] = 1;
  num[1] = 1;
  n = fib(n);
  cout << n << endl;
  return 0;
}



Measured memory_bytes: 3096
#include <stdio.h>

struct point{
	int s;
	int c;
};

int main(){
	int i, j, n, m,checker=0;
	scanf("%d%d",&n,&m);
	struct point d[m],p;
	for(i=0;i<m;i++){
		scanf("%d%d",&d[i].s,&d[i].c);
		if((n!=1)&&(d[i].s==1)&&(d[i].c==0)) checker = 1;
	}
	for(i=0;i<m-1;i++){
		for(j=i+1;j<m;j++){
			if(d[i].s>d[j].s){
				p=d[i];
				d[i]=d[j];
				d[j]=p;
			}
		}
	}
	
	int ans[n];
	for(i=0;i<n;i++) ans[i]=0;
	ans[0]=1;

	for(i=0;i<m-1;i++){
		for(j=i+1;j<m;j++){
			if((d[i].s==d[j].s)&&(d[i].c!=d[j].c)) {
				checker = 1;
				break;
			}
		}
	}
	if(checker==1) printf("-1");
    else if((n==1)&&(m==0)) printf("0");
	else {
		for(i=0;i<m;i++) ans[d[i].s - 1] = d[i].c;
		for(i=0;i<n;i++) printf("%d",ans[i]);
	}
    printf("\n");
}
	


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, k;
    cin >> n >> k;
    vector<lint> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    lint ret = 0;
    for (int i = 0; i < n; ++i) {
        if ((k | a[i]) == k) {
            ret += b[i];
        }
    }
    for (int i = 1; i < 31; ++i) {
        if (k & (1 << i)) {
            lint kt = k;
            kt      = kt & ~(1 << i);
            for (int j = 0; j < i; ++j) {
                kt = kt | (1 << j);
            }
            lint temp = 0;
            for (int i = 0; i < n; ++i) {
                if ((kt | a[i]) == kt) {
                    temp += b[i];
                }
            }
            chmax(ret, temp);
        }
    }
    cout << ret << "\n";
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int n;
  map<int, bool> m;
  cin >> n;
  rep(i, 0, n) {
    int a;
    cin >> a;
    m[a] = !m[a];
  }
  int ans = 0;
  for(map<int, bool>::iterator i = m.begin(); i != m.end(); i++) {
    if(i->second) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 4992
use std::io;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let s: String = iter.next().unwrap().parse().unwrap();

    let n = s.len();

    let mut indexOfC: usize = 1000;
    let mut indexOfF: usize = 1000;

    for i in 0..n {
        if s.chars().nth(i).unwrap() == 'C' { indexOfC = i;break; }
    }
    for i in 0..n {
        if s.chars().nth(n-1-i).unwrap() == 'F' { indexOfF = n-1-i;break; }
    }

    println!("{}", if indexOfC<1000 && indexOfF<1000 && indexOfC<indexOfF {"Yes"} else {"No"});
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lb lower_bound
#define debug(x) cout<<"["<<#x<<": "<<x<<"]"<<endl
#define f(p,n) for(ll i=p;i<n;i++)
ll exp(ll a,ll b,ll m);

int main()
{
 ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 		/*
 	#ifndef ONLINE_JUDGE
        freopen("/home/savish/Desktop/2019/io/input.txt", "r", stdin);
        freopen("/home/savish/Desktop/2019/io/output.txt", "w", stdout);
    #endif
        */
    ll n,w;
    cin>>n>>w;
    ll dp[n+1][w+1];
    ll va[n+1],wt[n+1];
    f(1,n+1) cin>>wt[i]>>va[i];

    f(0,n+1)
    {
    	for(ll j=0;j<=w;j++)
    	{
    		if(i==0 || j==0) dp[i][j] = 0;
    		else if(wt[i]<=j) dp[i][j] = max(dp[i-1][j],va[i]+dp[i-1][j-wt[i]]);
    		else dp[i][j] = dp[i-1][j];
    	}
    } 
    cout<<dp[n][w]<<endl;
    
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}

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

long long int knapSack(long long int n, long long int w,long long int wt[],long long int val[]) 
{ 
   long long int i, j; 
   long long int dp[n+1][w+1]; 
   for (i = 0; i <= n; i++) 
   { 
       for (j = 0; j <= w; j++) 
       { 
           if (i==0 || j==0) 
               dp[i][j] = 0; 
           else if (wt[i-1] <= j) 
                 dp[i][j] = max(val[i-1] + dp[i-1][j-wt[i-1]],  dp[i-1][j]); 
           else
                 dp[i][j] = dp[i-1][j]; 
       } 
   } 
   return dp[n][w]; 
} 
  
int main() 
{ 
   long long int n,w;
   cin>>n>>w;
   long long int wt[n],val[n],i;
   for(i=0;i<n;i++)
   {
   	cin>>wt[i]>>val[i];
   }
    cout << knapSack(n,w, wt, val); 
    return 0; 
} 

Measured memory_bytes: 79104
#include <iostream>
using namespace std;
int main()
{
	int a,b,c,f=0;
	cin>>a>>b>>c;
	for(int i = a;i<=b;++i){
		if(0==c%i){
			f++;
		}
	}
	cout<<f<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

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

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

const int N = 100100;
int n, m, k;
int a[N], b[N];
int ans = (int)1e9;

int main()
{
	startTime = (double)clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for (int i = 0; i < m; i++)
		scanf("%d", &b[i]);
	while(k--) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		x--;y--;
		ans = min(ans, a[x] + b[y] - z);
	}
	int x = a[0], y = b[0];
	for (int i = 0; i < n; i++)
		x = min(x, a[i]);
	for (int i = 0; i < m; i++)
		y = min(y, b[i]);
	ans = min(ans, x + y);
	printf("%d\n", ans);


	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s, t;
	cin >> s >> t;
	vector<int> v, w;
	vector<int> a(30, 0), b(30, 0);
	int p = 1;
	for(int i = 0; i < s.size(); i++)
	{
		int tmp = s[i] - 'a';
		if(a[tmp] == 0)
		{
			v.push_back(p);
			a[tmp] = p;
			p++;
		}
		else
			v.push_back(a[tmp]);
	}
	p = 1;
	for(int i = 0; i < t.size(); i++)
	{
		int tmp = t[i] - 'a';
		if(b[tmp] == 0)
		{
			w.push_back(p);
			b[tmp] = p;
			p++;
		}
		else
			w.push_back(b[tmp]);
	}
	/*
	for(int i = 0; i < v.size(); i++)
		cout << v[i];
	cout << endl;
	for(int i = 0; i < w.size(); i++)
		cout << w[i];
	*/
	if(v == w)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	/*
	vector<int> vec(125, 0);
	bool table[125][125] = {};
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i] == t[i])
			continue;
		if(table[s[i]][t[i]] == true)
			vec[t[i]]--;
		table[s[i]][t[i]] = true;
		vec[t[i]]++;
	}
	for(int i = 0; i < 125; i++)
	{
		if(vec[i] >= 2)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	vector<pair<int, bool> > vec(125);
	for(int i = 0; i < 125; i++)
	{
		vec[i].first = i;
		vec[i].second = false;
	}
	
	bool table[125][125] ={};
	vector<char> a(125);
	for(int i = 0; i < 125; i++)
		a[i] = i;
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i] == t[i])
			continue;
		if(a[t[i]] == t[i])
		{
			//cout << a[t[i]] << " " << t[i] << endl;
			a[t[i]] = s[i];
			table[s[i]][t[i]] = true;
		}
		else if(table[s[i]][t[i]] == true)
		{
		}
		else
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	*/
	return 0;
}

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    string s;
    cin >> s;
    if((int)s.size() == 2) cout << s << endl;
    else cout << s[2] << s[1] << s[0] << endl;
    return 0;
}

Measured memory_bytes: 3592
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanln(&s)

	fmt.Println(logic(s))
}

func logic(s string) string {
	if s == "A" {
		return "T"
	}

	if s == "T" {
		return "A"
	}

	if s == "G" {
		return "C"
	}

	return "G"
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    string s;
    int k;
    cin >> s >> k;
    set<string> st;
    int n = s.size();
    rep(i, 0, n) {
        rep(j, 1, 6) {
            if (i + j - 1 < n) {
                st.insert(s.substr(i, j));
            }
        }
    }
    int cnt = 0;
    for (auto p : st) {
        if (++cnt == k) {
            cout << p << "\n";
            return 0;
        }
    }
}

Measured memory_bytes: 4720
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	N    int
	a, b [254321]int
)

func main() {
	readVariables()
	var answer []string
	for i := N; i > 0; i-- {
		val := i
		s := a[i]
		for val <= N {
			s += b[val]
			val += i
		}
		// fmt.Println(i, s)
		if s%2 == 1 {
			b[i] = 1
			answer = append(answer, strconv.Itoa(i))
		}
	}
	fmt.Println(len(answer))
	fmt.Println(strings.Join(answer, " "))
}

func dividers(x int) []int {
	result := make([]int, 0, 1024)
	upperbound := int(math.Sqrt(float64(x)) + 1)
	for i := 1; i < upperbound; i++ {
		if x%i == 0 {
			result = append(result, i)
		}
	}
	return result
}

func readVariables() {
	N = nextInt()
	for i := 1; i <= N; i++ {
		a[i] = nextInt()
	}
}

/* Template */

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt returns minimum argument
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt returns maximum argument
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt returns |x| for x
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow calculates integer power with modulo operation
//if modulo <= 1, it powers w/o module operation
//if base < 0, return value might be negative too.
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 14464
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;
// nCr: v[n][r]
vector<vector<ll>> comb(ll n, ll r) {
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for (int i = 0; i < v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int j = 1; j < v.size(); j++) {
        for (int k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
        }
    }
    return v;
}


ll calc(ll ce, ll co) {
    ll tmp = co;
    if (tmp % 2 != 0) tmp--;
    ll ret = 0;
    for (ll i = 0; i <= tmp; i += 2) {
        ret += comb(co, i)[co][i];
    }
    return (1LL << ce) * ret;
}

ll calc2(ll ce, ll co) {
    ll tmp = co;
    if (tmp % 2 == 0) tmp--;
    ll ret = 0;
    for (ll i = 1; i <= tmp; i += 2) {
        ret += comb(co, i)[co][i];
    }
    return (1LL << ce) * ret;
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n, p;
        cin >> n >> p;
        vector<ll> a(n);
        ll ce = 0, co = 0;
        rep(i, n) {
            cin >> a[i];
            a[i] %= 2;
            if (a[i] == 0) ce++;
            else co++;
        }
        if (p == 0) {
            cout << calc(ce, co) << endl;
        } else {
            cout << calc2(ce, co) << endl;
        }


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
n=int(input())
ans=0
lis=[]
def cnt(n):
  ret=0
  for i in range(1,n):
    ret+=i
  return ret
for i in range(n):
  lis.append(sorted(list(input())))
co=1
lis.sort()
bef=lis[0]

for i in lis[1:]:
  if bef!=i:
    ans+=cnt(co)
    co=1
    bef=i
  else:
    co+=1
ans+=cnt(co)
print(ans)

Measured memory_bytes: 31168
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll mod=1e9+7;
int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        int ct1=0;
        int ct2=0;
        for(int j=0;j<i;j++)
        {
            if(a[j]<a[i])
            ct1++;
        }
        for(int j=i+1;j<n;j++)
        {
            if(a[j]<a[i])
            ct2++;
        }
        ll p=((k*(k-1))/2)%mod;
        ll q=((k*(k+1))/2)%mod;
        ans=(ans+ct1*p)%mod;
        ans=(ans+(ct2*q))%mod;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3644
import Control.Monad (replicateM)
import Data.List (intersperse)

main :: IO ()
main = do
  n <- getLine
  ls <- getNLine_ $ (rInt . head . words) n
  putStrLn $ (concat . intersperse "\n" . biList) ls

biList :: [a] -> [a]
biList [] = []
biList (l:ls) = l : l : (biList ls)

-- 複数行入力
getNLine_ :: Int -> IO [String]
getNLine_ n = replicateM n getLine

-- 文字列を整数に
rInt :: String -> Int
rInt str = read str :: Int

Measured memory_bytes: 1404
import sys
input = sys.stdin.readline
def main():
    n = int(input())
    an = list(map(int, input().split()))
    an.sort(reverse=True)
    ans = 0
    for i in range(1, n):
        d=i//2
        ans +=an[d]
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 31408
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

int x,rate[10];

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
    	cin >> x;
    	if(x<=399) rate[1]++;
    	else if(x>=400 && x<=799) rate[2]++;
    	else if(x>=800 && x<=1199) rate[3]++;
    	else if(x>=1200 && x<=1599) rate[4]++;
    	else if(x>=1600 && x<=1999) rate[5]++;
    	else if(x>=2000 && x<=2399) rate[6]++;
    	else if(x>=2400 && x<=2799) rate[7]++;
    	else if(x>=2800 && x<=3199) rate[8]++;
    	else rate[9]++;
	}
	int mi = 0,ma = 0;
	for(int i=1;i<=8;i++){
		if(rate[i]>0) mi++;
	}
	if(mi==0 && rate[9]>0) mi = 1,ma = rate[9];
	else if(mi!=0 && rate[9]>0) ma = mi+rate[9];
	else if(mi!=0 && rate[9]==0) ma = mi;
	cout << mi << " " << ma << "\n";
    
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int x;
	cin >> x;
	for (int i = 1; i <= 360; i++)
	{
		if (x * i % 360 == 0)
		{
			cout << i << endl;
			return 0;
		}
	}
} 

Measured memory_bytes: 3644
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	l := eGetInt(scanner)
	l = l * 10000000
	l = l / 3
	fl := float64(l) / 10000000.0
	fmt.Printf("%.7f\n", fl*fl*fl)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
const (
	TooLarge = math.MaxInt64
	TooSmall = math.MinInt64
)

func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	if n == 0 {
		return 1
	}
	if n == 1 {
		return a
	}
	if n%2 == 1 {
		return pow((a*a), n/2) * a
	}
	return pow((a * a), n/2)
}
func powMod(a, n, mod int) int {
	if n == 0 {
		return 1 % mod
	}
	if n == 1 {
		return a % mod
	}
	if n%2 == 1 {
		return powMod((a*a)%mod, n/2, mod) * a % mod
	}
	return powMod((a*a)%mod, n/2, mod)
}

func factoricalMod(n, count, mod int) int {
	if count == 1 {
		return n % mod
	}
	return (n % mod) * (factoricalMod(n-1, count-1, mod)) % mod
}

func combinationMod(n, a, mod int) int {
	x := factoricalMod(n, a, mod)
	y := factoricalMod(a, a, mod)
	y = powMod(y, mod-2, mod)
	return ((x % mod) * (y % mod)) % mod
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}

type ints []int

func ToString(slice []int) string {
	format := fmt.Sprint(slice)
	return fmt.Sprint(format[1 : len(format)-1])
}


Measured memory_bytes: 640
//#define TEST

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Math;

struct Pair
{
    public long x;
    public long y;

    public Pair(long x, long y) { this.x = x; this.y = y; }

    public static Pair operator -(Pair X, Pair Y)
    {
        return new Pair(X.x - Y.x, X.y - Y.y);
    }
}

class Program
{
    static int n;
    static Pair[] ps;

    static void Main()
    {
        n = int.Parse(Console.ReadLine());
        if (n == 1)
        {
            Console.WriteLine(1);
            return;
        }
        ps = new Pair[n];
        for (int i = 0; i < n; i++)
        {
            string[] input = Console.ReadLine().Split();
            ps[i] = new Pair(long.Parse(input[0]), long.Parse(input[1]));
        }

        List<Pair> dis = new List<Pair>();
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (i == j) continue;
                dis.Add(ps[i] - ps[j]);
            }
        }
        dis.Sort(comp);
#if TEST
        foreach (var d in dis)
            Console.WriteLine("{0} {1}", d.x, d.y);
#endif
        int count = 1;
        int max = 0;
        for (int i = 1; i < dis.Count; i++)
        {
            if (dis[i].x == dis[i - 1].x && dis[i].y == dis[i - 1].y)
            {
                count++;
                continue;
            }
            max = Max(max, count);
            count = 1;
            continue;
        }
        max = Max(max, count);

#if TEST
        Console.WriteLine(max);
#endif
        Console.WriteLine(n - max);
    }

    static int comp(Pair a, Pair b)
    {
        if (a.x < b.x) return 1;
        if (a.x > b.x) return -1;
        if (a.y < b.y) return 1;
        if (a.y > b.y) return -1;
        return 0;
    }
}


Measured memory_bytes: 11516
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

map<long long, int> prime_factor(long long n) {
  map<long long, int> res;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

int main() {
  ll n, p;
  cin >> n >> p;
  auto mp = prime_factor(p);
  ll ans = 1;
  for (auto e : mp)
    ans *= pow(e.first, e.second/n);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_N 100000
#define MOD 1000000007

using namespace std;
typedef pair<int, int> ipair;

int dp[MAX_N + 1];
int main(int argc, char **argv) {
    int N, M;
    cin >> N >> M;
    dp[0] = dp[1] = 1;
    for(int i = 0; i < M; ++i) {
        int a;
        cin >> a;
        dp[a] = -1;
    }

    for(int i = 2; i <= N; ++i) {
        if(dp[i] == -1)
            continue;
        
        dp[i] = 0;
        if(dp[i - 1] != -1)
            dp[i] = (dp[i] + dp[i - 1]) % MOD;
        if(dp[i - 2] != -1)
            dp[i] = (dp[i] + dp[i - 2]) % MOD;
    }
    
    cout << dp[N] << endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N,A,B;
    cin >> N >> A >> B;
    if ((B-A)%2 == 1) {
        cout << "Borys" << endl;
        return 0;
    }
    cout << "Alice" << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
list1=[]
for i in range(n):
  list1.append(int(input()))

#ここから
#minv = R[0]
#for j が 1 から n-1 まで
#maxv = (maxv と R[j]-minv のうち大きい方) 
#minv = (minv と R[j] のうち小さい方)

maxv=list1[1]-list1[0]
minv=list1[0]                                    
for j in range(1,n):
  if maxv>=list1[j]-minv:
    maxv=maxv
  else:
    maxv=list1[j]-minv
  if minv<=list1[j]:
    minv=minv
  else:
    minv=list1[j]
print(maxv)




Measured memory_bytes: 13592
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

bool isprime(int a){
	for(int i = 2; i <= sqrt((double)a); i++){
		if(a%i == 0){
			return false;
		}
	}
	return true;
}

std::vector<int> num;

int main(){
	int n;
	scanf("%d", &n);
	int cnt = 0;
	for(int i = 2; cnt < n; i++){
		if(isprime(i) && i % 5 == 1){
			printf("%d ", i);
			cnt++;
		}
	}
	printf("\n");
	return 0;
}


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

#define int long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()
#define TASK ""

using namespace std;

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

signed main() {
#ifdef LOCAL
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
if (strlen(TASK) > 0)
	freopen(TASK".in", "r", stdin),
	freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
  
  int n, m;
  cin >> n >> m;
  cout << (n == m ? "Yes\n" : "No\n");

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

template <class T>
class SegmentTree
{
private:
    int _size = 1;
    T _def;
    std::vector<T> _nodes;
    std::function<T(T, T)> _op;
    std::function<T(T, T)> _update_op;

public:
    SegmentTree(int size, T default_value, std::function<T(T, T)> op,
                std::function<T(T, T)> update_op)
        : _def(default_value), _op(op), _update_op(update_op)
    {
        while (_size < size)
            _size *= 2;
        _nodes = std::vector<T>(2 * _size, default_value);
    }

    SegmentTree(std::vector<T> nodes, T default_value, std::function<T(T, T)> op,
                std::function<T(T, T)> update_op)
        : _def(default_value), _op(op), _update_op(update_op)
    {
        int real_size = nodes.size();
        while (_size < real_size)
            _size *= 2;
        _nodes = std::vector<T>(2 * _size, default_value);
        for (int i = 0; i < real_size; ++i)
            _nodes[i + _size] = nodes[i];
        for (int i = _size - 1; i >= 0; --i)
            _nodes[i] = _op(_nodes[i * 2], _nodes[i * 2 + 1]);
    }

    T find(int l, int r)
    {
        return find(l, r, 1, 0, _size);
    }

    T find(int l, int r, int index, int cover_l, int cover_r)
    {
        if (cover_r <= l || r <= cover_l)
            return _def;
        if (l <= cover_l && cover_r <= r)
            return _nodes[index];
        return _op(find(l, r, index * 2, cover_l, (cover_l + cover_r) >> 1),
                   find(l, r, index * 2 + 1, (cover_l + cover_r) >> 1, cover_r));
    }

    void update(int index, T value)
    {
        index += _size;
        _nodes[index] = _update_op(_nodes[index], value);
        while (index > 0)
        {
            index >>= 1;
            _nodes[index] = _op(_nodes[index * 2], _nodes[index * 2 + 1]);
        }
    }
};

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

    int n, k;
    cin >> n >> k;
    auto segt = SegmentTree<int>(
        300010, 0,
        [](int x, int y) { return max(x, y); },
        [](int x, int y) { return max(x, y); });

    REP(_, 0, n)
    {
        int x;
        cin >> x;
        int res = segt.find(max(0, x - k), min(300001, x + k + 1));
        segt.update(x, res + 1);
    }

    cout << segt.find(0, 300001) << endl;
}

Measured memory_bytes: 7432
#include <stdio.h>
    #include <stdlib.h>
     
    int main() {
     
        int A,B,C,X;
        int total,ans = 0;

        scanf("%d",&A);
        scanf("%d",&B);
        scanf("%d",&C);
        scanf("%d",&X);
        for(int a=0;a<=A;a++){
            for(int b=0;b<=B;b++){
                for(int c=0;c<=C;c++){
                    total = ((500*a)+(100*b)+(50*c));
                    if(total == X){ans++;}
                }
            }
        }
        printf("%d",ans);

        return 0;     
    }

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
long long n;
pair <long long,long long> a[2005];
long long dp[2005][2005];//dp[i][j]表示前i大的数，有j个被放到了左边 
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i].first;
		a[i].first=-a[i].first;
		a[i].second=i;
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++) a[i].first=-a[i].first;
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		//cout << a[i].first << " " << a[i].second << "\n";
		for(int j=0;j<i;j++)
		{
			long long l=j+1,r=n-(i-j-1);
			dp[i][j+1]=max(dp[i][j+1],dp[i-1][j]+(a[i].second-l)*a[i].first);
			dp[i][j]=max(dp[i][j],dp[i-1][j]+(r-a[i].second)*a[i].first);
			ans=max(ans,dp[i][j]);
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 25836