akhauriyash/Code-Regression huggingface dataset:
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

int main(){
    ll n , m ; 
    cin >> n >> m ; 
    vector<pair<ll,ll> > v(n) ; 
    for(ll i=0;i<n;i++){
    	cin >> v[i].first >> v[i].second ; 
    }
    sort(v.begin(),v.end());
    debug() << imie(v) ; 
    ll ans = 0 ; 
    for(auto p : v){
    	if ( m > 0 ) {
    		ll c = min(m,p.second);
    		ans += c*p.first ; 
    		m -= c ; 
    	}
    }
    cout << ans << endl;
    return 0 ;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long P, long long Q, long long R){
  long long ans = min(P+Q, Q+R);
  ans = min(ans, R+P);
  std::cout << ans << std::endl;
}

int main(){
  long long P;
  long long Q;
  long long R;
  scanf("%lld",&P);
  scanf("%lld",&Q);
  scanf("%lld",&R);
  solve(P, Q, R);
  return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int result = -1;
        for (int i = 1000; i > 0; i--) {
            double a = i * 0.08;
            double b = i * 0.1;
            if (Math.floor(a) == A && Math.floor(b) == B) {
                result = i;
            }
        }
        System.out.println(result);
    }

}


Measured memory_bytes: 23240
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する


int main() {
    int N;
    cin >> N;
    vector<int> A(N);

    REP(i, 0, N) {
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    int H = 0;
    int W = 0;
    REP(i, 0, N - 1) {
        if (A[i] == A[i + 1]) {
            if (H != 0) {
                W = A[i];
                break;
            } else {
                H = A[i];
                i++;
            }
        }
    }

    cout << (ll)(H) * (ll)(W) << endl;

    return 0;

}


Measured memory_bytes: 768
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	int a, b, c; cin >> a >> b >> c;
	if(b-a == c-b) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

int main(){
    using namespace std;
    set<int> s;
    int N; cin >> N;
    for (int i = 0; i < N; i++)
    {
        int A; cin >> A;
        if(s.count(A)!=0){
            cout << "NO" << endl;
            return 0;
        }
        s.insert(A);
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 9600
package main

import (
	"io"
	"os"

	"fmt"
)

func Solve(in io.Reader, out io.Writer) {
	var s string
	fmt.Fscan(in, &s)

	y := 700
	for i := 0; i < len(s); i++ {
		if s[i] == "o"[0] {
			y += 100
		}
	}

	fmt.Fprintln(out, y)
}

func main() {
	Solve(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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



int main() {
    ll a, b, c;
    ll k;
    cin >> a >> b >> c >> k;
    REP(i, k) {
        if(a >= b and a >= c) {
            a *= 2;
        }
        else if(b >= c) {
            b *= 2;
        }
        else {
            c *= 2;
        }
    }
    cout << a + b + c << endl;
}

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

int main(){
  int S,N;
  cin >> N;
  vector<int> B(N-1);
  for(int i=0;i<N-1;i++){
    cin >> B.at(i);
  }
  S = B.at(0);
  for(int i=1;i<N-1;i++){
    S += min(B.at(i),B.at(i-1));
  }
  S += B.at(N-2);
  cout << S << endl;
}

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

    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846


    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    void solve(){
        int x;
        cin>>x;
        if(x>=400 && x<=599)
            cout<<8;
        if(x>=600 && x<=799)
            cout<<7;
        if(x>=800 && x<=999)
            cout<<6;
        if(x>=1000 && x<=1199)
            cout<<5;
        if(x>=1200 && x<=1399)
            cout<<4;
        if(x>=1400 && x<=1599)
            cout<<3;
        if(x>=1600 && x<=1799)
            cout<<2;
        if(x>=1800 && x<=1999)
            cout<<1;
        
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("alchemy_input.txt", "r", stdin);
//        freopen("alchemy_output.txt", "w", stdout);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct Sieve {
	int n;
	vector<int> f, primes;
	Sieve(int n=1):n(n), f(n+1) {
		f[0] = f[1] = -1;
		for (ll i = 2; i <= n; ++i) {
			if (f[i]) continue;
			primes.push_back(i);
			f[i] = i;
			for (ll j = i*i; j <= n; j += i) {
				if (!f[j]) f[j] = i;
			}
		}
	}
	bool isPrime(int x) { return f[x] == x;}
	vector<int> factorList(int x) {
		vector<int> res;
		while (x != 1) {
			res.push_back(f[x]);
			x /= f[x];
		}
		return res;
	}
	vector<P> factor(int x) {
		vector<int> fl = factorList(x);
		if (fl.size() == 0) return {};
		vector<P> res;
		int pre= -1;
		for (int p : fl) {
			if (pre == p) {
				res.back().second++;
			} else {
				res.emplace_back(p, 1);
			}
			pre=p;
		}
		return res;
	}
};

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i, n) cin>>a[i];

	Sieve si(1000001);

	map<int, int> tfa;
	rep(i, n){
		auto ps=si.factor(a[i]);
		for(auto p : ps) tfa[p.first]=max(tfa[p.first], p.second);
	}

	mint lcm=1;
	for(auto p : tfa) rep(_, p.second) lcm*=p.first;
	mint ans=0;
	rep(i, n){
		ans+= lcm/a[i];
	}

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


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

#define endl "\n"
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(),(x).end()
#define rect return 0
#define pause cout << endl; system("pause")
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(x) (int)(x).size()
#define Pi acos(-1.0)
#define bitcount __builtin_popcountll

#define TupleGet(name, index) std::get<(index)>(name)
#define FOR(a, b, c) for(int (a) = (b); (a) < (c); ++(a))
#define FORs(a, b, c) for(int (a) = (b); (a) <= (c); ++(a))
#define revFOR(a, b, c) for(int (a) = (b); (a) > (c); --(a))
#define revFORs(a, b, c) for(int (a) = (b); (a) >= (c); --(a))
#define foreach(it, a) for(auto it = (a).begin(); it != (a).end(); it++)

using namespace std;

// *** TYPEDEF'S, CONSTANTS AND FUNCTIONS *** //
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tii;
typedef vector<vector<int> > vvi;

/* |T| |I| |P| |S|
@ string abc = "abcdefghijklmnopqrstuvwxyz";
@ 'char' - 'a' ::: порядковый номер латинской буквы
@ 'digit' - '0' or 'digit' - 48 ::: (char) ---> (int)
@ 'A' = dec 65 'Z' = dec 90
  'a' = dec 97 'z' = dec 122
  '0' = dec 48 '9' = dec 57
@ Если страдает скорость ввода:
1) ios::sync_with_stdio(0);
   cin.tie(0);
2) юзать сканф
@ для стринга перевод i-того символа в другой регистр: a[i] = char (a[i] +- 32)  :::  32 == 'a' - 'A'
@ int n (m знаков) :::  n[1] = n / 10^(m-1) ; n[m] = n % 10 ; n[m-1] = (n % 100)/10 ; n[m-2] = (n % 1000)/100...
@ cout << fixed << setprecision(n) ::: n знаков после запятой, без "fixed" - всего n знаков
@ abs(x-y) < EPS ::: равентсво вещественных чисел x и y по точности EPS
@ x + EPS < y  или  x - EPS < y ::: сравнение больше-меньше для вещественных чисел по точности EPS
@ если цифру можешь записать из головы - так и пиши в программе, иначе - пиши ФОРМУЛУ
@ «экспонента» - целое число, показывающее, на сколько надо сдвинуть десятичную запятую в числе ::: 123e2 = 12300 , 123e-4 = 0.0123
@ если задача плохо решается при нумерации с единицы, иногда оказывается намного проще перейти к нумерации с нуля.
  Особенно задачах, где явно надо делить на равные части.
@ while(cin >>)  |||  while (getline(cin, )) ::: считывание, пока даются данные
@ ctrl+Z ::: конец файла в консоли
@ Глобальные массивы, чтобы не было ошибок; размер брать с запасом
@ Количество цифр N числа X в b-ичной записи, N = floor[ log[b](X) ] + 1
@ ios::sync_with_stdio(0); //ввод
@ cin.tie(0); cout.tie(0); //могут быть проблемы в интерактивных задачах (частый ввод-вывод)
*/

void A() {
    int n;
    cin >> n;

    vi dp(1000 + 1, 0);
    dp[0] = dp[4] = dp[7] = 1;
    for (int i = 7; i <= n; i++) {
        dp[i] |= dp[i - 4];
        dp[i] |= dp[i - 7];
    }

    if (dp[n] == 0) {
        cout << "No";
    } else {
        cout << "Yes";
    }
}

int main() {
    A();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#define rep(i,j) FOR(i,0,j)
#define FOR(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int a=0,b=0,c,d;
		rep(i,n){
			cin>>c>>d;
			if(c>d)a+=c+d;
			else if(c<d)b+=c+d;
			else{
				a+=c;
				b+=d;
			}
		}
		cout<<a<<" "<<b<<endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define int long long
main()
{
    int n,ans=0;
    double d;
    cin>>n>>d;
    for(int i=1; i<=n; i++)
    {
        double x,y;
        cin>>x>>y;
        double v=sqrt((x*x)+(y*y));
        if(v<=d) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3772
K, A, B =map(int,input().split())
import sys
should_actAB = (B-A)
if should_actAB<=2:
    print(K+1)
    sys.exit()
 
else:
    ans_cookie=1
    K_=K-(A-1)
    ans_cookie+=(A-1)
    if K_%2==0:
        ans_cookie+=should_actAB*(K_)//2
    else:
        ans_cookie+=should_actAB*(K_-1)//2+1
print(ans_cookie)

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
string S;
string T;

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

	cin >> N;
	cin >> S >> T;

	for(int i = N;i >= 0;i--){
		bool flag = true;
		for(int j = 0;j < i;j++){
			if(S [N - i + j] != T [j]){
				flag = false;
				break;
			}
		}
		if(flag){
			cout << (N * 2 - i) << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stack>
#include <bitset>
#include <utility>
#include <vector>
#include <set>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
#define MP make_pair
#define PB push_back
const int N=1e5+10;
int p[N],low[N],dep[N],t=0;
stack<int> s;
bitset<N>went,in,used;
vector<pi> graph[N];
void dfs(int now){
    in[now]=went[now]=true;
    low[now]=dep[now]=++t;
    s.push(now);
    for(int i=0;i<graph[now].size();i++)if(!used[graph[now][i].S]){
        used[graph[now][i].S]=true;
        if(!went[graph[now][i].F])dfs(graph[now][i].F);
        if(in[graph[now][i].F])low[now]=min(low[now],low[graph[now][i].F]);
    }
    if(low[now]==dep[now]){
        while(s.top()!=now){
            p[s.top()]=now;
            in[s.top()]=false;
            s.pop();
        }
        p[now]=now;
        s.pop();
        in[now]=false;
    }
    return ;
}
int main(){
    int n,m,l,r;
    set<pi> ans;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        graph[l].PB(MP(r,i));
        graph[r].PB(MP(l,i));
    }
    went.reset();
    in.reset();
    used.reset();
    for(int i=0;i<n;i++)if(!went[i])dfs(i);
    for(int i=0;i<n;i++)for(int j=0;j<graph[i].size();j++)if(p[i]!=p[graph[i][j].F]){
        if(i<graph[i][j].F)ans.insert(MP(i,graph[i][j].F));
        else ans.insert(MP(graph[i][j].F,i));
    }
    for(auto u:ans)printf("%d %d\n",u.F,u.S);
}


Measured memory_bytes: 6648
# -*- coding: utf-8 -*-
import math

#入力
#S = str(input())
#a, b = map(int, input().split())
#N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())

if A > B :
  x = B
else :
  x = A

if C > D :
  y = D
else :
  y = C

print (x + y)

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

#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end());
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int d[110];
signed main() {
    cin >> N;
    rep(i, N) { cin >> d[i]; }
    int ans = 0;
    rep(i, N) {
        rep(j, i) { ans += d[i] * d[j]; }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque
from operator import itemgetter


def topolo():
    q = deque(v1 for v1 in range(N) if ins[v1] == 0)
    res = []
    popleft, append = q.popleft, q.append
    res_append = res.append
    while q:
        v1 = popleft()
        res_append(v1)
        for v2 in edges[v1]:
            ins[v2] -= 1
            if ins[v2] == 0:
                append(v2)
    return res


N, M = map(int, input().split(" "))
edges = [[] for _ in [0]*N]
rev = [[] for _ in [0]*N]

ins = [0]*N

for a, b in (map(int, input().split(" ")) for _ in [0]*(N+M-1)):
    edges[a-1].append(b-1)
    rev[b-1].append(a-1)
    ins[b-1] += 1

sorted_nodes = topolo()
order = [i for i, v in sorted(enumerate(sorted_nodes), key=itemgetter(1))]

for input_nodes in rev:
    l = len(input_nodes)
    if l == 0:
        print(0)
        continue
    elif l == 1:
        print(input_nodes[0] + 1)
        continue
    temp = 0
    for node in input_nodes:
        temp = max(temp, order[node])
    print(sorted_nodes[temp] + 1)


Measured memory_bytes: 46664
#include <stdio.h>
#include <string.h>
int main(){
  int K, L;
  char S[100];
  scanf("%d",&K);
  scanf("%s",&S);
  L=strlen(S);
  if(L<=K){
    printf("%s",S);
  }else{
    S[K]='\0';
    printf("%s...",S);
  }
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define repi(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
using namespace std;
typedef long long ll;

int main() {
  int N; cin >> N;
  vector<tuple<string, int, int>> a;
  repi(i,1,N+1) {
    string S; int P;
    cin >> S >> P;
    a.emplace_back(S, -P, i);
  }
  
  sort(a.begin(), a.end());

  rep(i,N) cout << get<2>(a[i]) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int dp[500000][55];

int main(){  
  int N;cin >> N;
  vector<int> A(N),B(N);
  rep(i,N) cin >> A[i];
  rep(i,N) cin >> B[i];
  rep(bit,1 << N){
    rep(i,55){
      dp[bit][i] = INF;
    }
  }
  dp[0][0] = 0;  
  
  rep(bit,1 << N){
    int S_size = 0;
    rep(i,N) {
      int mask = 1 << i;
      if(bit & mask){
        S_size++;
      }
    }
    vector<pair<int,int>> invS;//  first:もともと何番目か，second:カードの現在位置
    int now = S_size;
    rep(i,N){
      int mask = 1 << i;
      if((bit & mask) == 0){
        invS.emplace_back(i,now);
        now++;
      }
    }
    rep(last,51){
      for(auto v:invS){
        int i=v.first;
        int now = v.second;
        int i_val;
        if(abs(i -S_size) % 2 == 0){
          i_val = A[i];
        }else{
          i_val = B[i];
        }
        if(i_val >= last){
          chmin(dp[bit | (1 << i)][i_val],dp[bit][last]+abs(now-S_size));
        }
      }
    }
  } 
  int ans = INF;
  rep(i,55){
    chmin(ans,dp[(1 << N)-1][i]);
  }
  if(ans == INF){
    cout << -1 << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 59956
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N,A,B,C,D;
    string S;
    cin >> N >> A >> B >> C >> D;
    A--;B--;C--;D--;
    cin >> S;
    // まず A くんが C に到達可能かどうかを調べます
    bool ok = 1;
    for(int i=A;i<=C;i++)if(S[i]=='#'&&S[i+1]=='#'&&i+1<N)ok = 0;
    for(int i=B;i<=D;i++)if(S[i]=='#'&&S[i+1]=='#'&&i+1<N)ok = 0;
    if(!ok){
        cout << "No" << endl;
        return 0;
    }else if(C<D){
        cout << "Yes" << endl;
        return 0;
    }
    ok = 0;
    for(int i=B;i<=D;i++){
        if(S[i]=='.'&&S[i+1]=='.'&&S[i-1]=='.'&&i+1<N)ok = 1;
    }
    if(ok)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 592
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint X, Y;
int main() {
	cin >> X >> Y;
	if (abs(X - Y) > 1) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Brown" << endl;
	}
}


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

using namespace std;

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

int main(){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	int l = 0;
	int r = n - 1;
	int ans = 0;
	int count = 0;
	while(l < r - 1 && count < k){
		if(s[l] == s[l+1] && s[r] == s[r-1]){
			l += 1;
			r -= 1;
			ans += 2;
		}else if(s[l] != s[l+1] && s[r] == s[r-1]){
			r -= 1;
			ans += 1;
		}else if(s[l] == s[l+1] && s[r] != s[r-1]){
			l += 1;
			ans += 1;
		}else if(s[l] != s[l+1] && s[r] != s[r-1] && l < r + 1){
			l += 1;
			r -= 1;
			ans += 2;
			
			count += 1;			
		}
		// cout << ans << endl;
	}
	if(l == r - 1 && count < k && s[l] != s[l+1]){
		l = r;
		ans += 1;
	}
	if(l < r){
		while(l < r){
			if(s[l] == s[l+1]){
				ans += 1;
				l += 1;
			}else{
				l += 1;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
import scala.io.StdIn


object Main extends App {

  val line = StdIn.readLine().split(" ").map(_.toInt).toList.splitAt(2)

  def solve(input: (List[Int], List[Int])): String = {
    val result = input._1.sum - input._2.sum
    if (result > 0) "Left"
    else if (result < 0) "Right"
    else "Balanced"
  }


  println(solve(line))

}

Measured memory_bytes: 25504
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ld = long double;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMax = 1e12 + 1;
constexpr ll kMod = 1e9 + 7;
constexpr long double kPI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;

  vll cnt(100001);
  ll sum = 0;
  REP(i, 0, N) {
    ll a;
    cin >> a;
    cnt[a]++;
    sum += a;
  }

  ll Q, B, C;
  cin >> Q;
  REV(q, Q, 0) {
    cin >> B >> C;
    sum += (C - B) * cnt[B];
    cnt[C] += cnt[B];
    cnt[B] = 0;

    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 3984
a, b, c = map(int, input().split(" "))
mod = a % b
if mod == c:
    print("YES")
else:
    mod_list = [mod]
    while True:
        mod = (mod_list[-1] + a) % b
        if mod in mod_list:
            print("NO")
            exit()
        else:
            if mod == c:
                print("YES")
                exit()
            else:
                mod_list.append(mod)

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

using namespace std;

#define ll long long
#define pi pair<int, int>
#define pb push_back
#define fr first
#define sc second
#define endl '\n'

const int mxn = 1e6 + 5;
const ll MOD = 1e9 + 7;
ll arr[mxn];
int n, m, k;
string s, t;

ll pow(ll A,ll B,ll R=1)
{while(B){if(B&1)R=R*A%MOD;A=A*A%MOD;B>>=1;}return R;}


void read(){
    cin >> n >> k;
    for(int i = 1, u, v; i <= n; i++){
        arr[i] = arr[i - 1] + i;
        //cout << arr[i] << endl;
    }
}

void solve(){
    ll res = 0;
    for(int i = k; i < n + 1; i++){
        ll mn = arr[i - 1];
        ll mx = arr[n] - arr[n - i];
        res += (mx - mn + 1);
        res %= MOD;
    }
    cout << (res + 1) % MOD << endl;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    while(T--) read(), solve();
    return 0;
}


Measured memory_bytes: 5152
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
bool second_greater(const pii& left, const pii& right) {
    return left.second > right.second;
}
#endif


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

    int N; cin >> N;
    vi v(N); REP(i, N) cin >> v[i];

    bool same = true;
    REP(i,N-1) {
        if (v[i] != v[i+1]){
            same = false;
            break;
        }
    }
    if (same) {
        cout << N / 2 << endl;
        return 0;
    }

    const int VMAX = 100000;
    vi ho(VMAX + 1, 0), he(VMAX + 1, 0);
    REP(i,N) {
        if (i % 2 == 0) {
            ho[v[i]]++;
        } else {
            he[v[i]]++;
        }
    }

    vector<pii> mdO;
    FOR(i,1,VMAX+1) {
        if (0 < ho[i]) {
            mdO.push_back(pii(i, ho[i]));
        }
    }
    sort(mdO.begin(), mdO.end(), second_greater);

    vector<pii> mdE;
    FOR(i,1,VMAX+1) {
        if (0 < he[i]) {
            mdE.push_back(pii(i, he[i]));
        }
    }
    sort(mdE.begin(), mdE.end(), second_greater);

    int mo = mdO[0].first, me = mdE[0].first;

    int ans;
    if (mo == me){
        int mo2 = mdO[1].first, me2 = mdE[1].first;
        if (ho[mo] + he[me2] >= ho[mo2] + he[me]) {
            ans = N - ho[mo] - he[me2];
        } else {
            ans = N - ho[mo2] - he[me];
        }
    } else {
        ans = N - ho[mo] - he[me];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2680
// Library
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

// MACRO

#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "YES" : "NO")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

// Global Tables

// Functions

void TC(int t)
{
    int N, n, i;
    cin >> N;
    int S[N] = {0,};
    for(n = 1; n < N; n++)
    {
        cin >> i;
        S[i-1]++;
    }
    for(n = 0; n < N; n++)
    {
        cout << S[n] << endl;
    }
    //cout.setf(ios::fixed, ios::floatfield);
    //cout.precision(4);
}

// Main

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int T = 1, t;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


Measured memory_bytes: 4388
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N,K = map(int, input().split())
    having = [False]*(N)
    for _ in range(K):
        d = int(input())
        for a in map(int, input().split()):
            having[a-1] = True

    print(len(list(filter(lambda b: not b, having))))

main()


Measured memory_bytes: 8988
#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 a, b, c;
    cin >> a >> b>> c;
    cout << max(c-a+b, 0) << endl;
    
    return 0;
}


Measured memory_bytes: 256
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T

main :: IO ()
main = do
  let
    modulus = 1000000007 :: Int
    modAdd :: Int -> Int -> Int
    modAdd x y = (x + y) `mod` modulus
    modMul :: Int -> Int -> Int
    modMul x y = (x * y) `mod` modulus
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  as <- map unsafeTextToInt . T.words <$> T.getContents :: IO [Int]
  let
    bs = scanl modAdd 0 as :: [Int]
  print . foldl modAdd 0 $ zipWith modMul bs as

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 4932
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<ll> A(3);
    for(int i=0; i<3; i++) cin >> A.at(i);

    sort(A.begin(), A.end());
    bool flag = true;
    for(auto a : A)
    {
        if(a%2==0) flag = false;
    }
    if(!flag)
    {
        cout << "0\n";
    }
    else
    {
        cout << A[0] * A[1] << '\n';
    }
    

    return 0;
}


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

using namespace std;

signed main()
{
    // freopen("input.txt", "r", stdin);
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    int sugar = 0, water = 100 * a;
    for(int i = 0; i <= 30; i++)
        for(int j = 0; j <= 30; j++)
            for(int k = 0; k <= 1500; k++)
                for(int l = 0; l <= 1500; l++)
                {
                    int tw = 100 * (i * a + j * b);
                    int ts = k * c + l * d;
                    if(100 * ts <= e * tw && tw + ts <= f)
                        if(ts * (sugar + water) >= sugar * (ts + tw))
                            sugar = ts, water = tw;
                }
    cout << sugar + water << ' ' << sugar << endl;
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000


int main() {
	long long a[N];
	long long b[N];
	long long ma, mb;
	vector<pair<long long, long long> >c;
	f(i, N)a[i] = 0;
	long long n, k;
	long long x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%lld", &n);
	ma = -1;
	mb = MOD;
	z = 0;
	f(i, n) {
		scanf("%lld %lld", &a[i],&b[i]);
		if (ma < a[i]) {
			x = i;
			ma = a[i];
		}
		if (b[i] < mb) {
			y = i;
			mb = b[i];
		}
		z = max(z, b[i] - a[i] + 1);
	}
	if (x == y) {
		z += (mb - ma + 1);
		printf("%lld\n", z);
		return 0;
	}
	f(i, n) {
		x = max((long long)0, b[i] - ma + 1);
		y = max((long long)0, mb - a[i] + 1);
		c.push_back(make_pair(x, y));
	}
	sort(c.begin(), c.end());
	x = MOD;
	s = 0;
	ans = z+max((long long)0, mb - ma + 1);
	f(i, n - 1) {
		x = min(x, c[i].second);
		s = x + c[i + 1].first;
		ans = max(ans, s);
	}
	

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


	return 0;
}


Measured memory_bytes: 5492
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		//宣言文
		//標準入力オブジェクトを生成
		Scanner sc = new Scanner(System.in);
		//標準入力で以下の変数を初期化
		int numberA = sc.nextInt();
		int numberB = sc.nextInt();
		int numberC = sc.nextInt();
		int numberX = sc.nextInt();
		//和変数
		int sumNum = 0;
		//フラグ変数
		int flagNum = 0;

		//処理文
		for(int i = 0; i <= numberA; i++) {
			for(int j = 0; j <= numberB; j++) {
				for(int k = 0; k <= numberC; k++) {
					sumNum = ((500 * i) + (100 * j) + (50 * k));
					if(numberX == sumNum) {
						flagNum++;
					}
				}
			}
		}
			//標準出力
			System.out.print(flagNum);
	}
}


Measured memory_bytes: 22100
#include <iostream>
using namespace std;
typedef long long ll;
ll dp[201][201],ans,n;
ll gcd(ll x,ll y){
    if(y==0)return x;
    return gcd(y,x%y);
}
int main(void){
    cin>>n;
    for(int i=1;i<=200;i++){
        for(int j=1;j<=200;j++){
            dp[i][j]=gcd(i,j);
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                ans+=dp[i][dp[j][k]];
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3952
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    lli n, num, ans = 0;
    cin >> n;
    for(lli i = 0; i < n; i++){
        cin >> num;
        ans += num - 1;
    }

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

Measured memory_bytes: 256
import java.util
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val f = (x: Int) => {
      var y = x
      var ret = 0
      while(y!=0) {
        ret += y % 10
        y /= 10
      }
      ret
    }
    println(if(n%f(n)==0) {
      "Yes"
    } else {
      "No"
    })
  }
}


Measured memory_bytes: 25528
package main

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

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func readInt() int {
	i, _ := strconv.Atoi(read())
	return i
}

func max(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func min(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()
	d := readInt()
	x := readInt()
	for i := 0; i < n; i++ {
		a := readInt()
		x += (d - 1) / a
		x += 1
	}
	fmt.Println(x)
}


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

using namespace std;


int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<string> numbers;
    for(int i = 0; i < 1000; i++) {
        string x = to_string(i);
        if(x.size() == 1) {
            x = "00" + x;
        }
        else if(x.size() == 2) {
            x = '0' + x;
        }
        numbers.push_back(x);
    }
    int ans = 0;
    for(int i = 0; i < 1000; i++) {
        string x = numbers[i];
        int a = -1, b = -1, c = -1;
        for(int i = 0; i < n; i++) {
            if(s[i] == x[0]) {
                a = i;
                break;
            }
        }
        if(a == n-1) {
            continue;
        }
        for(int i = a+1; i < n; i++) {
            if(s[i] == x[1]) {
                b = i;
                break;
            }
        }
        if(b == n-1) {
            continue;
        }
        for(int i = b+1; i < n; i++) {
            if(s[i] == x[2]) {
                c = i;
                break;
            }
        }
        if(a != -1 && b != -1 && c != -1) {
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3808
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<u64>();
    let (x, y) = (line[0], line[1]);

    if x%y == 0{
        println!("-1");
        return;
    }
    let mut ans = x;
    while ans <= 1_000_000_000_000_000_000{
        if ans%y > 0{
            println!("{}", ans);
            return;
        }
        ans += x;
    }
    println!("-1");
}


Measured memory_bytes: 4352
N = int(input())
d={}
for x in range(N):
    s = input()
    if d.get(s) is None: d[s] = 1
    else: d[s] += 1
    
m = max(d.values())
ans = []
b={}
for x in d.items():
    if x[1] == m and b.get(x[0]) is None:
        ans.append(x[0])
        b[x[0]] = True
        
print('\n'.join(sorted(ans)))

Measured memory_bytes: 53596
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(A, B, C):
    if (A == B and A != C) or (B == C and B != A) or (C == A and C != B):
        return "Yes"
    return "No"


if __name__ == "__main__":

    # A B C
    #
    A, B, C = map(int, input().split())
    ans = solv(A, B, C)

    print(ans)


Measured memory_bytes: 2940
#include<stdio.h>
int main()
{
    unsigned long long int a, b, c;
    scanf("%lld %lld %lld", &a, &b, &c);
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
        printf("0\n");
    else
    {
        unsigned long long int x;
        if (a > c)
        {
            x = a;
            a = c;
            c = x;
        }
        if (b > c)
        {
            x = b;
            b = c;
            c = x;
        }
        printf("%lld\n", a*b);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))

void solve(){
     ll n;cin>>n;
     int ac=0,tle=0,wa=0,re=0;
     f(i,0,n){
     	string s;
     	cin>>s;
     	if(s=="AC")ac++;
     	else if(s=="WA")wa++;
     	else if(s=="TLE")tle++;
     	else re++;
     }
     cout<<"AC "<<"x "<<ac<<"\n";
     cout<<"WA "<<"x "<<wa<<"\n";
     cout<<"TLE "<<"x "<<tle<<"\n";
     cout<<"RE "<<"x "<<re<<"\n";
}
int main() {
    ios;
	int t=1;
	//cin>>t;
	while(t--)solve();
 
    
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    if (N == M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 2e5+5;
bool vis[N];
int a[N];
map<ll,int>mp;
vector<int>v;
int main()
{
	ll n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	int id=1,cnt=0;
	while(!vis[id])
	{
		mp[id]=cnt;
		v.push_back(id);
		vis[id]=true;
		id=a[id];
		cnt++;
	}
	k++;
	if(k<=mp[id])cout<<v[k-1];
	else
	{
		k-=mp[id];
		k%=(cnt-mp[id]);
		if(k==0)k=cnt-mp[id];
		cout<<v[mp[id]-1+k];
	}
	return 0;
}

Measured memory_bytes: 17236
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	ll n;
	scanf("%ld", &n);
	
	ll m = n;
	V primefactor;
	for(ll i=2; i*i<=m; i++){
		if(m%i==0) primefactor.push_back(i);
		while(m%i==0) m /= i;
	}
	if(m>1) primefactor.push_back(m);
	
	V zs;
	for(ll p: primefactor){
		for(ll i=p; i<=n; i*=p){
			if(n%i==0) zs.push_back(i);
		}
	}
	std::sort(ALL(zs));

	ll ans = 0;
	for(ll z: zs){
		if(n%z==0){
			n /= z;
			ans++;
		}
	}
	printf("%ld\n", ans);
	return 0;
}




Measured memory_bytes: 3784
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N;
	cin>>N;
	scanf("%d",&N);
	printf("%d\n",N%2?2*N:N);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<int>> a(h,vector<int>(w,0));
  vector<vector<int>> ans;
  rep(i,h)rep(j,w) cin >> a.at(i).at(j);
  bool flg = 0;
  
  rep(i,h){
    if(i%2 == 0){
      for(int j=0;j<w;j++){
        if(flg){
          vector<int> b;
          if(j>0) b = {i,j-1,i,j};
          else b = {i-1,0,i,0};
          ans.push_back(b);
          if(a.at(i).at(j)%2 == 1) flg = 0;
        }else{
          if(a.at(i).at(j)%2 == 1) flg = 1;
        }
      }
    }else{
      for(int j=w-1;j>=0;j--){
        if(flg){
          vector<int> b;
          if(j!=w-1)  b = {i,j+1,i,j};
          else b = {i-1,w-1,i,w-1};
          ans.push_back(b);
          if(a.at(i).at(j)%2 == 1) flg = 0;
        }else{
          if(a.at(i).at(j)%2 == 1) flg = 1;
        }
      }
    }
  }
  cout << ans.size() << endl;
  rep(i,ans.size()){
    rep(j,4) {
      cout << ans.at(i).at(j)+1 ;
      if(j != 3) cout << " ";
      else cout << endl;
    }
  }  
        
  return 0;
}



Measured memory_bytes: 9904
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define mk make_pair
#define pp pair<int,int>
#define ppl pair<long long int,long long int>
#define vec vector<int> 
#define finput ifstream cin;cin.open("input.txt")
#define foutput ofstream cout;cout.open("output.txt") 

int main(){
	int n;
	cin>>n;
	if(n<1200) cout<<"ABC";
	else if(n<2800) cout<<"ARC";
	else cout<<"AGC";
}

Measured memory_bytes: 256
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))

def lcm(a):
    l = 1
    for i in a:
        l = l*i // gcd(l,i)
    
    return l

l = lcm(a)
count = 0
for i in a:
    count += l // i

print(count % (10**9+7))

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

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

  vector<int> b(N + 1);
  int cnt = 0;
  for (int i = N; i >= 1; i--) {
    int sum = 0;
    for (int j = 2; j <= N / i; j++) {
      sum += b.at(i * j);
    }
    if (a.at(i) % 2 == sum % 2) {
      b.at(i) = 0;
    } else {
      b.at(i) = 1;
      cnt++;
    }
  }

  cout << cnt << endl;
  if (cnt == 0) return 0;

  for (int i = 1; i <= N; i++) {
    if (b.at(i) == 1) {
      cout << i << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 2688