akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll m1, d1, m2, d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;

    if (m2 == m1 + 1) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#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>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	int N; cin >> N;
	vector<int>arr(N, 0);
	vector<int>arr2(N, 0);
	for (int i = 0; i < N; i++)
	{
		cin >> arr[i];
	}
	arr2 = arr;
	sort(arr2.begin(), arr2.end());
	int a = arr2[N / 2 - 1];
	int b = arr2[N / 2];
	if (N==2)
	{
		b = max(arr2[0], arr2[1]);
		a = min(arr2[0], arr2[1]);
		cout << b << "\n" << a << "\n";
		return 0;
	}
	for (int i = 0; i < N; i++)
	{
		if (arr[i] <= a)
		{
			cout << b << "\n";
		}
		else if (arr[i]>=b)
		{
			cout << a << "\n";
		}
	}
}


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

int main(){
    int s[5];
    int sum = 0;

    for(int i = 0; i < 5; i++){
        cin >> s[i];
        if(s[i] < 40) s[i] = 40;
        sum += s[i];
    }
    cout << (sum / 5) << endl;
    
    return 0;
}



Measured memory_bytes: 3100
a, b, c, d, e, f = list(map(int, input().split()))
a_count = 0
b_count = 0
c_count = 0
d_count = 0
max_per = 0.0
max_ans = [a*100,0]
while a_count * 100 * a <= f:
    b_count = 0
    c_count = 0
    d_count = 0
    while (a_count * a + b_count * b) * 100  <= f:
        c_count = 0
        d_count = 0
        while (a_count * a + b_count * b) * 100 + c_count * c <= f:
            d_count = 0
            while (a_count * a + b_count * b) * 100 + c_count * c + d_count * d <= f:
                #溶けてるのかどうか
                if (a_count * a + b_count * b)* e < (c_count * c + d_count * d):
                    break
                else:
                    if a_count + b_count + c_count + d_count == 0:
                        break
                    if max_per < (100 * (c_count * c + d_count * d) / ((a_count * a + b_count * b) * 100 + c_count * c + d_count * d)):
                        max_ans = [(a_count * a + b_count * b) * 100 + c_count*c + d_count*d, c_count*c + d_count * d]
                        max_per = (100 * (c_count * c + d_count * d) / ((a_count * a + b_count * b) * 100 + c_count * c + d_count * d))
                d_count += 1
            c_count += 1
        b_count += 1
    a_count += 1
print("{} {}".format(max_ans[0], max_ans[1]))

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int k = in.nextInt();
		out.println(n + (k/2));

		out.flush();
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

Measured memory_bytes: 22996
//package atcoder;
 
import java.util.*;
import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		String U= sc.next();
		//System.out.println(U);
		//System.out.println(A-1);
		if(U.contentEquals(S)) {
			System.out.print((A-1)+" "+B);
			//System.out.print(B);
		}
		if(U.contentEquals(T)) {
			System.out.print(A+" "+(B-1));
			//System.out.print(B-1);
		}
	}
}

Measured memory_bytes: 23252
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define pint pair<int, int>
#define mp make_pair

using namespace std;

typedef long long ll;


const int inf = 999999999;

int N;
int t[10000];
int dp[2][5001][2];
int main() {
	cin >> N;
	t[0] = 0;
	for (int i = 1; i < N; i++) {
		cin >> t[i];
	}

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j <= N / 2; j++) {
			for (int k = 0; k < 2; k++) {
				dp[i][j][k] = inf;
			}
		}
	}

	dp[0][0][0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= min(i, N / 2); j++) {
			dp[(i + 1)%2][j+1][0] = min(dp[i%2][j][0], dp[i%2][j][1] + t[i]);
			dp[(i + 1)%2][j][1] = min(dp[i%2][j][1], dp[i%2][j][0] + t[i]);
		}
		dp[0][0][0] = inf;
	}

	cout << min(dp[0][N/2][0], dp[0][N/2][1]) << endl;

	return 0;
}




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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

#define space cout << endl;
#define test_data(data) cout << data << endl;
#define test_comp(var1, var2) cout << var1 << " " << var2 << endl;

using namespace std;

/* function */
//  - none - 


/* code */
int main (void) 
{

  /* Variable_Proclamation */
  int D;    // input 難易度の区分数
  int G;    // input 目標スコア
  vector<int> p, c;

  int i, j; // subscript
  int bit;

  int sum;
  int sol_cnt;
  int ans;  // output


  /* Input, Array_Proclamation */
  cin >> D;
  cin >> G;
  p.resize(D); // 配点(i+1)*100点の問題数
  c.resize(D); // コンプリートボーナス

  for(i=0; i<D; i++)
  {
    cin >> p.at(i) >> c.at(i);
  }


  /* Initialize */
  sum = 0;
  ans = INT_MAX;


  /* Calculation */
  for(bit=0; bit<(1<<D); bit++)
  {

    sum     = 0;
    sol_cnt = 0;

    // 全て解く問題の難易度を指定（全探索）
    for(i=0; i<D; i++)
    {
      if(bit & (1<<i)) 
      {
        sum     += (i+1)*100 * p.at(i) + c.at(i);
        sol_cnt += p.at(i);
      }
    }

    // 目標点を超えていれば解答終了
    if(sum >= G)
    {
      ans = min(sol_cnt, ans);
    }

    else if(sum < G)
    {

      // 完遂していない難易度の問題のうち、配点（難易度）の最も高い問題を一問ずつ解く
      // 配点が低い問題については考慮不要
      
      for(i=D-1; i>=0; i--)
      {

        // 既に完遂している難易度は飛ばす
        if(bit & (1<<i))
        {
          continue;
        }
        
        else
        {
          for(j=0; j<p.at(i); j++)
          {
          
            // 目標点まで一問ずつ解答
            sum     += (i+1)*100;
            sol_cnt += 1;

            // 目標点を超えたら解答終了
            if(sum >= G)
            {
              goto FIN;
            }

          }
        }

      }
      FIN:

      ans = min(sol_cnt, ans);

    }

  }


  /* Output */
  cout << ans << endl;


  return 0;

}


/* entity */
//  - none -




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a,b,ans;
    cin >> a >> b;
    ans = 0;
    if(a>b){
        ans += a;
        a--;
    } else {
        ans += b;
        b--;
    }
    if(a>b){
        ans += a;
        a--;
    } else {
        ans += b;
        b--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// make_tuple emplace_back next_permutation push_back make_pair second first
// setprecision

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
   public:
    int n;
    vector<vector<int>> t;
    Solver(LL n) : n(n), t(2 * n - 1){};
    void add_edge(int a, int b, int v) {
        t[a].push_back(v);
        t[v].push_back(a);
        t[v].push_back(b);
        t[b].push_back(v);
    }
    pair<LL, LL> calc(int r) {
        vector<LL> maxc((LL)t.size()), dep((LL)t.size(), -1);
        queue<int> Q;
        Q.push(r);
        dep[r] = 0;
        LL ret = 0;
        while (!Q.empty()) {
            int now = Q.front();
            Q.pop();
            for (auto x : t[now]) {
                if (dep[x] == -1) {
                    dep[x] = dep[now] + 1;
                    Q.push(x);
                }
            }
            ret = max(ret, dep[now] + 1);
            LL cnt_child =
                (now == r ? (LL)t[now].size() : (LL)t[now].size() - 1);
            maxc[dep[now]] = max(maxc[dep[now]], cnt_child);
        }
        LL ret2 = 1;
        for (int i = 0; i < ret - 1; ++i) {
            ret2 *= maxc[i];
        }
        DBG(r, ret, ret2, maxc)
        return {(ret + 1) / 2, ret2};
    }
    void solve() {
        for (int i = 0; i < n - 1; ++i) {
            int a, b;
            cin >> a >> b;
            add_edge(a - 1, b - 1, n + i);
        }
        pair<LL, LL> ans = {LINF, LINF};
        for (int i = 0; i < (int)t.size(); ++i) {
            auto tmp = calc(i);
            if (tmp.first < ans.first or
                (tmp.first == ans.first and tmp.second < ans.second)) {
                ans = tmp;
            }
        }
        cout << ans.first << ' ' << ans.second << "\n";
    }
};
}  // namespace Problem

int main() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    long long n = 0;
    std::cin >> n;
    Problem::Solver sol(n);
    sol.solve();
    return 0;
}


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

int gcd(int a, int b){
  if(a%b==0){
    return b;
  }else{
    return gcd(b, a%b);
  }
}

int gcd(int i, int j, int k){
  int gcd_j_k = gcd(max(j, k), min(j, k));
  if(i==gcd_j_k){
    return i;
  }else if(i<gcd_j_k){
    return gcd(gcd_j_k, i);
  }else{
    return gcd(i, gcd_j_k);
  }
}

int main(){
  int K;
  cin >> K;
  int ans=0;
  for(int i=1; i<K+1; i++){
    for(int j=1; j<K+1; j++){
      for(int k=1; k<K+1; k++){
        ans += gcd(i, j, k);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	char N;
	cin >> N ;

	if (N>='a' && N <='z') {
		cout << 'a' << endl;
	}
	else{
		cout << 'A' << endl;
	}
	return 0;
}

Measured memory_bytes: 3616
x, y = map(int, input().split())
s1 = {1,3,5,7,8,10,12}
s2 = {4,6,9,11}
s3 = {2}

def include(i):
  if i in s1:
    return 1
  elif i in s2:
    return 2
  elif i in s3:
    return 3
  else:
    return 0

if include(x) == include(y):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define fr(i, n) for (i = 0; i < n; i++)
#define rep(i, n) for (i = 1; i <= n; i++)
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#include <iostream>

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
const int M = 4;
LL dp[3000][3000][M];
LL val[3000][3000];
const LL INF = 100000000000000000;
LL len1, len2;
bool visited[3000][3000];

void solve(short x, short y)
{
    if (x < 0 || y < 0)
    {
        return;
    }
    else
    {
        if (visited[x][y])
        {
            return;
        }
        visited[x][y] = true;
        solve(x - 1, y);
        solve(x, y - 1);
        //0 now

        LL maxima = 0;
        if (x > 0)
        {
            for (short i = 0; i < M; i++)
            {
                maxima = max(maxima, dp[x - 1][y][i]);
            }
        }
        dp[x][y][0] = maxima;
        if (y > 0)
        {
            dp[x][y][0] = max(dp[x][y][0], dp[x][y - 1][0]);
        }

        //1 here->
        dp[x][y][1] = maxima+val[x][y];
        if (y > 0)
        {
            dp[x][y][1] = max(dp[x][y][1], dp[x][y - 1][1]);
        }

        //2 here
        dp[x][y][2] = val[x][y];
        if (y > 0)
        {
            dp[x][y][2] = max(val[x][y] + dp[x][y - 1][1], dp[x][y - 1][2]);
        }

        //3 here
        dp[x][y][3] = val[x][y];
        if (y > 0)
        {
            dp[x][y][3] = max(val[x][y] + dp[x][y - 1][2], dp[x][y - 1][3]);
        }
    }
}
int main()
{
    fastinput;
    LL n, i, j, k, t, temp, tc, c, r;
    cin >> len1 >> len2 >> k;
    for (i = 0; i < len1; i++)
    {
        for (j = 0; j < len2; j++)
        {
            val[i][j] = 0;
            visited[i][j] = false;
            for (t = 0; t < M; t++)
            {
                dp[i][j][t] = -INF;
            }
        }
    }

    for (i = 0; i < k; i++)
    {
        cin >> j >> t >> tc;
        j--;
        t--;
        val[j][t] = tc;
    }

    for (t = 0; t < M; t++)
    {
        dp[0][0][t] = val[0][0];
    }
    dp[0][0][0] = 0;
    visited[0][0] = true;
    solve(len1 - 1, len2 - 1);
    LL ans = 0;
    for (i = 0; i < M; i++)
    {
        ans = max(ans, dp[len1 - 1][len2 - 1][i]);
    }

    // for (i = 0; i < len1; i++)
    // {
    //     for (j = 0; j < len2; j++)
    //     {
    //         printf("%3lld ",val[i][j]);
    //     }
    //     printf("\n");
    // }
    // part;

    // for (i = 0; i < len1; i++)
    // {
    //     for (j = 0; j < len2; j++)
    //     {
    //         debug(val[i][j]);
    //         for (k = 0; k < M; k++)
    //         {
    //             cout << "dp[" << i << "][" << j << "][" << k << "] is " << dp[i][j][k] << endl;
    //         }
    //         part;
    //     }
    // }
    cout << ans << endl;
    //debug(ans);

    return 0;
}


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

int main() {
  int l,r,d;
  cin >> l >> r >> d;
  
  int ans = 0;
  for (int i = 1;i < 200;i++){
    if (l <= d*i && r >= d*i){
      ans++;
    }
  }
  
  cout << ans << endl;
}



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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int N, M, Q;
vector<int> a, b, c, d;
ll ans = 0;

ll solve(vector<int> &A) {
    ll cnt = 0;
    for (int i = 0; i < Q; i++) {
        if (A.at(b.at(i) - 1) - A.at(a.at(i) - 1) == c.at(i)) {
            cnt += d.at(i);
        }
    }
    return cnt;
}

ll dfs(vector<int> &A) {
    if (A.size() == N) {
        ans = max(ans, solve(A));
        return ans;
    }
    
    int prev;
    if (A.size() == 0) {
        prev = 1;
    }
    else {
        prev = A.back();
    }
    
    for (int v = prev; v <= M; v++) {
        A.push_back(v);
        dfs(A);
        A.pop_back();
    }
    return ans;
}

int main() {
    cin >> N >> M >> Q;
    a.resize(Q), b.resize(Q), c.resize(Q), d.resize(Q);
    for (int i = 0; i < Q; i++) {
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
    }
    vector<int> A;
    cout << dfs(A);
    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	cout<<max({a+b,a-b,a*b})<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100

typedef struct{ 
  int k;
  int v[N];
}G;

int main(){
  int u,k,n,i,j,l,flag;
  G A[N+1];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&A[u].k);
    for(j=0;j<A[u].k;j++){
      scanf("%d",&A[u].v[j]);
    }
  }
  
  for(i=1;i<n+1;i++){
    for(j=0;j<n;j++){
      flag = 0;
      //printf("a ");
      for(l=0;l<A[i].k;l++){
	if(j+1 == A[i].v[l]){
	  flag++;
	  if(j == n-1)printf("1");
	  else printf("1 ");
	  break;
	}	
      }
      if(flag == 0){
	if(j == n-1)printf("0");
	else printf("0 ");
      }

    }
    printf("\n");
  }

  return 0;
  
  
  
}



Measured memory_bytes: 2052
#include<stdio.h>
#include<math.h>

struct Pointtw{double x,y;};

void kochtw(int n,Pointtw a,Pointtw b){
    if(n==0)return;
    Pointtw s,t,u;
    double th = M_PI *60.0/180.0; 

    s.x=(2.0*a.x+1.0*b.x)/3.0;
    s.y=(2.0*a.y+1.0*b.y)/3.0;
    t.x=(1.0*a.x+2.0*b.x)/3.0;
    t.y=(1.0*a.y+2.0*b.y)/3.0;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

    kochtw(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    kochtw(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    kochtw(n-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
    kochtw(n-1,t,b);
}

int main(){
    Pointtw a,b;
    int n;

    scanf("%d",&n);

    a.x=0;
    a.y=0;
    b.x=100;
    b.y=0;

    printf("%.8f %.8f\n",a.x,a.y);
    kochtw(n,a,b);
    printf("%.8f %.8f\n",b.x,b.y);

    return 0;
}


Measured memory_bytes: 2612
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
ll dp[100001];
int q(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int main(void) {
  int h,r;
  scanf("%d %d",&h,&r);
  if(h<-r){
    PRN(-1);
  }else if(h==-r){
    PRN(0);
  }else{
    PRN(1);
  }
  return 0;
}


Measured memory_bytes: 2076
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい



void Main(){
	int a, b;
	cin >> a >> b;
	if(a >= 13) cout << b << endl;
	else if(a <= 12 && a >= 6) cout << b/2 << endl;
	else cout << 0 << endl;


}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
using namespace std;
#define INF 10000;

int main(void){
	while(true){
		int n,m,sumT = 0,sumH = 0;
		cin >> n >> m;
		vector<int> T(n), H(m);
		if(n == 0 && m == 0)break;
		for(int i = 0; i < n; i++){
			cin >> T[i];
			sumT += T[i];
		}
		for(int i = 0; i < m; i++){
			cin >> H[i];
			sumH += H[i];
		}
		int ans_t = -1, ans_h, ans_sum = INF;
		int new_sumT, new_sumH;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				new_sumT = sumT - T[i] + H[j];
				new_sumH = sumH + T[i] - H[j];
				if(new_sumH == new_sumT && T[i] + H[i] < ans_sum){
					ans_t = T[i];
					ans_h = H[j];
					ans_sum = ans_t + ans_h;
				}
			}
		}
		if(ans_t == -1){
			cout << -1 <<endl;
		}else{
			cout << ans_t << ' ' << ans_h << endl;
		}

	}
	return 0;
}


/*
int main(void)
{
	while(true){
		int n, m;
		int tarou_sum = 0, hanako_sum = 0;
		int tarou_changed_sum, hanako_changed_sum;
		cin >> n >> m;
		if(n == 0 && m == 0) break;
		vector<int> tarou(n), hanako(m);
		for(int i = 0; i < n; i++){
			cin >> tarou[i];
			tarou_sum += tarou[i];
		}
		for(int i = 0; i < m; i++){
			cin >> hanako[i];
			hanako_sum += hanako[i];
		}

		bool found = false;
		int tarou_answer, hanako_answer;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				tarou_changed_sum = tarou_sum - tarou[i] + hanako[j];
	 			hanako_changed_sum = hanako_sum - hanako[j] + tarou[i];
	 			if(tarou_changed_sum == hanako_changed_sum){
	 				if(found){
	 					if(tarou_answer + hanako_answer > tarou[i] + hanako[j]){
	 						tarou_answer = tarou[i];
	 						hanako_answer = hanako[j];
	 					}
	 				}else{
	 					found = true;
	 					tarou_answer = tarou[i];
	 					hanako_answer = hanako[j];
	 				}
	 			}else{
	 				continue;
	 			}


			}
		}

		if(found){
			cout << tarou_answer << ' ' << hanako_answer << endl;
		}else{
			cout << -1 << endl;
		}
	}
	return 0;
}

*/


Measured memory_bytes: 3104
num_input = int(input())

restaurants = []
for index in range(1, num_input+1):
    name, score_str = input().split(' ')
    reduced_score = 100 - int(score_str)
    restaurants.append((name, reduced_score, index))

restaurants.sort()

ordered_indexes = [index for _, _, index in restaurants]

for index in ordered_indexes:
    print(index)

exit(0)


Measured memory_bytes: 3060
n=int(input())
x=list(map(int,input().split()))
ans=10**12
cou=0

for i in range(min(x),max(x)+1):
  for j in range(n):
    cou+=(x[j]-i)**2
  if cou<ans:
    ans=cou
  cou=0  
print(ans)
  

Measured memory_bytes: 8988
/*

*/

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
using namespace std;

int main()
{
 	ios::sync_with_stdio(false);
	int a,b,c;
	int i,j,k;
	while(cin>>a>>b)
	{
		if(a%2==0||b%2==0)
		{
			cout<<"No"<<endl;
		}
		else
		{
			cout<<"Yes"<<endl;
		}
	 } 
	
	
	
	
	
	
	return 0;
}


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  FAST();

  int n;
  cin >> n;
  
  map<string, int> rec;

  REP(i, 0, n){
    string str;
    cin >> str;
    sort(all(str));
    rec[str]++;
  }

  ll ans = 0;
  for(auto x : rec){
    ans += 1LL * x.second * (x.second - 1) / 2;     // VVI - integer overflow when multiplying
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 11264
class SegmentTree:
    def __init__(self, size, f=lambda x, y: x + y, default=0):
        self.size = 2 ** (size - 1).bit_length()
        self.default = default
        self.dat = [default] * (self.size * 2)
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i * 2], self.dat[i * 2 + 1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res


n, q = map(int, input().split())
s = SegmentTree(n)
for i in range(q):
    com, x, y = map(int, input().split())
    x -= 1
    if com == 0:
        s.update(x, s.query(x, x + 1) + y)
    else:
        print(s.query(x, y))




Measured memory_bytes: 10736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS() std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
int f(int x)
{
	if(x==1) return 300000;
	if(x==2) return 200000;
	if(x==3) return 100000;
	return 0;
}
int main()
{

	IOS();
	int a,b;
	while(cin>>a>>b)
	{
		int ans=f(a)+f(b);
		if(ans==600000) ans+=400000;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  double n,y;
  while(cin>>n){
    if(n==0) break;
    cin >> y;
    double b,r,t,ans=0,ansb;
    for(int i=0;i<n;i++){
      cin >> b >> r >> t;
      if(t==1){
	if(ans<1+y*(r/100)){
	  ans = 1+y*(r/100);
	  ansb = b;
	}
      }
      else if(t==2){
	double k = 1+r/100;
	for(int i=1;i<y;i++) k *= 1+r/100;
	if(ans<k){
	  ans = k;
	  ansb = b;
	}
      }
    }
    cout << ansb << endl;
  }
  return 0;
}

Measured memory_bytes: 1276
#include "bits/stdc++.h"
// #define rep(i, n) for(int i = 0; i < (int)(n); i++)
// #define all(a) (a).begin(),(a).end()
// #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
// int gcd(int a, int b){return b ? gcd(b, a%b) : a;}

#define int long long
#define SIZE 100000

using namespace std;

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

  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  // int n; cin >> n;
  vector<pair<int, int>> p(3);
  for (auto it = p.begin(); it < p.end(); ++it) {
    cin >> (*it).first >> (*it).second;
  }

  array<int, 4> cnt;

  bool flag = true;
  for (auto it = cnt.begin(); it < cnt.end(); ++it) *it =0;
  for (auto it = p.begin(); it < p.end(); ++it) {
    ++cnt[(*it).first - 1];
    ++cnt[(*it).second - 1];
  }

  for (auto it = cnt.begin(); it < cnt.end(); ++it) if (*it > 2 || *it < 1) flag = false;

  if (flag) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  // array<int, SIZE> a;
  // for (auto it = a.begin(); it < a.begin() + n; ++it) cin >> *it;
  // for (auto it = a.begin(); it < a.begin() + n; ++it) num += *it;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
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));i>=((int)(a));i--)
typedef long long ll;

/*
単調増加にすれば十分か？
*/

ll n,c[10010],d[10010]={},cnt=0,ans=0;
vector<ll> v[10010];

void init(){
	cin>>n;
	rep(i,n-1){
		ll a,b;
		cin>>a>>b;
		v[a-1].push_back(b-1);
		v[b-1].push_back(a-1);
	}
	rep(i,n)cin>>c[i];
	sort(c,c+n);
}

int main(void){
	init();
	int deg_max=0;
	queue<ll> Q;
	Q.push(0);
	d[0]=c[n-1-cnt];
	while(!Q.empty()){
		ll p=Q.front();Q.pop();
		for(ll q:v[p]){
			if(d[q]==0){
				cnt++;
				d[q]=c[n-1-cnt];
				ans+=c[n-1-cnt];
				Q.push(q);
			}
		}
	}
	cout<<ans<<endl;
	rep(i,n)cout<<d[i]<<(i<n-1?" ":"");
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>

using namespace std;

int main(void)
{
  int x; cin>>x;
  
  if((400<=x)&&(x<=599)){
    cout<<"8"<<endl;
  }else if((600<=x)&&(x<=799)){
    cout<<"7"<<endl;
  }else if((800<=x)&&(x<=999)){
    cout<<"6"<<endl;
  }else if((1000<=x)&&(x<=1199)){
    cout<<"5"<<endl;
  }else if((1200<=x)&&(x<=1399)){
    cout<<"4"<<endl;
  }else if((1400<=x)&&(x<=1599)){
    cout<<"3"<<endl;
  }else if((1600<=x)&&(x<=1799)){
    cout<<"2"<<endl;
  }else if((1800<=x)&&(x<=1999)){
    cout<<"1"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3672
import sys
input = sys.stdin.readline
INF = 10**20
MOD = 10**9 + 7
from bisect import insort_left

def main():
    n,k = map(int,input().split())
    XY = [tuple(map(int,input().split())) for _ in range(n)]  
    XY.sort(key = lambda x:x[0])
    
    ans = INF
    for l in range(n - k + 1):
        Y = [XY[i][1] for i in range(l,l + k - 1)]
        Y.sort()
        dif = -1
        for r in range(l + k - 1, n):
            dif += 1
            insort_left(Y,XY[r][1])
            w = INF
            for i in range(dif + 1):
                w = min(w, Y[i + k - 1] - Y[i])
            ans = min(ans, w * (XY[r][0] - XY[l][0]))
    
    print(ans)   

if __name__=='__main__':
    main()

Measured memory_bytes: 3064
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;
	static int[] par, dep, ch;

	static void solve() {
		char[] s=ir.next().toCharArray();
		out.println(s[1]==s[2]&&(s[0]==s[1]||s[3]==s[2])?"Yes":"No");
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
const int MOD = 1000000007;
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;

  cin >> a >> b >> c;
  if(a == 1 && b == 1 && c == 0 || a == 0 && b == 0 && c == 1){
    cout << "Open" << endl;
  }else{
    cout << "Close" << endl;
  }
  return 0;
}




Measured memory_bytes: 3208
n=int(input())
a=sorted(list(map(int,input().split())))
c=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if a[k]<a[i]+a[j] and a[k]!=a[j] and a[j]!=a[i] and a[i]!=a[k]:
                c+=1
print(c)

Measured memory_bytes: 9184
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define MOD 1000000007LL

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
  
int main()
{
	string s;
  cin>>s;
  bool ac=1;
  if(s[0]!='A') ac=0;
  int c=0;
  int n=s.size();
  for(int i=2; i<=n-2; i++){
    if(s[i]=='C') c++;
  }
  if(c!=1) ac=0;
  for(int i=1; i<n; i++){
    if(s[i]!='C' && !((s[i]-'a')>=0 && (s[i]-'a')<26)) ac=0;
  }
  if(ac){
    cout<<"AC"<<endl;
  }else{
    cout<<"WA"<<endl;
  }
    return 0;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())
if b - a + 1 <= k:
    for i in range(a, b + 1):
        print(i)
    exit()
ans = sorted(list(set(range(a, a + k)) | set(range(b - k + 1, b + 1))))
for i in ans:
    print(i)


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string s;
    cin >> s;
    map<char, int> m;
    for(int i = 0; i < s.size(); i++){
        m[s[i]]++;
    }
    bool enter = false;
    for(map<char, int> :: iterator it = m.begin(); it != m.end(); it++){
        if(it->second == 2){
            enter = true;
        }
        else{
            enter = false;
            cout << "No";
            return 0;
        }
    }
    if(enter == true){
        cout << "Yes";
    }
    else cout << "No";
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

H, W, k = LI()
x1, y1, x2, y2 = LI()
maze = [input() for _ in range(H)]
dp = [[10**10] * W for _ in range(H)]
dx, dy = [0, 1, 0, -1], [1, 0, -1, 0]
que = deque()
que.append((x1-1, y1-1))
dp[x1-1][y1-1] = 0
while que:
    y, x = que.popleft()
    dist = dp[y][x]
    if y == x2 - 1 and x == y2 - 1:
        print(dist)
        quit()
    for i in range(4):
        dy_, dx_ = dy[i], dx[i]
        ny, nx = y, x
        for _ in range(1, k+1):
            ny, nx = ny + dy_, nx + dx_ 
            if 0 <= ny < H and 0 <= nx < W:
                if maze[ny][nx] == '@':
                    break
                if dist + 1 < dp[ny][nx]:
                    dp[ny][nx] = dist + 1
                    que.append((ny, nx))
                if dist + 1 > dp[ny][nx]:
                    break
            else:
                break
print(-1)


            
    


Measured memory_bytes: 95768
#include <iostream>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
using Graph = vector<vector<int>>;
using Graph_Wei = vector<vector<pair<int,int>>>;
using ll = long long;

//長さを記録する
Graph_Wei graph_wei;
// 二部グラフ判定
vector<int> color;
void dfs(const Graph_Wei &G, int v, int w,int cur = 0) {

    for (auto next_v : G[v]) {
        //訪問ずみならスルー
        if(color[next_v.first] != -1) continue;
        //first:頂点番号　second:長さ
        w += next_v.second;

        //距離が偶数の時、同色
        if(w % 2 == 0){
            color[next_v.first] = cur;
        }else{
            color[next_v.first] = 1 - cur;
        }
        
        dfs(G, next_v.first, w);
          
    }  
}

int main() {
    
    int n;
    string s;
    cin >> n >> s;

    //1文字取り出す
    //次の文字が同じである間繰り返す
    int count = 1;
    bool flag = false;
    for(int i =0;i < n;){
        if(flag || i == n-1) break;
        for(int j = i+1 ;j < n;j++){
            //ちがう文字みっけたら終わり
            if(s[i] != s[j]){
                i = j;
                count++;
                break;
                if(j >= n-1) flag = true;
            }

            if(j >= n-1) flag = true;


        }


    }

    cout << count << endl;


    return 0;

}

Measured memory_bytes: 512
class Array
  def gcd
    self.inject(:gcd)
  end
end

n,inix=gets.chomp.split(" ").map(&:to_i);
x = []
x=gets.chomp.split(" ").map(&:to_i);
x.push(inix)
xmin = x.min
x.map! do|i|
  i=i-xmin
end
puts x.gcd


Measured memory_bytes: 11524
#include <cstdio>

using namespace std;

int concat(int a, int b){
  int t = 0, d=0;
  int ret = a;
  while (b){
    t = t*10 + b%10;
    b /= 10;
    d++;
  }
  for (int i=0; i<d; i++){
    ret = ret*10 + t%10;
    t /= 10;
  }
  return ret;
}

int main(void){
  int a,b,c;
  int flg = 0;
  
  scanf("%d%d", &a, &b);
  c = concat(a,b);
//  printf("%d\n", c);
  for (int i=0; i*i<=c; i++) flg |= i*i==c;
  puts(flg?"Yes":"No");
  
  return 0;
}

Measured memory_bytes: 128
def main():
    n = int(input())
    As = sorted(list(map(int, input().split())))[::-1]

    alice = 0
    bob = 0
    for i in range(n):
        if i % 2 == 0:
            alice += As[i]
        else:
            bob += As[i]

    ans = alice - bob
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<string> S(N);
	for (int i = 0; i < N; ++i) cin >> S[i];
	vector<string> S_sort = S;
	sort(S_sort.begin(), S_sort.end());
	S_sort.erase(unique(S_sort.begin(), S_sort.end()), S_sort.end());
	if (S_sort.size() != N) {
		cout << "No" << endl;
	}
	else {
		bool ok = true;
		for (int i = 1; i < N; ++i) {
			if (S[i - 1].back() != S[i].front()) {
				ok = false;
			}
		}
		cout << (ok ? "Yes" : "No") << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long double A,B;
	float x=10,y=100 , z=0;

	cin>>A;
	cin>>B;
	if(1<=A && A<=pow(10,100))
	{
		if(1<=B && B<=pow(10,100))
		{
			if(A>B)
			{
				printf("GREATER");
			}
			else if(A<B)
			{
				printf("LESS");
			}
			else
			{
				printf("EQUAL");	
			}
		}
		else
		{
		printf("Error");
		}
	}
	else
	{
		printf("Error");
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int a[105];
void out(int a[],int n){
	for(int i=1;i<=n;i++){
		if(i>1){
			printf(" ");
		}
	    printf("%d",a[i]);
	}
    printf("\n");
}
void SSort(int a[], int n){
	int v,j;
	for(int i=2;i<=n;i++){
		v=a[i];
		j=i-1;
		while(j>0&&a[j]>v){
			a[j+1]=a[j];
			j--;
		} 
	a[j+1]=v;
	out(a,n);
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	out(a,n);
	SSort(a,n);
    return 0;
}



Measured memory_bytes: 3180
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	final long MODULO = 1_000_000_000 + 7;

	void run() throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();// 積み木の総数
		int m = sc.nextInt();// 操作回数
		/*
		 * dp[i][j][k]:=i回目の操作まで終えたとき(k=0ならば左端に到達せずに、k=1ならば左端に訪れて）j番目に到達する経路数
		 */

		long[][][] dp = new long[2][n + 1][2];
		for (int i = 0; i <= n; ++i) {
			if (i != 0)
				dp[0][i][0] = 1;
			else
				dp[0][i][1] = 1;
		}

		for (int i = 0; i < m; ++i) {
			for (int j = 0; j <= n; ++j) {
				for (int k = 0; k < 2; ++k) {

					// 左に移動
					if (j - 1 >= 0) {
						if (j - 1 > 0)
							dp[(i + 1) % 2][j - 1][k] += dp[i % 2][j][k];
						else
							dp[(i + 1) % 2][j - 1][1] += dp[i % 2][j][k];
					}
					// 右に移動
					if (j + 1 <= n) {
						dp[(i + 1) % 2][j + 1][k] += dp[i % 2][j][k];
					}

					// 左を経由して元の位置に移動
					if (j - 1 >= 0) {
						if (j - 1 > 0) {
							dp[(i + 1) % 2][j][k] += dp[i % 2][j][k];
						} else if (j - 1 == 0) {
							dp[(i + 1) % 2][j][1] += dp[i % 2][j][k];
						}
					}

					// 右を経由して元の位置に移動
					if (j + 1 <= n) {
						dp[(i + 1) % 2][j][k] += dp[i % 2][j][k];
					}

				}
			}
			for (int j = 0; j <= n; ++j) {
				for (int k = 0; k < 2; ++k) {
					dp[(i + 1) % 2][j][k] %= MODULO;
				}
			}
			dp[i % 2] = new long[n + 1][2];
		}

		long ans = 0;
		for (int i = 0; i <= n; ++i) {
			ans = (ans + dp[m % 2][i][1]) % MODULO;
		}
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 98944
from collections import Counter
from heapq import heappush, heappop

n, k = map(int, input().split())
s = []
for _ in range(n):
    t, d = map(int, input().split())
    s.append((d, t))
s.sort()
bp = 0
x = 0
c = Counter()
cand = []
for _ in range(k):
    d, t = s.pop()
    bp += d
    if c[t] == 0:
        x += 1
    c[t] += 1
    heappush(cand, (d, t))
ans = bp + x * x
while s:
    d, t = s.pop()
    if c[t] == 0:
        while cand:
            dd, td = heappop(cand)
            if c[td] == 1:
                continue
            else:
                c[td] -= 1
                bp -= dd
                break
        else:
            break
        bp += d
        x += 1
        c[t] = 1
        ans = max(ans, bp + x * x)
print(ans)


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

int main()
{
	int x;
  cin >> x;
  int arr[x],dp[x];
  for (int i=0;i<x;i++)
    cin >> arr[i];
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for (int i=2;i<x;i++)
    dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
              cout << dp[x-1];
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		if(x<=599) {
			System.out.println(8);
		}
		else if(x<=799) {
			System.out.println(7);
		}
		else if(x<=999) {
			System.out.println(6);
		}
		else if(x<=1199) {
			System.out.println(5);
		}
		else if(x<=1399) {
			System.out.println(4);
		}
		else if(x<=1599) {
			System.out.println(3);
		}
		else if(x<=1799) {
			System.out.println(2);
		}
		else if(x<=1999) {
			System.out.println(1);
		}
		
	}

}

Measured memory_bytes: 35732
#include <cstdio>
#include <cstdlib>
using namespace std;
const int N=100010;
const int INF=1e9;
int n,originN;
int deg[N];
int h[N],tot;
struct Edge{
	int v,next;
}e[N*2];
int col[N]; // 0:black 1:white
int whiteSum,firstWhite;
inline int min(int x,int y){
	return x<y?x:y;
}
inline int max(int x,int y){
	return x>y?x:y;
}
void addEdge(int u,int v){
	e[++tot]=(Edge){v,h[u]}; h[u]=tot;
	e[++tot]=(Edge){u,h[v]}; h[v]=tot;
}
void readData(){
	scanf("%d",&n);
	originN=n;
	int u,v;
	for(int i=1;i<n;i++){
		scanf("%d%d",&u,&v);
		addEdge(u,v);
	}
	static char str[N];
	scanf("%s",str+1);
	for(int i=1;i<=n;i++){
		col[i]=(str[i]=='W');
		whiteSum+=col[i];
		if(col[i]&&!firstWhite)
			firstWhite=i;
	}
}
bool del[N];
bool haveWhite[N];
int originNeed;
int maxMinus;
int f[N];
void deleteUseless(int u,int fa){
	haveWhite[u]=(col[u]==1);
	for(int i=h[u],v;i;i=e[i].next)
		if((v=e[i].v)!=fa){
			deleteUseless(v,u);
			if(!haveWhite[v]){
				n--;
				del[v]=true;
			}
			else{
				haveWhite[u]|=haveWhite[v];
				deg[u]++;
				deg[v]++;
			}
		}
}
int getRoot(){
	for(int u=1;u<=originN;u++)
		if(!del[u]&&deg[u]>1)
			return u;
	return -1; // unexpected
}
void dfs(int u,int fa){
	int type=(col[u]&1)^(deg[u]&1);
	originNeed+=(type==1);
	f[u]=-INF;
	bool haveSon=false;
	for(int i=h[u],v;i;i=e[i].next)
		if((v=e[i].v)!=fa&&!del[v]){
			haveSon=true;
			dfs(v,u);
			if(f[u]!=-INF)
				maxMinus=max(maxMinus,f[u]+f[v]);
			f[u]=max(f[u],f[v]+1+(type==1)-(type==0));
		}
	if(!haveSon) // leaf
		f[u]=1+(type==1)-(type==0);
}
void check(){
	if(whiteSum<=1){
		printf("%d\n",whiteSum);
		exit(0);
	}
	if(n==2){
		puts("2");
		exit(0);
	}
}
int main(){
	readData();
	check();
	deleteUseless(firstWhite,0);
	check();
	originNeed=(n-1)*2; // for each edge twice
	maxMinus=-INF;
	int rt=getRoot();
	dfs(rt,0);
	printf("%d\n",originNeed-maxMinus);
	return 0;
}


Measured memory_bytes: 10496