akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int H, W, K;
  cin >> H >> W >> K;

  vector<int> f = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55};

  vector<vector<int>> dp(H + 10, vector<int>(W + 10, 0));
  dp.at(0).at(0) = 1;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if (j > 0)
      {
        dp.at(i + 1).at(j - 1) += dp.at(i).at(j) 
           * ((f.at(j - 1) * f.at(W - j - 1)) % MOD) % MOD;
        dp.at(i + 1).at(j - 1) %= MOD;
      }

      dp.at(i + 1).at(j) += dp.at(i).at(j)
        * ((f.at(j) * f.at(W - j - 1)) % MOD) % MOD;
      dp.at(i + 1).at(j) %= MOD;

      if (j < W - 1)
      {
        dp.at(i + 1).at(j + 1) += dp.at(i).at(j)
          * ((f.at(j) * f.at(W - j - 2)) % MOD) % MOD;
        dp.at(i + 1).at(j + 1) %= MOD;
      }
    }
  }
  
  int ans = dp.at(H).at(K - 1);
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

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

  private static class City {
    int p;
    int y;
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int m = sc.nextInt();

    List<City> cities = new ArrayList<>(m);
    for (int i = 0; i < m; i++) {
      int p = sc.nextInt();
      int y = sc.nextInt();
      City c = new City();
      c.p = p;
      c.y = y;
      cities.add(c);
   }

    Map<Integer, List<City>> prefToCity = new HashMap<>();

    for (City c : cities) {
      List<City> list = prefToCity.getOrDefault(c.p, new ArrayList<>());
      list.add(c);
      prefToCity.put(c.p, list);
    }

    Map<City, Integer> indexOfPref = new HashMap<>();
    for (List<City> list : prefToCity.values()) {
      list.sort(Comparator.comparingInt(c -> c.y));
      for (int i = 0; i < list.size(); i++) {
        indexOfPref.put(list.get(i), i + 1);
      }
    }

    List<String> res = new ArrayList<>();
    for (int i = 0; i < m; i++) {
      City c = cities.get(i);
      res.add(String.format("%06d%06d", c.p, indexOfPref.get(c)));
    }
    os.println(String.join(System.lineSeparator(), res));
  }
}


Measured memory_bytes: 173368
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
	N = int(input())
	# = list(input())
	#A,B = map(int, input().split(" "))
	PP = list(map(int, input().split(" ")))
 
	flg = True
	for k,val in enumerate(PP):
		if k == 0:
			continue
		if PP[k-1] <= val:
			pass
		else:
			flg = False
 
	if flg == True:
		print("YES")
		sys.exit()
 
	tmp = []
	for i in range(N):
		for j in range(i+1, N):
			P = copy.deepcopy(PP)
			tmp = copy.deepcopy(P[i])
			P[i] = copy.deepcopy(P[j])
			P[j] = copy.deepcopy(tmp)
			
			flg = True
			for k,val in enumerate(P):
				if k == 0:
					continue
				if P[k-1] <= val:
					pass
				else:
					flg = False
			
			if flg == True:
				print("YES")
				sys.exit()
 
	print("NO")
            	
if __name__ == "__main__":
	main()


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

int main() {
  int N;
  cin >> N;
  vector<vector<int>>data(2,vector<int>(N));
  for(int i=0;i<N;i++){
    cin >> data.at(0).at(i);
  }
  for(int i=0;i<N;i++){
    cin >> data.at(1).at(i);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    int x=0;
    for(int j=0;j<=i;j++){
      x+=data.at(0).at(j);
    }
    for(int j=i;j<N;j++){
      x+=data.at(1).at(j);
    }
    ans=max(ans,x);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
import java.util.*

fun main(args : Array<String>) {
    val sc = Scanner(System.`in`)

    var N = sc.nextInt()
    val M = sc.nextFloat()
    var total = 0F
    var A = mutableListOf<Float>()
    for(i in 0 until N) {
        val a = sc.nextFloat()
        A.add(a)
        total += a
    }

    var cnt = 0
    val min = total / (4F * M)
    for (i in 0 until N) {
        if (A[i] >= min) {
            cnt++
        }
    }
    if (cnt >= M) {
        println("Yes")
    } else {
        println("No")
    }
}


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

#define mx 100005
#define ll long long 

int ar[mx];
char ch[mx];

int m,n,k,ii;


void solve()
{
	cin>>n;
	if(n%2==0)
	{
		cout<<-1<<endl;
		return;
	}
	int cnt=0;
	ll hate=0;
	while(1)
	{
       cnt++;
       hate*=10;
       hate+=7;
       hate%=n;
       if(hate==0)break;
       if(cnt>1000000)
       {
       	cout<<-1<<endl;
       	return;
       }
	}
	cout<<cnt<<endl;
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif

	int t=1;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define int long long
using namespace std;

const int N = 60;
int cnt[11][11];

int get_first(int x) {
  return (int)(x / (int)pow(10, (int)log10(x)));
}

int get_last(int x) {
  return x % 10;
}

signed main () {
  boost();
  int n; cin >> n;
  for (int i = 1; i <= n; i++) {
    cnt[get_first(i)][get_last(i)]++;
  }
  int res = 0;
  for (int i = 1; i <= n; i++) {
    int x = get_first(i);
    int y = get_last(i);
    res += cnt[y][x];
  }
  cout << res << endl;
}


Measured memory_bytes: 640
n,m = map(int,input().split())

maru = [0]*n
pena = [0]*n

for i in range(m):
    p,s = input().split()
    p = int(p)
    if s =="AC":
        maru[p-1] = 1
    else:
        if maru[p-1]==0:
            pena[p-1]+=1

penapena = [maru[i]*pena[i] for i in range(n)]

print(maru.count(1),sum(penapena))

Measured memory_bytes: 11412
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
ll n;
ll h[100005],t[100005];
ll a,b,L=1ll,R,ans,mid;
/*---define function---*/

bool check(ll x)
{
	ll res=0ll;
	memcpy(t,h,sizeof(h));
	ll damage=x*b;
	for(ll i=1;i<=n;++i)
	{
		t[i]-=damage;
	}
	ll dif=a-b;
	for(ll i=1;i<=n;++i)
	{
		if(t[i]>0)
		{
			if(t[i]%dif!=0)
			{
				res+=t[i]/dif+1;
			}
			else
			{
				res+=t[i]/dif;
			}
		}

	}
	return res<=x;
}

/*---main code---*/
int main()
{
	FIO;
	cin>>n>>a>>b;
	for(int i=1;i<=n;++i)
	{
		cin>>h[i];
	}
	sort(h+1,h+n+1);
	R=1e9;
	while(L<=R)
	{
		mid=(L+R)>>1;
		if(check(mid))
		{
			ans=mid;
			R=mid-1;
		}
		else
		{
			L=mid+1;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1792
using System;

class Program
{
    static void Main(string[] args)
    {
        var abt = Console.ReadLine().Split();
        var a = int.Parse(abt[0]);
        var b = int.Parse(abt[1]);
        var t = int.Parse(abt[2]);

        var ans = t / a * b;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <cxxabi.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    ((ll)1ll<60)
#define INF     ((int)1<<30)
#define EPS     (1e-9)
#define MOD     (1000000007)
template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool b=1;for(auto s:t)os<<(exchange(b,0)||strlen(abi::__cxa_demangle(typeid(S).name(),0,0,0))>20?"":" ")<<s;return os<<endl;}

constexpr int gcd(int a,int b){return b?gcd(b,a%b):a;}
constexpr int lcm(int a,int b){return a*b/gcd(a,b);}

int ma;

int solve(int p, int q, int r, int a, int n){
	int ans=0;
	if(p==0) return 1;
	if(n==0) return 0;
	for(int nq=r;a*nq<=ma;nq++){
		if(p*nq>n*q) break;
		if(p*nq>=q){
			int P=p*nq-q;
			int Q=q*nq;
			ans+=solve(P/gcd(P,Q),Q/gcd(P,Q),nq,a*nq,n-1);
		}
	}
	return ans;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int p,q,n;
	while(cin>>p>>q>>ma>>n,p){
		cout<<solve(p,q,1,1,n)<<endl;
	}
	return 0;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
bool calc(int num){
  int count=0;
  for(int i=1;i<=num;i++){
    count+=(num%i==0);
    if(count>8)break;
  }
  return count==8;
}
int main(){
  int n;cin>>n;
  int count=0;
  for(int i=1;i<=n;i+=2){
    count += calc(i);
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

void show(vector< pair<char, int> > &a) {
	int n = a.size();
	for (int i = 0; i < n; i++) {
		printf("%c%d%c", a[i].first, a[i].second, i == n - 1 ? '\n' : ' ');
	}
}

void selection_sort(vector< pair<char, int> > &a) {
	int n = a.size();
	int pos;
	for (int i = 0; i < n; i++) {
		pos = i;
		for (int j = i; j < n; j++) {
			if (a[j].second < a[pos].second) {
				pos = j;
			}
		}
		swap(a[i], a[pos]);
	}
}

void bubble_sort(vector< pair<char, int> > &a) {
	int n = a.size();
	bool hasNext = true;
	while (hasNext) {
		hasNext = false;
		for (int i = n - 1; i >= 1; i--) {
			if (a[i].second < a[i - 1].second) {
				swap(a[i], a[i - 1]);
				hasNext = true;
			}
		}
	}
}

void stable_sort(vector< pair<char, int> > &a) {
	auto tmp = a;
	int n = a.size();
	vector<bool> used(n, false);

	for (int i = 0; i < n; i++) {
		int pos = -1;
		for (int j = 0; j < n; j++) {
			if (used[j]) {
				continue;
			}
			if (pos == -1) {
				pos = j;
			}
			if (tmp[j].second < tmp[pos].second) {
				pos = j;
			}
		}
		used[pos] = true;
		a[i] = tmp[pos];
	}
}

int main() {
	int n, num;
	char suit;
	string input;

	cin >> n;
	vector< pair<char, int> > cards(n), sort1, sort2, sort3;
	for (int i = 0; i < n; i++) {
		cin >> input;
		suit = input[0];
		num = input[1] - '0';
		cards[i] = make_pair(suit, num);
	}


	sort1 = sort2 = sort3 = cards;
	bubble_sort(sort1);
	selection_sort(sort2);
	stable_sort(sort3);

	show(sort1);
	printf("%s\n", sort1 == sort3 ? "Stable" : "Not stable");
	show(sort2);
	printf("%s\n", sort2 == sort3 ? "Stable" : "Not stable");

	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b ;
    //*/

    /*
    vector<int> vec(4);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    //*
    if( a <= 8 && b <= 8 ){
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
    //*/
    
    //cout << max(a * b, max(a + b, a - b) ) << endl;

    return 0; 
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

struct event {
    ll t, type, val;
    bool operator<(const event &a) {
        return t < a.t;
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    vector<event> eves;
    vector<int> D(q);
    for(int i = 0; i < n; i++) {
        ll s,t,x;
        cin >> s >> t >> x;
        eves.push_back({s-x, 1, x});
        eves.push_back({t-x, -1, x});
    }
    for(int i = 0; i < q; i++) {
        cin >> D[i];
    }
    sort(eves.begin(), eves.end());

    int k = 0;
    multiset<ll> s; 
    for(int i = 0; i < q; i++) {
        ll now = D[i];
        while(k < eves.size() && eves[k].t <= now) {
            if(eves[k].type == 1) {
                s.insert(eves[k].val);
            }else{
                s.erase(s.find(eves[k].val));
            }
            k++;
        }

        if(s.empty()) {
            cout << -1 << endl;
        }else {
            cout << *s.begin() << endl;
        }
    }
    
}

Measured memory_bytes: 21096
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


############ ---- Input Functions ---- ############
def in_int():
    return (int(input()))


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


def in_str():
    s = input()
    return (list(s[:len(s) - 1]))


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

mod = 7 + 10**9

n, k = in_ints()

ans = 0
for p in range(k, n+2):
    ans = (ans + p*(n+1-p) + 1)%mod


print(ans)

Measured memory_bytes: 9220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input = br.readLine();
		
		if(input.length() <= 3){
			System.out.println("No");
		}
		
		else if(input.subSequence(0, 4).equals("YAKI")){
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 23124
import sys

class Card:

	def __init__(self, card):
		self.card = card
		self.mark = card[0]
		self.value = int(card[1])

	def __str__(self):
		return self.card

def print_arr(arr):
	for i in range(len(arr)):
		sys.stdout.write(str(arr[i]))
		if i != len(arr) - 1:
			sys.stdout.write(' ')
	print()

def swap(arr, i, j):
	temp = arr[i]
	arr[i] = arr[j]
	arr[j] = temp

def bubble_sort(arr, n):
	swap_count = 0
	for i in range(0, n):
		for j in range(n - 1, i, -1):
			if arr[j].value < arr[j - 1].value:
				swap(arr, j, j - 1)
				swap_count += 1
	return swap_count

def selection_sort(arr, n):
	stable = True
	for i in range(n):
		minj = i
		for j in range(i, n):
			if arr[j].value < arr[minj].value:
				minj = j
		if minj != i:
			for k in range(i + 1, minj):
				if arr[k].value == arr[i].value: stable = False
			swap(arr, i, minj)
	return stable

n = int(input())
arr = list(map(str, input().split()))
cards1 = [None] * n
cards2 = [None] * n
for i in range(n):
	cards1[i] = Card(arr[i])
	cards2[i] = Card(arr[i])

swap_count = bubble_sort(cards1, n)
stable = selection_sort(cards2, n)

print_arr(cards1)
print('Stable')
print_arr(cards2)
if stable == True:
	print('Stable')
else:
	print('Not stable')


Measured memory_bytes: 5624
#include <stdio.h>

int main()
{
    int N,sub;
    int i,k=0,l=0;
    scanf("%d",&N);
    if(N%2==0){
        N=N-1;
    }

    for(sub=N;sub>1;sub-=2){
        for(i=1;i<=sub;i++){
            if(sub%i==0){
                k++;
            }
        }

        if(k==8){
            l++;
        }
        
        k = 0;
    }

    printf("%d",l);
    return 0;
}

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

bool check(const vector<int> &b){
	for(int i=0 ; i < b.size() ; i++ ){
		if( i+1 != b[i] ) return false;
	}
	return true;
}

int main(){
	int N;
	while( cin >> N , N ){
		vector<int> b(N);
		for(int i=0 ; i < N ; i++ ) cin >> b[i];
		
		bool f = false;
		int ans = 100000;
		for(int i=0 ; i <= 10000 ; i++ ){
			
			if( check(b) ){
				f = true;
				cout << i << endl;
				break;
			}
			for(int j=0 ; j < b.size() ; j++ ){
				b[j]--;
			}
			b.push_back(b.size());
			vector<int> tmp;
			for(int j=0 ; j < b.size() ; j++ ){
				if( b[j] != 0 ) tmp.push_back( b[j] );
			}
			b = tmp;
		}
		if( !f ){
			cout << -1 << endl;
		}
	}
}

Measured memory_bytes: 1244
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

vector<ll> as;

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

    as.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    reverse(as.begin(), as.end());

    priority_queue<ll> pq;
    pq.push(as[0]);

    ll ans = 0;
    for (int i = 1; i < N; i++) {
        ll v = pq.top();
        pq.pop();

        ans += v;
        pq.push(as[i]);
        pq.push(as[i]);
    }


    cout << ans << endl;

    return 0;
}


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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
 
const ll MAX = 3e5;
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll p[MAX],sz[MAX];

ll find(ll u){
	return (p[u] == u? u:p[u] = find(p[u]));
}


void uni(ll u,ll v){
	ll x = find(u), y= find(v);
	if(x == y) return;
	p[y] = x;
	sz[x] += sz[y];
}


int main(){
	fastio;
	ll n,m,u,v,ans = 0;
	cin >> n >> m;
	f(i,1,n+1) p[i] = i,sz[i] = 1;
	f(i,0,m){
		cin >> u >> v;
		uni(u,v);
	}
	f(i,1,n+1) if(find(i) == i) ans = max(ans,sz[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6948
def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False

    for i in range(3, int(x ** 0.5) + 1, 2):
        if x % i == 0:
            return False

    return True

n = int(input())
cnt = 0
for _ in range(n):
    i = int(input())
    cnt += isPrime(i)

print(cnt)


Measured memory_bytes: 5672
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

bool great(const pair<int, int>& l, const pair<int, int>& r) {
	if (l.second == r.second) return l.first < r.first;
	else return l.second > r.second;
}

int main(){
	int n,a,b;
	vector<pair<int, int> > v;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}
	sort(v.begin(), v.end(), great);
	cout << v[0].first << " " << v[0].second << endl;
	return 0;
}

Measured memory_bytes: 1208
# https://atcoder.jp/contests/agc033/tasks/agc033_a

from collections import deque
h, w = map(int, input().split())

matrix = []
for _ in range(h):
    matrix.append(list(input()))

def bfs(matrix):
    # 上、右、下、左
    dy = [-1, 0, 1, 0]
    dx = [0, 1, 0, -1]
    q = deque()
    for i in range(h):
        for j in range(w):
            if matrix[i][j] == '#':
                q.append((i, j))
    ans = 0
    next_q = deque()
    while q:
        y, x = q.popleft()
        for i in range(4):
            next_y = dy[i] + y
            next_x = dx[i] + x
            if 0 <= next_y < h and 0 <= next_x < w and matrix[next_y][next_x] == '.':
                matrix[next_y][next_x] = '#'
                next_q.append((next_y, next_x))
        if not q and next_q:
            q = next_q
            next_q = deque()
            ans += 1
    return ans

ans = bfs(matrix)
print(ans)

Measured memory_bytes: 146796
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let d: usize = iterator.next().unwrap().parse().unwrap();
    let t: usize = iterator.next().unwrap().parse().unwrap();
    let s: usize = iterator.next().unwrap().parse().unwrap();

    if d <= s * t {
        "Yes".to_string()
    } else {
        "No".to_string()
    }
}


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

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,T,A;
vector<int> H;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N >> T >> A;
    H = fetch_vec<int>(N);
}

int solve(){
    vector<double> tmp;
    for (int i = 0; i < N; i++)
    {
        tmp.push_back(abs(T-H[i]*0.006-A));
    }
    auto itr = min_element(tmp.begin(),tmp.end());
    cout << itr-tmp.begin()+1 << endl;    
    return 0;
}   

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int R,C;
int maze[15][10005];
int res;
void rev(int n){
	for(int i=0;i<C;i++){
		maze[n][i]=maze[n][i]^1;
	}
}
int Calc(){
	int sum = 0;
	for(int i=0;i<C;i++){
		int cnt = 0;
		for(int j=0;j<R;j++){
			cnt +=maze[j][i];
		}
		sum += max(cnt,R-cnt);
	} 
	return sum;
}
void dfs(int n){
	if(n==R){
		res = max(res, Calc());
		return;
	}
	rev(n);
	dfs(n+1);
	rev(n);
	dfs(n+1);
}
int main(){
	while(scanf("%d%d",&R,&C)==2){
		res = 0;
		if(R==0&&C==0) break;
		for(int i=0;i<R;i++){
			for(int j=0;j<C;j++){
				scanf("%d",&maze[i][j]);
			}
		}
		dfs(0); 
		cout<<res<<endl;
	}
	return 0; 
} 


Measured memory_bytes: 3524
#include<iostream>
#include<string>
using namespace std;
int main()
{string s;int k=0;
 string t;
 getline(cin,s);
 getline(cin,t);
 for (int i=0;i<3;i++)
 { if (s[i]==t[i])
   {k++;
   }
 
 }
cout<<k;
 return 0;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ot(x) cout<<x<<" ";
#define pb push_back
#define in insert
#define ll long long int
#define YES cout<<"YES"<<"\n";
#define NO cout<<"NO"<<"\n";
#define ld long double
#define yes cout<<"yes"<<"\n";
#define no cout<<"no"<<"\n";
#define fa(i,a) for(auto i:a)
#define No cout<<"No"<<"\n";
#define Yes cout<<"Yes"<<"\n";
#define f(i,a) for(i=0;i<a;i++)
#define f1(i,a) for(i=1;i<=a;i++)
#define f2(i,a) for(i=2;i<=a;i++)
#define fy(i,a) for(auto i:a)
#define next cout<<"\n";
#define ull unsigned long long int
#define sp(n) cout<<fixed<<setprecision(n);
#define  gcd(a,b)    __gcd(a,b)
#define bs  binary_search
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t-->0)
#define mod 1000000007


int main()
{
   fast
   int n;cin>>n;
  if(n>=30){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  return 0;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
VVL dp(1010, VL(1010, 0));

int main(int argc, char const *argv[])
{
    int h, w;
    cin >> h >> w;
    vector<string> g(h);
    rep(i, h) cin >> g[i];
    dp[0][0] = 1;
    rep(i, h) rep(j, w)
    {
        if (g[i][j] == '#')
            continue;
        if (j - 1 >= 0)
        {
            dp[i][j] += dp[i][j - 1];
        }
        if (i - 1 >= 0)
        {
            dp[i][j] += dp[i - 1][j];
        }
        dp[i][j] %= MOD;
    }

    cout << dp[h - 1][w - 1] << endl;

    return 0;
}


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

int main() {
    int a,b;
    cin>>a>>b;
    if(a==1){
        if(b==1){
            cout<<"Draw"<<endl;
        }else{
            cout<<"Alice"<<endl;
        }
    }else{
        if(a<b || b==1){
            cout<<"Bob"<<endl;
        }else if(a==b){
            cout<<"Draw"<<endl;
        }else{
            cout<<"Alice"<<endl;
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pair<int, int> > vpi;


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


Measured memory_bytes: 256
n,m = map(int,input().split())
card = [ 0 for i in range(n+5) ]
for i in range(m):
    l , r = map(int,input().split())
    card[l] += 1
    card[r+1] -= 1

for i in range(1,n+1):
    card[i] += card[i-1]
ans = 0
for i in card:
    if i == m:
        ans += 1
print(ans)


Measured memory_bytes: 7080
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
// #define DEBUGGING

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

namespace __init {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

VV<ll> edges;

PLL dfs(ll now, ll pre) {
    PLL ret(0, now);
    for(ll nxt : edges[now]) {
        if(nxt == pre) continue;
        auto tmp = dfs(nxt, now);
        if(ret.first < tmp.first) ret = tmp;
    }
    ret.first++;
    return ret;
}

ll dfs2(ll now, ll pre) {
    ll ret = 0;
    for(ll nxt : edges[now]) {
        if(nxt == pre) continue;
        chmax(ret, dfs2(nxt, now));
    }
    return ret + 1;
}

int main() {
    ll N;
    cin >> N;
    edges.resize(N);
    for(ll i = 0; i < N - 1; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    auto tmp = dfs(0, -1).second;
    ll R = dfs2(tmp, -1);
    cout << (R % 3 != 2 ? "First" : "Second") << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(long long i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
const double pi = acos(-1.0);
const ll mod = pow(10,9) + 7;
const ll INF = pow(2,31) - 1;

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    if(a+b+c >= 22)cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
inline int gcd(int a,int b){return b?gcd(b,a%b):a;}
inline int lcm(int a,int b){return a*b/gcd(a,b);}
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;

using namespace std;

int main()
{
  int N, A, B;
  cin >> N >> A >> B;
  cout << min(A*N, B) << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<long long> a(n);
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	
	long long ans = 0;
	long long sum = 0;
	long long tmp = 0;
	for(int j = 0; j < 2; j++)
	{
		for(int i = 0; i < n; i++)
		{
			if(j == 0 && i == 0)
			{
				if(a[i] != 0)
				{
					sum = a[i];
					continue;
				}
				else
				{
					sum = -1;
					ans++;
					continue;
				}
			}
			else if(j == 1 && i == 0)
			{
				tmp = ans;
				ans = 0;
				sum = a[i] > 0 ? -1 : 1;
				ans += a[i] > 0 ? a[i] + 1 : -(a[i] - 1);
				continue;
			}
			
			if(sum > 0)
			{
				if(sum + a[i] >= 0)
				{
					ans += sum + a[i] + 1;
					sum = -1	;
					continue;
				}
			}
			else
			{
				if(sum + a[i] <= 0)
				{
					ans -= sum + a[i] - 1;
					sum = 1; 
					continue;
				}
			}
			sum += a[i];
		}
	}
	
	cout << (ans < tmp ? ans : tmp) << endl;
	return 0;
}
			

Measured memory_bytes: 1024
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();
		sc.close();
		if (B % A == 0) {
			System.out.println(A + B);
		} else {
			System.out.println(B - A);
		}
	}
}


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

int main(){
  ll n,count=0;
  cin >> n;
  vector<vector<int>> v(10,vector<int>(10,0));
  for(int i = 1;i<=n;i++){
    int a,b,c=i;
    b=i%10;
    while(c/10!=0)c/=10;
    a=c;
    v[a][b]++;
  }
  for(int i = 1;i<=9;i++){
    for(int j=i;j<=9;j++){
      if(i==j)count+=v[i][j]*v[j][i];
      else count+=v[i][j]*v[j][i]*2;
    }
  }
  cout<<count<<endl;
}

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

int main() {
    long long int N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    long long int m = min(A, min(B, min(C, min(D, E))));

    if(N%m==0){
        cout << N/m + 4 << endl;
    }
    else{
        cout << N/m + 5 << endl;
    }
}


Measured memory_bytes: 256
from collections import deque
def main():
    h, w = map(int, raw_input().split())
    s = [raw_input().strip() for _ in xrange(h)]
    q = deque()
    po = q.popleft
    pu = q.append
    a = [100000] * (h * w)
    for i, r in enumerate(s):
        for j, c in enumerate(r):
            if c == '#':
                pu((i, j))
                a[i*w+j] = 0
    while q:
        x, y = po()
        z = a[x*w+y] + 1
        if x and a[(x-1)*w+y] > z:
            a[(x-1)*w+y] = z
            pu((x-1,y))
        if x < h - 1 and a[(x+1)*w+y] > z:
            a[(x+1)*w+y] = z
            pu((x+1,y))
        if y and a[x*w+y-1] > z:
            a[x*w+y-1] = z
            pu((x,y-1))
        if y < w - 1 and a[x*w+y+1] > z:
            a[x*w+y+1] = z
            pu((x,y+1))
    print z - 1
main()


Measured memory_bytes: 109176
//Life is inherently meaningless unless you find something which gives it meaning
 

#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){
    ll n,x,m,s=0;
    cin>>n>>x>>m;
    map<ll,ll> mm;
    vector<ll> v;

    if(n<=m){
        ll ans=0;
        for1(i,n){
            ans=(ans+x);
            //cout<<x<<" ";
            x=(x*x)%m;
        }
        cout<<ans<<endl;
        return 0;
    }

    ll a=x,cur=0,start=-1,ans=0;
    while(1){
        //cout<<a<<" ";
        auto it=mm.find(a);
        if(it!=mm.end()){
            start=(it->se)+1;
            break;
        }
        v.pb(a);
        mm.insert(mp(a,cur));
        a=(a*a)%m;
        cur++;
    }
    //for(auto x:v) cout<<x<<" ";
    ll len=(v.size()-start+1); //length of the loop
    //cout<<len<<" ";
    if(n<start){
        for(ll i=1;i<=n;i++){
            ans=(ans+v[i-1]);
        }
        cout<<ans<<endl;
        return 0;
    }
    
    for(ll i=0;i<start-1;i++){
            ans=(ans+v[i]);
    }
    //cout<<ans<<" "<<start<<" ";
    n-=(start-1);
    //ll s=0;
    for(ll i=start-1;i<v.size();i++){
        s=(s+v[i]);
    }
    ans=(ans+((n/len)*s));
    n=n%len;
    for(ll i=start-1;i<=start+n-2;i++){
        ans=(ans+v[i]);
    }
    cout<<ans;
}

Measured memory_bytes: 6596
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define sl set<ll>
#define vs vector<string>
#define vl vector<ll>
#define vi vector<int>
#define vpl vector<pair<ll,ll>>
#define pb push_back
#define PI 3.14159265358979323846
#define ll long long
#define ld long double
#define endl "\n"
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repp(i,a,b) for (ll i = (a); i >= (b); i--)
#define rop(i,a,b)  for(ll i=(a); i>(b); i--)
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define tt long long t; cin>>t; while(t--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const int maxn=1e5+100;

int main()
{
    IOS;
    ll n,cnt=0;
    cin>>n;
    ll flag=0;
    while(n--)
    {
        ll a,b;
        cin>>a>>b;
        if(a==b)cnt++;
        else cnt=0;
        if(cnt==3){cout<<"Yes";flag=1;break;}
    }
   if(flag==0)cout<<"No";
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = int64_t;

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; }
const int INF = 1001001001;
const ll INFL = (1LL<<60);
const double eps = (1e-9);

void solve(int n, vector<ll>& count, vector<set<int>>& edges) {
  auto& children = edges[n];
  if (edges.empty()) return;
  for (auto& v : children) {
    count[v] += count[n];
    edges[v].erase(n);
    solve(v, count, edges);
  }
}

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

  int n, q;
  cin >> n >> q;
  vector<set<int>> edges(n, set<int>());
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    edges[a].insert(b);
    edges[b].insert(a);
  }

  vector<ll> count(n, 0);
  rep(i, q) {
    ll p, x;
    cin >> p >> x;
    p--;
    count[p] += x;
  }

  solve(0, count, edges);

  rep(i, n) cout << count[i] << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 54016
n = int(input())
a = [int(x) for x in input().split()]

b = sum(a)
c = a[0]
d = a[0]

for i in range(1, n-1):
    c += a[i]
    if abs(b-2*d) > abs(b-2*c):
        d = c

print(abs(b-2*d))

Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,x,y;
	cin>>n>>x>>y;
	int A[n]={0};
	int dist;
	for(int i=1;i<=n;i++)
	{
		for(int j=n;j>i;j--)
		{
			dist=min(j-i,abs(x-i)+1+abs(y-j));
			A[dist]++;
		}
	}
	for(int i=1;i<n;i++)
	{
		cout<<A[i]<<endl;
	}
}

Measured memory_bytes: 3556
#include <iostream>
#include <string>
int main()
{
  std::string s, sub;
  int k;
  std::cin >> k >> s;
  if (s.length() <= k)
  {
    std::cout << s << std::endl;
  }
  else
  {
    sub = s.substr(0, k);
    std::cout << sub << "..." << std::endl;
  }
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    string t;
    cin >> t;
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if (s < t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    



}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

  cout << x << " " << y << " " << z << endl;

  return 0;
}

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

using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define show(x) cerr << #x << x << endl

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

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

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

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = 1000000000 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//
//
//  　　┓　　　┏
//  　＊┗┓　┏┛
//  　　　┫　┣　＊
//  　┏┳┻━┻┳┓
//  　┗┫　　　┣┛
//  ＊　┣　　━┃　＊        Merry Christmas!!
//  　┏┛　　〃┃
//  　┃●　　　┣━┳┓
//  　┗┻┳━━┛　┣┛
//  　＊　┃┏┓┣┓┃
//WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

int n;
string s;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1 = freopen("C:\\Users\\naruse\\CLionProjects\\competitive\\cmake-build-debug\\in.txt", "r", stdin);
    //stream2 = freopen("out.txt", "w", stdout);
    if (stream1 == nullptr) return 0;
    //if (stream2 == NULL) return 0;
#endif
    cin >> n;
  if (n == 25) {
    cout << "Christmas" << endl;
  }else if (n == 24) {
    cout << "Christmas Eve" << endl;
  }else if (n == 23) {
    cout << "Christmas Eve Eve" << endl;
  }else if (n == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int count=0;
  cin>>s;
  for(int i=0;i<s.length();i++){
    for(int j=0;j<s.length();j++){
      if(i!=j&&s[i]==s[j]){
	count++;
      }
    }
  }
  if(count>0){
    cout<<"no"<<"\n";
  }else{
    cout<<"yes"<<"\n";
  }
  return 0;
}


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

int main(){
	int n;
	int result;
	int x = 0, y = 0, z = 0;
	
	scanf("%d", &n);
	
	int m[n+1][3];
	
	m[0][0] = m[0][1] = m[0][2] = 0;
	
	for(int i = 0; i < n+1; i++){
		if(i > 0){
			scanf("%d", &x);
			scanf("%d", &y);
			scanf("%d", &z);
			
			//Caso não possa escolher a atividade a
			m[i][0] = max(m[i - 1][1], m[i - 1][2]) + x;
			//Caso não possa escolher a atividade b
			m[i][1] = max(m[i - 1][0], m[i - 1][2]) + y;
			//Caso não possa escolher a atividade c
			m[i][2] = max(m[i - 1][1], m[i - 1][0]) + z;
		}
	}
	
	result = max(max(m[n][0], m[n][1]), m[n][2]);
	printf("%d\n",result);
}

Measured memory_bytes: 1408
#include<stdio.h>
int r=0,d[100010],p[100010]={};
int ta[10010],nt[100010],to[100010];
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int main(){
  int n,i,a,b,r,t,q[100010],c[100010]={};
  long long s=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)ta[i+1]=-1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    nt[i    ]=ta[to[i+n-1]=a];
    nt[i+n-1]=ta[to[i    ]=b];
    ta[b]=i+n-1;
    ta[a]=i;
    c[a]++;
    c[b]++;
  }
  /*for(i=0;i<n;i++){printf("%d:",i+1);
    for(t=ta[i+1];t+1;t=nt[t])printf(" %d",to[t]);
    printf("\n");
    }//*/
  for(i=0;i<n;i++){
    scanf("%d",&a);
    hin(a);
    s+=a;
  }
  for(i=r=0;i<n;i++)d[i]=N[hout()];
  for(i=1;i<=n;i++){
    if(c[i]==1)q[r++]=i;
  }
  //for(i=0;i<n;i++)printf("%d\n",c[i+1]);
  for(t=0;r-t;t++){//printf("t:%d %d\n",t,q[t]);
    p[q[t]]=d[t];
    for(i=ta[q[t]];i+1;i=nt[i]){
      c[to[i]]--;
      if(c[to[i]]==1)q[r++]=to[i];
    }
  }
  printf("%lld\n",s-d[n-1]);
  for(i=0;i<n;i++)printf("%d%c",p[i+1],i+1-n?' ':'\n');
  return 0;
}


Measured memory_bytes: 3072
import math
import numpy as np
def calc(h,m): 
    if (h == 12): h = 0
    if (m == 60): m = 0
    hour_angle = 0.5 * (h * 60 + m) 
    minute_angle = 6 * m 
    angle = abs(hour_angle - minute_angle) 
    angle = min(360 - angle, angle) 
    return angle 

a,b,h,m = map(int,input().split())
angle=calc(h,m)
theta1=np.deg2rad(angle)
side = (a*a) + (b*b) - 2*a*b*math.cos(theta1)
print(math.sqrt(side))

Measured memory_bytes: 27184
N = int(input())

A = [[] for i in range(N)]

for i in range(N):
  a, b = [int(j) for j in input().split()]
  c = a + b
  A[i] = [a, b, c]

A.sort(key=lambda x: x[2], reverse=True)

diff = 0

for i in range(N):
  if i % 2 == 0:
    diff += A[i][0]
  else:
    diff -= A[i][1]

print(diff)


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

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

}

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

int main(void){
	char stringTable[][6] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	char strings[1025];
	char string[2];
	char message[76];
	int length;
	int index_c=0;
	int index_m=0;
	int pressed=0;
	int num=0;
	int times=0;
	int tableLen = 0;
	int i;

	scanf("%d", &length);
	for(i=0; i<length; i++){
		scanf("%s", strings);
		while(strings[index_c] != '\0'){
			string[0] = strings[index_c];
			string[1] = '\0';
			num = atoi(string);
			if(num){
				//printf("num: %d\n", num);
				pressed = num;
				times ++;
			}else{  // 0が押された
				if(pressed){
					if(pressed == 1) tableLen = 5;
					else if(pressed == 2 || pressed == 3 || pressed == 4 || pressed == 5 || pressed == 6 || pressed == 8) tableLen = 3;
					else if(pressed == 7 || pressed == 9) tableLen = 4;
					message[index_m] = stringTable[pressed][(times - 1) % tableLen];
					//printf("%c_\n", message[index_m]);
					index_m ++;
					times = 0;
					pressed = 0;
				}
			}
			index_c ++;
		}
		message[index_m] = '\0';
		printf("%s\n", message);
		times = 0;
		index_m = 0;
		index_c = 0;
	}

	return 0;
}

Measured memory_bytes: 0