akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) (a).begin(),(a).end()
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

template<typename T>
class BIT {
    public:
    int n;
    vector<T> dat; // i: [1,n]

    BIT(int size): n(size+1), dat(vector<T>(n+1)) {}

    void add(int i, T x) {
        while (i <= n) {
            dat[i] += x;
            i += i & -i;
        }
    }

    T sum(int i) {
        T ret = 0;
        while (i > 0) {
            ret += dat[i];
            i -= i & -i;
        }
        return ret;
    }

    T range(int l, int r) {
        return sum(r) - sum(l-1);
    }
};

using ll = long long;

// i < j, (v[i] op v[j]) を満たす(i,j)の組を数える
template<typename T>
ll inversion(vector<T> v, string op) {
    assert(op == "<=" || op == ">=" || op == ">" || op == "<");
    if (op == ">=" || op == "<") {
        reverse(v.begin(), v.end());
    }

    ll size = v.size();
    vector<pair<T, int>> vp(size);
    rep(i,size) {
        vp[i] = {v[i],i};
    }
    sort(vp.begin(), vp.end());

    // 小さい順に 1..size の連番を振る
    vector<int> order(size);
    rep(i,size) {
        order[vp[i].second] = i+1;
    }

    // i < j, order[i] <= order[j] の個数を数える
    ll result = 0;
    BIT<ll> bt(size);
    rep(i,size){
        result += bt.sum(order[i]);
        bt.add(order[i], 1);
    }

    if (op == ">" || op == "<") {
        return size*(size-1)/2 - result;
    } else {
        return result;
    }
}

int main(void){
    string s;
    cin >> s;
    int n = s.size();

    map<char,int> sum;
    for (char c : s) {
        sum[c]++;
    }
    int odd_alpha = 0;
    for (auto itr : sum) {
        if (itr.second & 1) odd_alpha++;
    }
    if (odd_alpha >= 2) {
        cout << -1 << endl;
        return 0;
    }

    vector<int> x(n); // s[i] -> sx[j]へ動くとき, x[i] = j
    int ai = 0, ci = (n+1)/2;
    map<char, int> cnt;
    string sa, sc;
    rep(i,n) {
        char c = s[i];
        if ((sum[c]&1) && cnt[c] == sum[c]/2) {
            x[i] = n/2;
        } else if (cnt[c] < sum[c]/2) {
            x[i] = ai++;
            sa += c;
        } else {
            x[i] = ci++;
            sc += c;
        }
        cnt[c]++;
    }
    assert(ai == n/2);
    assert(ci == n);
    assert(sa.size() == sc.size());

    int m = sa.size();
    map<char, vector<int>> pos;
    rep(i,m) pos[sa[i]].push_back(i);

    cnt.clear();
    reverse(all(sc));
    vector<int> t(m);
    rep(i,m) {
        char c = sc[i];
        t[i] = pos[c][cnt[c]];
        cnt[c]++;
    }

    cout << inversion(x, ">") + inversion(t, ">") << endl;

    return 0;
}


Measured memory_bytes: 7172
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; readV(n);

  auto f = new int[](n+1);
  foreach (i; 1..n+1) {
    while (i > 1) {
      foreach (j; 2..i+1)
        while (i%j == 0) {
          ++f[j];
          i /= j;
        }
    }
  }

  auto c = f.filter!"a >= 2".array, m = c.length, r = 0;

  foreach (i; 0..m)
    foreach (j; 0..m)
      foreach (k; j+1..m) {
        if (i != j && i != k && c[i] >= 2 && c[j] >= 4 && c[k] >= 4)
          ++r;
      }

  foreach (i; 0..m)
    foreach (j; 0..m) {
      if (i != j && c[i] >= 2 && c[j] >= 24)
        ++r;
      if (i != j && c[i] >= 4 && c[j] >= 14)
        ++r;
    }

  foreach (i; 0..m)
    if (c[i] >= 74)
      ++r;

  writeln(r);
}


Measured memory_bytes: 256
/**
 * @Author: harshkhajuria
 * @Date:   03-Jun-2019 09:20:31 am
 * @Email:  khajuriaharsh729@gmail.com
 * @Filename: C.cpp
 * @Last modified by:   harshkhajuria
 * @Last modified time: 03-Jun-2019 09:37:59 am
 */

#include <bits/stdc++.h>
#define ll long long
#define mp(a, b) make_pair(a, b)
#define newline cout << endl;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(),v.end()
using namespace std;

template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p)
{
	out << '(' << p.ff << ", " << p.ss << ')';
	return out;
}

template <typename T> ostream& operator<<(ostream& out, vector<T> const& v)
{
	int l = v.size();
	for (int i = 0; i < l - 1; i++)
		out << v[i] << ' ';
	if (l > 0)
		out << v[l - 1];
	return out;
}

template <typename T> void trace(const char* name, T&& arg1) { cout << name << " : " << arg1 << endl; }

template <typename T, typename... Args> void trace(const char* names, T&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cout.write(names, comma - names) << " : " << arg1 << " | ";
	trace(comma + 1, args...);
}

/*Input*/
const int size = 1e5+100;
int n;
vector<int> v(size);
map<int,int> m1;
map<int,int> m2;
/*Input*/

struct node {
  int high1, high2, val1, val2;
  node() {
    high1 = -1;
    high2 = -1;
    val1 = -1;
    val2 = -1;
  }
};

node solve1(){
  node ans;
  for(auto ind : m1){
    if(ind.ss>=ans.high1){
      ans.high2 = ans.high1;
      ans.val2 = ans.val1;
      ans.high1 = ind.ss;
      ans.val1 = ind.ff;
    } else if (ind.ss >= ans.high2 && ind.ss < ans.high1){
      ans.high2 = ind.ss;
      ans.val2 = ind.ff;
    }
  }
  return ans;
}

node solve2(){
  node ans;
  for(auto ind : m2){
    if(ind.ss>=ans.high1){
      ans.high2 = ans.high1;
      ans.val2 = ans.val1;
      ans.high1 = ind.ss;
      ans.val1 = ind.ff;
    } else if (ind.ss >= ans.high2 && ind.ss < ans.high1){
      ans.high2 = ind.ss;
      ans.val2 = ind.ff;
    }
  }
  return ans;
}

int main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	clock_t tStart = clock();
	int test;
	test = 1;
	// cin >> test;
	while (test--) {
    cin >> n;
    for(int i=0;i<n;i++){
      cin >> v[i];
      if(i%2==0){
        m2[v[i]]++;
      } else {
        m1[v[i]]++;
      }
    }
    node ans1, ans2;
    ans1 = solve1();
    ans2 = solve2();
    // trace("a,b,c,d",ans1.val1, ans1.high1, ans1.val2, ans1.high2);
    // trace("a,b,c,d",ans2.val1, ans2.high1, ans2.val2, ans2.high2);
    if(ans1.val1!=ans2.val1){
      int ans = (n/2-ans1.high1) + (n/2-ans2.high1);
      cout << ans << endl;
    } else {
      if(ans2.high2==-1) ans2.high2=0;
      if(ans1.high2==-1) ans1.high2=0;
      int ans = min((n/2-ans1.high1) + (n/2-ans2.high2), (n/2-ans1.high2) + (n/2-ans2.high1));
      cout << ans << endl;
    }
	}
#ifdef LOCAL_DEFINE
	printf("Time taken: %.2fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC);
#endif
	return 0;
}


Measured memory_bytes: 5376
#include<stdio.h>
const int N = 300;
const int M = 300;
int main()
{
	int n,m;
	while(scanf("%d %d" ,&n,&m))
	{
		if(n==0&&m==n)
		{
			break;
		}
		for(int i = 0; i<n;i++)
		{
			for(int j = 0; j < m; j++)
			{
			printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

char s[105];
ll dp[105][105];
int N, K;
ll dfs(int i, int k, int p){
    if(i == N+1){
        if(k == K) return 1;
        return 0;
    }
    if(p == 0 && dp[i][k] != -1) return dp[i][k];
    int last = 9;
    if(p == 1) last = s[i]-'0';
    ll ans = 0;
    for(int j=0;j<=last;j++){
        int add = 0;
        if(j != 0) add = 1;
        if(p == 1 && j == last) ans += dfs(i+1, k+add, 1);
        else ans += dfs(i+1, k+add, 0);
    }
    if(p == 0) dp[i][k] = ans;
    return ans;
}
int main(){
    memset(dp, -1, sizeof(dp));
    scanf("%s", s+1);
    N = strlen(s+1);
    scanf("%d", &K);
    printf("%lld\n", dfs(1, 0, 1));
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N;
int A[300010];
ll acc[300010];
ll acc2[300010];
ll ans[300010];

int main ()
{
    cin >> N;
    REP(i,N) cin >> A[i];
    map < int,int > cnt;
    REP(i,N) cnt[A[i]]++;

    for (auto &a : cnt) {
        acc[a.second]++;
        acc2[a.second]++;
    }
    
    REP(i,300005) {
        acc[i] *= (ll)i;
    }
    
    REP(i,300005) {
        acc[i + 1] = acc[i] + acc[i + 1];
        acc2[i + 1] = acc2[i] + acc2[i + 1];
    }

    for (ll i = 1; i <= N; i++) {
        ans[i] = acc[i] + (acc2[N] - acc2[i]) * i;
        ans[i] /= i;
    }

    for (ll K = 1; K <= N; K++) {
        ll l = 0, r = N + 1;
        while (r - l > 1) {
            ll mid = (r + l) / 2;
            if (K <= ans[mid]) {
                l = mid;
            } else {
                r = mid;
            }
        }
        cout << l << endl;
    }

    return 0;
}


Measured memory_bytes: 22528
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <cmath>
#include <cstdio>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef unsigned long long ull;

using namespace std;

int main() {
	int n, m;
	int ps[1000];
	for (;;) {
		cin >> n >> m;
		if (!(n | m))
			break;
		int ans = 0;
		REP(i,n) {
			cin >> ps[i];
			ans += ps[i];
		}
		if (n < m) {
			cout << ans << endl;
			continue;
		}
		sort(ps, ps + n, greater<int>());
		for (int i = m - 1; i < n; i += m) {
			ans -= ps[i];
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<int,int> P;
ll longinf=1ll<<60;
int inf=1<<29;

int main(){
      int n;
      int a,b;
      cin>>n>>a>>b;
      int p[n];
      rep0(i,n) cin>>p[i];
      int aa,bb,cc;
      aa=bb=cc=0;
      rep0(i,n){
            if(p[i]<=a) aa++;
            else if(p[i]<=b) bb++;
            else cc++;
      }
      cout<<min({aa,bb,cc})<<endl;
      return 0;
}

Measured memory_bytes: 256
import math

s = int(input().strip())


def get_next(a):
    if a % 2 == 0:
        return math.floor(a / 2)
    else:
        return 3 * a + 1


flag = True
tmp = s
As  = [s]
counter = 1
while flag:
    nex = get_next(tmp)
    counter += 1
    tmp = nex
    if nex in As:
        flag = False
    As.append(nex)

print(counter)

Measured memory_bytes: 3064
//https://atcoder.jp/contests/dp/tasks/dp_n
//N - Slimes
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
  std::ifstream in("./test/sample-1.in");
  //std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  ll N; cin>>N;
  vector<ll> an(N);
  for(auto&& a:an){
    cin>>a;
  }
  vector<ll> sums(N+1);
  FOR(i,0,N){
    sums[i+1]=sums[i]+an.at(i);
  }
  auto sum=[&](ll l, ll r){
    return sums[r]-sums[l];
  };
  dump(sum(0,N));

  //開区間
  vector<vector<ll>> dp(N,vector<ll>(N+1,INT64_MAX));
  function<ll(ll,ll)> dfs=[&](ll l, ll r)->ll{
    if(l+1>=r)return 0;
    if(dp.at(l).at(r)!=INT64_MAX) return dp[l][r];
    ll ret=INT64_MAX;
    FOR(k,l+1,r){
      chmin(ret,dfs(l,k)+dfs(k,r)+sum(l,r));
    }
    dp.at(l).at(r)=ret;
    return ret;
  };
  auto ans=dfs(0,N);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;



void solve(){
	string s;
	int k;
	cin>>k>>s;
	if(sz(s) > k){
		rep(i,0,k)cout<<s[i];
		cout<<"...";
		return;
	}
	cout<<s;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3640
import sys


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

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        else:
            self.par[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


n, m = list(map(int, input().split()))
wuf = WeightedUnionFind(n + 1)

for _ in range(m):
    l, r, d = list(map(int, input().split()))

    if wuf.same(l, r):
        if wuf.diff(l, r) != d:
            print("No")
            sys.exit()
    wuf.union(l, r, d)

print("Yes")


Measured memory_bytes: 11164
n,k=map(int,input().split())

b=1
S=0
a=0
m=0
for i in range(1,n+1):
    b=i
    for j in range(0,100000):
        if b>=k:
            m=j
            break
        else:
            b=b*2
            continue
    

    S=S+(1/(n*2**(m)))

print(S)

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

int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int t1, t2, t;
  t1 = h1*60 + m1;
  t2 = h2*60 + m2;
  t = t2 - t1;
  cout << t-k << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
  int H, W;
  cin >> H >> W;
  string S[2200];
  vector<vector<int> > vert(H, vector<int>(W));
  vector<vector<int> > hori(H, vector<int>(W));

  REP(i, H) cin >> S[i];

  REP(i, H) {
    int cnt = 0, start = 0;
    REP(j, W) {
      if (S[i][j] == '.') cnt++;
      if (S[i][j] == '#') {
        REP2(k, start, j) hori[i][k] = cnt;
        cnt = 0;
        start = j;
      }
      if (j == W - 1) REP2(k, start, j + 1) hori[i][k] = cnt;
    }
  }

  REP(j, W) {
    int cnt = 0, start = 0;
    REP(i, H) {
      if (S[i][j] == '.') cnt++;
      if (S[i][j] == '#') {
        REP2(k, start, i) vert[k][j] = cnt;
        cnt = 0;
        start = i;
      }
      if (i == H - 1) REP2(k, start, i + 1) vert[k][j] = cnt;
    }
  }

  vector<vector<int> > ans(H, vector<int>(W));
  int answer = 0;
  REP(i, H) {
    REP(j, W) {
      if (S[i][j] != '#') {
        ans[i][j] = vert[i][j] + hori[i][j];
        answer = max(answer, ans[i][j]);
      }
    }
  }

  cout << answer - 1 << endl;
  return 0;
}


Measured memory_bytes: 51456
import java.util.*;
import java.io.*;

public class Main {

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	  int n=sc.nextInt();
	  int a[]=new int[n];
	  int sum=0;
	  for(int i=0;i<n;i++) {
	    a[i]=sc.nextInt();
	    sum+=a[i];
	  }
	  Arrays.parallelSort(a);
	  if(sum%10!=0) {
	    System.out.println(sum);
	    return;
	  }else {
	 for(int i=0;i<n;i++) {
	   if((sum-a[i])%10!=0) {
	     sum-=a[i];
	     System.out.println(sum);
	     return ;
	   }
	 }
	 
	  }
	  System.out.println(0);
	}


static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
}




Measured memory_bytes: 35864
import java.util.Scanner;

class Main{
 
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String str = scan.nextLine();
		
		char[] c = str.toCharArray();
		
		for(int i=0; i<c.length; i++)
		{
			c[i] = Character.isUpperCase(c[i]) ? Character.toLowerCase(c[i]) : Character.isLowerCase(c[i]) ? Character.toUpperCase(c[i]) : c[i];
		}
		
		System.out.println(c);
		scan.close();
	}
}

Measured memory_bytes: 26276
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)] 
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main(){
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int T = 1;
	 for(int t = 1; t <= T; t++){
		 int r;
		 cin >> r;
		 cout << r * r << "\n";
	 }
}



Measured memory_bytes: 3544
/*author : Sparsh Sinha */
#include "bits/stdc++.h"
using namespace std;
#define  ll long long
int main(){
        int n;
        cin >> n;
        ll ans=0;
        for(ll i = 1; i <= n; i++){
            if( !((i%3==0 && i%5==0) || (i%3==0) || (i%5==0))) {
                ans += i;
            }
        }
        cout<<ans<<'\n';
}

Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include<sstream>
#include <vector>
#include <set>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define PI 3.14159265358979323846264338327950L

#define INF 0x3f3f3f3f
//const int N = 2e5 + 5;

 
 


int32_t  main() {

	IOS;
  
	int N;

	cin >> N;
	
	set<string> s;

	for (int i = 0; i < N; i++) {

		string tmp;
		cin >> tmp;
		s.insert(tmp);

	}
	cout << s.size() << endl;
}

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

namespace CSharpSample01
{


    class Program
    {
        const int MOD = 1000000007;


        static long Solve(int H, int W, char[,] masu)
        {
            int[,] dp = new int[H, W];

            dp[0, 0] = 1;

            for(int i = 0; i < H; i++)
            {
                for(int j = 0; j < W; j++)
                {
                    if(j + 1 < W && masu[i, j + 1] == '.')
                    {
                        dp[i, j + 1] += dp[i, j];
                        dp[i, j + 1] %= MOD;
                    }
                    if(i + 1 < H && masu[i + 1, j] == '.')
                    {
                        dp[i + 1, j] += dp[i, j];
                        dp[i + 1, j] %= MOD;
                    }
                }
            }         

            return dp[H - 1, W - 1];
        }


        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int H = int.Parse(input[0]);
            int W = int.Parse(input[1]);

            char[,] masu = new char[H, W];

            for(int i = 0; i < H; i++)
            {
                string str = Console.ReadLine();
                for(int j = 0; j < W; j++)
                {
                    masu[i, j] = str[j];
                }
            }

            Console.WriteLine(Solve(H, W, masu));
        }
    }
}

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	cout<<a[n-1]-a[0]<<endl;
	return 0;
}


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


inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
const int MAXN = 100007;

struct Edge {
	int to, nextEdge;
} e[MAXN << 4];
int cntEdge, head[MAXN << 1];
inline void addEdge(int u, int v) {
	++cntEdge;
	e[cntEdge].to = v, e[cntEdge].nextEdge = head[u], head[u] = cntEdge;
	return;
}

bool tag[MAXN << 1];
void predfs(int u) {
	tag[u] = 1;
	for (int it = head[u]; it != 0; it = e[it].nextEdge) {
		predfs(e[it].to);
		tag[u] ^= 1;
	}
	return;
}

int n;
int val[MAXN];
bool vis[MAXN << 4];
void dfs(int u) {
	for (int &it = head[u]; it != 0; it = e[it].nextEdge) {
		if (vis[it]) continue;
		vis[it] = vis[it ^ 1] = 1;
		if (u <= n && e[it].to > n && e[it].to != 2 * n + 1) val[u] = 1;
		else if (u > n && e[it].to <= n) val[u - n] = -1;
		dfs(e[it].to);
	}
	return;
}


int fa[MAXN << 1];
int main() {
	n = read();
	int root1, root2;
	for (int i = 1; i <= n; ++i) {
		fa[i] = read();
		if (fa[i] == -1) {
			root1 = i;
			continue;
		}
		addEdge(fa[i], i);
	}
	for (int i = 1; i <= n; ++i) {
		fa[i + n] = read();
		if (fa[i + n] == -1) {
			root2 = n + i;
			continue;
		}
		addEdge(fa[i + n] + n, i + n);
	}
	predfs(root1);
	predfs(root2);
	for (int i = 1; i <= n; ++i) {
		if (tag[i] != tag[i + n]) {	
			puts("IMPOSSIBLE");
			return 0 ;
		}
	}
	
	cntEdge = 1;
	for (int i = 1; i  <= 2 * n; ++i) head[i] = 0;
	for (int i = 1; i <= n; ++i) {
		if (tag[i]) {
			addEdge(i, i + n);
			addEdge(i + n, i);
		}
		if (fa[i] != -1) {
			addEdge(i, fa[i]);
			addEdge(fa[i], i);
		}
		if (fa[i + n] != -1) {
			addEdge(fa[i + n] + n, i + n);
			addEdge(i + n, fa[i + n] + n);
		}
	}
	int s = 2 * n + 1;
	addEdge(s, root1);
	addEdge(root1, s);
	addEdge(s, root2);
	addEdge(root2, s);
	dfs(s);
	puts("POSSIBLE");
	for (int i = 1; i <= n; ++i) printf("%d ", val[i]);
	return 0;
}


Measured memory_bytes: 29780
#include<stdio.h>
#define MAX 100000
#define SEN 2000000000

struct Node {
    char suit;
    int value;
};

struct Node L[MAX/2+2],R[MAX/2+2];

void merge(struct Node *,int,int,int,int);
void mergeSort(struct Node *,int,int,int);
int partition(struct Node *,int,int,int);
void quickSort(struct Node *,int,int,int);

int main(){
    int n,i,v;
    struct Node A[MAX],B[MAX];
    char S[10];
    int stable=1;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf(" %s %d",S,&v);
        A[i].suit=B[i].suit=S[0];
        A[i].value=B[i].value=v;
    }
    
    mergeSort(A,n,0,n);
    quickSort(B,n,0,n-1);
    
    for(i=0;i<n;i++){
        if(A[i].suit != B[i].suit) stable=0;
    }
    
    if(stable==1)printf("Stable\n");
    else printf("Not stable\n");
    for(i=0;i<n;i++){
        printf("%c %d\n",B[i].suit,B[i].value);
    }
    return 0;
}

void merge(struct Node A[],int n,int left,int mid,int right){
    int i,j,k;
    int n1=mid-left;
    int n2=right-mid;
    for(i=0;i<n1;i++) L[i]=A[left+i];
    for(i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1].value=R[n2].value=SEN;
    i=j=0;
    for(k=left;k<right;k++){
        if(L[i].value <= R[j].value){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }
}

void mergeSort(struct Node A[],int n,int left,int right){
    int mid;
    if(left+1<right){
        mid=(left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}


int partition(struct Node A[],int n,int p,int r){
    int i,j;
    struct Node t,x;
    x=A[r];
    i=p-1;
    for(j=p;j<r;j++){
        if(A[j].value<=x.value){
            i++;
            t=A[i];
            A[i]=A[j];
            A[j]=t;
        }
    }
    t=A[i+1];
    A[i+1]=A[r];
    A[r]=t;
    return i+1;
}

void quickSort(struct Node A[],int n,int p,int r){
    int q;
    if(p<r){
        q=partition(A,n,p,r);
        quickSort(A,n,p,q-1);
        quickSort(A,n,q+1,r);
    }
}



Measured memory_bytes: 4084
#import<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef struct{int a;int b;}H;
int a,b,i,j,k,l,m,n,s,sz,t,pv[200040];
H e[400005];
int C(H a,H b){return a.a<b.a;}
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	n=(1<<n)-1;
	m=(1<<m)-1;
	for(;i++<n;cout<<endl)
	{
		for(j=0;j++<m;)
		{
			cout<<((i&-i)==(j&-j));
		}
	}
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yay!" << endl:cout << ":(" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int a[5],k;
    REP(i,5){cin >> a[i];}
    cin >> k;
    Yes(a[4]-a[0]<=k);
    
    return 0;
}


Measured memory_bytes: 256
/*
 * Created by Dipta Das on 
 * Title: []
 * Problem Link: 
 * Editorial: 
 * Source Code: 
 * Comments: 
*/
#include <bits/stdc++.h>
#define fin freopen("input", "r", stdin);
#define fout freopen("output", "w", stdout);
#define wt(x) cerr << #x << ": " << x << " ";
#define whatis(x) {cerr << #x << ": " << x << endl;}
#define whatis2(x, y) {wt(x); wt(y); cerr << endl;}
#define whatis3(x, y, z) {wt(x); wt(y); wt(z); cerr << endl;}
#define whatis4(x, y, z, a) {wt(x); wt(y); wt(z); wt(a); cerr << endl;}
using namespace std;

typedef long long ll; typedef unsigned long long ull; typedef long double ld;
const ll MOD = 1000000007; const ld PI = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

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


    return 0;
}


Measured memory_bytes: 3640
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n = gets.to_s.to_i
  end

  def solve
    (n - 2) * 180
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end

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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 310;

int n, m;
char a[maxn + 5][maxn + 5];

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	REP(i, 0, n) scanf("%s", a[i]);
	int ans = 0;
	REP(i, 1, m)
	{
		static int fr[maxn + 5][maxn + 5];
		memset(fr, 0, sizeof fr);
		REP(j, 0, n) REP(k, 0, n) fr[j + 1][k + 1] = fr[j][k] + (a[j][i - 1] == a[k][i]);
		static int dp[maxn + 5][maxn + 5];
		memset(dp, oo, sizeof dp);
		REP(j, 0, n + 1) REP(k, 0, n + 1)
		{
			if (!j || !k) dp[j][k] = 0;
			chkmin(dp[j + 1][k], dp[j][k] + fr[j + 1][k]);
			chkmin(dp[j][k + 1], dp[j][k] + fr[j][k + 1]);
		}
		ans += dp[n][n];
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1152
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MOD = 998244353;
signed main(){
  init_io();
  ll n,s;
  cin >> n >> s;
  vector<ll> a(n);
  ll dp[n+1][s+1];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<=n;i++){
    for(int j=0;j<=s;j++){
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  for(int i=0;i<n;i++){
    for(int j=0;j<=s;j++){
      dp[i+1][j] += dp[i][j] * 2;
      dp[i+1][j] %= MOD;
      if(j+a[i]<=s){
        dp[i+1][j+a[i]] += dp[i][j];
        dp[i+1][j+a[i]] %= MOD;
      }
    }
  }
  cout << dp[n][s] << endl;
}


Measured memory_bytes: 74044
#include<bits/stdc++.h>
using namespace std;
int fact(long long int n){
    int c=0;
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            c++;
            n/=i;
        }
    }
    if(n>1)
        c++;
    return c;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
   long long int n;
  cin>>n;
  if(n%1000==0)
    cout<<"0";
  else{
  long long int ans= 1000-(n%1000);
  cout<<ans;}
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(){
  int ans1=0,ans2=0,n,m,i,x,a;
  scanf("%d%d%d",&n,&m,&x);
  for(i=1;i<=m;i++){
    scanf("%d",&a);
    a<x?ans1++:ans2++;
  }
  printf("%d\n", ans1>ans2 ? ans2 : ans1);
  return 0;
}

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

int into(string s, int n){
  int sum=0;
  for(int i=0; i<s.length(); i++){
    if(s[i]=='X')sum=sum*10+n;
    else sum=sum*10+(s[i]-'0');
  }
  return sum;
}

int main(){
  string s;
  while(cin>>s){
    int p=s.find("+", 0), q=s.find("=", 0);
    string c1=s.substr(0, p);
    string c2=s.substr(p+1, q-p-1);
    string c3=s.substr(q+1, s.length()-q-1);
    int i=0;
    if((c1.length()!=1 && c1[0]=='X') || (c2.length()!=1 && c2[0]=='X') || (c3.length()!=1 && c3[0]=='X'))i=1;
    bool flag=false;
    for( ; i<=9; i++){
      if(into(c1, i)+into(c2, i)==into(c3, i)){cout<<i<<endl; flag=true; break;}
    }
    if(!flag)cout<<"NA"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
#include <complex>
#include <cmath>
#include <algorithm>
using namespace std;



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

  vector<long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];/* code */
  }

  //最初座標0にいる






  long tmp = 0;
  for (int i = 1; i < k; ++i) { //開区間[0 - k)
    tmp += (a[i] - a[i - 1]); //距離
  }

  long tmp2=tmp;

  //両方共負
  if (a[0] < 0 && a[k - 1] < 0)tmp2 += -a[k - 1];
  //両方共正
  if (a[0] > 0 && a[k - 1] > 0)tmp2 += a[0];
  //両方正負
  if (a[0] < 0 && a[k - 1] > 0)tmp2 += min(abs(a[0]), abs(a[k - 1]) );


  cerr << "tmp"<< tmp << endl;
  cerr << tmp2 << endl;
  long minsum = tmp2;
  

  for (int i = 2; i + k - 2  < n; ++i) {
    tmp -= (a[i - 1] - a[i - 2]) ;
    tmp += (a[k + i - 2 ] - a[k + i - 3] );

    cerr << "tmp:"<< tmp << endl;
    tmp2 = tmp;

    //両方共負
    if (a[i - 1] < 0 && a[k + i - 2] < 0)tmp2 += -a[k + i - 2];
    //両方共正
    if (a[i - 1] > 0 && a[k + i - 2] > 0)tmp2 += a[i-1];
    //両方正負
    if (a[i - 1] < 0 && a[k + i - 2] > 0)tmp2 += min(abs(a[i-1]), abs(a[k + i - 2]) );


    cerr << "tmp2:"<<tmp2 << endl;

    if (tmp2 < minsum)minsum = tmp2;
  }


  cout << minsum;



  return 0;
}

Measured memory_bytes: 1024
import java.io.*;

public class Main {

    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String str;
            while ((str = br.readLine()) != null)  {
                String[] num = str.split(" ", 0);
                if(num.length==6){
                int a = Integer.parseInt(num[0]);
                int b = Integer.parseInt(num[1]);
                int c = Integer.parseInt(num[2]);
                int d = Integer.parseInt(num[3]);
                int e = Integer.parseInt(num[4]);
                int f = Integer.parseInt(num[5]);
                double x = 1.0*(c*e-b*f)/(a*e-b*d);
                double y = 1.0*(-c*d+a*f)/(a*e-b*d);
                if(x==-0){
                    x=0;
                }
                if(y==-0){
                    y=0;
                }
                System.out.printf("%.3f %.3f",x,y);
                System.out.println("");
                }
            }
        } catch (IOException ex) {
            System.out.println("error");
        }
    }
}

Measured memory_bytes: 24816
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    vector< pair<int,int> > job(N);
    priority_queue<int> pq;
    for(int i=0; i<N; i++) {
        cin >> job[i].first >> job[i].second;
    }

    sort(job.begin(), job.end());

    int ans = 0;
    int now = 0;
    for(int i=1; i<=M; i++) {
        while(job[now].first == i) {
            pq.emplace(job[now].second);
            now++;
        }
        if(pq.empty()) continue;
        ans += pq.top();
        pq.pop();
    }

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


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll h, w;
    cin >> h >> w;
    vector<vector<bool>> odd(h, vector<bool>(w, false)); // 奇数ならtrue;
    vector<pair<P,P>> ans;
    rep(i, h) {
        rep(j, w) {
            ll a; cin >> a;
            if((a%2) == 1) odd[i][j] = true;
        }
    }
    rep(i, h) {
        bool ok = false; // 奇数から取ったコインを移動中
        rep(j, w) {
            if(odd[i][j]) {
                if(ok) {
                    ok = false;
                }
                else {
                    ok = true;
                    if(j != w-1) ans.push_back(make_pair(P(i+1,j+1), P(i+1,j+2)));
                }
            }
            else {
                if(ok && (j != w-1)) {
                    ans.push_back(make_pair(P(i+1,j+1), P(i+1,j+2)));
                }
            }
        }
        if(ok && i != h-1) {
            ans.push_back(make_pair(P(i+1,w), P(i+2,w)));
            odd[i+1][w-1] = !(odd[i+1][w-1]);
        }
    }
    cout << ans.size() << endl;
    rep(i, ans.size()) {
        cout << ans[i].first.first << ' ';
        cout << ans[i].first.second << ' ';
        cout << ans[i].second.first << ' ';
        cout << ans[i].second.second << endl;
    }

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 7484
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
 
struct node{
    node *left;
    node *right;
    int key;
};
 
struct tree{
    node *nil;
    node *root;
};
 
void insert(tree *t, int id){
    node *x, *y, *n;
    n = new node;
    n->key = id;
    n->left = t->nil;
    n->right = t->nil;
    x = t->root;
    while(x != t->nil){
        y = x;
        if(id > x->key){
            x = x->right;
        }
        else{
            x = x->left;
        }
    }
    if(id > y->key){
        y->right = n;
    }
    else{
        y->left = n;
    }
}
 
 
void printIn(tree *t, node *n){
    if (n == t->nil){
        return ;
    }
    else{
        printIn(t, n->left);
        printf(" %d", n->key);
        printIn(t, n->right);
    }
}
 
void printPre(tree *t, node *n){
    if (n == t->nil){
        return ;
    }
    else{
        printf(" %d", n->key);
        printPre(t, n->left);
        printPre(t, n->right);
    }
}
 
int main(void){
    tree *t;
    t = new tree;
    char str[10];
    int i,id,n;
    scanf("%d", &n);
     
    t->root = new node;
 
    t->root->left = t->nil;
    t->root->right = t->nil;
     
    for(i=0;i<n;i++){
        if(i==0){
            scanf("%s %d", str, &(t->root->key));
        }
        else{
            scanf("%s", str);
            if(str[0] == 'i'){
                scanf("%d", &id);
                insert(t, id);
            }
            else{
                printIn(t, t->root);
                printf("\n");
                printPre(t, t->root);
                                printf("\n");
 
            }
        }
    }
    return 0;
}

Measured memory_bytes: 18324
#include<stdio.h>
#include<algorithm>
using namespace std;
int i;
/*int js(long long x,long long y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}*/
main()
{
    long long n,k,j,max,min,x,y,t,a,b;
    while(~scanf("%lld %lld",&x,&y))
    {
        a=x;
        b=y;
       // max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
        max=a*b/min;
    printf("%lld %lld\n",min,max);
    }

}

Measured memory_bytes: 1024
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int C[3][3];
    REP(i, 3) REP(j, 3) cin >> C[i][j];

    int a[3];
    int b[3] = {C[0][0], C[0][1], C[0][2]};
    a[0]     = 0;
    a[1]     = C[1][0] - b[0];
    a[2]     = C[2][0] - b[0];

    REP(i, 3) REP(j, 3) {
        int c = a[i] + b[j];
        if (c != C[i][j]) {
            cout << "No" << endl;
            return 0;
        }
    }

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

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


int main() {
  int n; cin >> n;
  int H[n];
  for(int i = 0; i < n; i++) cin >> H[i];
  int cnt = 1;
  int h = H[0];
  for(int i = 1; i < n; i++){
    if(H[i]>=h) cnt++;
    if(h<H[i]) h = H[i];
  }
  cout << cnt << endl;
}

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

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    int[] A=new int[N];
	    boolean f=true;
	    for(int i=0; i<N;i++) {
	    	A[i]=gi();
	    	if(A[i]%2==0 && A[i]%3!=0 && A[i]%5!=0)f=false;
	    }	    
	    
       // System.out.print(sb.toString());

        if (f) {
    	    System.out.print("APPROVED");
        }else{
        	 System.out.print("DENIED");
        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35808
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val X = ni()
    val i = (X - 400) / 200
    out.println(8 -i)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 34712
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] b = new int[200];
		for(int i=0;i<N;i++) b[B[i]] = 1;
		
		for(int i=0;i<3;i++){
			int cnt = 0;
			for(int j=0;j<3;j++) cnt += b[A[i][j]];
			if(cnt == 3){
				Console.WriteLine("Yes");
				return;
			}
		}
		for(int j=0;j<3;j++){
			int cnt = 0;
			for(int i=0;i<3;i++) cnt += b[A[i][j]];
			if(cnt == 3){
				Console.WriteLine("Yes");
				return;
			}
		}
		{
			int cnt = 0;
			for(int i=0;i<3;i++){
				cnt += b[A[i][i]];
			}
			if(cnt == 3){
				Console.WriteLine("Yes");
				return;
			}
		}
		{
			int cnt = 0;
			for(int i=0;i<3;i++){
				cnt += b[A[2 - i][i]];
			}
			if(cnt == 3){
				Console.WriteLine("Yes");
				return;
			}
		}
		
		Console.WriteLine("No");
	}
	int[][] A;
	int N;
	int[] B;
	public Sol(){
		A = new int[3][];
		for(int i=0;i<3;i++) A[i] = ria();
		N = ri();
		B = new int[N];
		for(int i=0;i<N;i++) B[i] = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
s = input()

s1=s[::-1]
s2=s[:(len(s)+1)//2-1]
s3=s[(len(s)+3)//2-1:]

if s1 == s1[::-1] and s2 == s2[::-1] and s3 == s3[::-1] :
  print("Yes")
else:
  print("No")


Measured memory_bytes: 8968