akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());

        double ans = n * Math.PI * 2;

        ans = Math.Truncate(ans * 1000) / 1000;

        Console.WriteLine(ans);
    }
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

ll N;
ll A[1001][1001];
ll dayidxs[1001];

int main(){
	cin >> N;
	rep(i, N) rep(j, N - 1) {
		cin >> A[i][j];
		A[i][j]--;
	}


	for(ll day = 0; day >= 0; day++) {
		set<ll> done;

		bool has = false;
		bool change = false;
		rep(zibun, N) {
			ll dayidx = dayidxs[zibun];
			if(dayidx >= N-1) continue;
			has = true;
			if(done.count(zibun) > 0) continue;

			ll teki = A[zibun][dayidx];
			if(dayidxs[teki] < N - 1 && A[teki][dayidxs[teki]] == zibun && done.count(teki) == 0) {
				change = true;
				done.insert(zibun);
				done.insert(teki);
				dayidxs[zibun]++;
				dayidxs[teki]++;
			}
		}

		if(!has) {
			cout <<  day << endl;
			return 0;
		}
		if(!change) {
			cout <<  -1 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 11476
#include <iostream>

int main() {
	int n, m, k;
	std::cin >> n >> m >> k;

	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= m; ++j) {
			if (m * i + n * j - i * j * 2 == k) {
				std::cout << "Yes" << std::endl;
				return 0;
			}
		}
	}

	std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

using ll = long long;

ll MOD = 998244353;

ll n, a, b, k;
ll fac[3 * (int)1e5 + 1], rfac[3 * (int)1e5 + 1];

ll binpow(ll x, ll p) {
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 1) {
        ll b = binpow(x, p - 1) * x;
        if (b > MOD) {
            b %= MOD;
        }
        return b;
    } else {
        ll b = binpow(x, p / 2);
        if (b > MOD) {
            b %= MOD;
        }
        return b * b % MOD;
    }
}

int main() {
    cin >> n >> a >> b >> k;

    fac[0] = 1;
    rfac[0] = 1;
    for (ll i = 1; i <= n; i++) {
        fac[i] = fac[i - 1] * i;
        if (fac[i] > MOD) {
            fac[i] %= MOD;
        }
        rfac[i] = binpow(fac[i], MOD - 2) % MOD;
    }

    ll ans = 0, sqn = fac[n] * fac[n] % MOD;
    for (ll x = 0; x <= n; x++) {
        if (k < a * x) {
            break;
        }

        ll r = k - x * a;
        if (r % b == 0) {
            ll y = r / b;
            if (y > n) {
                continue;
            }

            ans += (((sqn *
                    rfac[x] % MOD) *
                    rfac[n - x] % MOD) *
                    rfac[y] % MOD) *
                    rfac[n - y] % MOD;
            if (ans > MOD) {
                ans %= MOD;
            }
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 4992
import sys
input = sys.stdin.readline

N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()

answer = 0
first = -K
rest = C
for t in T:
    if first + K >= t and rest > 0:
        # 乗れる
        rest -= 1
        continue
    # 乗れない
    answer += 1
    first = t
    rest = C-1

print(answer)

Measured memory_bytes: 7384
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    string s;
    cin >> s;
    int N = s.size();
    ll MOD = 1000000007;

    vector<vector<ll>> dp(N + 10, vector<ll>(13, 0));
    dp[0][0] = 1;
    for (int i = 0; i < N; i++) {
        rep(j, 13) {
            if (s[i] == '?') {
                rep(k, 10) {
                    dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
                    dp[i + 1][(j * 10 + k) % 13] %= MOD;
                }
            } else {
                ll num = (s[i] - '0');
                dp[i + 1][(j * 10 + num) % 13] += dp[i][j];
                dp[i + 1][(j * 10 + num) % 13] %= MOD;
            }
        }
    }

    cout << dp[N][5] << endl;
}

Measured memory_bytes: 13696
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
import math
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))

def SUM(x):return sum([abs(x) for x in a ])



sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n = INT()

a = LIST()

ct = 0

p=[]

for i, x in enumerate(a):
    if x < 0:
        ct +=1
        p.append([i, x])
    elif x == 0:
        ct = 0
        p.clear()


saidai = SUM(a)
a_abs = [abs(x) for x in a]

if ct % 2 == 0:
    print(saidai)
else:
    a_min = min(a_abs)
    print(saidai-2*a_min)

    
    

Measured memory_bytes: 25624
#include <iostream>
#include <array>

int main() {
  int a,b;
  while(std::cin >> a >> b){
    if(a!=0&&b!=0){
      int c;
      std::cin >> c;
      int town[a+1][b+1]={};
      int x,y;
      for(int n=0;n<c;++n){
        std::cin >> x >> y;
        town[x][y]=-1;
      }
      town[1][1]=1;
      for(int sum=3;sum<=a+b;++sum){
        for(int t=std::min(sum-1,a);t>0 &&sum-t<=b;--t){
          //if(sum-t<=b){
          	//std::cout << t;
            if(town[t][sum-t]==-1){
              town[t][sum-t]=0;
            }else{
              town[t][sum-t] = town[t-1][sum-t]+town[t][sum-t-1];
            }
          //}
        }
      }
      std::cout << town[a][b] << std::endl;
    }else{
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3008
(let* ((a (read))
    (b (read))
    (c (parse-integer (format Nil "~D~D" a b)))
    (ans "No"))

    (loop for i from 1 to c do
        (if (= (* i i) c)
        (progn
            (setq ans "Yes")
            (return)
        )
        )
    )
    (princ ans)
)

Measured memory_bytes: 24440
from itertools import combinations
n, k = [int(item) for item in input().split()]
if k > (n - 1) * (n - 2) // 2:
    print(-1)
    exit()

edges = []
for i in range(2, n+1):
    edges.append([1, i])
pairs = (n - 1) * (n - 2) // 2

for i, comb in enumerate(combinations([item for item in range(2, n+1)], 2)):
    if pairs == k:
        break
    else:
        edges.append([comb[0], comb[1]])
        pairs -= 1

print(len(edges))
for first, second in edges:
    print(first, second)

Measured memory_bytes: 4120
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define db double
#define pb push_back
#define wrln cout<<'\n';
#define pii pair<int,int>
using namespace std;

const int H=1e9+7;
const int N=2e5+100;

ll x[N],y[N],n,res,d[6];
ll xz[6],yz[6];

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

 /*   freopen("test12.inp","r",stdin);
    freopen("test.out","w",stdout);*/

    d[1]=d[2]=d[3]=d[4]=LLONG_MIN;
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>x[i]>>y[i];
        if (d[1]<x[i]+y[i])
        {
            d[1]=x[i]+y[i];
            xz[1]=x[i];
            yz[1]=y[i];
        }
        if (d[2]<x[i]-y[i])
        {
            d[2]=x[i]-y[i];
            xz[2]=x[i];
            yz[2]=y[i];
        }
        if (d[3]<-x[i]+y[i])
        {
            d[3]=-x[i]+y[i];
            xz[3]=x[i];
            yz[3]=y[i];
        }
        if (d[4]<-x[i]-y[i])
        {
            d[4]=-x[i]-y[i];
            xz[4]=x[i];
            yz[4]=y[i];
        }
    }
    for (int i=1; i<=4; i++)
    {
        for (int j=1; j<=n; j++)
        {
            res=max(res,abs(x[j]-xz[i]) + abs( y[j]-yz[i]) );
        }
    }
    cout<<res;
}


Measured memory_bytes: 6744
#include <bits/stdc++.h>
#define LIM 1<<17
/// TONI BO$$ was here
/// #MLC

using namespace std;
char BUF[LIM];
int poz;

inline char getChar(){
    poz++;
    if(poz>=LIM){
    	fread(BUF,LIM,1,stdin);
    	poz=0;
    }
    return BUF[poz];
}

inline int getNr(){
    int r=0, semn=1;
    char ch=getChar();
    while(isdigit(ch)==0 && ch!='-') ch=getChar();
    if(ch=='-'){
        semn=-1;
        ch=getChar();
    }
    while(isdigit(ch)!=0){
        r=r*10+semn*(ch-'0');
        ch=getChar();
    }
    return r;
}

int main()
{
    int x,y;
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d",&x,&y);
    printf("%d",x+y/2);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int K = sc.nextInt();

    int maxNum = Math.max( Math.max( A,B) , C );
    int reminder = A + B + C - maxNum ;

    for(int i =  0 ; i < K ;i ++){
      maxNum = maxNum * 2;
    }

    System.out.println( maxNum + reminder );

  }
}


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

int main()
{
	int n;
	cin >> n;
	bool ans = false;
	for(auto i = 0; i <= n; i += 7){
		if((n - i) % 4 == 0){
			ans = true;
			break;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int gdc (int m, int n)
{
    if(n==0)
    {
        return m;
    }
    return gdc(n,m%n);
}
int main()
{
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  int a,b,c,i,j,k;
  long long s=0;
  for(i=1;i<=n;i++)
  {
      for(j=1;j<=n;j++)
      {
          for(k=1;k<=n;k++)
          {
              a=gdc(i,j);
              b=gdc(k,a);
              s=s+b;
          }
      }
  }
  cout<<s<<endl;
return 0;
}


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

int main(void){
    
    int N,M,C,count=0;
    cin >> N >> M >> C;
    vector<int> B{};
    
    for(int i=0;i<M;i++){
        int b_i;
        cin >> b_i;
        B.push_back(b_i);
    }
    
    
    for(int i=0;i<N;i++){
        int sum = 0;
        for(int j=0;j<M;j++){
            int a_i;
            cin >> a_i;
            sum += (B.at(j)*a_i);
        }
        if(sum + C > 0) count++;
    }
    
    
    cout << count << endl;
    
}

Measured memory_bytes: 3604
// finish date: 2018/08/19
#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)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>>
        vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    vvi V(N, vi(N, 0));
    rep(i, M) {
        int L, R;
        cin >> L >> R;
        L--, R--;
        V[L][R]++;
    }
    rep(i, N) FOR(j, 1, N) V[i][j] += V[i][j - 1];
    rep(i, Q) {
        int p, q;
        cin >> p >> q;
        p--, q--;
        int cnt = 0;
        FOR(j, p, q + 1) {
            cnt += V[j][q];
        }
        cout << cnt <<  endl;
    }

    return 0;
}



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

int main(){
    int n,s=0,max=0;
     cin>>n;
    char arr[100];
    for(int i=0;i<n;i++){
        cin>>arr[i];
        if(arr[i]=='I')
            s++;
        else s--;
        if(s>=max)
            max=s;
    }

cout<<max;
 return 0;
}


Measured memory_bytes: 3624
// https://beta.atcoder.jp/contests/abc067

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

int main() {
    string s;
    cin >> s;
    map<char, int> count_map;
    for (char c : s) count_map[c]++;

    int len = s.length();
    int ans;
    for (int back = 1; back < len; ++back) {
        if ((len - back) % 2 != 0) continue;
        int half = (len - back) / 2;

        bool ok = true;
        for (int i = 0; i < half; ++i) {
            if (s[i] != s[half + i]) ok = false;
        }

        if (ok) {
            ans = len - back;
            break;
        };
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 500;
int n;
string s, t;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> s >> t;
  FOR(i, 0, n) cout << s[i] << t[i];
  cout << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
	int n;
	int x = 0;
	int max = 0;
	char s[100];
	
	scanf("%d",&n);
	scanf("%s",s);
	
	for(int i=0;i<n;i++){
		if(s[i] == 'I'){
			x++;
		}else if(s[i] == 'D'){
			x--;
		}
		if(max<x){
			max = x;
		}
	}
	
	printf("%d\n",max);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

ll G[606][606];

int main(){
    ll n,m; cin >> n >> m;
    rep(i,m){
        ll s,t; cin >> s >> t; s--; t--;
        G[s][t] = 1;
    }
    vl id(n,-1);
    vd dp(n,0.0);
    for(ll i=n-2; i>=0; i--){
        double mx = 0.0;
        double sum = 0.0;
        ll num = 0;
        ll mxid = -1;
        rep(j,n){
            if(G[i][j]){
                if(chmax(mx,dp[j] + 1.0)){
                    mxid = j;
                }
                sum += dp[j] + 1.0;
                num++;
            }
        }
        dp[i] = sum / (double)num;
        if(num > 1) id[i] = mxid;
    }
    double ans = dp[0];
    rep(i,n-1){
        if(id[i] == -1) continue;
        rep(j,n) dp[j] = 0.0;
        for(ll j=n-2; j>=0; j--){
            double sum = 0.0;
            ll num = 0;
            rep(k,n){
                if(i==j && k==id[j]) continue;
                if(G[j][k]){
                    sum += dp[k] + 1.0;
                    num++;
                }
            }
            dp[j] += sum / (double)num;
        }
        chmin(ans, dp[0]);
    }
    printf("%.10f\n",ans);
}

Measured memory_bytes: 3072
#include<stdio.h>
#define MAX 200000
int vector[MAX];
int last=0;
void pushBack(int);
int randomAccess(int);
void popBack(void);
int main(void)
{
  int i,q,x1,x2;
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&x1);
      switch(x1)
        {
        case 0:
          scanf("%d",&x2);
          pushBack(x2);
          break;
        case 1:
          scanf("%d",&x2);
          printf("%d\n",randomAccess(x2));
          break;
        case 2:
          popBack();
          break;
        }
    }
  return 0;
}
void pushBack(int x)
{
  vector[last]=x;
  last++;
}
int randomAccess(int p)
{
  return vector[p];
}
void popBack(void)
{
  last--;
}


Measured memory_bytes: 2488
n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]

DP = [[0] * 3 for i in range(n+1)]

for i in range(n):
    for j in range(3):
        DP[i+1][j] = max(DP[i][k] + A[i][j] for k in range(3) if j != k)

print(max(DP[n]))

Measured memory_bytes: 44108
from heapq import heapify, heappop, heappush
from collections import deque

n,k = map(int, input().split())
dtl = []
# t_dmax = [-1]*(n+1)
for _ in range(n):
    t,d = map(int, input().split())
    dtl.append((d,t))


dtl.sort(reverse=True)
dtq = deque(dtl)

dt_remq = deque([])
already_t = [False]*(n+1)
tll = [ [] for _ in range(n+1)]
cnt = 0
oisi = 0
kl = []
while dtq:
    d,t = dtq.popleft()
    if k <= cnt or already_t[t]: 
        dt_remq.append((d,t))
    else:
        already_t[t] = True
        kl.append((d,t))
        tll[t].append(d)
        cnt += 1
        oisi += d


rem = k-cnt
# if rem == 0:
#     ans = oisi + k*k
#     print(ans)
#     exit()

more_twos = []
for _ in range(rem):
    d,t = dt_remq.popleft()
    tll[t].append(d)
    oisi += d

ones = []
for tl in tll:
    if len(tl) == 1: ones.append(tl[0])

ones.sort()
onesq = deque(ones)

cuur_v = oisi + cnt*cnt
# print(cuur_v)
# print(kl,cnt)
while dt_remq and onesq:
    d,t = dt_remq.popleft()
    oisi_diff = d-onesq[0]
    bonus_diff = cnt*cnt-(cnt-1)*(cnt-1)
    if oisi_diff > bonus_diff:
        cuur_v += (oisi_diff-bonus_diff)
        cnt -= 1
        onesq.popleft()
    else:
        break

print(cuur_v)

Measured memory_bytes: 101388
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;



int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    set<int> a;
    int e;
    cin >> e;
    a.insert(e);
    cin >> e;
    a.insert(e);
    cin >> e;
    a.insert(e);
    cout << (a.size() == 2 ? "Yes" : "No");
    

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cstring>
using namespace std;
#define REP(i,n) for (int i=0;i<(int)n; ++i)

string s;
int memo[2000][2000];
bool memo2[2000][2000];
int memo3[2000][2000];

int rec(int l, int r) {
  if (l>r) return 0; 
  if (memo2[l][r]) return memo[l][r];
  memo2[l][r] = 1;
  if (s[l] == s[r]) {
    memo3[l][r] = 0;
    if (l==r)
      return memo[l][r] = rec(l+1,r-1) + 1;
    else
      return memo[l][r] = rec(l+1,r-1) + 2;
  } else {
    int tmp1 = rec(l+1, r);
    int tmp2 = rec(l, r-1);

    if (tmp1<tmp2) {
      memo3[l][r] = 1;
      return memo[l][r] = tmp2;
    } else {
      memo3[l][r] = -1;
      return memo[l][r] = tmp1;  
    }
  }
}


int main() {
  while(cin >> s) {
    memset(memo2,0,sizeof(memo2));
    rec(0, s.size()-1);

    string res;
    bool f = 0;
    for (int l=0, r=s.size()-1; l<=r;) {
      if (memo3[l][r]>0) r--;
      else if (memo3[l][r]<0) l++;
      else {
        if (l==r) f = 1;
        res += string(1,s[l]);
        r--;l++;
      }
    }
    string res2 = res;
    reverse(res2.begin(), res2.end());
    

    if (f) {
       res2.erase(res2.begin());
    }
     cout << res << res2 << endl;
  }
         
}

Measured memory_bytes: 30000
package main

import (
	"container/list"
	"fmt"
)

var G [][]int
var numBride int
var visited []int

func dfs() {
	s := list.New()
	s.PushFront(0)
	visited[0] = 1

	for s.Len() > 0 {
		n := s.Remove(s.Front()).(int)
		for i, e := range G[n] {
			if e == 1 && visited[i] == 0 {
				visited[i] = 1
				s.PushFront(i)
			}
		}
	}
}

func allVisted(visited []int) bool {
	for _, v := range visited {
		if v == 0 {
			return false
		}
	}
	return true
}

func checkBridge() bool {
	visited = make([]int, len(G))
	dfs()
	return !allVisted(visited)
}

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	G = make([][]int, N)
	visited = make([]int, N)
	for i := 0; i < N; i++ {
		G[i] = make([]int, N)
	}

	var a, b int
	edges := make([][]int, M)
	for i := 0; i < M; i++ {
		fmt.Scanf("%d %d", &a, &b)
		edges[i] = []int{a - 1, b - 1}
		G[a-1][b-1] = 1
		G[b-1][a-1] = 1
	}

	ans := 0
	for _, e := range edges {
		// delete edge
		G[e[0]][e[1]] = 0
		G[e[1]][e[0]] = 0

		if checkBridge() {
			ans++
		}

		// repaire edge
		G[e[0]][e[1]] = 1
		G[e[1]][e[0]] = 1
	}
	fmt.Println(ans)
}


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

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    for(int i = 0; i < n; i++){
        cin >> x[i];
        y[i] = x[i];
    }
    sort(x.begin(), x.end());
    for(int i = 0; i < n; i++){
        auto itr = lower_bound(x.begin(), x.end(), y[i]);
        //cout << "y: " << y[i] << endl;
        //cout << "itr: " << itr-x.begin() << endl;
        if(itr-x.begin() <= n/2){
            if(itr-x.begin() == n/2){
                cout << x[n/2-1] << endl;
            }else{
                cout << x[n/2] << endl;
            }
        }else{
            cout << x[n/2-1] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4812
#include <stdio.h>

int main(){
  int num,sum,n,i;

  while(1){
    scanf("%d",&n);
    if(n==0) break;

    for(i=0,sum=0;i<(n/4);i++){
      scanf("%d",&num);
      sum+=num;
    }
    printf("%d\n",sum);
  }

  return 0;
}

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

int main() {
  string c1, c2;
  cin >> c1 >> c2;
  bool is_rotate = true;
  for (int i=0; i<c1.size(); i++)
    if (c1.at(i) != c2.at(c2.size()-i-1)) {
      is_rotate = false;
      break;
    }
  if (is_rotate) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    char n[4];
    scanf("%s",n);
    for(int i = 0; i < 3; i++){
        if(n[i] == '1'){
            n[i] = '9';
        }else if(n[i] == '9'){
            n[i] = '1';
        }
    }

    printf("%s\n",n);

    return 0;
}

Measured memory_bytes: 128
A,B = map (int, input ().split ())
if B < 10:
  X = A*10+B
elif B < 100:
  X = A*100+B
else:
  X = A*1000+B
o = 1
p = 'No'
while o**2 <= X:
  if o**2 == X:
    p = 'Yes'
    break
  o += 1
print (p)
    

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

int main(){
    ll A,B,N; cin >> A >> B >> N;
    ll x = N;
    x = min(B-1,x);
    cout << floor(A*x/B) << endl;
}

Measured memory_bytes: 3760
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX/2+2],R[MAX/2+2];

void merge(struct Card A[],int n,int left,int mid,int right){
	int i,j,k;
	int n1=mid-left;
	int n2=right-mid;
	for(i=0;i<n1;i++){
		L[i]=A[left+i];
	}
	for(i=0;i<n2;i++){
		R[i]=A[mid+i];
	}
	L[n1].value=R[n2].value=SENTINEL;
	i=j=0;
	for(k=left;k<right;k++){
		if(L[i].value<=R[j].value){
			A[k]=L[i++];
		}else{
			A[k]=R[j++];
		}
	}
}

void mergeSort(struct Card A[],int n,int left,int right){
	if(left+1<right){
		int mid=(left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}

int partition(struct Card A[],int n,int p,int r){
	int i,j;
	struct Card t,x;
	x=A[r];
	i=p-1;
	for(j=p;j<r;j++){
		if(A[j].value<=x.value){
			i++;
			t=A[i];
			A[i]=A[j];
			A[j]=t;
		}
	}
	t=A[i+1];
	A[i+1]=A[r];
	A[r]=t;
	return i+1;
}

void quickSort(struct Card A[],int n,int p,int r){
	int q;
	if(p<r){
		q=partition(A,n,p,r);
		quickSort(A,n,p,q-1);
		quickSort(A,n,q+1,r);
	}
}

int main(){
	int n,i,v;
	struct Card A[MAX],B[MAX];
	char S[10];
	int stable=1;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%s %d",S,&v);
		A[i].suit=S[0];
		B[i].suit=S[0];
		A[i].value=v;
		B[i].value=v;
	}
	
	mergeSort(A,n,0,n);
	quickSort(B,n,0,n-1);
	
	for(i=0;i<n;i++){
		if(A[i].suit!=B[i].suit){
			stable=0;
		}
	}
	
	if(stable==1){
		printf("Stable\n");
	}else{
		printf("Not stable\n");
	}
	for(i=0;i<n;i++){
		printf("%c %d\n",B[i].suit,B[i].value);
	}
	return 0;
}


Measured memory_bytes: 4036
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> A,B;
void input(){
    fast_io();
    cin >> N;
    A = fetch_vec<ll>(N);
    B = fetch_vec<ll>(N);
}
#define YES do{cout <<"Yes" << endl;return 0;}while(false);
#define NO do{cout <<"No" << endl;return 0;}while(false);

int solve(){
    if(A==B) YES
    ll as = accumulate(A.begin(),A.end(),0LL);
    ll bs = accumulate(B.begin(),B.end(),0LL);
    if(as>=bs) NO //あきらかNO.Aが増え続ける。
    ll diff = bs-as; //操作回数
    ll diff_A=0; //AをBに一致させるのに必要な操作回数
    ll diff_b=0; //BをAに一致させるのに必要な操作回数
    for (int i = 0; i < N; i++)
    {
        if(B[i]<A[i]) diff_b+=(A[i]-B[i]);
        else diff_A +=(B[i]-A[i])/2;
    }
    // if(diff_b>diff) NO
    // if(diff_A<diff_b) NO
    // YES
    // 定義より diff_A <= diffだから条件は以下の式だけでいい。嫌、ウソや。
    // if(diff_b<=diff_A) YES
    if(diff_b<=diff && diff_b<=diff_A) YES 
    else NO
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

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

int A, B, C;

void solve(){
    if(A == B && A != C) {
        cout << "Yes";
        return;
    }
    if(B == C && B != A) {
        cout << "Yes";
        return;
    }
    if(C == A && C != B) {
        cout << "Yes";
        return;
    }
    cout << "No";
}
int main(){
    cin >> A >> B >> C;
    solve();
    return 0;
}

Measured memory_bytes: 256
use std::cmp::min;
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()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let s = read::<String>();
    let master = "keyence".to_string();
    for j in 0..s.len() {
        for k in j..s.len() {
            let a = &s[0..j];
            let b = &s[k..s.len()];
            if master == format!("{}{}",a,b) {
                println!("YES");
                return;
            }
        }
    }
    println!("NO");
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please


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

	int N, M;
	cin >> N >> M;

	int saidai = sqrt(M);

	int kotae = 1;
	for (int i = 1; i < saidai + 1; i++) {
		if (M % i == 0) {
			if (M >= 1ll * N * i) kotae = max(kotae, i);
			if (M >= 1ll * N * (M / i)) kotae = max(kotae, (M / i));
		}
	}
	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int t=s.size();
  sort(s.begin(),s.end());
  s.erase(unique(s.begin(),s.end()),s.end());
  if(s.size()==t)cout<<"yes"<<endl;
  else cout<<"no"<<endl;
  return(0);
}


Measured memory_bytes: 256
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
   string S,T;
   cin>>S>>T;


   int N=3;
   int D;
   D=0;
   for(int i=0;N>i;i++){
       if(S[i]==T[i]){
           D=D+1;

       }
       else{
           D=D+0;
       }
   }
   cout<<D<<endl;
}

Measured memory_bytes: 256
#include<functional>
#include <algorithm>
#include  <iostream>
#include   <ctype.h>
#include   <cstring>
#include   <fstream>
#include    <cstdio>
#include    <vector>
#include    <string>
#include     <cmath>
#include     <deque>
#include     <stack>
#include     <queue>
#include      <list>
#include       <set>
#include       <map>
#define INF 0X7FFFFFFF
#define PI acos(-1.0)
typedef long long ll;
using namespace std;
const int mod = 1e9 + 7;
inline int getint()
{
	int w = 0, q = 0;
	char c = getchar();
	while ((c<'0' || c>'9') && c != '-') c = getchar();
	if (c == '-') q = 1, c = getchar();
	while (c >= '0'&&c <= '9') w = w * 10 + c - '0', c = getchar();
	return q ? -w : w;
}
int n;
ll a[100005];
char c[100005];
int main() {
	n = getint();
	int i = 0;
	ll ans = 0;
	ll sum = 0;
	while (i < n) {
		a[i] = getint();
		sum += a[i];
		if (i != 0 && c[i - 1] == '-') {
			ans -= a[i];
		}
		else {
			ans += a[i];
		}
		if (i == n - 1) {
			break;
		}
		c[i] = getchar();
		i++;
	}
	int flag = 1;
	ll t = ans;
	ll m = sum;
	for (int i = 0; i < n - 1; i++) {
		if (c[i] == '-') {
			sum = m;
			m -= a[i + 1] * 2;
			sum -= a[i + 1] * 2;
			int j = i + 1;
			while (j < n) {
				if (c[j] == '+') {
					sum -= a[j + 1] * 2;
					j++;
				}
				else {
					break;
				}
			}
			t = max(t, sum);
		}
	}
	ans = max(t, ans);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
int main(void){
	int i,j,k,H[300],W[300];
	for(i=0;;i++){
		scanf("%d %d",&H[i],&W[i]);
		if(H[i]==0&&W[i]==0){
			break;
		}
	}
	for(i=0;H[i]!=0||W[i]!=0;i++){
		for(j=0;j<H[i];j++){
			for(k=0;k<W[i];k++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

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

  int n; cin >> n;
  string s;
  ll cnt[5] = {};
  rep(i, n) {
    cin >> s;
    if(s[0] == 'M') cnt[0]++;
    if(s[0] == 'A') cnt[1]++;
    if(s[0] == 'R') cnt[2]++;
    if(s[0] == 'C') cnt[3]++;
    if(s[0] == 'H') cnt[4]++;
  }

  ll ans = 0;
  rep(i, 5) {
    for(int j = i+1; j < 5; j++) {
      for(int k = j+1; k < 5; k++) {
        ans += cnt[i]*cnt[j]*cnt[k];
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


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

ans = sum(b)
for i in range(n-1):
    if a[i] + 1 == a[i + 1]:
        ans += c[a[i]-1]

print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int k = std.nextInt();
        int count = 0;
        for (int i = 0; i < n; i++) {
            int h = std.nextInt();
            if (h - k >= 0) {
                count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 46604
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back

void setIO(string s) 
{
	//ios_base::sync_with_stdio(0); cin.tie(0); 

	//freopen((s+".in").c_str(),"r",stdin);
	//freopen((s+".out").c_str(),"w",stdout);
}
int n, d;
int cnt;
void solve()
{
    scanf("%lld%lld", &n, &d);
    while(n--)
    {
        int x, y; scanf("%lld%lld", &x, &y);
        if (x*x+y*y <= d*d)++cnt;
    }
    printf("%lld\n", cnt);
}
signed main(void)
{
    //setIO("exercise");
    int T = 1; //scanf("%lld", &T);
    while(T--) solve();
    return 0;
}

Measured memory_bytes: 3856
// Code by H~$~C
#include <bits/stdc++.h>
using namespace std;

static const int Maxn = 200005;
static const int mod = 998244353;

inline void inc(int &x, int y) {
  (x += y) >= mod && (x -= mod);
}

int n, ans, sum, c;
char str[Maxn];
int a[Maxn];
int dp[Maxn][3][3][2];
// , sum mod 3, the last position, has there a equal pair adjacently

namespace solve_3 {

bool vis[3][3][3];

void dfs(int a, int b, int c) {
  if (vis[a][b][c]) return ;
  vis[a][b][c] = true;
  ans++;
  if (a != b) dfs(3 - a - b, 3 - a - b, c);
  if (b != c) dfs(a, 3 - b - c, 3 - b - c);
}

int main() {
  memset(vis, false, sizeof(vis));
  ans = 0;
  dfs(a[1], a[2], a[3]);
  printf("%d\n", ans);
  return 0;
}

}

int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (int i = 1; i <= n; ++i) {
    a[i] = str[i] - 'a';
    sum += a[i];
  }
  sum %= 3;
  c = 0;
  for (int i = 1; i < n; ++i) {
    c += (a[i] == a[i + 1]);
  }
  if (c == n - 1) {
    puts("1");
    return 0;
  }
  
  if (n == 2) {
    puts("2");
    return 0;
  }
  if (n == 3) {
    solve_3::main();
    return 0;
  }
  
  for (int i = 0; i < 3; ++i) {
    dp[1][i][i][0] = 1;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        for (int b = 0; b < 2; ++b) {
          for (int l = 0; l < 3; ++l) {
            inc(dp[i + 1][(j + l) % 3][l][b | (l == k)], dp[i][j][k][b]);
          }
        }
      }
    }
  }
  for (int k = 0; k < 3; ++k) {
    inc(ans, dp[n][sum][k][1]);
  }
  if (c == 0) {
    inc(ans, 1);
  }
  printf("%d\n", ans);
  return 0;
}


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

 int N, Q;
 vector<vector<int>> tree(200010);
 vector<int> ans(200010, 0);
 vector<bool> done(200010, false);

 void add(int v, int pv) {
   done.at(v) = true;
   if (v != 0) ans.at(v) += ans.at(pv);
   for (int nv : tree.at(v)) {
       if (!done.at(nv)) add(nv, v);
   }
 }

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

   rep(i, 0, N - 1) {
     int a, b;
     cin >> a >> b;
     a--;
     b--;
     tree.at(a).push_back(b);
     tree.at(b).push_back(a);
   }

   rep(i, 0, Q) {
     int P, X;
     cin >> P >> X;
     P--;
     ans.at(P) += X;
   }

   add(0, 0);

   rep(i, 0, N - 1) cout << ans.at(i) << " ";
   cout << ans.at(N - 1) << endl;
 }


Measured memory_bytes: 23552
#import sys
#input = sys.stdin.readline

n,m = map(int, input().split( ))
p = [[] for _ in range(n+1)] #[[]]*(n+1)ってなんぞ
Ip = [0]*(m+1)
Ix = [0]*(m+1)
for i in range(m):
    pi,yi = map(int, input().split( ))
    p[pi].append((yi,i))
#print(p)
for i in range(n+1):
    p[i].sort()

for pi in range(n+1):
    if p[pi]:
        for k,(yj,j) in enumerate(p[pi]):
            Ip[j] = pi
            Ix[j] = k+1

for i in range(m):
    if Ip[i]:
        print(str(Ip[i]).zfill(6)+str(Ix[i]).zfill(6))


Measured memory_bytes: 65440
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) v.begin(),v.end()
#define fi first
#define se second
const int inf = 1e9;

signed main(){
	char a, b;
	scanf("%c %c", &a, &b);
	if(a == 'H')printf("%c\n", b);
	else printf("%c\n", b == 'H' ? 'D' : 'H');
	return 0;
}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

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

int main() {

	lint a, b, c, d;
	cin >> a >> b >> c >> d;

	lint ans = -LINF;
	chmax(ans, a * c);
	chmax(ans, b * c);
	chmax(ans, b * d);
	chmax(ans, a * d);

	cout << ans << "\n";

	return 0;
}


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

using ll = long long;

int main(int argc, char *argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, w;
    cin >> n >> w;

    vector<pair<ll, ll>> items(n);
    for(auto& item : items) cin >> item.first >> item.second;

    const int MAX_VALUE = 100000;

    vector<vector<ll>> dp(n, vector<ll>(MAX_VALUE + 1, numeric_limits<ll>::max()));
    dp[0][items[0].second] = items[0].first;
    dp[0][0] = 0;

    int maxValue = dp[0][items[0].second] <= w ? items[0].second : 0;

    for(int i = 1; i < n; ++i) {
        for(int v = 0; v <= MAX_VALUE; ++v) {
            dp[i][v] = dp[i - 1][v];

            if(v - items[i].second < 0) {
                continue;
            }

            ll prev = dp[i - 1][v - items[i].second];
            if(prev == numeric_limits<ll>::max()) {
                continue;
            }

            dp[i][v] = min(dp[i][v], items[i].first + prev);

            if(dp[i][v] <= w) {
                maxValue = max(maxValue, v);
            }
        }
    }

    cout << maxValue << '\n';
}


Measured memory_bytes: 79488
import sys

while True:
    n = int(input())
    if n == 0:
        break;
    x = {}
    for i in range(n):
        k,v = sys.stdin.readline().rstrip().split()
        x[k] = v
    y = []
    for i in range(int(sys.stdin.readline().rstrip())):
        a = sys.stdin.readline().rstrip()
        if a in x:
            y.append(x[a])
        else:
            y.append(a)
    print(''.join(y))

Measured memory_bytes: 8608
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include <string.h>
using namespace std;
int a[100005];
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int sum = 0;
	int pre = 0;
	int mx = 0;
	for (int i = 1; i <= n; i++) {
		sum += abs(pre - a[i]);
		pre = a[i];
	}
	for (int i = 1; i <= n; i++) {
		if (i == n) {
			cout << sum - abs(a[i - 1] - a[i]) + abs(a[n-1])<< endl;
		}
		else {
			cout << sum - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]) +abs(a[n])<< endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

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

// const int MAX = 1010;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<int>> c(10, vector<int>(10, 0)); // 隣接行列
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cin >> c[i][j];
        }
    }
    int list[h * w];
    for (int i = 0; i < h * w; i++)
    {
        cin >> list[i];
    }

    // ワーシャルフロイド
    for (int k = 0; k < 10; k++)
    {
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    int ans = 0;
    for (auto l : list)
    {
        if (l == -1)
        {
            continue;
        }
        ans += c[l][1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3796
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	int a,b,c,d,n,m;
	cin>>a>>b;
	if(a%3==0||b%3==0||(a+b)%3==0)
		cout<<"Possible"<<endl;
	else
		cout<<"Impossible"<<endl;

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t a, b, k; cin >> a >> b >> k;
	int64_t r = min(k, a);
	a -= r;
	k -= r;

	r = min(k, b);
	b -= r;

	cout << a << " " << b << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int w,h,n,a,x,y,s=0,t=0;
	scanf("%d %d %d",&w,&h,&n);
	while(n--){
		scanf("%d %d %d",&x,&y,&a);
		if(a==1&&s<x)s=x;
		if(a==2&&w>x)w=x;
		if(a==3&&t<y)t=y;
		if(a==4&&h>y)h=y;
	}
	printf("%d\n",w<s||h<t?0:(w-s)*(h-t));
	return 0;
}

Measured memory_bytes: 128