akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<vector<ll> >DP(101,vector<ll>(100001,INT_MIN));
vector<ll>wt,val;
ll dp(ll n,ll W)
{
	
	ll i,j;
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=W;j++)
		{
			if(i==0||j==0)
			DP[i][j]=0;
			else if(wt[i-1]<=j)
			DP[i][j]=max(DP[i-1][j],val[i-1]+DP[i-1][j-wt[i-1]]);
			else
			DP[i][j]=DP[i-1][j];
		}
	}
	return DP[n][W];
}
int main()
{   ll n,W;
     cin>>n>>W;
     ll i,j,k;
     for(i=0;i<n;i++)
     {cin>>j>>k;
     wt.push_back(j);
     val.push_back(k);
	 }
	 cout<<dp(n,W);
    return 0;
}


Measured memory_bytes: 80256
h,w=map(int,input().split())
m=min((0--h//3-h//3)*w,(0--w//3-w//3)*h)
for i in range(1,h):
  a,b,c=sorted((i*w,-~w//2*(h-i),w//2*(h-i)))
  m=min(m,c-a)
for i in range(1,w):
  a,b,c=sorted((i*h,-~h//2*(w-i),h//2*(w-i)))
  m=min(m,c-a)
print(m)

Measured memory_bytes: 42492
#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;

const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}


//Eと名のつくのはデバッグ用！
int EintN(ll array[],const ll num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {cerr<<array[i][k]<<" ";}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}


int prob(){
    ll ans;ans=0;
    ll N;cin>>N;
    ll Monster[N+1];
    ll Hero[N];
    inarray(Monster, 0, N+1);
    inarray(Hero, 0, N);
    ll temp;
    
    FOR(i, 0, N){
        if(Monster[i]> Hero[i]){ans+=Hero[i];Monster[i]-=Hero[i];continue;}
        if(Monster[i]<=Hero[i]){
            ans+=Monster[i];
            Hero[i]-=Monster[i];
            Monster[i]=0;
            if(Monster[i+1]> Hero[i]){
                ans+=Hero[i];
                Monster[i+1]-=Hero[i];
                Hero[i]=0;
            }
            else{
                ans+=Monster[i+1];
                Monster[i+1]=0;
            }
            
        }
        
    }
    
    
    OutputAndReturn0(ans);
    return 0;
}



signed main(){
    //test();
    prob();
    return 0;
}



Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
constexpr int INF = 0x3f3f3f3f;
int main() {
  string s;
  cin >> s;
  int n = (int)s.size();
  int ans = INF;
  rep(i, 1, n) if (s[i - 1] != s[i]) { ans = min(ans, max(i, n - i)); }

  cout << (ans == INF ? n : ans) << endl;

  return 0;
}

Measured memory_bytes: 3744
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second > b.second; }

int main(){
    set<ll>a;
    rep(i,3)a.insert(i+1);
    ll b,c;cin>>b>>c;
    a.erase(b);
    a.erase(c);
    for(auto p:a){
        ll ans=p;
        cout<<ans<<endl;
    }
}

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

using namespace std;

int main() {
    int a;
    int b;
    cin >> a >> b;
    if (a > b)
    {
        cout << "a > b" << endl;
    }
    else if (a == b)
    {
        cout << "a == b" << endl;
    }
    else if (a < b)
    {
        cout << "a < b" << endl;
    };
}


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

int main() {
        vector<int> M = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30};
        int a;

        rep(i, 28) {
                cin >> a;
                auto r = find(M.begin(), M.end(), a);
//              M.erase(M.begin() + a);
                M.erase(r);
        }

        rep(i, M.size()) {
                cout << M.at(i) << endl;
        }
        return 0;
}



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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)

#define F first
#define S second

typedef pair<li, li> PI;

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
public:
	dsu() : _n(0) {}
	dsu(int n) : _n(n), parent_or_size(n, -1) {}

	int merge(int a, int b) {
		assert(0 <= a && a < _n);
		assert(0 <= b && b < _n);
		int x = leader(a), y = leader(b);
		if (x == y) return x;
		if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
		parent_or_size[x] += parent_or_size[y];
		parent_or_size[y] = x;
		return x;
	}

	bool same(int a, int b) {
		assert(0 <= a && a < _n);
		assert(0 <= b && b < _n);
		return leader(a) == leader(b);
	}

	int leader(int a) {
		assert(0 <= a && a < _n);
		if (parent_or_size[a] < 0) return a;
		return parent_or_size[a] = leader(parent_or_size[a]);
	}

	int size(int a) {
		assert(0 <= a && a < _n);
		return -parent_or_size[leader(a)];
	}

	std::vector<std::vector<int>> groups() {
		std::vector<int> leader_buf(_n), group_size(_n);
		for (int i = 0; i < _n; i++) {
			leader_buf[i] = leader(i);
			group_size[leader_buf[i]]++;
		}
		std::vector<std::vector<int>> result(_n);
		for (int i = 0; i < _n; i++) {
			result[i].reserve(group_size[i]);
		}
		for (int i = 0; i < _n; i++) {
			result[leader_buf[i]].push_back(i);
		}
		result.erase(
		    std::remove_if(result.begin(), result.end(),
		[&](const std::vector<int>& v) { return v.empty(); }),
		result.end());
		return result;
	}

private:
	int _n;
	// root node: -1 * component size
	// otherwise: parent
	std::vector<int> parent_or_size;
};

pair<li, li> p[100100];

int main(void)
{
	li n, m;
	cin >> n >> m;
	dsu d(n);
	rep(i, n) {
		p[i].F = i;
		cin >> p[i].S;
		p[i].S--;
	}
	rep(i, m) {
		li x, y;
		cin >> x >> y;
		x--;
		y--;
		d.merge(x, y);
	}
	auto g = d.groups();
	li res = 0;
	for (auto& gg : g) {
		set<li> st;
		for (auto& ggg : gg) {
			st.insert(p[ggg].F);
		}
		for (auto& ggg : gg) {
			if (st.count(p[ggg].S) > 0) {
				res++;
			}
		}
	}
	cout << res << endl;


	return 0;
}

Measured memory_bytes: 12560
<?php
$days = explode(',', '0,31,60,91,121,152,182,213,244,274,305,335');
$format = explode(',', 'Wednesday,Thursday,Friday,Saturday,Sunday,Monday,Tuesday');
while(fscanf(STDIN,"%d %d",$a,$b)) {
    if($a == 0) {
        break;
    }
    
    $n = $days[$a-1] + $b;
    echo $format[$n%7].PHP_EOL;
}


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

int capCheck(string a){
	if(a[1] > 122 || a[1] < 97)
		return 0;
	for(int i = 2; i < a.length()-1; i++)
		if((a[i] > 122 || a[i] < 97) && a[i] != 'C')
			return 0;
	if(a[a.length()-1] > 122 || a[a.length()-1] < 97)
		return 0;
	return 1;
}

int checkC(string a){
	int counter = 0;
	for(int i = 2; i < a.length()-1; i++)
		if(a[i] == 'C')
			counter++;
	return counter-1;
}

int main(){
	string a;
	cin >> a;
	if(a[0] == 'A' && !checkC(a) && capCheck(a))
		cout << "AC\n";
	else
		cout << "WA\n";
}

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

int main(void)
{
    int n;
    cin >> n;
    float arr[100];
    float s = 0;
    for(int i=0;i<n;i++)
    {   
        cin >> arr[i];
    }
    for(int i=0;i<n;i++)
    {   
        s += 1/arr[i];
    }
    float d = 1/s;
    cout << 1/s;
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int x,y,z,k;
  cin >> x >> y >> z >> k;

  vector<ll> a(x), b(y), c(z);

  REP(i,x)cin >> a[i];
  REP(i,y)cin >> b[i];
  REP(i,z)cin >> c[i];
  sort(a.rbegin(), a.rbegin());
  sort(b.rbegin(), b.rbegin());
  sort(c.rbegin(), c.rbegin());

  vector<ll> ab, abc;
  REP(i, min(k,(int)a.size()))REP(j,min(k,(int)b.size()))ab.emplace_back(a[i]+b[j]);
  sort(ab.rbegin(), ab.rend());
  REP(i,min(k,(int)ab.size()))REP(j,min(k,(int)c.size()))abc.emplace_back(ab[i]+c[j]);
  sort(abc.rbegin(), abc.rend());

  REP(i,k)cout << abc[i] << endl;
}



Measured memory_bytes: 43224
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner sc = new Scanner(is);

        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();

        long x = Math.min(B-1, N);

        os.println((long)(Math.floor(A*x/(double)B)-A*Math.floor(x/(double)B)));
    }
}

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<P> dat(m);
    rep(i,m){
        int a,b,n=0;
        cin>>a>>b;
        rep(j,b){
            int c;
            cin>>c;c--;
            n|=(1<<c);
        }
        dat[i]=P(a,n);
    }
    vector<int> dp((1<<n),1e9);
    dp[0]=0;
    rep(i,1<<n){
        rep(j,m){
            int now=(i|dat[j].second);
            int val=dp[i]+dat[j].first;
            dp[now]=min(dp[now],val);
        }
    }
    if(dp[(1<<n)-1]>=1e9) dp[(1<<n)-1]=-1;
    cout<<dp[(1<<n)-1]<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  vector<VI> cs(3, VI(3));
  FOR(c,cs) {
    FOR(x,c) {
      cin >> x;
    }
  }
  bool ans = true;
  REP(i,0,2) {
    REP(j,0,2) {
      ans = ans && cs[i][j] - cs[i][j+1] == cs[i+1][j] - cs[i+1][j+1];
      ans = ans && cs[i][j] - cs[i+1][j] == cs[i][j+1] - cs[i+1][j+1];
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int d = tmp[0], n = tmp[1];

        if (n == 100)
        {
            n++;
        }

        string ans = n.ToString();

        for (int i = 0; i < d; i++)
        {
            ans += "00";
        }

        WriteLine(ans);
    }
}


Measured memory_bytes: 13268
package main

import "fmt"

func main() {
	var x, y int
	for {
		fmt.Scan(&x)
		fmt.Scan(&y)

		if x == 0 && y == 0 {
			break
		}

		if x < y {
			fmt.Println(x, y)
		} else {
			fmt.Println(y, x)
		}
	}
}



Measured memory_bytes: 1336
import sys
from math import floor
input = sys.stdin.readline
def main():
    X = int(input())
    for a in range(301):
        for b in range(301):
            if a**5-b**5==X:
                print(a,b)
                exit()
            if a**5+b**5==X:
                print(a,-b)
                exit()

if __name__ == "__main__":
    main()

Measured memory_bytes: 9104
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<int,int> P;
    typedef pair<int,P> P1;
    typedef pair<P,P> P2;
    #define pu push
    #define pb push_back
    #define mp make_pair
    #define eps 1e-7
    #define INF 1000000000
    #define mod 1000000007
    #define fi first
    #define sc second
    #define rep(i,x) for(int i=0;i<x;i++)
    #define repn(i,x) for(int i=1;i<=x;i++)
    #define SORT(x) sort(x.begin(),x.end())
    #define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
    #define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
    #define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
    vector<pair<string,P> >vec;
    int a,b;
    int main(){
    	cin>>a>>b;
    	b+=3*a;
    	cout<<b/2<<endl;
    }

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    vi data(5);
    for (int i = 0; i < 5; i++) {
        cin >> data.at(i);
    }
    int last = 0;
    for (int i = 1; i < 5; i++) {
        if ((data.at(i) - 1) % 10 < (data.at(last) - 1) % 10) {
            last = i;
        }
    }
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        if (i == last || data.at(i) % 10 == 0) {
            ans += data.at(i);
        }
        else {
            ans += data.at(i) - (data.at(i) % 10) + 10;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  vector<vector<int>> G(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
  }
  vector<int> path;
  vector<int> curPath;
  vector<bool> inPath(n);
  vector<bool> vis(n);
  bool loop = false;
  auto dfs = [&](auto dfs, int cur) -> void {
    if(loop) return;
    if(inPath[cur]) {
      loop = true;
      auto itr = find(all(path), cur);
      int sz = path.end() - itr;
      curPath = vector<int>(sz);
      copy(itr, path.end(), curPath.begin());
      return;
    }
    if(vis[cur]) return;
    vis[cur] = true;
    inPath[cur] = true;
    path.push_back(cur);
    for(int ne: G[cur]) {
      dfs(dfs, ne);
      if(loop) return;
    }
    inPath[cur] = false;
    path.pop_back();
  };
  rep(i, n) {
    rep(j, n) inPath[j] = false;
    dfs(dfs, i);
  }
  if(!loop) cout << -1 << "\n";
  else {
    bool updated = true;
    while(updated) {
      updated = false;
      set<int> se;
      for(int v: curPath) se.insert(v);
      int sz = curPath.size();
      rep(i, sz) {
        int v = curPath[i];
        for(int ne: G[v]) {
          if(se.count(ne) && ne!=curPath[(i+1)%sz]) {
            vector<int> newCurPath;
            int j = find(all(curPath), ne) - begin(curPath);
            while(j != i) {
              newCurPath.push_back(curPath[j]);
              (j+=1)%=sz;
            }
            newCurPath.push_back(curPath[j]);
            curPath = vector<int>(newCurPath.size());
            copy(all(newCurPath), begin(curPath));
            updated = true;
          }
          if(updated) break;
        }
        if(updated) break;
      }
    }
    cout << curPath.size() << "\n";
    for(int v: curPath) cout << v+1 << "\n";
  }
  return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  int n;  cin >> n;
  string s;
  cin >> s;
  sort(all(s));
  ll ans = 1;
  for(int i=0 ; i<n ;){
    int j=i;
    while(s[i]==s[j]){
      j++;
    }
    ans *= (j-i+1);
    ans %= mod;
    i = j;
  }
  cout << ans-1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int x;
  cin>>x;
  if(400<=x and x<600) cout<<8<<endl;
  else if(600<=x and x<800) cout<<7<<endl;
  else if(800<=x and x<1000) cout<<6<<endl;
  else if(1000<=x and x<1200) cout<<5<<endl;
  else if(1200<=x and x<1400) cout<<4<<endl;
  else if(1400<=x and x<1600) cout<<3<<endl;
  else if(1600<=x and x<1800) cout<<2<<endl;
  else cout<<1<<endl;
  return 0;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
inline void add(int &x, int v) { x += v; if (x >= MOD) x -= MOD; }

int N;
int fact[2000001];
int modpow(int x, int k) {
  int a = 1;
  while (k > 0) {
    if (k & 1) a = (1LL*a*x) % MOD;
    x = (1LL*x*x) % MOD;
    k >>= 1;
  }
  return a;
}

int inv(int x) {
  return modpow(x, MOD-2);
}

int nCr(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  return (1LL * fact[n] * inv((1LL*fact[k]*fact[n-k]) % MOD)) % MOD;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  fact[0] = 1;
  for (int i=1; i<=2000000; i++) fact[i] = (1LL*i*fact[i-1])%MOD;

  cin >> N;
  int s = 0;
  rep(num, N) {
    int n=N-2, k = num-1;
    int sum = 0;
    if (k>=0&&n-k>=0) sum = nCr(k, n-k);
    sum = (MOD-sum)%MOD;
    add(sum, nCr(N-1, num));
    sum = (1LL*sum*fact[num])%MOD;
    sum = (1LL*sum*fact[N-1-num])%MOD;
    add(s, sum);
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 8064
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main(void)
{
	double a,b,c,s,l,h,rd,l2;
	scanf("%lf %lf %lf",&a,&b,&c);
	rd=c*M_PI/180.0;
	s=a*b*sin(rd)/2.0;
	l2=a*a+b*b-2.0*a*b*cos(rd);
	l=a+b+sqrt(l2);
	h=s*2.0/a;
	printf("%lf\n",s);
	printf("%lf\n",l);
	printf("%lf\n",h);
	return 0;
}


Measured memory_bytes: 1076
#include <stdio.h>
#include <string.h>
int main(){
    int i,buf,l,ans=0,num;
    char s[100001];
    scanf("%s",s);
    l=strlen(s);
    buf=s[0]-48;
    for(i=1;i<l;i++){
        num=s[i]-48;
        if(num==buf){
            ans++;
        if(num==1)buf=0;
        else buf=1;
        }
        else buf=num;
    }
   printf("%d",ans);
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int main()
{
 
//  int a, b, c, d, e, X, Y;
  int a, b, c,  d, e,f,n;
  //  double  c;
//  long long  A[1000001]={};
  int  A[2001][1001]={};
  int  B[2000001]={};
  int  ans[100003]={};
  int  sum[100003]={};
  int  cnt_flag[100003]={};

  int  L[1003]={};


//  long long  a, b, c, d, X, Y;
//  long long   d, X, Y;
  long long JPY;
  double BTC;
  char s[200001][1001]={};
  char t[200001][1001]={};
  char u[200001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k,point;
  int point_A=0, point_B=0;
  int flag=0;
//  int flag[10000003]={};
  int tmp=0;
//  int min=1000000;
  int min=10;
  int len=0;
  int cnt=0;
  int cnt0=0;
  int cnt1=0;
  int num=0;
//  double ans=0.0;
//  long long ans=0;
  int max=0;
//  int sum=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
 
  scanf("%d%d%d%d", &a, &b, &c, &n);
  for(i=0;(i*a)<n+1;i++){
    if((i*a)==n){
      cnt++;
      break;
    }
    for(j=0;(i*a)+(j*b)<n+1;j++){
      if((i*a)+(j*b)==n){
        cnt++;
        break;
      }
      else  if((n-((i*a)+(j*b)))%c==0){
          cnt++;
      }//      k=0;
//      if((i*a)+(j*b)+(k*c)>n) break; 
//          printf("i=%d j=%d k=%d n=%d cnt=%d\n",i,j,k,(i*a)+(j*b)+(k*c), cnt);
    }
//  j=0;
//  if((i*a)+(j*b)+(k*c)>n) break;     
//          printf("i=%d j=%d k=%d n=%d cnt=%d\n",i,j,k,(i*a)+(j*b)+(k*c), cnt);
  }
  
  printf("%d\n",cnt);
//    else  
  
return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();

        // 主処理
        int result = 0;
        for (int i = 0; i < n; i++) {
            if (a.charAt(i) != b.charAt(i)) {
                result++;
            }
            if (a.charAt(i) != c.charAt(i) && b.charAt(i) != c.charAt(i)) {
                result++;
            }
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 23636
// input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        p_vec: [usize; n],
    }
    let mut swap_count = 0;
    for (i, p) in p_vec.iter().enumerate() {
        if i + 1 != *p {
            swap_count += 1;
        }
    }
    if swap_count == 0 || swap_count == 2 {
        println!("YES")
    } else {
        println!("NO")
    }
}


Measured memory_bytes: 4352
MOD = 10 ** 9 + 7
N, M = map(int, input().split())


fact = [1] * (M+1)
for i in range(2, M+1): fact[i] = i * fact[i-1] % MOD

invfact = [1] * (M+1)
invfact[M] = pow(fact[M], MOD-2, MOD)
for i in range(M, 1, -1):
	invfact[i-1] = invfact[i] * i % MOD

def permute(n, k):
	return fact[n] * invfact[n - k] % MOD

def choose(n, k):
	return permute(n, k) * invfact[k] % MOD

total = pow(permute(M, N), 2, MOD)
add = -1

for i in range(1, N+1):
	total = (total + add * choose(N, i) * permute(M, i) % MOD * pow(permute(M-i, N-i), 2, MOD)) % MOD
	add *= -1

print(total)


Measured memory_bytes: 91468
#include <stdio.h>
#include <stdlib.h>
int main(){
    char str[4] ;
    int count[3]={};
    scanf("%s",str);
    for(int m = 0; m<3;m++){
        count[str[m]-'a']++;
    }
    for(int i=0;i<3;i++){
        if(count[i]!=1){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for (int i = 0; i < N - 1; i++)
    {
        int idx;
        cin >> idx;
        A[idx - 1]++;
    }
    for (int i = 0; i < N; i++)
    {
        cout << A[i] << endl;
    }
 
    return 0;
}

Measured memory_bytes: 4024
#include <stdio.h>
#include <math.h>
#include <string.h>
#define rep(i,a,n) for(int i=a;i<n;i++)

int main(){
	int n;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		double s[1001]={0},ave=0,a=0;
		rep(i,0,n){
			scanf("%lf",&s[i]);
			ave+=s[i];
		}
		ave/=(double)n;
		rep(i,0,n){
			a+=pow(s[i]-ave,2);
		}
		a/=(double)n;
		a=sqrt(a);
		printf("%.10lf\n",a);
	}
	return 0;
}

Measured memory_bytes: 1100
import math
n = int(input())

def koch(n, p1, p2):
    if n == 0:
        return

    sx = (2*p1['x'] + 1*p2['x'])/3
    sy = (2*p1['y'] + 1*p2['y'])/3
    tx = (1*p1['x'] + 2*p2['x'])/3
    ty = (1*p1['y'] + 2*p2['y'])/3
    ux = (tx - sx)*math.cos(math.radians(60)) - (ty - sy)*math.sin(math.radians(60)) + sx
    uy = (tx - sx)*math.sin(math.radians(60)) + (ty -sy)*math.cos(math.radians(60)) + sy
    
    s = {'x':sx, 'y':sy}
    t = {'x':tx, 'y':ty}
    u = {'x':ux, 'y':uy}

    koch(n-1,p1,s)
    print('{} {}'.format(s['x'],s['y']))
    koch(n-1, s, u)
    print('{} {}'.format(u['x'],u['y']))
    koch(n-1, u, t)
    print('{} {}'.format(t['x'],t['y']))
    koch(n-1,t,p2)

p1 = {'x':float(0),'y':float(0)}
p2 = {'x':float(100),'y':float(0)}
print('{} {}'.format(p1['x'],p1['y']))
koch(n, p1, p2)
print('{} {}'.format(p2['x'],p2['y']))



Measured memory_bytes: 5744
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))

    summary = []

    for i in range(n):
        summary.append([a[i], i])

    summary.sort()

    print(*[summary[i][1] + 1 for i in range(n)])


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


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

	cin >> S;
	int N = S.length();

	bool ans = true;
	reps(i,1,N-1) if( S[i-1] != S[i+1] ) ans = false;

	if( ans ) cout << "Second" << endl;
	else cout << ((N-(S[0]==S.back()))%2 ? "First" : "Second") << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  string s, t;
  in2(s, t);
  vector<char> a(s.size()), b(t.size());
  rep(i, s.size())
    a[i] = s[i];
  rep(i, t.size())
    b[i] = t[i];
  sort(all(a));
  sort(all(b));
  reverse(all(b));
  bool k = true;
  if(s.size() > t.size()){
    rep(i, t.size()){
      if(a[i] > b[i])
        break;
      else if(a[i] == b[i])
        continue;
      else{
        k = false;
        break;
      }
    }
  }
  else if(s.size() == t.size()){
    rep(i, s.size()){
      if(a[i] < b[i]){
        k = false;
        break;
      }
      else if(a[i] == b[i])
        continue;
      else{
        break;
      }
    }
  }
  else{
    k = false;
    rep(i, s.size()){
      if(a[i] < b[i])
        break;
      if(a[i] > b[i]){
        k = true;
        break;
      }
    }
  }
  if(k)
    out("No");
  else
    out("Yes");
  memi;
}

Measured memory_bytes: 256
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

x = input_n
n = 512
pre = Array.new(n)
nums = Array.new(n)
(n / 2).times do |i|
  pre[i + (n / 2)] = -(i ** 5)
  nums[i + (n / 2)] = -i
  pre[i] = (i ** 5)
  nums[i] = i
end

pre.each_with_index do |p, i|
  pre.each_with_index do |r, j|
    if p - r == x
      puts "#{nums[i]} #{nums[j]}"
      exit
    end
  end
end


Measured memory_bytes: 14400
#include<cstdio>
#include<iostream>
#include<ctime>
#include<string.h>
#include<algorithm>
#include<cmath>
using namespace std;
int per[100005],n,cnt;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&per[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(per[i]==i)
		{
			if(i==n)
			{
				cnt++;
				break;
			}
			else
			{
				cnt++;
				int t;
				t=per[i];
				per[i]=per[i+1];
				per[i+1]=t;
			}
		}
	}
	printf("%d",cnt);
}


Measured memory_bytes: 640
a = list(input())
b = list(input())
i = 0
while True:
    c = b[-1]
    b = b[:-1]
    b = [c] + b
    if a == b:
        yesno = 'Yes'
        break
    i += 1
    if i > len(a)+1:
        yesno = 'No'
        break

print(yesno)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int w, a, b; cin >> w >> a >> b;
    if (b >= a + w) out(b - (a + w));
    else if (b + w <= a) out(a - (b + w));
    else out(0);
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);

		String s = sc.next();
		
		if (s.equals("Sunny")) {
			System.out.println("Cloudy");
		} else if (s.equals("Cloudy")) {
			System.out.println("Rainy");
		} else {
			System.out.println("Sunny");
		}
	}
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

ll lol;

ll power(ll x,ll n)
{
    if(n==0){return 1;}
    if(n==1){return x;}
    if(n%2==0){
        return power((x*x)%M,n/2);
    }
    if(n%2==1){
        return (power((x*x)%M,n/2)*x)%M;
    }
}

ll f(ll n)
{
    n=n%M;
    ll ans=(n*(n+1))%M;
    ans=(ans*lol)%M;
    return ans;
}

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

    lol=power(2,M-2);
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    for(ll i=k;i<=n+1;++i)
    {
        ll ch=f(n);
        ch=(ch-f(n-i)+M)%M;
        ch=(ch-f(i-1)+M)%M;
        ch=(ch+1)%M;
        ans=(ans+ch)%M;
    }
    cout<<ans;

    return (0);
}


Measured memory_bytes: 3692
import math
n, d = map(int,input().split())
p = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
  for j in range(i+1, n):
    x = 0
    for k in range(d):
      x += abs(p[i][k] - p [j][k])**2
    x = math.sqrt(x)
    if x == int(x):
      ans+=1
print(ans)

Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn get_angle(e: (f64, f64)) -> f64 {
    e.1.atan2(e.0)
}

fn main() {
    let n = read::<usize>();
    let mut engines = vec![];
    for i in 0..n {
        let v = read_vec::<f64>();
        let (x, y) = (v[0], v[1]);
        engines.push((x, y));
    }

    engines.sort_by_key(|&e| Total(get_angle(e)));
    engines.append(&mut engines.clone());

    let mut next_pointer = 1;
    let mut cur_vec = engines[0];
    let mut ans = 0.0;
    for i in 0..n {
        let cur_angle = get_angle(engines[i]);
        while next_pointer < engines.len()
            && next_pointer < i + n
            && (cur_vec.0 + engines[next_pointer].0).hypot(cur_vec.1 + engines[next_pointer].1)
                >= cur_vec.0.hypot(cur_vec.1)
        {
            cur_vec.0 += engines[next_pointer].0;
            cur_vec.1 += engines[next_pointer].1;
            next_pointer += 1;
        }
        ans = f64::max(cur_vec.0.hypot(cur_vec.1), ans);

        // pop
        cur_vec.0 -= engines[i].0;
        cur_vec.1 -= engines[i].1;
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}


Measured memory_bytes: 3004
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;



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

	int W, H;
	while(cin >> W >> H, W) {
		int b[20][15] = { 0 };
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				cin >> b[i][j];
			}
		}

		int dp[20][15] = { 0 };
		for(int i = 0; i < W; i++) {
			if(b[0][i] != 1)
				dp[0][i] = 1;
		}

		for(int i = 0; i < H - 1; i++) {
			for(int j = 0; j < W; j++) {
				if(b[i][j] == 0) {
					for(int d = -1; d <= 1; d++) {
						if(j + d < 0 || W <= j + d) continue;
						if(b[i + 1][j + d] == 0 || b[i + 1][j + d] == 2 && d == 0)
							dp[i + 1][j + d] += dp[i][j];
					}
				}
				else if(b[i][j] == 2) {
					dp[i + 2][j] += dp[i][j];
				}
			}
		}

		int ans = 0;
		for(int i = H - 1; i <= H; i++) {
			for(int j = 0; j < W; j++) {
				if(b[i][j] != 1)
					ans += dp[i][j];
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1196
#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];

  int sum = 0;
  for (int i = 0; i < n; ++i)
    sum += a[i];

  double avg = (double)sum / n;

  int ans = 0;
  double d = abs((double)a[0] - avg);
  for (int i = 1; i < n; ++i) {
    double tmp = abs((double)a[i] - avg);
    if (tmp < d) {
      d = tmp;
      ans = i;
    }
  }

  cout << ans << endl;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

class Data{
public:
	int P,Y;
	int i,x;
};

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

	int N=in(),M=in();
	vector<Data> D(M);
	REP(i,M){
		D[i].P=in();
		D[i].Y=in();
		D[i].i=i;
	}
	sort(ALL(D),[](Data& lhs,Data& rhs){return lhs.P==rhs.P ? lhs.Y<rhs.Y : lhs.P<rhs.P;});
	int number = 0,old_p = D[0].P;
	REP(i,M){
		if(D[i].P!=old_p){
			number = 1;
		}
		else number++;
		D[i].x = number;
		old_p = D[i].P;
	}
	sort(ALL(D),[](Data& lhs,Data& rhs){return lhs.i<rhs.i;});
	REP(i,M){
		printf("%06d%06d\n",D[i].P,D[i].x);
	}
	
	return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int D;
long long G;
vector<int> ps, cs;

int main(){
  cin >> D >> G;
  ps.resize(D); cs.resize(D);
  for (int i = 0; i < D; i++) cin >> ps[i] >> cs[i];
  
  int ans = 1000;
  
  for (int mask = 0; mask < (1<<D); mask++) {
    long long total = 0;
    int num = 0;
    
    for (int i = 0; i < D; i++) {
      if (mask & (1<<i)) {
        total += 100 * (i + 1) * ps[i] + cs[i];
        num += ps[i];
      }
    }
    
    if (total >= G) {
      ans = min(ans, num);
    } else {
      for (int i = D - 1; i >= 0; i--) {
        if (!(mask & (1<<i))) {
          for (int j = 0; j < ps[i]; j++) {
            if (total < G) {
              total += 100 * (i + 1);
              num++;
            }
          }
        }
      }
      ans = min(ans, num);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> w = new ArrayList<Integer>();
		List<Integer> h = new ArrayList<Integer>();


		 for(int i=0;;i++){
			 h.add(i, scan.nextInt());
			 w.add(i, scan.nextInt());
			 if(w.get(i)==0 && h.get(i)==0) break;
		 }

		 for(int i=0;;i++){
			if(w.get(i)==0 && h.get(i)==0) break;
			printFlame(w.get(i),h.get(i));
		 }
	}

	static void printFlame(int w,int h){
		for(int i=0 ;i< h;i++){
			if(i%2==0){
				for(int j=0 ; j < w;j++){
					if(j%2==0) System.out.print("#");
					if(j%2!=0) System.out.print(".");
				}
			}else{
				for(int j=0 ; j < w;j++){
					if(j%2==0) System.out.print(".");
					if(j%2!=0) System.out.print("#");
				}
		}
			System.out.println();
		}
		
		System.out.println();

	}

}

Measured memory_bytes: 37112
// AOJ_C++.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include <iostream>
#include <iomanip>
#include <string>
void Drawline(int b) {
	for (int j = 0; j < b; ++j) {
		std::cout << "#";
	}
	std::cout << "\n";
}

void Output(int a, int b) {
	Drawline(b);
	for (int i = 1; i < a - 1; ++i) {
		std::cout << "#";
		for (int j = 1; j < b - 1; ++j) {
			std::cout << ".";
		}
		if(b > 1) std::cout << "#";
		std::cout << "\n";
	}
	if(a > 1) Drawline(b);
	std::cout << "\n";
}

int main()
{
	int arr[1000][2];
	for (int i = 0; true; ++i) {
		int a, b;
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			for (int j = 0; j < i; j++) {
				Output(arr[j][0], arr[j][1]);
			}
			break;
		}
		arr[i][0] = a;
		arr[i][1] = b;
	}

	
	return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include<algorithm>
#include<string> 
#include <bits/stdc++.h> 
using namespace std;
#define int long long
int n;
int R=0;
int G=0;
int B=0;
string S;
char array1[4100];
signed main(){
cin>>n;
cin>>S;    
int ans=0;
strcpy(array1, S.c_str());
for(int i=0;i<n;i++){
	if(array1[i]=='R')R+=1;
	if(array1[i]=='G')G+=1;
	if(array1[i]=='B') B+=1;
}
int P=R*G*B;
for(int i=0;i<n-2;i++){
	for(int k=i+2;k<n;k++){
		if((i+k)%2==1){
			continue;
		}
		int v=(i+k)/2;
		if(((array1[i]!=array1[k])&&(array1[i]!=array1[v]))&&(array1[v]!=array1[k]))ans+=1;
	}
}
cout<<P-ans;
return 0;
} 

Measured memory_bytes: 3644
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>

using namespace std;

int main()
{
    int N, C;
    std::cin >> N >> C;

    struct Prog {
        int s;
        int e;
        int ch;
    };

    std::vector<Prog> P;
    for (int i = 0; i < N; ++i) {
        Prog t;
        std::cin >> t.s >> t.e >> t.ch;
        P.push_back(t);
    }

    std::sort(std::begin(P), std::end(P),
              [](const auto& a, const auto& b) {
                  return a.s < b.s;
              });


    struct Rec {
        int ch;
        int e;
    };
    std::vector<Rec> recs;

    for (auto&& p: P) {

        auto pos = std::find_if(std::begin(recs), std::end(recs), [&p](auto r) {
                if (p.ch == r.ch) {
                    return r.e <= p.s;
                }
                else {
                    return r.e * 2 <= p.s * 2 - 1;
                }
            });
        if (pos != std::end(recs)) {
            pos->ch = p.ch;
            pos->e = p.e;
        }
        else {
            recs.push_back({p.ch, p.e});
        }
    }

    std::cout << recs.size() << std::endl;

    return 0;
}


Measured memory_bytes: 1912
# 整数の入力
n = input()
n = int(n)

# いくつあるかわからないときのスペース区切りの整数の入力
nums = input().split()
nums = list(map(int,nums))

#　n個の長さの0のリストを作る。
l = [0] * n


i = 0
for i in range(0,n):
	ans = 0
	check = nums[i]
	while check % 2 == 0:
		check = check / 2
		ans = ans + 1
		#print(check)
	l[i] = ans

#print (l)

print(min(l))

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

int main() {
  int n;
  cin >> n;
  ll ans = 1;
  for (ll i = 2; i <= n; i++) {
    ans = ans * i % 1000000007;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3544
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

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

// utility of stdin,stdout
#define _CRT_SECURE_NO_WARNINGS
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	std::vector<int> p(n);
	for (int i = 0; i < n; ++i)	cin >> p.at(i);

	std::vector<int>::iterator iter = std::max_element(p.begin(), p.end());
	size_t index = std::distance(p.begin(), iter);
	p.at(index) /= 2;

	int sum = std::accumulate(p.begin(), p.end(), 0);
	OUT(sum) BR;
	RET;
}


Measured memory_bytes: 256
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    912 Hours of Solitude
    Quarantine_Day : 38
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;
typedef pair<ll, ll>		pll;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005

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

    ll n; cin>>n;
    ll ans(0), i = 1;
    while(i * i <= n){
        ans = i * i;
        i++;
    }
    cout<<ans<<"\n";

    return 0;
}


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

    for(int i = k-1; i >= 0; i--)
    {
        if(g==1)
        {
            break;
        }
        else
        {
            if(-1 != a[n-i])
            {
                cout<<n-i<<endl;

            }

        }
    }

}


Measured memory_bytes: 256