akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define pb push_back
using namespace std;
typedef long long ll;

const int mod=1e9+7;

int main(){
  int n;
  cin>>n;
  vector<int> x(n),y(n);
  rep(i,n) cin>>x[i]>>y[i];
  map<pair<int,int>,int> d;
  rep(i,n){
    rep(j,n){
      if(i==j) continue;
      if(d.count({x[i]-x[j],y[i]-y[j]})){
        d[{x[i]-x[j],y[i]-y[j]}]++;
      }else{
        d.insert({{x[i]-x[j],y[i]-y[j]},1});
      }
    }
  }
  int res=0;
  for(auto itr=d.begin();itr!=d.end();itr++){
    res=max(res,itr->second);
  }
  int ans=n-res;
  cout<<ans<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
#define ar array 

void test_case() {
	string s , t;
	cin >> s >> t;
	int ans = INT_MAX;
	int curr = 0;
	for(int i = 0 ; i <(int)s.size()-(int)t.size()+1 ; i++){
		curr = 0;
		for(int j = 0 ; j < (int)t.size() ; j++){
			if(s[i+j] != t[j])
				curr++;
		}
		ans = min(ans,curr);
	}
	ans = min(ans,curr);
	cout<<ans;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T = 1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;

int main()
{
	ll n,d,x;
	ll ans = 0;
	cin >> n;
	cin >> d >> x;

	for (ll i = 0; i < n; i++){
		ll tmp;
		cin >> tmp;
		a.push_back(tmp);
	}
	for (ll i = 0; i < n; i++) {
		ll count = 0;
		for (ll j = 1; j < d+1; j++) {
			if (j == count * a[i] + 1) {
				ans += 1;
				count++;
			}
			
		}
	}
	ans += x;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a, b,x,cnt;	//?????°
	
	while (cin >> a >> b){
		cnt = 0;
		x = a + b;

		while (x > 0){
			cnt++;
			x /= 10;
		}

		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int N,X,L[100],D=0,ans=1;
int main(void){
	cin>>N>>X;
	for(int i=0;i<N;i++)
		cin>>L[i];
	for(int i=0;i<N;i++){
		D+=L[i];
		if(D<=X)ans++;
		else break;
	}
	cout<<ans;
	return 0;
}


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

int n,a,b,ans;

int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		int x=i,sum=0;
		while(x>0)
		{
			sum+=x%10;
			x/=10;
		}
		if(sum>=a&&sum<=b)ans+=i;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  long n, minv, maxv, i;
  std::cin >> n >> minv >> i;

  maxv = i - minv;
  minv = std::min(minv, i);

  while (std::cin >> i) {
    maxv = std::max(maxv, i - minv);
    minv = std::min(minv, i);
  }

  std::cout << maxv << '\n';
}



Measured memory_bytes: 3084
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <stack>
#include <unordered_map>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 1000005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;

char text[1005];
int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    n = read<int>();
    map<string, int> mpp;
    int maxx = 0;
    for (int i = 0; i < n; i++) {
        scanf("%s", text);
        mpp[text]++;
        maxx = max(maxx, mpp[text]);
    }
    for (auto v : mpp) {
        if (v.second == maxx) {
            printf("%s\n", v.first.c_str());
        }
    }
    return 0;
}

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

using namespace std;
const int N = 55;
long long dp[N];
int a[N], b[N], n;

bool bit(long long mask, int j) {return (mask>>j)&1;}
bool check(long long mask) {
    for (int i = 0; i <= 50; i++) {
        dp[i] = 1ll<<i;
        for (int j = 1; j <= 50; j++) if (bit(mask, j)) dp[i] |= dp[i % j];
    }
    for (int i = 0; i < n; i++) if (!bit(dp[a[i]], b[i])) return 0;
    return 1;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    long long mask = 0;
    for (int i = 50; i >= 1; i--) {
        mask |= (1ll<<i) - 2;
        if (!check(mask)) mask |= 1ll<<i;
        mask ^= (1ll<<i) - 2;
    }
    if (!check(mask)) return cout << -1 << "\n", 0;
    cout << mask << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
int a[maxn];
int main(void){
	int h,n;
	cin >> h >> n;
	ll sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum += a[i];
	}
	if(sum>=h)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
	
}

Measured memory_bytes: 640
package main

import (
    "fmt"
    "os"
)

const MOD int = 1000000007
const MAX_H int = 100
const MAX_W int = 8

func main() {
    var h, w, k int
    fmt.Scan(&h, &w, &k)

    if w == 1 {
        fmt.Println(1)
        os.Exit(0)
    }


    var t [MAX_H + 1][MAX_W]int
    t[0][0] = 1
    s := 1 << (uint)(w - 1)
    for i := 1; i <= h; i++ {
        for c := 0; c < s; c++ {
            if c & (c << 1) != 0 {
                continue
            }

            if c & 1 != 0 {
                t[i][0] += t[i - 1][1]
            } else {
                t[i][0] += t[i - 1][0]
            }
            t[i][0] %= MOD
            for j := 1; j < w - 1; j++ {
                if c & (1 << (uint)(j - 1)) != 0 {
                    t[i][j] += t[i - 1][j - 1]
                } else if c & (1 << (uint)(j)) != 0 {
                    t[i][j] += t[i - 1][j + 1]
                } else {
                    t[i][j] += t[i - 1][j]
                }
                t[i][j] %= MOD
            }
            if c & (s >> 1) != 0 {
                t[i][w - 1] += t[i - 1][w - 2]
            } else {
                t[i][w - 1] += t[i - 1][w - 1]
            }
            t[i][w - 1] %= MOD
        }
    }
    fmt.Println(t[h][k - 1])
}


Measured memory_bytes: 512
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

N, K = gets_i_list
h_list = gets_i_list

dp = Array.new(N, Float::INFINITY)
dp[0] = 0

(1...N).each do |i|
  # min = [] で min.min すると LTE
  min = Float::INFINITY
  k = i - K
  k = 0 if k < 0
  k.upto(i - 1) do |j|
    s = (h_list[i] - h_list[j]).abs + dp[j]
    min = min < s ? min : s
  end
  dp[i] = min
end

puts dp.last

# LTEになる
# INF = 10**12
# dp = Array.new(N, Float::INFINITY)
# dp[0] = 0
# 
# (N-1).times do |i|
#   k = K < N - i - 1 ? K : N - i - 1
#   1.upto(k).each do |j|
#     s1 = dp[i] + (h_list[i] - h_list[i + j]).abs
#     # dp[i + k] = [dp[i + k], s1].min 
#     dp[i + j] = dp[i + j] < s1 ? dp[i + j] : s1
#   end
# end
# puts dp.last


Measured memory_bytes: 9724
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
using namespace std;
void read(int &x){
	char ch;bool ok;
	for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
	for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=5e5+10;
int n,m;
double sum,now,a[maxn],b[maxn],ans[maxn];
struct oo{double a,b;}q[maxn];
int main(){
	read(n),read(m);
	for(rg int i=1,x,y;i<=n;i++)read(x),read(y),a[i]=x,b[i]=y;
	int l=1,r=0;ans[1]=a[1];
	for(rg int i=1;i<=n;i++){
		sum=sum+a[i]*b[i],now=now+b[i];
		q[++r]=(oo){a[i],b[i]};
		while(l<=r){
			if(now<=m)break;
			if(now-q[l].b<m){
	    		sum=sum-q[l].b*q[l].a;
				q[l].b=q[l].b-(now-m);
				sum=sum+q[l].b*q[l].a;
				now=m;
				break;
			}
			else now-=q[l].b,sum-=q[l].b*q[l].a,l++;
		}
	    ans[i]=sum/m;
		while(l<r&&q[r].a<q[r-1].a){
			double tot=q[r-1].b+q[r].b;
			sum=sum-q[r].a*q[r].b-q[r-1].a*q[r-1].b,now=now-q[r].b-q[r-1].b;
		    q[r-1].a=(q[r].a*q[r].b+q[r-1].a*q[r-1].b)/tot;
			q[r-1].b=tot;
			sum=sum+q[r-1].a*q[r-1].b,now=now+q[r-1].b;
		    r--;
		}
	}
	for(rg int i=1;i<=n;i++)printf("%.7lf\n",ans[i]);
}


Measured memory_bytes: 28672
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ll m = 0;
    ll ans = 0;
    for(int i = 0; i< n; i++){
        if(a[i] < m){
            ans += m-a[i];
        }else{
            m = a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int N = 5;

class C{
  public:
    int num, cnt;
    C(){}
    C(int _n, int _c){ num = _n; cnt = _c; }
};

bool compare_num(const C &a, const C &b){ return a.num < b.num; }
bool compare_cnt(const C &a, const C &b){ return a.cnt < b.cnt; }

string solve(int cards[N]){
  vector<C> c;
  set<int> s;
  REP(i, N){
    int cnt = 0;
    REP(j, N) if(cards[i] == cards[j]) ++cnt;
    if(s.find(cards[i]) == s.end()) c.push_back(C(cards[i], cnt));
    s.insert(cards[i]);
  }
  sort(c.begin(), c.end(), compare_cnt);
  reverse(c.begin(), c.end());
  if(c[0].cnt == 4) return "four card";
  if(c[0].cnt == 3 && c[1].cnt == 2) return "full house";
  sort(c.begin(), c.end(), compare_num);
  if(c.size() == 5 && ((c[0].num + 1 == c[1].num && c[1].num + 1 == c[2].num && c[2].num + 1 == c[3].num && c[3].num + 1 == c[4].num) || (c[0].num == 1 && c[1].num == 10 && c[2].num == 11 && c[3].num == 12 && c[4].num == 13))) return "straight";
  sort(c.begin(), c.end(), compare_cnt);
  reverse(c.begin(), c.end());
  if(c[0].cnt == 3) return "three card";
  if(c[0].cnt == 2 && c[1].cnt == 2) return "two pair";
  if(c[0].cnt == 2) return "one pair";
  return "null";
}

int main() {
  int cards[N];
  while(scanf("%d,%d,%d,%d,%d", &cards[0], &cards[1], &cards[2], &cards[3], &cards[4]) != EOF) cout <<solve(cards) <<endl;
  return 0;
}

Measured memory_bytes: 1216
import java.util.Scanner;

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

        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int count = 0;

        for(; a <= b; a++) {
            if (c % a == 0) {
                count++;
            }
        }

        System.out.println(count);
    }
}



Measured memory_bytes: 26412
N,Y = map(int, input().split())

for x in range(2001):
    for y in range(2001):
        z = N-x-y
        if z<0:
            break
        temp = x*10000+y*5000+z*1000
        if temp==Y:
            print(x,y,z)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
int_n = int(input())
str_s = input()

int_x = 0
li_x = list()
li_x.append(int_x)
for s in str_s:
    if s == "I":
        int_x += 1
    else:
        int_x -= 1
    li_x.append(int_x)
print(max(li_x))


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

#define N 600000
#define NIL -1

//array
int key[N];
int parent[N];
int leftc[N];
int rightc[N];
//root
int root=NIL;

//function insert
void insert(int z){
  int x,y;
  
  y=NIL;
  x=root;

  while(x!=NIL){
    y=x;
    if(key[z]<key[x]) x=leftc[x];
    else x=rightc[x];
  }  
  
  parent[z]=y;

  if(y==NIL) root=z;
    
  else if(key[z]<key[y]) leftc[y]=z;

  else rightc[y]=z;
  
  
}

//function search
int find(int now,int data){
  if(now==NIL ||data==key[now]) return now;
  
  if(data<key[now]) return find(leftc[now],data);
  else return find(rightc[now],data);
}


int treeminimum(int x){
  while(leftc[x]!=NIL){
    x=leftc[x];
  }
  return x;
}


int treesuccessor(int x){
  int y; 
  if(rightc[x]!=NIL) return treeminimum(rightc[x]);
  y=parent[x];
  while(y!=NIL &&x==rightc[x]){
    x=y;
    y=parent[y];
  }
  return y;
}


//function delete
void treedelete(int z){
  int x,y;
  if(leftc[z]==NIL ||rightc[z]==NIL) y=z;
  else y=treesuccessor(z);

  if(leftc[y]!=NIL) x=leftc[y];
  else x=rightc[y];

  if(x!=NIL) parent[x]=parent[y];
  if(parent[y]==NIL) root=x;
  else if(y==leftc[parent[y]]) leftc[parent[y]]=x;
  else rightc[parent[y]]=x;

  if(y!=z) key[z]=key[y];

}

//print
void inorderprint(int now){
  if(now!=NIL){
    inorderprint(leftc[now]);
    printf(" %d",key[now]);
    inorderprint(rightc[now]);
  }
}

void preorderprint(int now){
  if(now!=NIL){
    printf(" %d",key[now]);
    preorderprint(leftc[now]);
    preorderprint(rightc[now]);
  }
}



int main(){

  int n,i,j,data;
  int z=0;
  int del;
  char str[10];
  //initialize array
  for(i=0;i<N;i++){
    parent[i]=NIL;
    key[i]=NIL;
    rightc[i]=NIL;
    leftc[i]=NIL;
  }
  //load n
  scanf("%d",&n);
  //load commnad and key
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(strcmp(str,"insert")==0) {
      scanf("%d",&data);
      key[z]=data;
      insert(z);
      z++;
    }
    else if(strcmp(str,"find")==0){
      scanf("%d",&data);
      if(find(root,data)!=NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(str,"delete")==0){
      scanf("%d",&data);
      del=find(root,data);
      treedelete(del);
    }
    else if(strcmp(str,"print")==0){
      inorderprint(root);
      cout <<endl;
      preorderprint(root);
      cout <<endl;
    }
  }

  return 0;
}

Measured memory_bytes: 10000
import math,sys
s = list(raw_input())
n = len(s)
s = s+["A","A"]
for i in range(n):
    if s[i] == s[i+1]:
        print i+1,i+2
        sys.exit()
    if s[i] == s[i+2]:
        print i+1,i+3
        sys.exit()
print -1,-1

Measured memory_bytes: 6516
def score(s, t, u):
    return max([s, t, u]) - min([s, t, u])


def solve(h, w):
    if h % 3 == 0 or w % 3 == 0:
        return 0
    res = w * h
    for i in range(1, h):
        s = i * w
        if (h - i) % 2 == 0 or w % 2 == 0:
            t = u = (h - i) * w // 2
            r = score(s, t, u)
            if res > r:
                res = r
        else:
            t = (h - i) // 2 * w
            u = ((h - i) // 2 + 1) * w
            r = score(s, t, u)
            if res > r:
                res = r
            t = w // 2 * (h - i)
            u = (w // 2 + 1) * (h - i)
            r = score(s, t, u)
            if res > r:
                res = r
    return res

# import sys
# sys.stdin = open('a1.in')
h, w = map(int, input().split())
res = min(solve(w, h), solve(h, w))
print(res)


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

int rec(int arr[], int mem[], int id, int n, int k)
{
  if(id>=n)
    return INT_MAX;
  if(id==n-1)
    return 0;
  if(mem[id]!=-1)
    return mem[id];
  int ans=INT_MAX;
  for(int i=1;i<=k;i++)
  {
    int a=rec(arr,mem,id+i,n,k);
    if(a!=INT_MAX)
    	ans=min(ans,a+abs(arr[id+i]-arr[id]));
  }
  mem[id]=ans;
  return mem[id];
}

int main(){
  int n,k;
  cin>>n>>k;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  int mem[n];
  for(int i=0;i<n;i++)
	mem[i]=-1;
  cout<<rec(arr,mem,0,n,k)<<endl;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
  int N;
  cin >> N;
  vector<ll>A(N);
  for (int i = 0; i < N; i ++) {
    ll a;
    cin >> a;
    A[i] = (ll)a - i - 1;
  }
  sort(A.begin(), A.end());
  ll b = A[N / 2];
  ll ans = 0;
  for (int i = 0; i < N; i ++) {
    ans += max(A[i] - b, b - A[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4756
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <utility>
 
using namespace std;


int main() {

long int N;
long int K;
cin >>N>>K;

long int ans;

if(K%2==1){
ans=(N/K)*(N/K)*(N/K);}

else{
long int sho=N/(K/2);
ans=(sho/2)*(sho/2)*(sho/2)+((sho+1)/2)*((sho+1)/2)*((sho+1)/2);
}

cout <<ans;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};
lld dp[33];
int main(void){
	lld n;
	cin >> n;
	string a = "";
	while(n!=0){
		n--;
		int nn = n%26;
		a += (char)('a'+nn);
		n/=26;
	}
	reverse(all(a));
	cout << a;
	return 0;
}


Measured memory_bytes: 3620
/**********************************************

1.
2.テァツつュテァツ板ーテゥツォツ佚ィツシツ?
3.sumita.takaki@gmail.com

last updated: 2013-07-10@12:35

 **********************************************/
#include<iostream>
#include<algorithm>
#include<sstream>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;

int main(void) {

        while(1){
                
        vector<int> w_uni(10);
        vector<int> k_uni(10);

        for(int i=0; i<10; i++){
                cin >> w_uni[i];
        }

        for(int i=0; i<10; i++){
                cin >> k_uni[i];                
        }

        sort(w_uni.begin(), w_uni.end());
        sort(k_uni.begin(), k_uni.end());

        int total1 = w_uni[7] + w_uni[8] + w_uni[9];
        int total2 = k_uni[7] + k_uni[8] + k_uni[9];

        if(total1 == 0 && total2 == 0)break;

        cout << total1 << ' '<< total2 << endl;

        }
        

}

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using plglg = pair<ll, ll>;
using tlglglg = tuple<ll, ll, ll>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    string a; cin >> a;
    ll alen = a.length();
    map<char, ll> mp;
    for (char c = 'a'; c <= 'z'; c++) {
        mp[c] = 0;
    }
    REP(i, a.length()) {
        mp[a[i]]++;
    }

    ll ans = 1 + alen*(alen-1)/2;
    for (char c = 'a'; c <= 'z'; c++) {
        ans -= mp[c] * (mp[c]-1) / 2;
    }
    print(ans);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3760
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;

    if (a + b == c || a + c == b || b + c == a)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
S = {}
name_list = []
for i in range(N):
  name = input()
  if name not in S:
    S[name] = 1
    name_list.append(name)
  else:
    S[name] += 1
name_list = sorted(name_list)
max_vote_name = []
max_vote = -float('inf')
for name in name_list:
  if S[name] > max_vote:
    max_vote = S[name]
    max_vote_list = [name]
  elif S[name] == max_vote:
    max_vote_list.append(name)
for name in max_vote_list:
  print (name)

Measured memory_bytes: 33796
def sumorder(k, a, b):
  arr = list(str(k))
  s = sum(list(map(int,arr)))
  #print(arr, s)
  if a<=s and s<=b:
    return True
  else:
    return False
  
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
  if sumorder(i, a, b):
    ans += i
    
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

ll dp[110][200010];

int main() {
  int n, w; cin >> n >> w;
  dp[0][0] = 0;
  rep(i, n) {
    int a, b; cin >> a >> b;
    rep(j, 100010) {
      chmax(dp[i+1][j+a], dp[i][j] + b);
      chmax(dp[i+1][j], dp[i][j]);   
    }
  }
  cout << dp[n][w] << endl;
}

Measured memory_bytes: 156416
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define _rep(i,ra,re) for((i)=ra;(i)>(re);(i)--)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define _rep_(i,ra,re) for((i)=ra;(i)>=(re);(i)--)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define mod 1000000007


int i,j,k,l;
static const int MAX_N=10e5;
int main(void){
	string h;cin >> h;
	int res=0,ans=0;
	h+='S';
	rep(i,0,4){
		if(h[i]=='R'){
			res++;
		}
		else{
			ans=max(res,ans);
			res=0;
		}
	}
	puts(ans);
	return 0;
}


Measured memory_bytes: 3576
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(false);

	int N;
	scanf("%d",&N);
	int res = N;
	for (int i = 0; i <= N; i++)
	{
		int cc = 0;
		int t = i;
		while (t >0) cc += t % 6, t /= 6;
		t = N - i;
		while (t >0) cc += t % 9, t /= 9;
		if (res > cc) res = cc;
	}
	printf("%d\n",res);
}


Measured memory_bytes: 256
N = int(input())

al = ['','a','b','c','d','e','f','g',
     'h','i','j','k','l','m','n',
     'o','p','q','r','s','t','u',
     'v','w','x','y','z']

ans = ''

def conn(n):
  global ans
  h,r = divmod(n, 26)
  if r == 0:
    r = 26
    h -= 1
  ans = al[r] + ans
  #print(h,r,ans)
  if h > 0:
    conn(h)

conn(N)
print(ans)




Measured memory_bytes: 9208
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

template<class T>
inline void init(T& v) {
	for(auto &a__: v) cin>>a__;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a__: v) cin>>a__.first>>a__.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__.first>>a__.second;
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}


int X;

void input() {
	cin>>X;
}

void solve() {
	for(int i=1; ; i++) {
		if(X*i%360==0) {
			cout<<i<<endl;
			return;
		}
	}
	cout<<-1<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(){
  int i,j,minj,A[100],N,tmp,cnt=0;
  
  while(1){
    scanf("%d",&N);
    if(N>=1 && N<= 100){
      break;
    }  
  }
  
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  for(i = 0;i < N;i++){
    minj = i;
    for(j = i;j < N;j++){
      if(A[j] < A[minj]){
	minj = j;
      }
    }
      if(minj != i){
	tmp = A[i];
	A[i] = A[minj];
	A[minj] = tmp;
	cnt++;
      }
  }

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



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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    ll n;
    cin>>n;
    set<ll> st;
    for(ll i=0;i<n;i++){
        ll a; cin>>a;
        st.insert(a);
    }
    vector<ll> v; 
    for(ll i:st){
        v.push_back(i);
    }
    set<ll> ans;
    n = v.size();
    for(ll i=1;i<(1<<n);i++){
        ll ret = 1;
        for(ll j=0;j<n;j++){
            if(i & (1<<j)){
                ret = ret * v[j] / gcd(ret,v[j]);
            }
        }
        ans.insert(ret);
    }
    cout << ans.size() << endl;


}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
//#include <unordered_map>
#define M ((ll)1e12)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi acos(-1)
typedef long long ll;
using namespace std;
set<int> s;set<pair<int,int>> s1;int n,m;int visited[100001]={0};

void solve(){
       int h,w,k;
       cin>>h>>w>>k;
       string s[h];
       for(int i=0;i<h;i++)
       cin>>s[i];
       int ar[h][w];
       int c=1,in;
       for(int i=0;i<h;i++)
       {
           int j;
           for(j=0;j<w;j++)
           if(s[i][j]=='#'){
           in=i;break;}
           if(j!=w)
           break;
       }
      // cout<<in<<endl;
       for(int i=in;i<h;i++)
       {
           int f=0,j;
           for(j=0;j<w;j++)
           {
               if(s[i][j]=='#')
               {
                   f++;
               }
           }
           //cout<<f<<endl;
           if(f!=0)
           {
               int co=0;
               for(j=0;j<w&&co!=f-1;j++)
               {
                   ar[i][j]=c;
                   if(s[i][j]=='#'){co++;
                   c++;}
               }
               for(;j<w;j++)
               ar[i][j]=c;
               c++;
           }
           else 
           {
               for(j=0;j<w;j++)
               {
                   ar[i][j]=ar[i-1][j];
               }
           }
       }
       for(int i=in-1;i>=0;i--)
       {
           for(int j=0;j<w;j++)
           ar[i][j]=ar[i+1][j];
       }
       for(int i=0;i<h;i++)
       {
           for(int j=0;j<w;j++)
           {
               cout<<ar[i][j]<<" ";
           }
           cout<<endl;
       }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

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

using namespace std;

#define int long long

vector<int> graph[200005];
void add_edge(int u, int v)
{
    graph[u].push_back(v);
    graph[v].push_back(u);
}

// Function to traverse the undirected graph
// using DFS algorithm and keep a track of
// individual lengths of connected chains
void depthFirst(int v, vector<int> graph[],
                vector<bool>& visited, int& ans)
{
    // Marking the visited vertex as true
    visited[v] = true;

    // Incrementing the count of
    // connected chain length
    ans++;

    for (auto i : graph[v]) {
        if (visited[i] == false) {
            // Recursive call to the DFS algorithm
            depthFirst(i, graph, visited, ans);
        }
    }
}

// Function to initialize the graph
// and display the result
int UniqueConnectedComponent(int n,
                              vector<int> graph[])
{
    int mx = -1 ;

    // Initializing boolean visited array
    // to mark visited vertices
    vector<bool> visited(n + 1, false);

    // Initializing a Set container
    unordered_set<int> result;

    // Following loop invokes DFS algorithm
    for (int i = 1; i <= n; i++) {
        if (visited[i] == false) {
            // ans variable stores the
            // individual counts
            int ans = 0;

            // DFS algorithm
            depthFirst(i, graph, visited, ans);

            // Inserting the counts of connected
            // components in set
            result.insert(ans);
            mx = max (mx,ans);
        }
    }
    return mx ;
}
int32_t  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >>a>>b;
        add_edge(a,b);
    }
    cout << UniqueConnectedComponent(n,graph);
    return 0;
}


Measured memory_bytes: 27008
#include<iostream>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#define LIMIT 100

using namespace std;

static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
static const char dir[4] = {'r','u','l','d'};
int mdt[16][16];

class puzzle{
public :
  int f[16],space,md;
};

puzzle state;
int limit;
int path[LIMIT];

int getAllMD(puzzle pz){
  int sum =0;
  for(int i=0;i<16;i++){
    if(pz.f[i]==16)continue;
    sum+=mdt[i][pz.f[i]-1];
  }
  return sum;
}

bool isSolved(){
  for(int i=0;i<16;i++)if(state.f[i]!=i+1) return false;
  return true;
}

bool dfs(int depth,int prev){
  if(state.md==0)return true;
  if(depth+state.md >limit) return false;

  int sx=state.space/4;
  int sy=state.space%4;
  puzzle tmp;

  for(int r=0;r<4;r++){
    int tx=sx+dx[r];
    int ty=sy+dy[r];
    if(tx<0||ty<0||tx>=4||ty>=4)continue;
    if(max(prev,r)-min(prev,r)==2)continue;
    tmp=state;

    state.md-=mdt[tx*4+ty][state.f[tx*4+ty]-1];
    state.md+=mdt[sx*4+sy][state.f[tx*4+ty]-1];
    swap(state.f[tx*4+ty],state.f[sx*4+sy]);
    state.space = tx*4+ty;
    if(dfs(depth+1,r)){path[depth]=r;return true;}
    state = tmp;
  }
  return false;
}
string iterative_deepening(puzzle in){
  in.md = getAllMD(in);

  for(limit = in.md;limit<=LIMIT;limit++){
    state = in;
    if(dfs(0,-100)){
      string ans = "";
      for(int i=0;i<limit;i++)ans +=dir[path[i]];
      return ans;
    }
  }
  return "unsolvable";
}

int main(){
  for(int i=0;i<16;i++){
    for(int j=0;j<16;j++){
      mdt[i][j]=abs(i/4-j/4)+abs(i%4-j%4);
    }
  }
  puzzle in;
  for(int i=0;i<16;i++){
    cin >> in.f[i];
    if(in.f[i]==0){
      in.f[i]=16;
      in.space =i;
    }
  }
  string ans =iterative_deepening(in);
  cout << ans.size()<<endl;

  return 0;
}


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

int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  map<int, vector<int>> m;
  for (int i=0; i<n; i++) {
    m[a[i]].push_back(i);
  }
  vector<pair<int, vector<int>>> v;
  for (auto i: m) {
    v.emplace_back(i.first, i.second);
  }
  reverse(v.begin(), v.end());
  int idx = 0;
  set<int> numbers;
  long long cnt[n];
  for (int i=0;i<n; i++) cnt[i] = 0;
  while (idx < v.size()) {
    for (int i: v[idx].second) {
      numbers.insert(i);
    }
    long long diff;
    if (idx != v.size() - 1) {
      diff = v[idx].first - v[idx+1].first;
    } else {
      diff = v[idx].first;
    }
    cnt[*numbers.begin()] += diff * numbers.size();
    ++idx;
  }
  for (long long i: cnt) {
    cout<<i<<endl;
  }
}

Measured memory_bytes: 24812
a, b, c, d = map(int, input().split())
xy1 = xy2 = xy = 0

k = a*c
l = a*d
m = b*c
n = b*d

if k >= l:
    xy1 = k
else:
    xy1 = l

if m >= n:
    xy2 = m
else:
    xy2 = n

if xy1 >= xy2:
    xy = xy1
else:
    xy = xy2

print(xy)

Measured memory_bytes: 9056
#include <cstdio>

int a[200010], b[200010], c[200010];
int main()
{
    int n; scanf("%d", &n);
    for(int i=0; i<n; ++i) scanf("%d", a+i);

    int m=0;
    for(int i=n-1; i>=0; --i) {
        int t=a[i];
        for(int j=i+1; j<=n; j+=i+1) t^=c[j-1];
        c[i]=t;
        if (t) b[m++]=i+1;
    }

    printf("%d\n", m);
    for(int i=m-1; i>=0; --i) printf("%d%c", b[i], i?' ':'\n');
}


Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

map<ll, ll> primeFactors(ll n)
{
    map<ll, ll> ret;
    while (n % 2 == 0)
    {
        if( ret.find(2) != ret.end() ) {
            ret[2]++;
        }
        else
        {
            ret[2] = 1;
        }
        n = n / 2;
    }
    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            if( ret.find(i) != ret.end() ) {
            ret[i]++;
        }
        else
        {
            ret[i] = 1;
        }
            n = n / i;
        }
    }
    if (n > 2)
        {
            if( ret.find(n) != ret.end() ) {
            ret[n]++;
        }
        else
        {
            ret[n] = 1;
        }
        }
    return ret;
}

void print_map(map<ll, ll> mp){
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        std::cout << "key = " << itr->first           // キーを表示
                        << ", val = " << itr->second << "\n";    // 値を表示
    }
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> vec;
    rep(i, 2*N)
    {
        ll L;
        cin >> L;
        vec.push_back(L);
    }
    std::sort(vec.begin(), vec.end());
    ll sum = 0;
    rep(i, N)
    {
        if (vec.at(i*2) < vec.at(i*2+1)){
            sum += vec.at(i * 2);
        } else {
            sum += vec.at(i * 2 + 1);
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
a, b, c, d = map(int, input().split())


def gcd(a, b):
    if a == 0:
        return b
    return gcd(b % a, a)


# Function to return LCM of two numbers
def lcm(a, b):
    return (a * b) // gcd(a, b)

s1 = (a-1)//c
s2 = b//c
s3 = (a-1)//d
s4 = b//d
k = lcm(c, d)
s5 = (a-1)//(k)
s6 = b//(k)
# print((s2-s1),(s4-s3),(s6-s5))
s = (s2-s1)+(s4-s3)-(s6-s5)
print(b-a+1-s)

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

int main(){
    int x,a;
    cin >> x >> a;
    if(x < a) cout << 0 << endl;
    else cout << 10 << endl;
}


Measured memory_bytes: 256
program main
 implicit none
 integer X
 integer :: k500=0,k100=0,k50=0,k10=0,k5=0
 integer :: ure=0
 
 read *, X

 k500=X/500
 X=X-500*k500
!print *,X
 k5=X/5
 X=X-5*k5
!print *,X
 k100=X/100
 X=X-100*k100
!print *,X
 k50=X/50
 X=X-50*k50
!print *,X
 k10=X/10
 X=X-10*k10
!print *,X

 ure=1000*k500+5*k5

 print '(i0)', ure

endprogram main


Measured memory_bytes: 768
# coding: utf-8
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for a in A:
  if sum([a[i] * B[i] for i in range(M)]) + C > 0:
    ans += 1
print(ans)

Measured memory_bytes: 3064
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

int N;

int main() {
    cin >> N;
    for(int X = 1; X <= 50000; X++) {
        if((int)(X * 1.08) == N) {
            cout << X << endl;
            return 0;
        } 
    }
    cout << ":(" << endl;
}   


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
 int n,m,x,y,a,b;
 cin>>n>>m>>x>>y;
 int max=x;
 for(int i=0;i<n;i++){
  cin>>a;
  if(max<a) max=a;
 }
 int may=y;
 for(int i=0;i<m;i++){
  cin>>b;
  if(may>b) may=b;
 }
 if(max<may) cout<<"No War";
 else cout<<"War";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
const int MAX = 1000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算 COMinit()を先に使用すること
long long COM(int n, int k){
	if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
	int n,k;
	cin>>n>>k;
	COMinit();
	ll ans=0;
	for(int i=0;i<=min(n-1,k);i++){
		ans+=COM(n-1,i)*COM(n,i);
		ans%=MOD;
	}
	OUT(ans);
	return 0;
}

Measured memory_bytes: 23808
#include <iostream>
using ll = long long int;
using namespace std;

int main() {
  ll n, min, ans = -1e9;
  cin >> n;
  cin >> min;
  for (ll i = 1; i < n; i++) {
    ll r;
    cin >> r;
    if (r - min > ans) {
      ans = r - min;
    }
    if (r < min) {
      min = r;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int a, b;
  string s, t, u;
  cin >> s >> t >> a >> b >> u;
  if(s == u) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define YESNO OUT(three(solve(),"YES","NO"))
#define YesNo OUT(three(solve(),"Yes","No"))
#define WL(A,B) OUT(three(solve(),A,B))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
template<class T> inline bool chmax(int a, int b, T c, T d) { return c > d ? a : b; }
template<class T> inline bool chmin(int a, int b, T c, T d) { return c > d ? a : b; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<ppr, Vppr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 1e6 + 1000;
const int SIZE2 = 52;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 998244353;
const LL INF = 1LL << 30;
const long double EPS = 1e-7;
const LL inf = 1000000000;
typedef pair<ld, ut> pld;
const int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
ut N, M, K, L, Q, H, W, R;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL maps[SIZE2][SIZE2];
const LL C = 3;
LL A[SIZE], B[SIZE], D[SIZE], E[SIZE];
LL sum[SIZE2][SIZE2];
LL sy = 0, sx = 0;
LL solve() {
	cin >> N >> K;
	LL maxim = 0;
	REP(i, N) {
		cin >> A[i];
		maxim = max(maxim, A[i]);
	}
	LL gcdd = A[0];
	REP(i, N) {
		gcdd = __gcd(gcdd, A[i]);
	}
	if (maxim >=K and (maxim - K) % gcdd == 0) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;

	return 0;
}




//!!!!!!!!!!!!!!!!!!!実装を詰める!!!!!!!!!!!!!!!!!!!!!!!!!
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(0);
	solve();
	//cin >> N;
	return 0;

}


Measured memory_bytes: 25984
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN 200100

int a[MAXN];

int main() {
	int n;
	cin >> n;
	for (int i = 2; i <= n; i++) {
		int t;
		cin >> t;
		a[t]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << a[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 4192