akhauriyash/Code-Regression huggingface dataset:
from heapq import heappush, heappop
def dijkstra(s):
    d = [float("inf") for i in range(n)]
    d[s] = 0
    q = [(0,s)]
    while q:
        dx,x = heappop(q)
        for y,c in v[x]:
            if f[y] > 1:
                if dx+c < d[y]:
                    d[y] = dx+c
                    heappush(q,(d[y],y))
    return [-1 if d[i] == float("inf") else d[i] for i in range(n)]

while 1:
    n = int(input())
    if n == 0:
        break
    p = list(map(int,input().split()))
    d = list(map(int,input().split()))
    v = [[] for i in range(n)]
    edge = [None for i in range(n-1)]
    f = [0 for i in range(n)]
    for i in range(1,n):
        j = p[i-1]-1
        c = d[i-1]
        edge[i-1] = [j,i]
        v[i].append((j,c))
        v[j].append((i,c))
        f[i] += 1
        f[j] += 1
    ans = 0
    for x in range(n-1):
        i,j = edge[x]
        if f[i] == 1 or f[j] == 1:
            ans += d[x]
        else:
            ans += 3*d[x]
    dist = dijkstra(0)
    md = max(dist)
    l = dist.index(md)
    dist = dijkstra(l)
    m = max(dist)
    print(ans-m)



Measured memory_bytes: 6192
mod=998244353
fact=[1]
for i in range(1,2*10**5+1): #mod上での階乗を求める
 fact.append((fact[-1]*i)%mod)
revfact=[1]
for i in range(1,2*10**5+1): #mod上での階乗の逆元をフェルマーの小定理を用いて求める
 revfact.append(pow(fact[i],mod-2,mod))
n,m,k=map(int,input().split())
ans=0
for i in range(k,-1,-1): #各m(N-K<=m<=N)について場合の数を求める
 group=n-i
 tmp=fact[n-1]*revfact[group-1]*revfact[n-1-(group-1)]
 tmp%=mod
 tmp*=m
 tmp%=mod
 tmp*=pow(m-1,group-1,mod)
 ans+=tmp
 ans%=mod
print(ans)

Measured memory_bytes: 24788
#include <algorithm>
#include <iostream>
#include <string>

#include <vector>
#include <cmath>
#include <limits>
#include <functional>
using namespace std;

int main()
{

    int A, B;
    bool flag = true;
    int ans = 0;

    cin >> A >> B;

    for (int tmp = A; tmp <= B; tmp++)
    {
        std::string str;
        str = std::to_string(tmp);
        str.c_str();
        int len = str.length();
        for (int i = 0; i <= len / 2; i++)
        {
            if (str[i] == str[len - 1 - i])
            {
                flag = true;
            }
            else
            {
                flag = false;
                break;
            }
        }
        if(flag){
            ans++;
        }
    }

     cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3660
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n, sum, t int
	fmt.Scan(&n)
	for _, v := range strconv.Itoa(n) {
		t, _ = strconv.Atoi(string(v))
		sum += t
	}
	if n%sum == 0 {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (a == b){
    if (b != c) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else if (a == c){
    cout << "Yes" << endl;
  }
  else if (b == c){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

#define int long long

#define PB push_back
#define PPB pop_back
#define MK make_pair
#define ALL(V) V.begin(), V.end()
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, int> psi;
typedef pair<int, pii> pipii;

static const int INF = 1LL << 61;
//static const int MOD = 1000000007;
//static const int MAX_N = 100005;

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

    string s;
    cin >> s;
    bool flg = false;
    for (char c : s) {
        if (!flg && c == 'C') flg = true;
        if (flg && c == 'F') {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

int main(){
	#define int ll
	cin.tie(0);
	ios::sync_with_stdio(false);
	// ここに処理を記述

	string S;
	cin >> S;

	int center;
	center = (S.size() + 1)/2;

	REP(i,center){
		if(S[i] != S[(S.size() - 1) - i]){
			cout << "No" << "\n";
			return 0;
		}
	}

	string sub = S.substr(0, center - 1);

	REP(i,sub.size()){
		if(sub[i] != sub[(sub.size() - 1) - i]){
			cout << "No" << "\n";
			return 0;
		}
	}

	cout << "Yes" << "\n";

	return 0;
}

Measured memory_bytes: 256
inf = float('inf')

# distの初期化: dist = [inf for _ in range(N)]; dist[start] = 0
# True - >正常に更新, False -> startからendまでの経路において負閉路有り
def bellmanford(dist,edges,N,end):
    for i in range(N):
        for v ,nv, w in edges:
            if dist[nv] > dist[v] + w:
                dist[nv] = dist[v] + w
                # 頂点数Nなら更新は高々N-1回で済む
                # N回目にendの更新を行うなら経路の中に負閉路があるということ
                if i == N-1 and nv == end:
                    return False
    return True

N,M = map(int,input().split())
info = []
for _ in range(M):
    a,b,c = map(int,input().split())
    a -= 1; b -= 1; c = -c
    info.append((a,b,c))
 
dist = [inf for _ in range(N)]
dist[0] = 0

flag = bellmanford(dist,info,N,N-1)
ans = -dist[N-1] if flag else "inf"
print(ans)

Measured memory_bytes: 3316
sub max{my@m=@_;return $m[0]>$m[1]?$m[0]:$m[1]}
($A,$B,$C,$X,$Y)=glob<>;
$C*=2;
$n=&max($X,$Y);
$m=2e9;
for(0..$n){
    $t=$_*$C+&max($X-$_,0)*$A+&max($Y-$_,0)*$B;
    $m=$m<$t?$m:$t;
}
print $m;

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

int main() {
  string s;
  cin >> s;
  
  int n=0;
  for(int i=1;i<4;i++) {
    if(s[0]==s[i]) ++n;
  }
  for(int i=2;i<4;i++) {
    if(s[1]==s[i]) ++n;
  }
  for(int i=3;i<4;i++) {
    if(s[2]==s[i]) ++n;
  }
  
  if(n!=2) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using ii = pair<int, int>;
 
void solve();
 
clock_t start_time;
double get_current_time() {
	return (double)(clock() - start_time) / CLOCKS_PER_SEC;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	solve();
}
 
/* ========== actual code starts here ========== */
 
#define fi first
#define re return
#define se second
#define in insert
#define pb push_back
#define eb emplace_back
#define y1 y123123123123
#define all(x) x.begin(), x.end()
 
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repx(i, x, n) for (int i = x; i < (n); i++)
#define repd(i, n, d) for (int i = 0; i < (n); i += d)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepd(i, n, d) for (int i = (n) - 1; i >= 0; i -= d)
 
#ifdef artem
	#define debug(x) x
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(x)
#endif

const int limit = 2 * 100500;
const ll mod = (ll)1e9 + 7;
ll fact[ limit ];

void init_fact() {
	fact[ 0 ] = 1;
	repx(i, 1, limit) {
		fact[ i ] = (fact[ i - 1 ] * i) % mod;
	}
}

ll binpow(ll a, ll n) {
	ll res = 1;
	while(n) {
		if(n & 1) {
			res = (res * a) % mod;
		}
		a = (a * a) % mod;
		n >>= 1;
	}
	re res;
}

ll mult(ll a, ll b) {
	a %= mod, b %= mod;
	re a * b % mod;
}

ll sub(ll a, ll b) {
	re a * binpow(b, mod - 2) % mod;
}

ll C(ll a, ll b) {
	// cout << fact[ a ] << ' ' << mult(fact[ b ], fact[ a - b ]) << endl;
	re sub(fact[ a ], mult(fact[ b ], fact[ a - b ]));
}

void solve() {
	init_fact();
	// cout << C(6, 2) << endl;
	// re;

	int h, w, a, b;
	cin >> h >> w >> a >> b;

	ll ans = 0;
	for(int i = b + 1; i <= w; i++) {
		ll c1 = C(i + h - a - 2, h - a - 1), c2 = C(w - i + a - 1, a - 1);
		ans += mult(c1, c2);
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5176
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=2050;
//ここまでテンプレ
//↓RMQpint
struct SegMinPint{
private:
	int n;
	vector<pint> node;
public:
	//vpintをセグ木にsetする
	SegMinPint(vpint v){
		int sz=v.size();
		n=1;while(n<sz) n*=2;
		node.resize(2*n-1,mp(INF,INF));
		for(int i=0;i<sz;i++) node[i+n-1]=v[i];
		for(int i=n-2;i>=0;i--) node[i]=min(node[2*i+1],node[2*i+2]);
	}
	//x番目の要素をvalに変える
	void update(int x, pint val){
		x+=(n-1);
		node[x]=val;
		while(x>0){
			x=(x-1)/2;
			node[x]=min(node[2*x+1],node[2*x+2]);
		}
	}
	//区間[a,b)の最小値を得る
	pint getmin(int a,int b,int k=0,int l=0,int r=-1){
		if(r<0) r=n;
		if(r<=a || b<=l) return mp(INF,INF);
		if(a<=l && r<=b) return node[k];
		pint vl=getmin(a,b,2*k+1,l,(l+r)/2);
		pint vr=getmin(a,b,2*k+2,(l+r)/2,r);
		return min(vl,vr);
	}
};
//RMQpint
int main(){
	int N;
	cin>>N;
	vint P;
	for(int i=0;i<N;i++){
		int p;
		cin>>p;
		P.pb(p);
	}
	//偶数と奇数番目のセグ木を用意する
	vpint O,E;
	for(int i=0;i<N;i++){
		if(i%2){
			O.eb(P[i],i);
			E.eb(INF,i);
		}
		else{
			O.eb(INF,i);
			E.eb(P[i],i);
		}
	}
	SegMinPint OS(O),ES(E);
	SegMinPint S[2]={ES,OS};
	//pq(最小値、範囲)
	priority_queue<pair<int,pint>,vector<pair<int,pint>>,greater<pair<int,pint>>> Q;
	//偶数のなかから一番小さいものを入れとく
	Q.push(mp(S[0].getmin(0,N).first,mp(0,N)));
	//こたえ
	vint ans;
	//ループ
	while(Q.size()){
		//範囲[l,r)
		int l=Q.top().second.first,r=Q.top().second.second;
		//1つ目を入れる
		ans.pb(S[l%2].getmin(l,r).first);
		//偶数から一番小さいものの座標を見る
		int idxA=S[l%2].getmin(l,r).second;
		//[idxA,r)で一番小さい奇数からとる
		int idxB=S[(l+1)%2].getmin(idxA+1,r).second;
		//入れる
		ans.pb(S[(l+1)%2].getmin(idxA+1,r).first);
		Q.pop();
		
		//3つの区間に分ける[l,idxA),[idxA+1,idxB),[idxB+1,r)
		if(l<idxA-1)
			Q.push(mp(S[l%2].getmin(l,idxA).first,mp(l,idxA)));
		if(idxA+1<idxB)
			Q.push(mp(S[(idxA+1)%2].getmin(idxA+1,idxB).first,mp(idxA+1,idxB)));
		if(idxB+1<r)
			Q.push(mp(S[(idxB+1)%2].getmin(idxB+1,r).first,mp(idxB+1,r)));
			
	}
	for(int i=0;i<N;i++)
		cout<<ans[i]<<(i==N-1?'\n':' ');
	return 0;
}

Measured memory_bytes: 24184
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n;
    int a[200000];
    long long ans = 0;

    cin >> n;

    REP(i, 200000)
    {
        a[i] = 0;
    }

    REP(i, n)
    {
        int t;
        cin >> t;
        if (t > 100000)
        {
            ans++;
        }
        else
        {
            a[t]++;
        }
    }

    for (int i = 1; i < 200000; i++)
    {
        if (a[i] > i)
        {
            ans += a[i] - i;
        }
        else if (a[i] < i)
        {
            ans += a[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int char_to_int(char c){
  switch(c){
    case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
  }
}


int main(){
  ll N;
  cin >> N;
  vector <ll> A(N+1);
  rep(i, N) cin >> A.at(i);
  A.at(N) = -5;
  
  ll res = 0;
  int inc_or_dec = 0;
  
  
  if(N <=2){
    res = 1;
  }else{
    int i = 0;
    while(i+1 < N){
      while(A.at(i) == A.at(i+1)) i++;
      inc_or_dec = 0;
      if(i+1 < N){
        if(A.at(i) < A.at(i+1)){
          inc_or_dec = 1;
          while(A.at(i) <= A.at(i+1)) i++;
        }else{
          inc_or_dec = -1;
          while(A.at(i) >= A.at(i+1) && i+1 < N) i++;
        }
      }
      res++;
      //cout << i << " " << A.at(i) << endl;
      i++;
      if (i == N-1){
        if((inc_or_dec = 1 && A.at(i-1) > A.at(i)) || (inc_or_dec = -1 && A.at(i-1) < A.at(i))){
          res++;
        }
      }
    }
  }
    
  
  cout << res;
      
  
}

Measured memory_bytes: 1152
#include<iostream>
using namespace std;
#define sz 100
int Agrid[sz][sz];
int main()
{
    int h, w, i, j, cnt;
    char grid[sz][sz];

    cin>>h>>w;
    for(i=0; i<h; i++)
    {
        for(j=0; j<w; j++)
        {
            cin>>grid[i][j];
        }
    }
    for(i=0; i<h; i++)
    {

        for(j=0; j<w; j++)
        {
            cnt = 0;
            if(grid[i][j]=='.')
            {
                if(grid[i+1][j]=='#')
                    cnt++;
                if(grid[i-1][j]=='#')
                    cnt++;
                if(grid[i][j+1]=='#')
                    cnt++;
                if(grid[i][j-1]=='#')
                    cnt++;
                if(grid[i+1][j+1]=='#')
                    cnt++;
                if(grid[i+1][j-1]=='#')
                    cnt++;
                if(grid[i-1][j+1]=='#')
                    cnt++;
                if(grid[i-1][j-1]=='#')
                    cnt++;
            }
            Agrid[i][j] = cnt;
        }
    }
    for(i=0; i<h; i++)
    {
        for(j=0; j<w; j++)
        {
            if(grid[i][j]=='.')
                cout<<Agrid[i][j];
            else
                cout<<grid[i][j];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import heapq

def main():
    num = int(input())
    data = list(map(int, input().split()))

    left_heap = []
    left_sum = 0
    for i in range(num):
        left_sum += data[i]
        heapq.heappush(left_heap, data[i])

    dp_left = [0 for i in range(num + 1)]
    dp_left[0] = left_sum

    for i in range(num):
        now_num = data[num + i]
        pop_data = heapq.heappushpop(left_heap, now_num)
        left_sum += now_num - pop_data
        dp_left[i + 1] = left_sum

    right_heap = []
    right_sum = 0
    for i in range(num):
        right_sum += data[3 * num - 1 - i]
        heapq.heappush(right_heap, -data[3 * num - 1 - i])

    dp_right = [0 for i in range(num + 1)]
    dp_right[0] = right_sum

    for i in range(num):
        now_num = data[2 * num - 1 - i]
        pop_data = heapq.heappushpop(right_heap, -now_num)
        right_sum += now_num + pop_data
        dp_right[i + 1] = right_sum
    dp_right = dp_right[::-1]

    ans = dp_left[-1] - dp_right[-1]
    for i in range(num):
        ans = max(ans, dp_left[i] - dp_right[i])

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 119976
import java.util.Scanner;

public class Main
{

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

		char x = sc.next().charAt(0);
		char y = sc.next().charAt(0);

		System.out.println((x < y) ? "<" : (x > y) ? ">" : "=");
		sc.close();
	}
}

Measured memory_bytes: 22612
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var a int
	scanner.Scan()
	a, _ = strconv.Atoi(scanner.Text())

	fmt.Println(3 * a * a)
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int N=9e5+5,mo=1e9+7;

typedef long long LL;

int n,m,K,ans,Fac[N],Inv[N],p[N];

int C(int n,int m)
{
	return (LL)Fac[n]*Inv[m]%mo*Inv[n-m]%mo;
}

int main()
{
	p[0]=Fac[0]=Inv[0]=Fac[1]=Inv[1]=1; p[1]=3;
	for (int i=2;i<N;i++) Inv[i]=(LL)Inv[mo%i]*(mo-mo/i)%mo;
	for (int i=2;i<N;i++)
	{
		p[i]=p[i-1]*3ll%mo; Fac[i]=(LL)Fac[i-1]*i%mo; Inv[i]=(LL)Inv[i-1]*Inv[i]%mo;
	}
	scanf("%d%d%d",&n,&m,&K); n--;
	if (m<K) swap(m,K);
	for (int i=0,j=1;i<=m+K;i++)
	{
		ans=(ans+(LL)C(n+i,n)*p[m+K-i]%mo*j)%mo;
		if (i<K) j=j*2%mo;
		else if (i>=m) j=(j*2ll-C(i,K)-C(i,i-m))%mo;
		else j=(j*2ll-C(i,K))%mo;
	}
	if (ans<0) ans+=mo;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
int main()
{
	int x=read();
	cout<<(int)(pow(x,3))<<endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
#include<numeric>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;

int main(){
  int N; cin>>N;
  vector<ll>A(N),B(N);
  for(int i=0;i<N;i++){
    cin>>A[i]>>B[i];
  }
  vector<pair<ll,ll> >p(N);
  for(int i=0;i<N;i++){
    p[i]=make_pair(B[i],A[i]);
  }
  sort(p.begin(),p.end());
  for(int i=0;i<N;i++){
    B[i]=p[i].first;
    A[i]=p[i].second;
  }
  ll sum=0;
  for(int i=0;i<N;i++){
    sum+=A[i];
    if(sum<=B[i])continue;
    else{
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 6528
#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 pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    li a,b;
    cin>>a>>b;
    if(a<b)swap(a,b);
    // a>=b

    rep(i,a){
        cout<<b;
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 3604
N=int(input())
*T, = [0] + list(map(int,input().split())) + [0]
*A, = [0] + list(map(int,input().split())) + [0]
mod = 10**9+7
M = list(map(min,zip(A,T)))[1:-1]
m = [max(T[i] if T[i]>T[i-1] else 1, A[i] if A[i]>A[i+1] else 1) for i in range(1,N+1)]
ans = 1
for a,b in zip(m,M): ans = ans * max(0,b-a+1) % mod
print(ans)

Measured memory_bytes: 18624
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl;
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl;
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl;
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl;
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl;
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 200010;

ll n;
map<pii, ll> mapp;

void MAIN() {

    cin >> n;
    forifrom (i, 1, n + 1) {
        ll a = i;
        while (a > 9) a /= 10;
        mapp[{a, i % 10}]++;
    }
    ll ans = 0;
    forifrom (i, 1, n + 1) {
        ll a = i;
        while (a > 9) a /= 10;
        ans += mapp[{i % 10, a}];
    }
    cout << ans << '\n';

}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
2020
    )";
    MAIN();
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2) //O2优化？

#include<bits/stdc++.h>
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define BINF 0x7fffffff
#define INF 0x3f3f3f3f
#define LINF 9223372036854775807
#define END(s) {cout<<s;return 0;}
#define CON(s) {cout<<s;continue;}
#define BRE(s) {cout<<s;break;}
#define pb push_back
#define All(a) a.begin(),a.end()  //with A in CAPITAL!!!
#define sz(a) (int)a.size()
#define F first
#define S second
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	if(m>=n) cout<<n;
	else cout<<n-1;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int euclid(int a, int b);

int main(void)
{
	int a, b;
	int gcd, lcm;
	
	while (scanf("%d %d", &a, &b) != EOF){
		if (a > b){
			gcd = euclid(a, b);
		}
		else {
			gcd = euclid(b, a);
		}
		
		lcm = a * (b / gcd);
		
		printf("%d %d\n", gcd, lcm);
	}
	
	return (0);
	
}

int euclid(int a, int b)
{
	int c;
	c = a % b;
	
	if (c == 0){
		return (b);
	}
	
	return (euclid(b, c));
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>

int main() {
	int a, b;
	cin >> a >> b;
	int ans(6);
	ans = ans-a - b;
	cout << ans;
	return 0;
}

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

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

using namespace std;

int main(){
	const int n=1001;
	int fb[n+1];	fb[0]=1,fb[1]=2;
	for(int i=2;i<=n;i++)	fb[i]=(fb[i-1]+fb[i-2])%n;

	for(int v,d;~scanf("%d%d",&v,&d);){
		int a[n];
		rep(i,v)	a[i]=fb[i+1];
		sort(a,a+v);

		int cnt=1;
		for(int i=1;i<v;i++) if(a[i]-a[i-1]>=d) cnt++;
		printf("%d\n",cnt);
	}

	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }

  int sum = 0;
  for (int i = 0; i < n; i ++) {
    int x = a.at(i);
    int y = abs(k - a.at(i));
    sum += min(x, y) * 2;
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

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

  string s;
  cin >> s;

  int n = 0;
  for(char ch: s){
    switch(ch){
      case '+': ++n; break;
      case '-': --n; break;
    }
  }

  cout << n << endl;

  return 0;
}


Measured memory_bytes: 256
def main():
    s=input()
    q=int(input())
    queryy=[]
    sent="a"
    back="a"
    for i in range(q):
        queryy.append(tuple(input().split()))
    check=-1
    for query in queryy:
    #   print(query)
        if query[0]=="1":
            check*=-1
        else:
            if query[1]=="1":
                if check==-1:
                    sent+=str(query[2])
                   # s=str(query[2])+s
                else:
                    back+=str(query[2])
                   # s+=str(query[2])
                    
            else:
                if check==-1:
                    back+=str(query[2])
                    #s+=str(query[2])
                else:
                    sent+=str(query[2])
                    #s=str(query[2])+s
   # print(type(sent))
    #if sent[0]=="1":
     #   sent=sent[1:]
    sent=sent[1:]
    sent=sent[::-1]   
    back=back[1:]

    if check==1:
        s=sent+s+back        
        print(s[::-1]) 
    else:
        s=sent+s+back
        print(s)

if __name__=="__main__":
    main()  

Measured memory_bytes: 20156
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


struct UnionFind{
    vector<int> par;
    int count;
    UnionFind(int n) : par(n, -1), count(0){}
    int Find(int x){return par[x] < 0 ? x : Find(par[x]);}
    int Size(int x){return par[x] < 0 ? -par[x] : Size(par[x]);}
    bool Unite(int x, int y){
        x = Find(x);
        y = Find(y);
        if(x == y)
            return false;
        if(par[x] > par[y])
            swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return ++count;
    }
};


void solve(long long n, long long m, long long k, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c, std::vector<long long> d){
    vector<pair<int,int>> fr;
    set<pair<int,int>> bl;
    for(int i = 0; i < m; ++i){
        --a[i], --b[i];
        fr.push_back(minmax(a[i], b[i]));
    }
    for(int i = 0; i < k; ++i){
        --c[i], --d[i];
        bl.emplace(minmax(c[i], d[i]));
    }
    UnionFind uf(n);
    for(auto& p : fr)
        uf.Unite(p.first, p.second);
    vector<int> cnt(n, 0);
    for(int i = 0; i < n; ++i)
        cnt[i] = uf.Size(i) - 1;
    for(auto& p : fr)
        if(uf.Find(p.first) == uf.Find(p.second)){
            --cnt[p.first];
            --cnt[p.second];
        }
    for(auto& p : bl)
        if(uf.Find(p.first) == uf.Find(p.second)){
            --cnt[p.first];
            --cnt[p.second];
        }

    for(int i = 0; i < n; ++i)
        cout << cnt[i] << " \n"[i == n - 1];
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    std::vector<long long> C(K);
    std::vector<long long> D(K);
    for(int i = 0 ; i < K ; i++){
        scanf("%lld",&C[i]);
        scanf("%lld",&D[i]);
    }
    solve(N, M, K, std::move(A), std::move(B), std::move(C), std::move(D));
    return 0;
}


Measured memory_bytes: 10228
#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}



int main()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    int cur=0;
    for(int i=1;i<n;i++){
        if(s[i]==s[i-1])cur++;
    }
cout<<min(n-1,cur+2*k);
    return 0;
}


Measured memory_bytes: 3736
def main():
    def plus(x, y):
        return x + y
    def minus(x, y):
        return x - y

    ans = ""
    func = {"+": plus, "-": minus}
    A, B, C, D = [int(v) for v in list(input())]
    for sym1 in ["+", "-"]:
        for sym2 in ["+", "-"]:
            for sym3 in ["+", "-"]:
                if func[sym3](func[sym2](func[sym1](A, B), C), D) == 7:
                    ans = str(A) + sym1 + str(B) + sym2 + str(C) + sym3 + str(D) + "=7"
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <set>

using namespace	std;

int main() {
  set<string> data;
  int N; cin>>N;
  while(--N >= 0) {
    string s; cin>>s;
    data.insert(s);
  }
  cout << data.size() << endl;
  return 0;
}


Measured memory_bytes: 15592
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    map<pair<int, int>, int> mp;
    for (int i = 0, y = 0, x = 0, w = 0; i < N; i++) { cin >> y >> x >> w, mp[{y, x}] += w, mp[{y - 1, x}] += w, mp[{y, x - 1}] += w, mp[{y - 1, x - 1}] += w; }
    int ans = 0;
    for (const auto& p : mp) { ans = max(ans, p.second); }
    cout << ans << " / " << 1 << endl;
    return 0;
}



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

int main()
{
    int n, a[201];
    cin >> n; for(int i = 1; i <= 2*n; i++) cin >> a[i];
    sort(a+1,a+2*n+1,greater<int>());
    int l = 0;
    for(int i = 1; i <= n; i++) l += a[2*i];
    cout << l;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(int argc, char **argv)
{
    int n;
    vector<int> a, b, c;

    cin >> n;
    a.resize(n);
    b.resize(n);
    c.resize(n);

    for (int i = 0; i < n * 3; i++)
    {
        int tmp;
        cin >> tmp;
        if (i < n)
            a[i] = tmp;
        else if (i < n * 2)
            b[i % n] = tmp;
        else
            c[i % n] = tmp;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        vector<int>::iterator ia = lower_bound(a.begin(), a.end(), b[i]);
        vector<int>::iterator ic = upper_bound(c.begin(), c.end(), b[i]);
        sum += (distance(a.begin(), ia)) * distance(ic, c.end());
        //sum += (ia - a.begin()) * (c.end() - ic);
    }
    cout << sum << endl;
   return 0;
}

Measured memory_bytes: 1408
/**
 *    Author: "Robin Singh" !!
 *    rob_in_1
**/

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

#define dbg( args...) { vector<string> _v = split( #args, ','); err( _v.begin(), args); cerr << '\n'; }
vector<string> split( const string& s, char c) { vector<string> v; stringstream ss( s); string x; 
while ( getline( ss, x, c)) v.emplace_back(x); return move(v); }
void err( vector<string>::iterator it) { } 
template<typename T, typename... Args>
void err( vector<string>::iterator it, T a, Args... args) {
cerr << it -> substr( ( *it)[0] == ' ', it -> length()) << " = " << a << '\t'; err( ++it, args...); }

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ff first
#define ss second
#define MP make_pair
#define szz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)     
#define bk(i, j, k) for(int i = j-1; i >= k; i--)
#define mem(ptr, val)  memset(ptr, val, sizeof ptr)
#define sbit(n)  __builtin_popcount(n)
#define nl "\n"

typedef long double ld;
typedef pair<int, int> pii;
typedef vector <int> vi;
typedef vector < pair<int,int> > vpii;
const long double eps = 1e-9;
const int mod = 1e9+7;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

//*********************************!Template Ends Here!**********************************//

const int nn = 2e5+5;

void robin(){
    int k, A, B;
    cin >> k >> A >> B;
    int c = 1, y = 0;

    if(A+2 >= B){
        c += k;
    }

    else{
        c = A;
        k -= A-1;
        if(k == 1) c++;
        else if(k >= 2){
            c += (k/2) * (B-A);
            if(k % 2 == 1) c++; 
        }
    }
    cout << c; 
}

int32_t main(){
    // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        robin();
    }
    return 0;
}

Measured memory_bytes: 256
def solve():
  n,m = map(int,input().split())
  lst = [0]
  append = lst.append
  for i in range(n - 1):
    append(lst[-1] + int(input()))
  ans = 0
  num = 0
  for i in range(m):
    a = int(input())
    ans += abs(lst[num] - lst[num + a])
    num += a
  print(ans % 100000)
solve()


Measured memory_bytes: 9640
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N, K;
  cin >> N >> K;
  int R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;

  int ans = 0;
  vector<int> pre(K);
  vector<int> last(K);
  rep(i, 0, K) {
    pre[i] = 1;
    last[i] = i;
  }
  rep(i, K, N) {
    int k = i % K;
    if (T[i - K] == T[i]) {
      pre[k]++;
    } else {
      int x = 0;
      if (T[i - K] == 'r') x = P;
      if (T[i - K] == 's') x = R;
      if (T[i - K] == 'p') x = S;
      ans += (pre[k] + 1) / 2 * x;
      pre[k] = 1;
    }
    last[k] = i;
  }
  rep(i, 0, K) {
    int x = 0;
    if (T[last[i]] == 'r') x = P;
    if (T[last[i]] == 's') x = R;
    if (T[last[i]] == 'p') x = S;
    ans += (pre[i] + 1) / 2 * x;
  }
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



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

int main(){
  int N;
  cin >> N;
  vector<double> x(N);
  vector<string> u(N);
  for(int i = 0; i < N; i++){
    cin >> x[i] >> u[i];
  }

  double ans = 0;
  for(int i = 0; i < N; i++){
    if(u[i] == "JPY"){
      ans += x[i];
    }
    else{
      ans += x[i] * 380000.0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
#include <list>
#include <iterator>
#include <cmath>
#include <cstdio>

using namespace std;

bool com(pair<pair<string, int>, int> a, pair<pair<string, int>, int> b) {
	if (a.first.first != b.first.first) return a.first.first < b.first.first;
	else return a.first.second > b.first.second;
}

int main() {
	int n; cin >> n;
	vector <pair<pair<string,int>,int> > sp(n);
	for (int i = 0; i < n; ++i) {
		cin >> sp[i].first.first >> sp[i].first.second;
		sp[i].second = i + 1;
	}
	sort(sp.begin(), sp.end(), com);
	for (int i = 0; i < n; ++i) cout << sp[i].second << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            MyInputStream cin = new MyInputStream();

            var n = cin.ReadInt();
            var l = cin.ReadInt();

            var str = new List<string>(n);
            for (var i = 0; i < n; ++i)
                str.Add(ReadLine());

            var ans = str.OrderBy(s => s).Aggregate((acc, next) => acc + next);
            WriteLine(ans);
        }
    }

    public static class MyExtensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
    }

    public class Pair<T1, T2>
    {
        public T1 First;
        public T2 Second;
        public Pair() { First = default(T1); Second = default(T2); }
        public Pair(T1 f, T2 s) { First = f; Second = s; }
        public override string ToString() { return "(" + First + ", " + Second + ")"; }
        public override int GetHashCode() { return First.GetHashCode() ^ Second.GetHashCode(); }
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj)) return true;
            else if (obj == null) return false;
            var tmp = obj as Pair<T1, T2>;
            return (object)tmp != null && First.Equals(tmp.First) && Second.Equals(tmp.Second);
        }
    }

    #region HashMap
    public class HashMap<K, V> : Dictionary<K, V>
    {
        public HashMap() : base() { }
        public HashMap(int cap) : base(cap) { }
        public HashMap(IDictionary<K, V> dictionary) : base(dictionary) { }
        new public V this[K i]
        {
            get
            {
                V v;
                return TryGetValue(i, out v) ? v : base[i] = default(V);
            }
            set { base[i] = value; }
        }
    }
    #endregion
}


Measured memory_bytes: 12128
#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 <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#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
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

int main()
{
    ll N;
    cin >> N;

    string S;
    int a,j=0;

    for (ll i = 1; i <= N; ++i) {
        S = to_string(i);
        a = S.size();
        if (a % 2 == 1) { ++j; }
    }
    cout << j << endl;
}

Measured memory_bytes: 256
main = do
  q <- readLn :: IO Int
  ab <- getContents >>= return . map (map read . words) . lines :: IO [[Integer]]

  
  mapM_ print $ map (\(a:b:_) -> 2 * (sqrt' (a*b)) - (if isSq (a*b) then 2 else 1) + (if a==b then 1 else 0) - 1 + (if sqrt' (a*b) * (sqrt' (a*b) + 1) < a*b then 1 else 0)) ab
 
  where
    sqrt' :: Integer -> Integer
    sqrt' n = floor $ sqrt (fromIntegral n)

    isSq n = (sqrt' n) ^ 2 == n


Measured memory_bytes: 1020
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>

//     MLE,TLE魔
//↓↓↓↓↓↓↓↓↓↓↓↓
#define int long long
//↑↑↑↑↑↑↑↑↑↑↑↑
//     MLE,TLE魔
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 5000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
map<int, int>factor(int x) {
	map<int, int>res;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1)res[x]++;
	return res;
}
/*--------Library Zone!--------*/


signed main() {
	string s;
	cin >> s;
	if (s.substr(0, 4) < "2019") {
		cout << "Heisei" << endl;
		endre;
	}
	else if (s.substr(0, 4) > "2019") {
		cout << "TBD" << endl;
		endre;
	}
	else {
		if (s.substr(5, 2) <= "04") {
			cout << "Heisei" << endl;
		}
		else {
			cout << "TBD" << endl;
		}
	}
	endre;
}

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

using namespace std;

int main() {
  int c1, c5, c10, c50, c100, c500;
  cin >> c1>> c5>> c10>> c50>> c100>> c500;
  cout << ( c1 +  c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500 >= 1000 )  << endl;

  return EXIT_SUCCESS;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdio>

using namespace std;

class Point3D{
public:
  double x, y, z;
  Point3D(){}
  Point3D(double x, double y, double z): x(x), y(y), z(z) {}
  Point3D operator +(const Point3D &a) const { return Point3D(x+a.x, y+a.y, z+a.z); }
  Point3D operator -(const Point3D &a) const { return Point3D(x-a.x, y-a.y, z-a.z); }
  Point3D operator *(const double a) const { return Point3D(a*x, a*y, a*z); }
  bool operator < (const Point3D &a) const {
    if(x != a.x) return x < a.x;
    if(y != a.y) return y < a.y;
    return z < a.z;
  }
};

struct Segment { Point3D p1, p2; };
typedef Segment Line;

double dot(const Point3D &a, const Point3D &b){ return a.x * b.x + a.y * b.y + a.z * b.z; }
double norm(const Point3D &a) { return dot(a, a); }
double abs(const Point3D &a) { return sqrt(norm(a)); }
Point3D projection(const Segment &s, const Point3D &p){
  Point3D t = s.p2 - s.p1;
  return s.p1 + t * (dot(p - s.p1, t) / norm(t));
}

Point3D reflection(const Segment &s, const Point3D &p){
  return p + (projection(s, p) - p) * 2.0;
}

double distanceLP(const Line &l, const Point3D &p){
  return abs(p - projection(l, p));
}

class Circle{
public:
  Point3D p;
  double r;
  Circle(){}
  Circle(Point3D p, double r): p(p), r(r) {}
};

int n;
Point3D dir;
vector<Circle> data;

const double INF = 1e77;
const double EPS = 1e-8;

Point3D solve(){
  Point3D last = Point3D(0, 0, 0);
  while(1){
    double valm = INF;
    int id = -1;
    for(int i=0;i<n;i++){
      Line line = (Segment){last, dir};
      if(distanceLP(line, data[i].p) >= data[i].r) continue;
      double l = 0, mid;
      double r = dot(data[i].p - line.p1, line.p2 - line.p1) / norm(line.p2 - line.p1);
      while(abs(l-r) > EPS){
        mid = (l + r) / 2.0;
        if(abs(line.p1 + (line.p2 - line.p1) * mid - data[i].p) < data[i].r) r = mid;
        else l = mid;
      }
      if(l < EPS) continue;
      if(valm > mid) valm = mid, id = i;
    }
    if(id == -1) break;
    Point3D np = last + (dir - last) * valm;
    Point3D nd = reflection((Segment){data[id].p, np}, last);
    last = np;
    dir = nd;
  }
  return last;
}

void init(){
  data.clear();
}

main(){
  while(cin >> n && n){
    cin >> dir.x >> dir.y >> dir.z;
    init();
    for(int i=0;i<n;i++){
      Circle in;
      cin >> in.p.x >> in.p.y >> in.p.z >> in.r;
      data.push_back(in);
    }
    Point3D ans = solve();
    printf("%.4f %.4f %.4f\n", ans.x, ans.y, ans.z);
  }
}

Measured memory_bytes: 1256