akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
 
int main() {
	int a,b;
	cin >> a >>b;
	cout << (a+b) %24 <<endl;
}


Measured memory_bytes: 256
from collections import defaultdict
class UnionFind:
  def __init__(self, n):
    self.par = [i for i in range(n)]
    self.size = [1]*n
    self.rank = [0]*n
  def find(self, x):
    if self.par[x]==x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  def unit(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x==y:
      return
    elif self.rank[x]<self.rank[y]:
      self.par[x] = y
      self.size[y] += self.size[x]
      return
    elif self.rank[y]<self.rank[x]:
      self.par[y] = x
      self.size[x] += self.size[y]
    else:
      self.par[y] = x
      self.size[x] += self.size[y]
      self.rank[x] += 1
      
  def same(self, x, y):
    return self.find(x)==self.find(y)
  
  def count(self, x):
    return self.size[x]
N, M, K = map(int, input().split())
frend = defaultdict(list)
F = UnionFind(N)
for i in range(M):
  a, b = map(int, input().split())
  frend[a] += [b]
  frend[b] += [a]
  F.unit(a-1,b-1)
ans = [0]*N
for i in range(N):
  p = F.find(i)
  X = F.count(p)
  ans[i] = X-len(frend[i+1])-1
for i in range(K):
  a, b = map(int, input().split())
  if F.same(a-1,b-1):
    ans[a-1] -= 1
    ans[b-1] -= 1

print(' '.join(map(str,ans)))

Measured memory_bytes: 44388
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
using namespace std;

#define LL long long
int n, x, num, Min;

int main() {
    #ifdef LOCAL
    freopen("test.txt", "r", stdin);
    #endif // LOCAL

    while(scanf("%d%d", &n, &x) != EOF) {
        Min = INT_MAX;
        for(int i = 0; i < n; ++i) {
            scanf("%d", &num);
            x -= num;
            Min = min(Min, num);
        }
        printf("%d\n", x / Min + n);
    }

    return 0;
}


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

memo1 = []
memo2 = []
memo3 = []
memo4 = []
for i in range(N):
  S = input()
  sum_n = sum([1 if s=='(' else -1 for s in S])
  if sum_n >= 0:
    sum_n = 0
    min_n = 1
    for s in S:
      if s == ')':
        sum_n -= 1
        min_n = min(min_n, sum_n)
      else:
        sum_n += 1
    if min_n >= 0:
      memo1.append([min_n, sum_n])
    else:
      memo2.append([min_n, sum_n])
  else:
    sum_n = 0
    min_n = 1
    for s in S[::-1]:
      if s == '(':
        sum_n -= 1
        min_n = min(min_n, sum_n)
      else:
        sum_n += 1
    if min_n >= 0:
      memo4.append([min_n, sum_n])
    else:
      memo3.append([min_n, sum_n])

left = 0
for min_n, sum_n in memo1:
  left += sum_n

memo2.sort(reverse=True)
for min_n, sum_n in memo2:
  if left + min_n < 0:
    print('No')
    quit()
  else:
    left += sum_n

right = 0
for min_n, sum_n in memo4:
  right += sum_n

memo3.sort(reverse=True)
for min_n, sum_n in memo3:
  if right + min_n < 0:
    print('No')
    quit()
  else:
    right += sum_n

if left == right:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 182816
#include<bits/stdc++.h>
using namespace std;
#define bitCount(num)  __builtin_popcount(num)
#define pb push_back
#define ll long long
#define bye return 0;
#define f(i,a,b) for( long long i=a;i<b;i++)
#define testCases long long t;cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define newLine <<"\n"
#define all(x) (x).begin(), (x).end()
#define vll vector<long long>

int main()
{
    fast
  int n;
  cin>>n;
  vector<ll> a(n,0);
  f(i,0,n) cin>>a[i];
  // sort(all(a));
  set<pair<int,pair<int,int>>> st;
ll count=0;
    for(int i=0;i<n-2;i++)
    {
    	for(int j=i+1;j<n-1;j++)
    	{
    		if(a[i]==a[j]) continue;

    		for(int k=j+1;k<n;k++)
    		{
    			if(a[i]==a[k]|| a[j]==a[k]) continue;
    			if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i]) 
    			// if(a[i]+a[j]>a[k])
    				{
    					
    					// vector<int> temp;
    					// temp.pb(a[i]);
    					// temp.pb(a[j]);
    					// temp.pb(a[k]);
    					// sort(all(temp));
    					// pair<int,pair<int,int>> p=make_pair(temp[0],make_pair(temp[1],temp[2]));
    					// if(st.count(p)==0)
    					// {
    					// 	st.insert(make_pair(temp[0],make_pair(temp[1],temp[2])));
// cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
    					count++;
    				// }
    				}

    		}
    	}
    }
 

  cout<<count<<endl;
    bye
}

Measured memory_bytes: 3684
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll b,c=0,d=0,n,m1,n2,m2,min=100000,k=0,ans=0;
    string s,s2;
    cin >> n;
    VI a(n);
    rep(i,n){ cin >> a[i];}
    sort(ALL(a));
    rep(i,n){
        if(c<a[i]){
            c = a[i];
            ans++;
        }
    }
    cout << ans <<endl; 
    return 0;
}


Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: u32,
        a: [usize; (n-1)]
    }
    let mut h = vec![0; 200000];
    for i in 0..a.len(){
        h[a[i] - 1] += 1;    
    }

    for i in 0..a.len()+1{
        println!("{}", h[i]);
    }
}


Measured memory_bytes: 5540
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	
	int cup[3]={1,0,0};
	string str;
	
	while( cin >> str ){
		if( cin.eof() ) break;
		swap( cup[str[0]-'A'] , cup[str[2]-'A'] );
	}
	
	for( int i=0 ; i<3 ; i++ ){
		if( cup[i] ) cout << char('A'+i) << endl;
	}
}

Measured memory_bytes: 1172
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;

int main(){
    string str;
    while(getline(cin, str)){
        stringstream ss;
        vector<int> hand;
        if(str == "0") break;
        int begin = 0;
        int point = 0;
        int one = 0;
        bool isbust = false;
        for(int i=0; i<str.size(); i++){
            if(str[i] == ' ' || i == str.size()-1){
                int tmp;
                ss << str.substr(begin, i-begin+1);
                ss >> tmp;
                if(tmp < 10){
                    hand.push_back(tmp);
                }else{
                    hand.push_back(10);
                }
                begin = i + 1;
            }
        }
        for(int i=0; i<hand.size(); i++){
            if(hand[i] == 1){
                one++;
            }else{
                point += hand[i];
            }
        }
        point += one*11;
        while(one--&&point>21){
            point -= 10;
        }
        if(point > 21){
            cout << "0" << endl;
        }else{
            cout << point << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    string s,p;
    vector<lli> vec;
    map<char,lli> map;
    lli i,j;
    cin>>p;
    rep(i,0,p.size()){
        map[p[i]]++;
    }
    for(auto itr=map.begin();itr!=map.end();itr++){
        s=p;
        lli ans=0;
        while(1){
            if(s.find_first_not_of(itr->first)==string::npos){
                vec.push_back(ans);
                break;
            }
            string t;
            rep(i,1,s.size()){
                if((s[i-1]==itr->first)||(s[i]==itr->first)){
                    t+=itr->first;
                }
                else{
                    t+=s[i];
                }
            }
            ans++;
//            cout<<t<<endl;
            s=t;
        }
    }
    cout<<*min_element(vec.begin(),vec.end())<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
const int maxn=2e5+7;
const ll modn=1e9+7;
const int inf=2e9+7;
const double PI = acos(-1.0);
const double eps=1e-8;
inline int lowbit(int x){return x&-x;}
inline ll lowbit(ll x) {return x&-x;}
inline int CountOneBinary(ll num){int ans=0;while(num){if(num&1) ans+=1;num>>=1;}return ans;}
inline void read(int &x){char c;x=0;for(c=getchar();c>'9'||c<'0';c=getchar());for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';}
inline void read(ll &x){char c;x=0;for(c=getchar();c>'9'||c<'0';c=getchar());for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';}
inline ll qpow(ll x,ll y){ll ans=1;while(y){if(y&1) ans=ans*x%modn;x=x*x%modn;y>>=1;}return ans;}
inline double qpow(double x,ll y){double ans=1;while(y){if(y&1) ans=ans*x;x=x*x;y>>=1;}return ans;}
ll n,a[maxn];
int main()
{
    while(scanf("%lld",&n)==1)
    {
        ll sum=0,k=n;
        for(int i=1;i<=n;i++)
        {
            scanf("%lld",&a[i]);
            a[i]-=i;sum+=a[i];
        }
        sort(a+1,a+1+n);
        ll ans=-k*a[1]+sum;
        for(int i=1;i<=n;i++)
        {
            ans=min(ans,-k*a[i]+sum);
            k-=2;
            sum-=2*a[i];
        }
        printf("%lld\n",ans);
    }
}


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

int main() {
	char c;
	cin >> c;

	if(c == 'a' || c == 'i' || c == 'u' || c == 'e' ||  c == 'o') {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>

static int XX[100100];

int main()
{
	int X;
	int a[6]={100,101,102,103,104,105};
	scanf("%d",&X);

	int i=0,j=0;
	XX[0]=1;
	while(i<=X){
		if(XX[i]==1){
			for(j=0;j<6;j++){
				XX[i+a[j]]=1;
			}
		}
		i++;
	}
	if(XX[X]==1)printf("1\n");
	else printf("0\n");
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int n;
  cin >> n;
  vector<ll> v(n+1,1);

  for(int i=2;i<=n;i++){
    for(int j=1;i*j<=n;j++){
      v[i*j]++;
    }
  }

  ll ans=0;
  for(int i=1;i<=n;i++){
    ans+=i*v[i];
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 81380
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')


Measured memory_bytes: 3060
import sys
import math
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    MOD = 1000000007
    d = {}
    
    pd = [1]
    for _ in range(N):
        pd.append((pd[-1]*2)%MOD)

    zero = 0
    ab = [0,0]
    for i in range(N):
        a,b = map(int,input().split())
        if a == b == 0:
            zero += 1
        elif a*b == 0:
            if a == 0:
                ab[0] += 1
            else:
                ab[1] += 1
        else:
            gcd = math.gcd(abs(a),abs(b))
            a //= gcd
            b //= gcd
            if a < 0 and b < 0:
                a *= -1
                b *= -1
            elif a < 0 and b > 0:
                a,b = b,a
            elif a > 0 and b < 0:
                a *= -1
                b *= -1
                a,b = b,a
            if (a,b) not in d:
                d[(a,b)] = 1
            else:
                d[(a,b)] += 1

    ans = 1
    use = {}
    
    for k,v in d.items():
        a,b = k
        if (a,-b) in d:
            if (a,-b) in use:
                continue
            ret = pd[d[(a,b)]]+pd[d[(a,-b)]]-1
            ans *= ret
            use[(a,b)] = 1
            use[(a,-b)] = 1
        else:
            ret = pd[d[(a,b)]]
            ans *= ret
            use[(a,b)] = 1
        ans %= MOD

    ret = pd[ab[0]]+pd[ab[1]]-1
    ans *= ret
    ans += zero
    
    print((ans-1)%MOD)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 143536
#include <bits/stdc++.h>
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)
#define MAX_V        20004

const ll inf = 1e18;
const ll mod = 1e9+7;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

struct edge {
    ll to, cap, rev;
    edge(ll t, ll c, ll r): to(t), cap(c), rev(r){}
};

char field[MAX_V][MAX_V];
vector<edge> G[MAX_V];
ll level[MAX_V];
ll iter[MAX_V];

void add_edge(ll from, ll to, ll cap) {
    G[from].push_back(edge(to, cap, G[to].size()));
    G[to].push_back(edge(from, 0, G[from].size() - 1));
}

void bfs(ll s) {
    memset(level, -1, sizeof(level));
    queue<ll> que;
    level[s] = 0;
    que.push(s);
    while (!que.empty()) {
        ll v = que.front(); que.pop();
        rep(i, G[v].size()) {
            edge &e = G[v][i];
            if (e.cap > 0 && level[e.to] < 0) {
                level[e.to] = level[v] + 1;
                que.push(e.to);
            }
        }
    }
}

ll dfs(ll v, ll t, ll f) {
    if (v == t) return f;
    for(i, iter[v], G[v].size()) {
        edge &e = G[v][i];
        if (e.cap > 0 && level[v] < level[e.to]) {
            ll d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

ll max_flow(ll s, ll t) {
    ll flow = 0;
    while (true) {
        bfs(s);
        if (level[t] < 0) return flow;
        memset(iter, 0, sizeof(iter));
        ll f;
        while ((f = dfs(s, t, inf)) > 0) {
            flow += f;
        }
    }
}

int main() {
    ll H, W; cin >> H >> W;
    
    ll S, T;
    rep(i, H) rep(j, W) {
        cin >> field[i][j];
        if (field[i][j] == 'S') S = i * W + j;
        if (field[i][j] == 'T') T = i * W + j;
    }
    
    if (S % W == T % W || S / W == T / W) {
        cout << -1 << endl;
        return 0;
    }
    
    rep(i, H) rep(j, W) if (field[i][j] != '.') {
        add_edge(i * W + j, H * W + i * W + j, 1);
        
        for(k, i+1, H) if (field[k][j] != '.') {
            add_edge(H * W + i * W + j, k * W + j, inf);
            add_edge(H * W + k * W + j, i * W + j, inf);
        }
        
        for(k, j+1, W) if (field[i][k] != '.') {
            add_edge(H * W + i * W + j, i * W + k, inf);
            add_edge(H * W + i * W + k, i * W + j, inf);
        }
    }
    cout << max_flow(H * W + S, T) << endl;
    
    return 0;
}

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

public class Main {
	static int n;
	static int m;
	static long x;
	static int[] c;
	static int[][] a;
	
	static int minC = Integer.MAX_VALUE;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		x = sc.nextInt();
		
		c = new int[n];
		a = new int[n][m];
		
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			Arrays.setAll(a[i], idx -> sc.nextInt());
		}
		
		dfs(0, new int[m], 0, true);
		dfs(0, new int[m], 0, false);
		
		int ans = minC == Integer.MAX_VALUE ? -1 : minC;
		System.out.println(ans);
		
		sc.close();
	}
	
	static void dfs(int sumC, int[] sumA, int idx, boolean buy) {
		if (idx == n) {
			if (checkSkill(sumA))
				minC = Math.min(minC, sumC);
			return;
		}
		
		if (buy) {
			sumC += c[idx];
			for (int i = 0; i < m; i++) {
				sumA[i] += a[idx][i];
			}
		}
		
		dfs(sumC, Arrays.copyOf(sumA, m), idx + 1, true);
		dfs(sumC, Arrays.copyOf(sumA, m), idx + 1, false);
		
	}
	
	static boolean checkSkill(int[] arr) {
		for (int num : arr)
			if (num < x) return false;
		return true;
	}
}




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

#ifndef _WIN32
    #define getchar getchar_unlocked
#endif

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
//#define int LLI
#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define F1(i,n) FOR(i,1,n)

typedef long long LLI;
typedef unsigned long long LLU;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LLI, LLI> pll;
typedef vector<int> vi;

#ifdef ONLINE_JUDGE
ostream cnull(NULL);
#define cerr cnull
#endif

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',') cerr<<*sdbg++;
  cerr<<"="<<h<<",";
  _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define dbgV(R) {cerr << #R << "=["; for(int e : R) cerr << e << ", "; cerr << "E]\n";}
#define dbgA(R, n) {cerr << #R << "=["; for(int i = 0; i <= n; ++i) cerr << R[i] << ", "; cerr << "E]\n";}
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MX = 107;
int a[MX];

int32_t main()
{
    boost;
    int n; cin >> n;
    int zumeg = 0;
    F1(i, n){
		cin >> a[i];
		zumeg += a[i];
	}
	int mineg = INT_MAX, odp = 0;
	F1(i, n){
		if(abs(a[i] * n - zumeg) < mineg){
			mineg = abs(a[i] * n - zumeg);
			odp = i - 1;
		}
	}
	cout << odp;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long ans, n, k, a[100001],i;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  n--;k--;
 ans=(n+(k-1))/k;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void){
  long long int n,a,b,c,d;

  cin>>n>>a>>b>>c>>d;

  long long int i;
  for(i=0;i<n;i++){
    if((i*c-(n-1-i)*d<=b-a)&&((b-a)<=(i*d-(n-1-i)*c))){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 9

struct Info{
	Info(int arg_code,int arg_sum_cost){
		code = arg_code;
		sum_cost = arg_sum_cost;
	}
	bool operator<(const struct Info &arg) const{ //総コストの昇順(PQ)
		return sum_cost > arg.sum_cost;
	}
	int code,sum_cost;
};

int N;
int table_index;
int table[40320][8],min_cost[40320];
int work[NUM],change_cost[NUM][NUM];
bool check[NUM];
map<int,int> MAP;

//N!の順列を作る
void makeCode(int index){

	if(index == N){

		int tmp = 0;

		for(int i = 0; i < N; i++){
			tmp = 10*tmp+work[i];
			table[table_index][i] = work[i];
		}

		MAP[tmp] = table_index;
		table_index++;

		return;
	}

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

		if(check[i])continue;
		check[i] = true;
		work[index] = i;
		makeCode(index+1);
		check[i] = false;
	}
}

int main(){

	scanf("%d",&N);

	for(int i = 1; i <= N; i++){
		for(int k = 1; k <= N; k++){
			scanf("%d",&change_cost[i][k]);
		}
	}

	//順列テーブルを作成する
	table_index = 0;
	for(int i = 1; i <= N; i++)check[i] = false;

	for(int i = 1; i <= N; i++){
		check[i] = true;
		work[0] = i;
		makeCode(1);
		check[i] = false;
	}

	//整列された状態を作る
	int first = 0,first_code;

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

		first = 10*first+i;
	}
	first_code = MAP[first];

	priority_queue<Info> Q;

	for(int i = 0; i < table_index; i++)min_cost[i] = BIG_NUM;

	min_cost[first_code] = 0;
	Q.push(Info(first_code,0));

	int next_num,next_code,next_cost;

	//整列された状態からの最短コストを求める
	while(!Q.empty()){

		if(Q.top().sum_cost > min_cost[Q.top().code]){
			Q.pop();
		}else{

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

				work[i] = table[Q.top().code][i];
			}

			for(int i = 0; i < N-1; i++){ //交換する左側
				for(int k = i+1; k < N; k++){ //右

					next_cost = Q.top().sum_cost+change_cost[work[i]][work[k]];
					swap(work[i],work[k]);
					next_num = 0;
					for(int a = 0; a < N; a++){
						next_num = 10*next_num+work[a];
					}
					next_code = MAP[next_num];
					swap(work[i],work[k]); //元に戻す

					if(min_cost[next_code] > next_cost){

						min_cost[next_code] = next_cost;
						Q.push(Info(next_code,next_cost));
					}
				}
			}
			Q.pop();
		}
	}

	int ans = 0;
	for(int i = 0; i < table_index; i++){
		ans = max(ans,min_cost[i]);
	}

	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 6792
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_078
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int onceTime = nm[1] * 1900 + (nm[0] - nm[1]) * 100;
            int rate = (int)Math.Pow(2, nm[1]);
            Console.WriteLine(onceTime * rate);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include<iostream>
using namespace std;
int main()
{
    int i,len;
   string str,str1;
   cin>>str;
    len=str.length();
  if(str[len-1]=='s')
  {
      str=str+"es";
  }
  else{

    str=str+"s";
  }
  cout<<str<<endl;


 return 0;
}


Measured memory_bytes: 3608
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,a[100005],ans;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		if(a[i]==i){
			swap(a[i],a[i+1]);
			ans++;
		}
	}
	cout<<ans;
	//system("pause");
	return 0;
}

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

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  int la = a.length();
  int lb = b.length();
  int lc = c.length();
  int ans = la + lb + lc;
  int lbc = lb + lc;
  string q = "";
  rep(i,lbc) q += "?";
  a = q + a + q;
  la = a.length();
  vector<bool> bf(la,false);
  vector<bool> cf(la,false);
  vector<bool> bcf(lbc,false);
  for(int i = 0; i + lb <= la; i++) {
    bool f = true;
    rep(j,lb) {
      if(a[i+j] != '?' && b[j] != '?' && a[i+j] != b[j]) f = false;
    }
    if(f) bf[i] = true;
  }
   for(int i = 0; i + lc <= la; i++) {
    bool f = true;
    rep(j,lc) {
      if(a[i+j] != '?' && c[j] != '?' && a[i+j] != c[j]) f = false;
    }
    if(f) cf[i] = true;
  };
  for(int i = -lc+1; i < lb; i++) {
    bool f = true;
    rep(j,lc) {
      if(i+j >= 0 && i+j < lb && b[i+j] != '?' && c[j] != '?' && b[i+j] != c[j]) f = false;
    }
    if(f) bcf[i+lc] = true;
    else bcf[i+lc] = false;
  }
  rep(i,la) {
    rep(j,la) {
      if(j-i >= -lc+1 && j-i < lb) {
        if(bcf[j-i+lc] && bf[i] && cf[j]) ans = min(ans,max({i+lb,j+lc,la-lbc})-min({i,j,lbc}));
      } else {
        if(bf[i] && cf[j]) ans = min(ans,max({i+lb,j+lc,la-lbc})-min({i,j,lbc}));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class DirectedGraph
{
public:
    DirectedGraph()
    : t(1)
    {}
    DirectedGraph(int n)
    : t(1), g(vector< vs32 >(n)), d(vs32(n, 0)), f(vs32(n, 0))
    {}
    ~DirectedGraph() {}

    void dfs(int i)
    {
        d[i] = t++;
        rep (j, g[i].size())
        {
            if (d[g[i][j]] == 0)
            {
                dfs(g[i][j]);
            }
        }
        f[i] = t++;
    }

    int t;
    vector< vs32 > g;
    vs32 d;
    vs32 f;
};

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

    int n;
    cin >> n;

    DirectedGraph dg(n);
    int u, v;
    int c;
    rep (i, n)
    {
        cin >> u >> c;
        --u;
        dg.g[u].resize(c);
        rep (j, c)
        {
            cin >> v;
            --v;
            dg.g[u][j] = v;
        }
    }

    rep (i, n)
    {
        if (dg.d[i] == 0)
        {
            dg.dfs(i);
        }
    }

    rep (i, n)
    {
        cout << i + 1 << " " << dg.d[i] << " " << dg.f[i] << "\n";
    }
    return 0;
}




Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;

int main()
{
    fast;
    
string s;
cin>>s;
sort(s.begin(),s.end());
s+='0';
for(ll i=0;i<s.size()-1;i+=2)
 {
 	if(s[i]!=s[i+1])
 	{
 		cout<<"No";
 		exit(0);
	 }
 }
 
 cout<<"Yes";
    
   
}

		
	
	
	
	


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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

int fr[200005];

int main() {
    int n, i, nr;
    cin >> n;
    for (i = 2; i <= n; i++) {
        cin >> nr;
        fr[nr]++;
    }
    for (i = 1; i <= n; i++)
        cout << fr[i] << '\n';
    return 0;
}


Measured memory_bytes: 4412
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n,p;
  cin>>n>>p;
  map<int,int> mp;

  if(n==1){
    cout<<p<<endl;
    return 0;
  }

  for(int i=2;i*i<=p;i++){
    while(p%i==0){
      mp[i]++;
      mp[p/i]++;
      p/=i;
    }
  }
  if(p>0)mp[p]++;
  int ans=1;
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    //cout<<itr->first<<" "<<itr->second<<endl;
    if(itr->second>=n)ans*=pow((itr->first),(itr->second/n));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		if(A*B%2==0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

}

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

int main(){
  int K, A, B;
  cin >> K >> A >> B;
  int count = 0;
  
  for (int i = 0; i < B - A + 1; i++){
    
    if ((A + i) % K == 0){
      cout << "OK" << endl;
      return 0;
    }
    else{
      count++;
    }
  }
  
  if (count == B - A + 1){
    cout << "NG" << endl;
  }
}


Measured memory_bytes: 3636
n = gets.to_i
i = 0
rest = Array.new(n)
n.times do
  rest[i] = gets.split
  rest[i][1] = rest[i][1].to_i 
  rest[i][2] = i+1
  i = i + 1
end
i = 0
rest = rest.sort {|a, b| (a[0] <=> b[0]).nonzero? || (b[1] <=> a[1])}
n.times do
 
	puts rest[i][2]
  	i = i + 1
end

Measured memory_bytes: 1788
/*It’s going to be hard,
but hard does not mean impossible.*/

#include <bits/stdc++.h>

// definitions
#define __Imperial_Lord__ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _cps CLOCKS_PER_SEC
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define acc(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#define p0(a) cout << a << " "
#define p1(a) cout << a << "\n"
#define p2(a, b) cout << a << " " << b << "\n"
#define p3(a, b, c) cout << a << " " << b << " " << c <<"\n"
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d <<"\n"
#define exec cerr<<"Time taken : "<<(ld)(clock())/_cps<<"s"<<"\n"
#define mod1 998244353
#define mod 1000000007
#define pi 3.1415926535897932384

using namespace std;

// alias name for common data types
typedef vector<long long> vl;
typedef vector<long double> vld;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll INF = 1e18;

template <class ...Args>
istream &read_args(Args &...args) {return (cin >> ... >> args);}
#define read(...)   __VA_ARGS__; read_args(__VA_ARGS__)

// cin and cout overloaded for vectors
template<typename T>    istream& operator>>(istream& is,  vector<T>& v)
{
    for (auto& i : v)
        is >> i;
    return is;
}
template<typename T>    ostream& operator<<(ostream& os,  vector<T>& v)
{
    for (auto& i : v)
        os << i << ' ';
    return os;
}

// code beigns in main
int main()
{
    __Imperial_Lord__
    ll t = 1;
    // cin >> t;
    
    while (t--)
    {
        ll read(n);
        vl a(n); cin>>a;

        ll cash=1000;

    // initialize local minimum to first element's index
    ll j = 0;

    // start from second element
    for (ll i = 1; i < n; i++)
    {
        // update local minimum if decreasing sequence is found
        if (a[i - 1] > a[i]) {
            j = i;
        }

        // sell shares if current element is peak
        // i.e. (previous <= current > next)
        if (a[i - 1] <= a[i] &&
            (i + 1 == n || a[i] > a[i + 1]))
        {
            // profit += (a[i] - a[j]);
        
            ll st=cash/a[j];
            cash%=a[j];
            cash+=st*a[i];
            // printf("Buy on day %d and sell on day %d\n", j + 1, i + 1);
        }
    }

    p1(cash);
    }   
    exec;
}


/*

    1000 
    100, 130: -> 10 stocks -> 1300
    130, 130: -> 10 stocks -> 1300
    115, 115: -> 11 stocks, bal=35, 1300


*/



Measured memory_bytes: 3852
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin>>n;
    
    int x[n];
    int x_sort[n];
    for(int i=0; i<n; i++){
        cin>>x[i];
        x_sort[i]=x[i];
    }
    
    sort(x_sort, x_sort+n);
    int x_med[n];
    
    for(int i=0; i<n; i++){
        if(x[i]<x_sort[n/2]){
            x_med[i]=x_sort[n/2];
        }else{
            x_med[i]=x_sort[n/2-1];
        }
        cout<<x_med[i]<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 4480
#include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <vector>
    #include <string>
    #include <string.h>
     
    typedef long long ll;
    using namespace std;
    const ll INF = 1000000000000000000ll;
    const ll MOD = 1000000007ll;
     
    const double EPS = 1e-8;
     
    int main()
    {
   		ll H,W;
		char C[200][200]={{},{}};
		char ans[200][200]={{},{}};

		cin >> H >> W;

		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin >>C[i][j];
			}
		}

		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				ans[2*i][j]=C[i][j];
				ans[2*i+1][j]=C[i][j];
			}
		}

		for(int i=0;i<2*H;i++){
			for(int j=0;j<W;j++){
				cout << ans[i][j];
			}
			cout << endl;
		}

		return 0;
    }

Measured memory_bytes: 384
import collections

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
a = collections.Counter(A)
asort = sorted(a.items(), key = lambda x:x[1])

ans = 0
l = len(asort)
for j in range(len(asort)):
    if l <= K:
        break
    else:
        l -= 1
        ans += asort[j][1]
print(ans)

Measured memory_bytes: 39352
#include<iostream>
#include<cstdio>
using namespace std;
long long re[10][10];
int h,w;
long long sum[10];
long long sumx;
long long inf=99999999;
long long ansx=inf;
long long ans;
void dfs(int step,int x)
{
	if(x==1)
	{
		ansx=min(ansx,sumx);
	//	cout<<ansx<<endl;
		return;
	}
	if(sumx>ansx)   return;
	else{
		for(int i=0;i<=9;i++)
		{
			if(i!=x)
			{
				sumx+=re[x][i];
				dfs(step+1,i);
				sumx-=re[x][i];				
			}
		}
	}
}
int main()
{
	cin>>h>>w;
	for(int i=0;i<=9;i++)
	  for(int j=0;j<=9;j++)   cin>>re[i][j];
	for(int i=1;i<=h;i++)
	  for(int j=1;j<=w;j++)
	  {
	  	int x;
	  	cin>>x;
	  	if(x!=-1)  sum[x]++;
	  }
	for(int i=0;i<=9;i++)
	{
		if(i!=1)
		{
			sumx=0;
			ansx=inf;
			//cout<<"1"<<endl;
			if(sum[i]!=0)
			{
				dfs(1,i);
			}
			//	cout<<ansx<<" "<<i<<" "<<sum[i]<<endl;
			ans+=ansx*sum[i];			
		}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define EPS 1e-9
#define rank asadf
using namespace std;

const int MAXN = 3e5 + 111;
const int MOD = 1e9 + 7;



int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int cnt = 0;
    for (int a = 1; a < n; ++a) {
        int b = (n - 1) / a;
        cnt += b;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
double pie=(22*1./7*1.);
int x;
cin>>x;
double ans=2*pie*x*1.;
cout<<fixed<<setprecision(10)<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3784
#include <string>
#include <iostream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
 
using namespace std;

  
int main(){
	double hmax, hmin;
	double h;

	bool f = true;

	while(cin >> h){
		if(f){
			hmax = h;
			hmin = h;
			f = false;
		}else{
			hmax = max(hmax, h);
			hmin = min(hmin, h);
		}
	}

	cout << hmax-hmin << endl;

	return 0;
}

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

#define F first
#define S second
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(int i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; const int inf = 1e9 + 7;
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cout << str << " : " << t << endl;}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cout << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cout << "["; for (T i = a; i != b; ++i) {if (i != a) cout << ", "; cout << *i;} cout << "]";cout<<endl;}

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

	ll k; cin >> k;
	ll n = 50;

	ll alpha = n - 1 - k;
	vector<ll> a(n, alpha);

	ll till = k % n; if (till == 0) till = n;
	FOR (i, 0, n - 1) {
		if (i < till) {
			a[i] += ((k+n-1)/n)*(n+1);
		} else {
			a[i] += (k/n)*(n+1);
		}
	}
	cout << n << "\n";
	for (ll x : a) cout << x << " ";

	return 0;
}


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

int main() {
  int n;
  float ans;
  cin >> n;
  if(n%2==0) ans = 0.50f;
  else ans = (n+1.0f)/(2.0f*n);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	LL N;
	cin>>N;
	N <<=(N&1);
	cout << N << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int i , j , n;
	char code[101] , buf;
	while(scanf("%s" , &code)!=EOF){
		i = 0;
		while(code[i]!='\0'){
			if(code[i]!='@'){
				printf("%c" , code[i]);
				i++;
				continue;
			}else{
				n = code[i+1] - '0';
				for(j=1;j<=n;j++){
					printf("%c" , code[i+2]);
				}
				i += 3;
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    ll ans = 0;
    ll tmp = INF64;
    for (int i = 0; i < n; ++i) {
        if(a[i] < tmp){
            tmp = a[i];
            ++ans;
        }
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<pair<string,int>> v;
    REP(i,n) {
        string s; cin >> s;
        int t; cin >> t;
        v.push_back({s,t});
    }
    string stop; cin >> stop;

    int ans = 0;
    bool sleep = false;
    REP(i,n) {
        if (sleep) ans += v[i].second;
        else if (v[i].first == stop) sleep = true;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

bool ready(int i, vector<pii> &icicle) {
    int N = icicle.size();
    if(i < 0 || i >= N)
        return false;
    if(i == 0) {
        if(icicle[i].first > icicle[i + 1].first) {
            return true;
        }
    } else if(i == N - 1) {
        if(icicle[i].first > icicle[i - 1].first) {
            return true;
        }
    } else {
        if(icicle[i].first > icicle[i + 1].first &&
           icicle[i].first > icicle[i - 1].first) {
            return true;
        }
    }
    return false;
}

int main() {
    int N, L;
    cin >> N >> L;
    vector<pii> icicle(N);
    rep(i, N) {
        int a;
        cin >> a;
        icicle[i] = MP(a, 0);
    }
    queue<pii> que;
    rep(i, N) {
        if(ready(i, icicle)) {
            que.push(MP(i, 0));
        }
    }

    while(!que.empty()) {
        auto p = que.front();
        que.pop();
        int idx = p.first;
        int now = p.second;
        icicle[idx].second = now + (L - icicle[idx].first);
        icicle[idx].first = 0;
        if(ready(idx - 1, icicle)) {
            int ma = 0;
            if(idx - 2 >= 0)
                ma = icicle[idx - 2].second;
            que.push(MP(idx - 1, max(ma, icicle[idx].second)));
        }
        if(ready(idx + 1, icicle)) {
            int ma = 0;
            if(idx + 2 < N)
                ma = icicle[idx + 2].second;
            que.push(MP(idx + 1, max(ma, icicle[idx].second)));
        }
    }
    int res = 0;
    rep(i, N) { res = max(res, icicle[i].second); }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4044
import java.io.*;
import java.util.StringTokenizer;
import java.util.Arrays;

class Customer {
	int n,c;

	Customer(int n,int c) {
		this.n = n;
		this.c = c;
	}

	boolean NotUsed() {
		if (this.n==-1) return true;
		return false;
	}

	void Set(int n) {
		this.n = n;
	}

	void count() {
		this.c++;
	}
}

class List {
	Customer ct[] = new Customer[1000];

	List() {
		for (int i=0;i<1000;i++) {
			ct[i] = new Customer(-1,0);
		}
	}

	void addNewNumber(int n) {
		for (int i=0;i<1000;i++) {
			if (ct[i].NotUsed()) {
				ct[i].Set(n);
				ct[i].count();
				for (int j=i;j>0;j--) {
					if (ct[j].n<ct[j-1].n) {
						Customer t = ct[j-1];
						ct[j-1] = ct[j];
						ct[j] = t;
					} else break;
				}
				break;
			}
			else if (this.ct[i].n==n) {
				ct[i].count();
				break;
			}
		}
	}

	void Search(List list) {
		for (int i=0;i<1000;i++) {
			if (this.ct[i].NotUsed()) break;
			for (int j=0;j<1000;j++) {
				if (list.ct[j].NotUsed()) break;
				if (this.ct[i].n==list.ct[j].n) System.out.println(this.ct[i].n+" "+(this.ct[i].c+list.ct[j].c));
			}
		}
	}
}

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			List list[] = {new List(),new List()};
			while (!(buf = br.readLine()).equals("")) {
				StringTokenizer st = new StringTokenizer(buf,",");
				list[0].addNewNumber(Integer.parseInt(st.nextToken()));
			}
			while ((buf = br.readLine())!=null) {
				StringTokenizer st = new StringTokenizer(buf,",");
				list[1].addNewNumber(Integer.parseInt(st.nextToken()));
			}
			list[0].Search(list[1]);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16936
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
 
    const lines = input.split('\n')
    const N = lines[0] - 0

    let s = 0
    s = (N * N + N) / 2
    for (let i = 3; i <= N; i  += 3) {
        s -= i
    }
    for (let i = 5; i <= N; i  += 5) {
        if (i % 3 !== 0) {
            s -= i
        }
    }

    console.log(s)

})(input)


Measured memory_bytes: 33188
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int N;
vector<int> *G;
vector<int> bfn(int spoint);

int main(){
  cin >> N;
  G = new vector<int>[N+1];
  int a, b;
  for(int i=1; i<N; i++){
    //cin >> a >> b;
    scanf("%d %d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vector<int> dist1 = bfn(1);
  vector<int> dist2 = bfn(N);

  int l=0; int r=0;
  for(int i=1; i<=N; i++){
    if(dist1[i] <= dist2[i]) l++;
    else r++;
  }

  if(l>r) cout << "Fennec" << endl;
  else  cout << "Snuke" << endl;
}

vector<int> bfn(int spoint){
  vector<int> dist(N+1,-1); 
  queue<int>  q; 
  q.push(spoint);
  dist[spoint] = 0;

  while(!q.empty()){
    int u = q.front();
    q.pop();
    for(int i : G[u]){
      if(dist[i]==-1){
	dist[i] = dist[u] + 1;
	q.push(i);
      }
    }
  }
  //delete[] G;
  return dist;
};


Measured memory_bytes: 6528