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

static const int N = 100;
int n,color[N],M[N][N],d[N],f[N];
int t;

void dfs_visit(int u){
  int v;
  color[u] = 1;
  d[u] = ++t;
  for (v = 0; v < n; v++) {
    if(M[u][v] == 0) continue;
    if(color[v] == 0) dfs_visit(v);
  }
  color[u] = 2;
  f[u] = ++t;
}
void dfs(){
  int u;

  for (u = 0; u < n; u++) {
    color[u] = 0;
  }
  t = 0;

  for (u = 0; u < n; u++) {
    if(color[u] == 0) dfs_visit(u);
  }

  for (u = 0; u < n; u++) {
    cout << u+1 << " " << d[u] << " "<< f[u] << endl;
  }
}

int main() {
  int i,j,u,k,v;

  cin >> n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      M[i][j] = 0;
    }
  }
  for (i = 0; i < n; i++) {
    cin >> u >> k;
    u--;
    for (j = 0; j < k; j++) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }
  //cout << "done1" << endl;

  dfs();

  return 0;
}



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

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

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

  string s, t;
  cin >> s >> t;

  int ans = 0;
  if (s[0] == t[0]) {
    ans++;
  }
  if (s[1] == t[1]) {
    ans++;
  }
  if (s[2] == t[2]) {
    ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define see(x) (cerr<<(#x)<<'='<<(x)<<endl)
using namespace std;

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

const int maxn = 3e5+20;
const int inf = 0x3f3f3f3f;
const int modd = 1e9+7;

inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}
template <class T> inline void sc(T &x){char c;x=0;while((c=getchar())<'0');while(c>='0'&&c<='9')x=x*10+(c-48),c=getchar();}
inline ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
inline ll exgcd(ll a,ll b,ll &x,ll &y){ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d;}
inline ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%modd;a=a*a%modd;n>>=1;}return sum;}
inline ll qmul(ll a,ll n){ll sum=0;while(n){if(n&1)sum=(sum+a)%modd;a=(a+a)%modd;n>>=1;}return sum;}
inline ll inv(ll a) {return qpow(a,modd-2);}

int dp[105][105];
char mp[105][105]; 
int n,m;

int dfs(int x,int y)
{
	if(dp[x][y]!=-1) return dp[x][y];
	//cout<<x<<" "<<y<<endl;
	if(x==n) dp[x][y]=dfs(x,y+1)+(mp[x][y]!=mp[x][y+1]&&mp[x][y]=='#');
	else if(y==m) dp[x][y]=dfs(x+1,y)+(mp[x][y]!=mp[x+1][y]&&mp[x][y]=='#');
	else dp[x][y]=min( (mp[x][y]!=mp[x+1][y]&&mp[x][y]=='#')+dfs(x+1,y) , (mp[x][y]!=mp[x][y+1]&&mp[x][y]=='#')+dfs(x,y+1) );
	return dp[x][y];
} 

int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%s",mp[i]+1);
	dp[n][m]=(mp[n][m]=='#');
	dfs(1,1);
	//for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) printf("%d%c",dp[i][j]," \n"[j==m]);
	printf("%d\n",dp[1][1]);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    int k;
    cin >> k;
    vector<string> substring;
    int s_len = s.length();
    rep(i, s.length()) {
        for ( int j = 1; j <= min(k, s_len - i); j++ ) {
//            bool break_flg = false;
//            rep(k, substring.size()) {
//                if ( substring[k] == s.substr(i, j) ) {
//                    break_flg = true;
//                    break;
//                }
//            }
//            if ( !break_flg ) substring.push_back(s.substr(i, j));
            substring.push_back(s.substr(i, j));
        }
    }
    sort(substring.begin(), substring.end());
    substring.erase(unique(substring.begin(), substring.end()), substring.end());
//    rep(i, substring.size()) cout << substring[i] << endl;
    cout << substring[k-1] << endl;
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s,t,ans = "No";
    int temp;
    cin >> s >> t;
    temp = stoi(s+t);

    for(int i = 1;i < temp;i++){
        if(i*i == temp)ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

H, W = getNM()
N = getN()
A = getList()
dist = []
for i in range(N):
    for j in range(A[i]):
        dist.append(i + 1)
distalta = [[0] * W for i in range(H)]
for i in range(H * W):
    # ジグザグに降りていく感じで縦と横のインデックスを決める
    hei = i // W
    if hei % 2 == 0:
        wid = i % W
    else:
        wid = -1 * (i % W) - 1
    distalta[hei][wid] = dist[i]
for i in distalta:
    print(*i)

Measured memory_bytes: 42992
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll k, s;
    cin >> k >> s;
    ll ans = 0;
    rep(i, k+1)rep(j, k+1)if(i+j <= s && s-i-j <= k)ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, K = list(map(int,_in[0].split(' ')))  # type:list(int)
    h_arr = [0] * (N+K)
    h_arr[:N] = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    dp = [float('inf')] * (N+K)  # 最小化問題
    dp[0] = 0                    # 初期条件
    
    # 配るDP
    for i in range(0,N):
        for j in range(1,K+1):
            dp[i+j] = chmin(dp[i+j],dp[i]+abs(h_arr[i]-h_arr[i+j]))
    
    cnt = dp[N-1]
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 55820
N = int(input())
S = input()

mi = 0
ma = 0
c = 0
for it in S:
  if it == '(':
    c +=1
  else:
    c -=1
  mi = min(c,mi)
  ma = max(c,ma)

print ( "("*( max(-mi,0) ) + S + ")"*( max(c-mi,0)  ) )




Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N;
bool prime[55556];
vector<ll> v;

signed main(){
    cin >> N;
    for(ll i = 2; i <= 55555; i++) prime[i] = true;
    for(ll i = 2; i <= 55555; i++){
        if(prime[i] == false) continue;
        if(i % 5 == 1) v.push_back(i);
        for(ll j = 2; i * j <= 55555; j++) prime[i * j] = false;
    }
    REP(i, N){
        cout << v[i];
        if(i == N - 1) cout << endl;
        else cout << " ";
    }
    return 0;
}

Measured memory_bytes: 3676
import sys
import collections
sys.setrecursionlimit(10**6)


def main(input, print):
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        ans += i * ((n//i)*(n//i+1)//2)
    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)


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

using namespace std;

#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__) << "] "

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
        int n, m; cin >> n >> m;
        vector<set<int>> a(n);
        for (int i = 0; i < n; ++i)
        {
                int k; cin >> k;
                for (int j = 0; j < k; ++j)
                {
                        int x; cin >> x;
                        a[i].insert(x);
                }
        }
        ll res = 0;
        for (int i = 1; i <= m; ++i)
        {
                bool ok = true;
                for (int j = 0; j < n; ++j)
                {
                        if (a[j].find(i) == a[j].end()) ok = false;
                }
                if (ok) res++;
        }
        cout << res << endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}


Measured memory_bytes: 3660
// ConsoleApplication7.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include <stdio.h>

int main(int argc, char* argv[])
{
	int i;
	int num;
	int buf[10000];
	char temp[10];

	for (num = 0; 1; num++) {
		fgets(temp, sizeof(temp), stdin);
		sscanf(temp, "%d", &buf[num]);
		if (buf[num] == 0) break;
	}
	for (i = 0; i < num; i++) {
		printf("Case %d: %d\n", i+1, buf[i]);
	}
	
	return 0;
}

Measured memory_bytes: 2616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

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

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

int main(void){
    
    int n;
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];
    
    
    
    
    ll ans = 1000;
    ll num = 0;
    
    int lastsell = n-1;
    
    while(lastsell>0 && a[lastsell-1]>=a[lastsell]){
        lastsell--;
    }
    
    int firstbuy = 0;
    
    while(firstbuy<n-1 && a[firstbuy]>=a[firstbuy+1]){
        firstbuy++;
    }
    
    if(firstbuy<lastsell){
        num = ans/a[firstbuy];
        ans -= num * a[firstbuy];
    }else{
        cout<<1000<<endl;
        return 0;
    }
    
    //cout<<firstbuy<< lastsell<<endl;
    
    for(int i=firstbuy+1; i<=lastsell; i++){
        //cout << i <<" "<<ans<<" "<<num<<endl;
        if(i==n-1){
            if(a[i-1]<=a[i]){
                ans += num * a[i];
                num = 0;
            }
        }else{
            if(a[i-1]<=a[i] && a[i]>a[i+1]){
                ans += num * a[i];
                num = 0;
            }else if(a[i-1]>a[i] && a[i]<=a[i+1]){
                num += ans/a[i];
                ans -= num * a[i];
            }
        }
    }
    
    if(num)ans += num*a[lastsell];
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    string s;
    int a, n, tmp, ans=777, i;
    cin >> s;
    n=s.size();
    for(i=0;i<=n-3;i++){
        tmp=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        ans=min(ans, abs(tmp-753));
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int X;
	cin >> X;
	if (X == 3 || X == 5 || X == 7)cout << "YES" << endl;
	else cout << "NO" << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 504
#include<stdio.h>

int main(void)
{
	int ans[1000] = {0};
	int q=1,i;
	char str[1000];
	int give;
	
	ans[0] = 1;
	
	
	
	while(ans[q-1]!=0){
		scanf("%s", str);
		for(i=0; str[i]!='\0'; i++){
			give = str[i] - '0';
			ans[q] += give;}
		q++;}
	
	for(i=1; i<q-1; i++){
		printf("%d\n", ans[i]);}
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  while (n--) {
    int a;
    cin >> a;
    if (a % 2 == 0 and a % 3 and a % 5) {
      cout << "DENIED\n";
      exit(0);
    }
  }
  cout << "APPROVED\n";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {

        String str = Console.ReadLine();
        double r = double.Parse(str);
        double pi = Math.PI;
        double men = 0;
        double shuu = 0;

        men = r * r * pi;
        shuu = 2 * pi * r;

        String strmen = string.Format("{0:f6}", men);
        String strshuu = string.Format("{0:f6}", shuu);

        Console.WriteLine("{0} {1}", strmen, strshuu);

    }
}

Measured memory_bytes: 9264
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	if(n<100){
		if(n>=9){cout<<9;return 0;}
		cout<<n;return 0;
	}
	int ans=0;
	if(n<10000){
		if(n>=999){cout<<909;return 0;}
		cout<<n-99+9;
		return 0;
	}
	if(n>=99999){cout<<90909;return 0;}
	cout<<909+n-10000+1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(string, s);
  Cin(ll, k);

  char ans = '\0';
  bool f = true;
  rep(i, sz(s)) {
    if (s[i] != '1') {
      ans = s[i];
      f = false;
      break;
    }
    if (--k == 0) {
      cout << s[i] << endl;
      return;
    }
  }
  if (f) {
    cout << 1 << endl;
    return;
  }
  cout << ans << endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using LL  = long long;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(n);
    vector<pair<int, int>> ans;
    for(int i=0;i<n;i++) cin >> a[i];

    int mmax = 0;
    int maxi = -1;
    for(int i=0;i<n;i++){
        if(mmax < abs(a[i])){
            mmax = abs(a[i]);
            maxi = i;
        }
    }
    if(a[maxi] > 0){
        for(int i=0;i<n;i++){
            if(a[i] < 0){
                ans.push_back({maxi, i});
            }
        }
        for(int i=0;i<n-1;i++){
            ans.push_back({i, i+1});
        }
    }else{
        for(int i=0;i<n;i++){
            if(a[i] > 0){
                ans.push_back({maxi, i});
            }
        }
        for(int i=n-1;i>0;i--){
            ans.push_back({i, i-1});
        }
    }

    cout << ans.size() << endl;
    for(auto p : ans){
        cout << p.first+1 << " " << p.second+1 << endl;
    }
    return 0;
}


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

int main() {
  /*
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
  */
	ull A;
	double B;
	cin >> A >> B;
	cout << A * ull(round(100*B)) / 100 << "\n";
	return 0;
}

Measured memory_bytes: 3744
n = int(input())
text_list = [input() for _ in range(n)]

for i in range(n-1):
    if text_list[i][-1] != text_list[i+1][0]:
        print("No")
        exit()
    if text_list.count(text_list[i]) > 1:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 3060
/***************************************************************
	File name: matrix.cpp
	Author: huhao
	Create time: Thu 16 Jan 2020 10:49:45 AM CST
***************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=r*10+c-48;
		c=getchar();
	}
	return r*t;
}
#define i64 long long
const int N=32010,mod=998244353;
i64 n,m;
//int g[N][N];
i64 f[N],F[N];
i64 power(i64 a,i64 b,i64 p)
{
	i64 r=1;
	while(b)
	{
		if(b&1) r=r*a%p;
		a=a*a%p; b>>=1;
	}
	return r;
}
i64 inv(i64 a){ return power(a,mod-2,mod); }
namespace C
{
	i64 f[N<<1],F[N<<1],p[N<<1],P[N<<1];
	void init(int n)
	{
		f[0]=p[0]=1;
		fr(i,1,n){ f[i]=f[i-1]*i%mod; p[i]=p[i-1]*2%mod; }
		F[n]=inv(f[n]); P[n]=inv(p[n]);
		fd(i,n,1){ F[i-1]=F[i]*i%mod; P[i-1]=P[i]*2%mod; }
	}
	i64 C(int a,int b){ return a<0||b<0||a-b<0?0:f[a]*F[b]%mod*F[a-b]%mod; }
}
int &Add(int &a,i64 b){ return a=(a+b)%mod; }
i64 &Add(i64 &a,i64 b){ return a=(a+b)%mod; }
const i64 _g=3,G=inv(3);
int l,r[N];
void init(int n)
{
	while((1<<l)<n) l++;
	fr(i,0,(1<<l)-1) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
}
void NTT(i64 *a,int opt)
{
	fr(i,0,(1<<l)-1) if(i<r[i]) std::swap(a[i],a[r[i]]);
	fr(i,0,l-1)
	{
		i64 wn=power(opt==1?_g:G,(mod-1)>>(i+1),mod);
		for(int j=0;j<(1<<l);j+=(1<<(i+1)))
		{
			i64 w=1;
			fr(k,0,(1<<i)-1)
			{
				i64 x=a[j+k],y=w*a[j+k+(1<<i)]%mod;
				a[j+k]=(x+y)%mod; a[j+k+(1<<i)]=(x-y+mod)%mod; w=w*wn%mod;
			}
		}
	}
	if(opt==-1)
	{
		i64 I=inv(1<<l);
		fr(i,0,(1<<l)-1) a[i]=a[i]*I%mod;
	}
}
i64 A[N],B[N];
int main()
{
	n=read(); m=read(); std::swap(n,m); C::init((N-10)*2);
/*	fr(i,0,m)
	{
		g[i][0]=1+i*(i+1)/2;
		fr(j,1,i) Add(g[i][1],j*(i-j+1));
		fr(j,2,i) g[i][j]=((i+3ll)*i+2)*i%mod*C::f[i-1]%mod*C::F[j+2]%mod*C::F[i-j]%mod;
//		fr(j,2,i) fr(l,j,i) Add(g[i][j],((i-l+1)*(i-l+2)*(i-l+3)/6)%mod*C::C(l-2,j-2));
	}*/
	fr(i,0,m) f[i]=C::C(m,i);
//	fr(i,0,m) fr(j,0,i) printf("%d%c",g[i][j],j==i?'\n':' ');
//	fr(j,0,m) printf("%lld%c",f[j],j==m?'\n':' ');
	init(m+m+2);
	fd(i,n,1)
	{
		fr(j,0,m){ F[j]=f[j]; f[j]=f[j]*(1+j*(j+1)/2)%mod*C::f[j]%mod; }
		fr(j,0,(1<<l)-1) A[j]=B[j]=0;
		fr(j,0,m){ A[j]=(1ll*j*j*j+3ll*j*j+2*j)%mod*(j?C::f[j-1]:1)%mod*F[j]%mod; B[j]=C::F[m-j+2]; }
//		fr(j,0,(1<<l)-1) printf("%lld%c",A[j],j==end_j?'\n':' ');
//		fr(j,0,(1<<l)-1) printf("%lld%c",B[j],j==end_j?'\n':' ');
		NTT(A,1); NTT(B,1);
		fr(j,0,(1<<l)-1) A[j]=A[j]*B[j]%mod;
		NTT(A,-1);
//		fr(j,0,(1<<l)-1) printf("%lld%c",A[j],j==end_j?'\n':' ');
//		putchar(10);
		fr(j,0,m) Add(f[j],A[j+m]);
//		fr(j,0,m) fr(k,m-j,m) Add(f[j+k-m],(1ll*j*j*j+3ll*j*j+2*j)%mod*C::f[j-1]%mod*C::F[m-k+2]%mod*F[j]);//g[j][j-k]*F[j]);
//		fr(j,0,m) printf("%lld%c",f[j],j==m?'\n':' ');
		fr(j,0,m) Add(f[j],-(1ll*j*j*j+3ll*j*j+2*j)%mod*(j?C::f[j-1]:1)%mod*C::F[2]%mod*F[j]%mod+mod);
		fr(j,0,m) f[j]=f[j]*C::F[j]%mod;
	}
	printf("%lld\n",f[0]);
	return 0;
}

Measured memory_bytes: 2688
//#pragma GCC optimize("O3")
//#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define M2 998244353
#define ll long long
#define pll pair<long, long>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define ff first
#define ss second
#define pb push_back
#define db pop_back
#define mp make_pair
#define mt make_tuple
#define g(a, b) get<a>(b)
#define INF (ll)1e18 + 100
#define vl vector<ll>
#define vi vector<int>
#define vll vector<pair<ll, ll>>
#define vii vector<pair<int, int>>
#define all(v) v.begin(),v.end()
#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll modI(ll a, ll m);
ll gcd(ll a, ll b);
ll powM(ll x, unsigned ll y, unsigned ll m);
void pairsort(int a[], int b[], int n);
void pairsortll(ll a[],ll b[],ll n);
ll logint(ll x,ll y);
 
 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
ll powM(ll x,ll y,ll m)
{
    if(y==0) return 1;
    ll p=powM(x,y/2,m)%m;
    p=(p*p)%m;
    return (y%2==0)?p:(x*p)%m;
}
 
ll modI(ll a, ll m)
{
   return powM(a, m-2, m);
}
 
void pairsort(int a[],int b[],int n)
{
    pair<int,int> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
void pairsortll(ll a[],ll b[],ll n)
{
    pair<ll,ll> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
ll logint(ll x,ll y)
{
    ll ans=0;
    ll a=1;
    for(ll i=0;i<=x;i++)
    {
        if(x<a)
        {
            return ans;
        }
        ans++;
        a*=y;
    }
    return -1;
}
int main()
{
    string s,t;
    cin>>s>>t;
    cout<<t+s;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int w,s;
	scanf("%lld %lld",&s,&w);
	if(w>=s)
	{
		printf("unsafe\n");
	}
	else 

{
	printf("safe\n");
}
return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 510000;
const double pi=acos(-1);

int main(){
  int x;
  cin >> x;
  vector<int>beki;
  beki.push_back(1);
  for(int i=2;i*i<=x;i++){
    int num=i*i;
    while(num<=x){
      beki.push_back(num);
      num*=i;
    }
  }
  sort(beki.begin(),beki.end());
  int ans=0;
  rep(i,beki.size()){
    if(ans<beki[i])ans=beki[i];
  }
  cout << ans << endl;
    
  return 0;
}


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

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

int main(){
	string a = "CODEFESTIVAL2016";
	string str;
	cin >> str;
	int ans = 0;
	rep(i,str.size()){
		if(a[i]!=str[i])
			ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 764
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll n, x, m, smallest = INF;
  scanf("%lld%lld", &n, &x);
  ll _x = x;
  for (int i = 0; i < n; i++)
  {
    scanf("%lld", &m);
    _x -= m;
    smallest = MIN(smallest, m);
  }
  printf("%lld\n", n + _x / smallest);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin>>x;
  for(;x>=1;x--){
    int n=x;
    if(x==1)
      cout<<x<<endl;
    for(int j=2;j*j<=n;j++){
      while(n%j==0)
        n/=j;
      if(n==1){
        cout<<x<<endl;
        x=1;
      }
      n=x;
    }
  }
}

Measured memory_bytes: 3604
<?php
$input = trim(fgets(STDIN));
$temp = str_replace(array("\r\n", "\r", "\n"), '', $input);
$array = explode(" ", $temp);
$n = $array[0];
$d = $array[1];
$answer = 0;
$temp_max = 0;

for ($i = 1; $i <= $n; $i++) {
  $min = $i - $d;
  $max = $i + $d;
  if ($max >= $n) {
    $answer++;
    break;
  } else if ($min >= 1 && $temp_max == 0) {
    $answer++;
    $temp_max = $max;
  } else if ($min > $temp_max) {
    $answer++;
    if ($max >= $n) {
      break;
    } else {
      $temp_max = $max;
    }
  } else {
    continue;
  }
}
echo $answer . "\n";

Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <cmath>
 
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    
    string s, t;
    cin >> s >> t;
    
    for(int i=0; i<s.length(); i++){
        if(s.substr(i, 1) != t.substr(i, 1)){
            cout << "No" << endl;
            goto END;
        }
    }
    
    cout << "Yes" << endl;
    
    END:
    
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int c[16];
int x[20000];
int n,m;

uint memo[20000][256];

uint solve(int now, int prev){
  if(now == n) return 0;
  if(memo[now][prev]!=0xFFFFFFFF) return memo[now][prev];

  uint ret = 0xFFFFFFFF;
  REP(i,m){
    int t = min(255,max(0,prev + c[i]));
    uint g = (uint)(t - x[now]) * (t - x[now]);
    ret = min(ret, g + solve(now+1, t));
  }
  return memo[now][prev] = ret;
}

int main(){
  while(scanf("%d%d",&n,&m), n+m){
    REP(i,m) scanf("%d",c+i);
    REP(i,n) scanf("%d",x+i);
    memset(memo,0xFF,sizeof(memo));
    printf("%u\n",solve(0,128));
  }
  return 0;
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    auto s=to_string(n);
    int c=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='2')
        c++;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    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;
    }

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll a;
        ld b;
        cin>>a>>b;
        ld c=a*b;
        ll k=c;
        cout<<k<<endl;
    }

Measured memory_bytes: 3720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iK = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iK2 = 0;
            Boolean bKE = false;
            if (iK % 2 == 0) { bKE = true; iK2 = iK / 2; }      // iKが偶数
            int iCnt1 = 0;
            int iCnt2 = 0;
            if (bKE)                                            // 偶数
            {
                for (int i = 1; i <= iN; i++)                   // 1からNまで
                {
                    if (i % iK == 0) { iCnt1 += 1; }
                    else if (i % iK2 == 0) { iCnt2 += 1; }
                }
            }
            else                                                // 奇数
            {
                for (int i = 1; i <= iN; i++)                   // 1からNまで
                {
                    if (i % iK == 0) { iCnt1 += 1; }
                }
            }
            long iOut = (long)Math.Pow(iCnt1, 3) + (long)Math.Pow(iCnt2, 3);

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

using namespace std;

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

	vector<int> cnt(10);
	cnt[a]++; cnt[b]++; cnt[c]++;

	bool flag =false;
	for (int i = 1; i <= 9; i++) {
		if (2 == cnt[i]) flag = true;
	}
	cout << (flag ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        x: usize,
    }

    let max = 100 * x;
    let mut data = vec![true; max];
    data[0] = false;
    data[1] = false;
    for i in 2..max {
        if !data[i] {
            continue;
        }
        if i >= x {
            println!("{}", i);
            return;
        }
        let mut j = 2 * i;
        while j < max {
            data[j] = false;
            j += i;
        }
    }
}


Measured memory_bytes: 11792
import sys

N = int(input())

print(0)
ans_f = input()

if ans_f == "Vacant":
    sys.exit()

l = 0
r = N-1
ans = ''
while r - l > 1:
    c = (l+r)//2
    print(c)
    ans = input()
    if ans == 'Vacant':
        sys.exit()
    if (ans == ans_f and c % 2 == 0) or (ans != ans_f and c % 2 == 1):
        l = c
    else:
        r = c

print(r)
ans = input()
if ans == 'Vacant':
    sys.exit()






Measured memory_bytes: 9156
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val b = sc.next()
    println(problem066b(b))
}

fun problem066b(b: String): Int {
    var str = b
    while (str.isNotEmpty()) {
        str = str.dropLast(1)
        if (str.length % 2 != 0) continue
        val front = str.take(str.length / 2)
        val back = str.drop(str.length / 2)
        if (front == back) break
    }
    return str.length
}

Measured memory_bytes: 31392
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

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


int main(){
    ll a, b;    cin >> a >> b;
    cout << a * b << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
    ll a,n,b,c,d;
	cin>>n>>a>>b>>c>>d;
    {
        ll k=0;
        for(ll i=0;i<n;i++)
        {
            if((c*(n-i-1)-i*d)<=(b-a)&&(b-a)<=(d*(n-i-1)-i*c))
            {
                puts("YES");
                return 0; 
            }
        }
        puts("NO");
    }
    return 0;
}

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

using namespace std;

int main()
{
    //system("chcp 65001");

    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(fabs(b - a) <= d && fabs(c - b) <= d)
    {
        cout << "Yes";
    }
    else if(fabs(c - a) <= d)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    

    //cout << N;

    return 0;
}

Measured memory_bytes: 256
#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 - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

struct X{
    string str;
    ll num;
    ll id;
};

bool compstr(const X& e1, const X& e2){
  	return e1.str < e2.str;
}
bool compnum(const X& e1, const X& e2){
  	return e1.num > e2.num;
}

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

    ll n;
    cin >> n;
    string s;
    ll p;
    vector<X> x;
    REP(i, n){
        cin >> s >> p;
        x.push_back(X{s, p, i + 1});
    }
    sort(x.begin(), x.end(), compstr);
    vector<vector<X>> a(n);
    ll k = 0;
    a[0].push_back(X{"WHO IS THE WRITER???", x[0].num, x[0].id});
    REP(i, n - 1){
        if(x[i + 1].str != x[i].str) k++;
        a[k].push_back(X{"W H O   I S   T H E   W R I T E R ???", x[i + 1].num, x[i + 1].id});
    }
    REP(i, n){
        sort(a[i].begin(), a[i].end(), compnum);
        for(auto v : a[i]) cout << v.id << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    println(problem169d(n))
}

fun problem169d(n: Long): Long {
    /**
     * 素因数分解
     */
    fun computePrimeFactorList(n: Long): List<Pair<Long, Long>> {
        val p = mutableListOf<Pair<Long, Long>>()
        var primeFactor = n
        for (i in 2..(Math.sqrt(n.toDouble()) + 1).toLong()) {
            var count = 0L
            while (primeFactor % i == 0L) {
                primeFactor /= i
                count++
                if (primeFactor == 1L) break
            }
            p.add(i to count)
        }
        if (primeFactor != 1L) p.add(primeFactor to 1L)
        return p
    }

    val pf = computePrimeFactorList(n)
    var count = 0L
    for (i in 0 until pf.size) {
        var (a, b) = pf[i]
        var j = 1
        while (b > 0) {
            if (b < j) break
            b -= j
            count++
            j++
        }
    }
    return count
}


Measured memory_bytes: 96800
S = input()

mod = 10**9+7
A = 0
AB = 0
ABC = 0
cnt = 0
for i in range(len(S)):
    if S[i] == "A":
        A += pow(3, cnt, mod)
        A %= mod
    elif S[i] == "B":
        AB += A
        AB %= mod
    elif S[i] == "C":
        ABC += AB
        ABC %= mod
    else:
        ABC = (3*ABC + AB) % mod
        AB = (3*AB + A) % mod
        A = (3*A + pow(3, cnt, mod)) % mod
        cnt += 1
        
        
print(ABC)

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

namespace AOJ2
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, int[]> dictionary = new Dictionary<int, int[]>();

            string input;

            bool before = true;
            while ((input = Console.ReadLine()) != null)
            {
                if (input == "")
                {
                    before = false;
                    continue;
                }

                string[] inputArray = input.Split(',');
                if (before)
                {
                    if (!dictionary.ContainsKey(int.Parse(inputArray[0])))
                    {
                        dictionary[int.Parse(inputArray[0])] = new int[] { 1, 0 };
                    }
                    else
                    {
                        dictionary[int.Parse(inputArray[0])][0]++;
                    }
                }
                else
                {
                    if (dictionary.ContainsKey(int.Parse(inputArray[0])))
                    {
                        dictionary[int.Parse(inputArray[0])][0]++;
                        dictionary[int.Parse(inputArray[0])][1] = 1;
                    }
                }
            }

            List<int> resultList = new List<int>();

            foreach (int key in dictionary.Keys)
            {
                if (dictionary[key][1] != 0)
                {
                    resultList.Add(key);
                }
            }

            resultList.Sort();

            foreach (int key in resultList)
            {
                Console.WriteLine("{0} {1}", key, dictionary[key][0]);
            }

        }
    }
}

Measured memory_bytes: 6356
N, M = map(int ,input().split())

# N + x : M - 2x = 1 : 2
# M - 2x = 2N + 2x
# x = (M - 2N) / 4

if N * 2 >= M:
  print(int(M / 2))
else:
  x = (M - 2 * N) / 4
  N += int(x)
  M -= 2 * int(x)
  print(N)
  
  
  

Measured memory_bytes: 9124
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h>
#define MOD 1000000007
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int ans[200200];
int bin[200200];

int Check(int N){

    FOR(i,1,N){
		if (bin[N+i]==bin[N+i-1]){
            return bin[N+i];
        }
		if (bin[N-i]==bin[N-i+1]){
            return bin[N-i];
        }
            
	}

    return bin[1];
}

int main(void){

    int N, x;

    cin >> N;

    FOR(i,1,2*N){
        cin >> ans[i];
    }
    
    int right = 2*N-1;
    int left = 1;

    while(left < right){
        
        int mid = left + (right-left) / 2;

        FOR(i,1,2*N){
            (ans[i] >= mid) ? bin[i] = 1 : bin[i] = 0;
        }
        
        if(Check(N)){
            left = mid+1;
        }else{
            right = mid;
        }

    }
        cout << left-1 << endl;

    return 0;
}


Measured memory_bytes: 1920
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
namespace AtCoder_Beginner_Contest_127
{
    class Program
    {
        static public int[] SIn() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static void Main(string[] args)
        {
            var rDx = SIn();
            var r = rDx[0];
            var D = rDx[1];
            var x2000 = rDx[2];
            long xnext = x2000;
            for(var i=0;i<10;++i)
            {
                xnext = r * xnext - D;
                WriteLine(xnext);
            }

        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	int bg = a.back();
	auto bad = [](){
		cout << "Impossible" << endl;
		exit(0);
	};
	if(count(a.begin(), a.end(), bg) < 2) bad();
	if(count(a.begin(), a.end(), a[0]) != 1 + (bg%2)) bad();
	int i = 0;
	for(int j = 0; j < n;){
		i = j;
		while(i < n && a[i] == a[j]) i++;
		if(j){
			if(a[j - 1] + 1 != a[j]) bad();
		}
		j = i;
	}
	cout << "Possible" << endl;
	return 0;
}



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

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int h, w;
  cin >> h >> w;

  string s[100];

  REP(i,h){
    cin >> s[i];
  }

  bool w_h[100] = {}, w_w[100] = {};

  REP(i,h){
    bool is_white = true;
    REP(j,w){
      if(s[i][j] == '#'){
        is_white = false;
        break;
      }
    }
    if(is_white){
      w_h[i] = true;
    }
  }

  REP(i,w){
    bool is_white = true;
    REP(j,h){
      if(s[j][i] == '#'){
        is_white = false;
        break;
      }
    }
    if(is_white){
      w_w[i] = true;
    }
  }

  REP(i,h){
    bool is_print = false;
    REP(j,w){
      if(!w_h[i] && !w_w[j]){
        cout << s[i][j];
        is_print = true;
      } 
    }
    if(is_print)
      cout << "\n";
  }
  return 0;
}



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

int64_t N;

int main() {
  cin >> N;
  vector<int64_t> A(N);
  vector<int64_t> A_new(N);
  for (int64_t i = 0; i < N; i++) {
    int64_t a;
    cin >> a;
    A[i] = a;
    A_new[i] = a;
  }

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

  map<int64_t, int64_t> num;

  for (int64_t i = 0; i < N; i++) {
    num[A_new[i]-1]++;
  }

  map<int64_t, int64_t> num2;

  for (int64_t i = 0; i < N; i++) {
    num2[i] = num[i]*(num[i]-1)/2;
  }

  int64_t sum = 0;
  for (int64_t i = 0; i < N; i++) {
    sum += num2[i];
  }

  map<int64_t, int64_t> num3;

  for (int64_t i = 0; i < N; i++) {
    if (num[i] > 1) {
      num3[i] = (num[i]-1)*(num[i]-2)/2;
    }
    else {
      num3[i] = 0;
    }
  }

  for (int64_t k = 0; k < N; k++) {
    int64_t c = A[k];
    int64_t sum2 = sum - num2[c-1] + num3[c-1];
    cout << sum2 << endl;
  }
}


Measured memory_bytes: 43264
function Main(input){
	input = ~~input.split("\n")[0];
  var a = "Christmas"
  while(input != 25){
  	input++;
  	a += " Eve";
  }
  return a;
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
22
`);

Measured memory_bytes: 21064
object Main extends App {

  val n = scala.io.StdIn.readLong()


  def solve(): Long =  {
    for(i <- Math.floor(Math.sqrt(n)).toLong to 1 by -1) {
      if(n % i == 0) return (i-1) + (n/i) - 1
    }
    n - 1
  }

  println(solve)

}


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

int main()
{
   int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    
    if (b-a == c-b)
    {
        printf("YES");
    }
    
    else 
    {
        printf("NO");
    }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=2e6+5;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	ll n;cin >> n;
	ll ans=0;
	for(ll i=1;i<=n-1;++i){
		ll res=n/i;
		if(n%i==0)--res;
		ans+=res;
	}
	cout << ans << endl;


}
	


Measured memory_bytes: 3664