akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  ll n;
  cin >> n;
  string s;
  cin >> s;
  bool l[30010][10], r[30010][10];
  rep(i, 10)
  {
    l[0][i] = r[n][i] = false;
  }
  rep(i, n)
  {
    rep(j, 10)
    {
      l[i + 1][j] = (l[i][j] || (s[i] == (char)(j + '0')));
    }
  }

  for (ll i = n; i >= 1; --i)
  {
    rep(j, 10)
    {
      r[i - 1][j] = (r[i][j] || (s[i - 1] == (char)(j + '0')));
    }
  }

  bool exist[10][10][10] = {};
  REP(center, 1, n - 1)
  {
    rep(l_num, 10)
    {
      rep(r_num, 10)
      {
        if (l[center][l_num] && r[center + 1][r_num])
        {
          exist[l_num][(int)(s[center] - '0')][r_num] = true;
        }
      }
    }
  }
  ll ans = 0;
  rep(i, 10) rep(j, 10) rep(k, 10)
  {
    if (exist[i][j][k])
    {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int[] a={sc.nextInt(),sc.nextInt(),sc.nextInt()};
		Arrays.sort(a);
		if (a[0]==5 && a[1]==5 && a[2]==7){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 21844
import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe (fromJust)

type Dice = [Int]

rot :: Dice -> Char -> Dice
rot d 'E' = [d!!3, d!!1, d!!0, d!!5, d!!4, d!!2]
rot d 'W' = [d!!2, d!!1, d!!5, d!!0, d!!4, d!!3]
rot d 'N' = [d!!1, d!!5, d!!2, d!!3, d!!0, d!!4]
rot d 'S' = [d!!4, d!!0, d!!2, d!!3, d!!5, d!!1]
rot _ _ = undefined

solve :: [[Int]] -> String
solve ([n]:dices) =
    let ls = [(a,b) | a<-dices,b<-dices, a/=b] in
    if (any id $ map equal ls) then
        "No"
    else
        "Yes"
    where
    equal (diceA,diceB) =
        let es = cycle "E" in
        let ns = cycle "N" in
        let cmdSets =   [ take a es ++ take b ns ++ take c es ++ take d ns
                        | a<-[1..4], b<-[1..4], c<-[1..4], d<-[1..4]]
        in
        eq cmdSets
        where
        eq [] = False
        eq (cmd:cmds) =
            if (foldl' rot diceB cmd == diceA) then
                True
            else
                eq cmds

main =
    putStrLn =<< solve . map (map read . words) . lines <$> getContents 



Measured memory_bytes: 5496
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
// #include <string>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  const long long a = (long long) pow(10, 9) + 7;
  int n;
  long long num = 1;
  cin >> n;
  long long index = 0;
  vector<long long> y(n);
  for (int i = 0; i < n; i++) {
    cin >> y[i];
    y[i] = y[i] - (i + 1); // 空きの数
  }
  for (int i = 1; i < y.size(); i++) {
    if(y[i] + index == i-1) {
      num *= i+1;
      index++;
      if(num >= a) num %= a;
      y.erase(y.begin());
    }
  }
  while(n - index) {
    num *= n - index;
    if(num >= a) num %= a;
    index++;
  }
  cout << num % a << endl;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int A, B;
    cin >> A >> B;

    int w = 100;
    vector<string> ans;

    if (B == 1) {
        ans.pb(string(w, '.'));
    } else {
        while(B > 1) {
            ans.pb(string(w, '.'));

            string tmp(w, '.');
            REP(i, w / 2) {
                if (B == 1) break;
                tmp[2*i] = '#';
                B--;
            }

            ans.pb(tmp);
            ans.pb(string(w, '.'));
        }
    }
    A--;

    if (A == 0) {
        ans.pb(string(w, '#'));
    } else {
        while(A > 0) {
            ans.pb(string(w, '#'));

            string tmp(w, '#');
            REP(i, w / 2) {
                if (A == 0) break;
                tmp[2*i] = '.';
                A--;
            }

            ans.pb(tmp);
            ans.pb(string(w, '#'));
        }
    }

    cout << ans.size() << " " << w << endl;
    REP(i, ans.size()) print(ans[i]);


}


Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    CINS(int, W, N);

    int ans = 1e9;
    for (int T = 0; T < N; T++) {
        int sum1 = 0, sum2 = 0;
        for (int i = 0; i < T; i++) {
            sum1 += W[i];
        }
        for (int i = T; i < N; i++) {
            sum2 += W[i];
        }
        ans = min(ans, abs(sum1 - sum2));
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {

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

	public void run() throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String input = reader.readLine();
		reader.close();

		Stack<Integer> st1 = new Stack<Integer>();
		Stack<Integer> st2 = new Stack<Integer>();
		Stack<Integer> st3 = new Stack<Integer>();
		
		int lv = 0;
		for (int i=0; i < input.length(); i++) {
			char c = input.charAt(i);
			if (c == '\\') {
				lv--;
				st1.add(i);
			} else if (c == '/') {
				lv++;
				if (!st1.isEmpty()) {
					int newArea = i - st1.pop();
					int tmp = 0;
					while (!st2.isEmpty() && st3.peek() < lv) {
						st3.pop();
						tmp += st2.pop();
					}
					st2.push(newArea + tmp);
					st3.push(lv);
				} else if (!st3.isEmpty()) {
					st3.pop();
					st3.push(lv);
				}
			}
		}
		
		StringBuffer sb = new StringBuffer();
		int totalArea = 0;
		int n = st2.size();
		sb.append(n);
		for (int i = 0; i < n; i++) {
			totalArea += st2.get(i);
			sb.append(" " + st2.get(i));
		}
		System.out.println(totalArea);
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 26488
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    auto S = sread();
    writeln(S[0 .. $ - "fastival".length]);
}


Measured memory_bytes: 2640
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#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 <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

ll ans=0;
ll div_map[10000010];

int main(void){
    ll n;
    ll ans =0;
    cin >>n;
    for(ll i=1; i<10000010; i++){
        ll pos = i;
        while(1){
            if(pos > 10000010){break;}
            div_map[pos]++;
            pos += i;
        }
    }
    for(ll i=1; i<n+1; i++){
        ans += i*div_map[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 81344
function main(input){
    input = input.split('\n');
    num = parseInt(input[0]);
    brick = input[1].split(' ');
    counter = 1;

    for(i=0;i<num;i++){
        if( brick[i] == String(counter)){
            counter++;
        }
    }

    if(counter==1){
        console.log(-1);
    }
    else{
        console.log(num-counter+1);
    }    
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 27216
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

//! 昇順にソートした配列
ll Min[100005];
//! 降順にソートした配列
ll Max[100005];

int main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		cin >> Min[i];
		Max[i] = Min[i];
	}
	sort(Min, Min + N);
	sort(Max, Max + N, [](ll a, ll b) {return a > b; });

	//! 配列の初期要素は最も小さい値としておく
	ll edge[2] = { Min[0],Min[0] };
	//! 挿入候補のIndex(Min,Maxの配列それぞれについて用意)
	int minIndex = 1, maxIndex = 0;

	ll ans = 0;
	//! 挿入要素がN個になるまでループ
	while (minIndex + maxIndex < N)
	{
		//! 挿入候補を取得
		ll min = Min[minIndex], max = Max[maxIndex];
		//! minを挿入したときに差が最大となる端点
		ll &minEdge = abs(min - edge[0]) > abs(min - edge[1]) ? edge[0] : edge[1];
		//! maxを挿入したときに差が最大となる端点
		ll &maxEdge = abs(max - edge[0]) > abs(max - edge[1]) ? edge[0] : edge[1];

		ll diffMin = abs(min - minEdge), diffMax = abs(max - maxEdge);
		if (diffMin > diffMax)
		{
			//! 最小値を挿入したほうが大きい値が得られる
			minEdge = Min[minIndex++];
		}
		else
		{
			//! 最大値を挿入したほうが大きい値が得られる
			maxEdge = Max[maxIndex++];
		}
		ans += std::max(diffMin, diffMax);

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

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0301

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def main(args):
    # members = deque(list(range(10)))
    # numbers = [2, 6, 5, 18, 3]
    # queries = [3, 0, 5]

    N, M, Q = map(int, input().split(' '))
    members = deque(list(range(N)))
    numbers = [int(x) for x in input().split(' ')]
    queries = [int(x) for x in input().split(' ')]

    for n in numbers:
        if n % 2 == 0:
            # n = n % N
            members.rotate(-n)
            members.popleft()
        else:
            # n = n % N
            members.rotate(n)
            members.popleft()
        N -= 1

    for q in queries:
        ans = 1 if q in members else 0
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 31324
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        300005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<pii>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
 
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}  
void solve(){
    // int n;
    // cin >> n;
    // vector<pii>v(n+5);
    // FOR(i,1,n+1)cin >> v[i].f >> v[i].se;
    int n,p = 1;
    cin >> n;
    vector<int>v(n+5);
    FOR(i,1,n+1)cin >> v[i];
    sort(v.begin()+1,v.begin()+n+1);
    if(!v[1])cout << "0\n";
    else {
        FOR(i,1,n+1){
            if(p > (int)1e18/v[i]){cout << "-1\n";return ;}
            p *= v[i];
        }
        cout << p << "\n";
    }
}      

 
signed main()   
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
        solve();
        //cout << "\n";
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define rep(i,n)  for(ll i = 0; i < (n); ++i)
#define red(i,n)  for(ll i = (n)-1; i >= 0; --i)
#define all(a)    begin(a),end(a)
#define pb(a)     push_back(a)
#define mp(a,b)   make_pair(a,b)
#define yn(a)     cout << ( (a)?"YES\n":"NO\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main(int argc,char* argv[])
{
    ll n,m,q;
    cin>>n;
    map<ll,ll> d;
    rep(i,n)cin>>q,d[q]+=1;
    cin>>m;
    vi t(m);
    rep(i,m)cin>>t[i];
    if(n<m)yn(0),exit(0);
    for(auto x:t) {
        if(d[x]==0) yn(0),exit(0);
        d[x]--;
    }
    yn(1);
    return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}
ll mul(ll x, ll y) {ll res=x*y; return(res>=MOD?res%MOD:res);}
ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}
ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}
ll power(ll x, ll y) {ll res=1; x%=MOD; while(y){if(y&1)res=mul(res,x); y>>=1; x=mul(x,x);} return res;}
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

const int MAX = 2e5 + 5;

ll fact[MAX], invf[MAX];
void preprocess()
{
	fact[0] = 1;
	invf[0] = 1;
	for(ll i = 1; i < MAX; i++){
		fact[i] = mul(fact[i - 1], i);
		invf[i] = power(fact[i], MOD - 2);
	}
}
ll calc(ll n, ll r)
{
	ll res = 1;
	for(ll i = n; i > n - r; i--)
	res = mul(res, i);
	res = mul(res, invf[r]);
	return res;
}
int main()
{
	boost;
	preprocess();
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = sub(power(2ll, n), 1ll);
	ans = sub(ans, calc(n, a));
	ans = sub(ans, calc(n, b));
	cout << ans;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define maxn 200005
using namespace std;

int arr[maxn], box[maxn];
vector<int> ans;
int n;

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        scanf("%d", arr + i);
    }
    ans.clear();
    memset(box, 0, sizeof(box));
    for(int i = n; i > 0; i--) {
        int sum = 0;
        for(int j = i + i; j <= n; j += i) {
            sum += box[j];
        }
        if(sum % 2 != arr[i]) box[i] = 1;
        if(box[i]) ans.push_back(i);
    }
    printf("%d\n", (int)ans.size());
    for(int i = 0; i < (int)ans.size(); i++) {
        printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);
    }
    return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std; 
int main() 
{
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int a, b;
	cin>>a>>b;
	for(int i=1;i<=1e4;++i) {
		int a2=i*8/100,b2=i*10/100;
		if(a2==a&&b2==b) 
		{
			cout<<i;
			return 0;
		}
	}
	cout<<-1;
}

Measured memory_bytes: 256
N, L = map(int, input().split())

addList = []
total = 0
for n in range(1, N+1):
    addList.append(L + n-1)
    total = total + L + n-1

exceptNum = 0
if addList[-1] <= 0:
    exceptNum = addList[-1]
elif addList[0] >= 0:
    exceptNum = addList[0]

print(total - exceptNum)

Measured memory_bytes: 3064
//https://atcoder.jp/contests/abc164/tasks/abc164_c
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
  ll N; cin>>N;
  set<string> lst;
  REP(i,N){
    string s; cin>>s;
    lst.insert(s);
  }
  cout<<lst.size()<<endl;
  return 0;
}

Measured memory_bytes: 19260
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[n],ar[n],a,sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>a;
        sum+=a;
    }
    for(int i=1;i<n;i++)
    {
        cin>>ar[i];
    }
    for(int i=0;i<n-1;i++)
    {
        if(arr[i+1]==arr[i]+1)
            sum+=ar[arr[i]];
    }
    cout<<sum<<endl;

}


Measured memory_bytes: 3624
n = int(input())
a = list(map(int, input().split()))
cnt = 0
f = 0
for i in range(1, n):
    if a[i-1] < a[i]:
        ff = 1
    elif a[i-1] > a[i]:
        ff = -1
    else:
        ff = 0
    if f and ff and f != ff:
        cnt += 1
        f = 0
    elif not f:
        f = ff

print(cnt + 1)

Measured memory_bytes: 14252
#include<stdio.h>
int med3(int x, int y, int z);
void quickSort(int a[], int left, int right);
void sort(int a[], int size);

int N, K, L[50], ans, i;
int main(){
  scanf("%d%d", &N, &K);
  for(i=0; i<N; i++){
    scanf("%d", L+i);
  }
  sort(L, N);
  for(i=0; i<K; i++){
    ans += L[i];
  }
  printf("%d\n", ans);
}

int med3(int x, int y, int z){
	if(x < y){
		if (y < z){return y;}else if(z < x){return x;}else{return z;}
	} else {
		if (z < y){return y;}else if(x < z){return x;}else{return z;}
	}
}

void quickSort(int a[], int left, int right){
	if(left >= right){return;}
	int pivot = med3(a[left], a[left+(right-left)/2], a[right]);
	int l=left, r=right;
	while(1){
		while (a[l] > pivot){l++;}
		while (pivot > a[r]){r--;}
		if(l>=r){break;}
		int t=a[l]; a[l]=a[r]; a[r]=t;
		l++; r--;
	}
	quickSort(a, left, l-1);
	quickSort(a, r+1, right);
}

void sort(int a[], int size){
	quickSort(a, 0, size-1);
}


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

typedef long long ll;

#define pb push_back

int main(){
	while(1){
		int max;
		int n,d[252];
		scanf("%d",&max); if(max == 0)break;
		scanf("%d",&n);
		for(int i = 1 ; i <= n ; i ++){
			scanf("%d",&d[i]);
		}
		vector<int> G[252];
		vector<int> rG[252];
		for(int i = 0 ; i < n+1 ; i ++){
			for(int j = 1 ; j <= max ; j ++){
				if(i+j >= n+1 || i+j+d[i+j] >= n+1){
					G[i].pb(n+1);
					rG[n+1].pb(i);
				}
				else if(i+j+d[i+j] >= 0){
					G[i].pb(i+j+d[i+j]);
					rG[i+j+d[i+j]].pb(i);
				}
				else {
					G[i].pb(0);
					rG[0].pb(i);
				}
			}
		}
		bool used[252];
		queue<int> que;
		for(int i = 0 ; i < 252 ; i ++){
			used[i] = false;
			que.push(0);
		}
		while(!que.empty()){
			int p = que.front(); que.pop();
			if(used[p])continue;
			used[p] = true;
			for(int i = 0 ; i < G[p].size() ; i ++){
				que.push(G[p][i]);
			}
		}
		bool used_[252];
		queue<int> que_;
		for(int i = 0 ; i < 252 ; i ++){
			used_[i] = false;
			que_.push(n+1);
		}
		while(!que_.empty()){
			int p = que_.front(); que_.pop();
			if(used_[p])continue;
			used_[p] = true;
			for(int i = 0 ; i < rG[p].size() ; i ++){
				que_.push(rG[p][i]);
			}
		}
		bool t = true;
		for(int i = 0 ; i < 252 ; i ++){
			if(used[i] && !used_[i])t = false;
		}
		if(t)puts("OK");
		else puts("NG");
		/*for(int i = 0 ; i <= n+1 ; i ++){
			printf("G[%d]:",i);
			for(int j = 0 ; j < G[i].size() ; j ++){
				printf("%d ",G[i][j]);
			}
			puts("");
			printf("rG[%d]:",i);
			for(int j = 0 ; j < rG[i].size() ; j ++){
				printf("%d ",rG[i][j]);
			}
			puts("");
		}*/
	}
}

Measured memory_bytes: 1240
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n,m = map(int, sys.stdin.readline().split())
    mat = [[0 for i in range(n)]for j in range(n)]

    #隣接行列
    for i in range(n):
        mat[i][i] = 0
    #辺に１を入れる
    for i in range(m):
        a,b = map(int, input().split())
        mat[a-1][b-1] = mat[b-1][a-1] = 1

    cnt = 0

    #辺の値を積でつないでいく方法。一個でもつながらなかったら０になる。
    for each in itertools.permutations(range(n)):
        if each[0] != 0:
            break
        factor = 1
        for i in range(n-1):
            factor *= mat[each[i]][each[i+1]]
        cnt += factor
    print(cnt)

    #dfs（深さ優先探索）

Measured memory_bytes: 5076
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const ll mod=998244353;
const int maxn=(3e5)+10;
int n,cnt1,cnt2;
ll ans;
char s[maxn],a,c;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	scanf("%s",s+1); ans=1;
	for (int i=1;i<=n;i++) ans=ans*i%mod;
	for (int i=1;i<=3*n;i++) {
		if (cnt2&&s[i]==c) {
			ans=ans*cnt2%mod; cnt2--;
		} else if (cnt1&&s[i]!=a) {
			ans=ans*cnt1%mod; cnt1--;
			cnt2++;
			c='R'+'G'+'B'-s[i]-a;
		} else cnt1++,a=s[i];
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

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

	char s[n];
	for(int i=1;i<=n;i++)
	{
		cin >> s[i-1];
	}

	for(int i=1;i<=n;i++)
	{
		if(s[i-1]=='Y')
		{
			cout << "Four" << endl;
			return 0;
		}
	}

	cout << "Three" << endl;
}

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

using namespace std;

long long mod = 1000000007;

void dfs(int p, int prev, vector<int> &a, vector<int> &dp, int dpl, vector<vector<int>> &v, vector<int> &res)
{
    int l = -1, r = dpl, mid;
    while (r - l > 1)
    {
        mid = (l + r) / 2;
        if (dp[mid] >= a[p])
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    int temp = dp[r];
    dp[r] = a[p];
    if (temp == -1)
    {
        dpl++;
    }
    res[p] = dpl;
    for (int i = 0; i < v[p].size(); i++)
    {
        if (v[p][i] == prev)
        {
            continue;
        }
        dfs(v[p][i], p, a, dp, dpl, v, res);
    }
    dp[r] = temp;
}

int main()
{
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    // ifstream cin("in.txt");
    // ofstream cout("out.txt");
    
    
    // int t;
    // cin >> t;
    // for (int qwe = 0; qwe < t; qwe++)
    // {
    //     cout << "Case #" << qwe + 1 << ": ";
    // }


    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    vector<bool> good(n, true);
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        if (h[x] <= h[y] && good[x])
        {
            good[x] = false;
            n--;
        }
        swap(x, y);
        if (h[x] <= h[y] && good[x])
        {
            good[x] = false;
            n--;
        }
    }
    cout << n << '\n';


    return 0;
}


Measured memory_bytes: 3424
using System;
using System.Collections.Generic;
using System.Linq;

class E
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

		var d = new Dictionary<long, int>();
		foreach (var x in a)
			foreach (var o in Factorize(x).GroupBy(p => p).Select(g => new { p = g.Key, c = g.Count() }))
				if (!d.ContainsKey(o.p) || d[o.p] < o.c) d[o.p] = o.c;

		var lcm = d.Select(p => ((MInt)p.Key).Pow(p.Value)).Aggregate((MInt)1, (x, y) => x * y);
		Console.WriteLine(a.Select(x => lcm / x).Aggregate((x, y) => x + y));
	}

	static long[] Factorize(long n)
	{
		long rn = (long)Math.Ceiling(Math.Sqrt(n)), x = 2;
		var r = new List<long>();
		while (n % x == 0) { r.Add(x); n /= x; }
		for (x++; x <= rn && n > 1; x += 2)
			while (n % x == 0) { r.Add(x); n /= x; }
		if (n > 1) r.Add(n);
		return r.ToArray();
	}
}

struct MInt
{
	const int M = 1000000007;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator -(MInt x, MInt y) => x.V - y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;
	public static MInt operator /(MInt x, MInt y) => x * y.Inv();

	public MInt Pow(int i) => MPow(V, i);
	public MInt Inv() => MPow(V, M - 2);
	public override string ToString() => $"{V}";

	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int64_t> X(n), L(n), R(n);
    vector<array<int64_t, 2>> D(n);
    for (int i = 0; i < n; i++){
        cin >> X[i] >> L[i];
        R[i] = X[i] + L[i];
        D[i] = {R[i], X[i] - L[i]};
    }

    sort(D.begin(), D.end());

    int ans = 0;
    int64_t last = -1e16;
    for (int i = 0; i < n; i++){
        if (last <= D[i][1]){
            last = D[i][0];
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4224
#include <math.h>
main(){
    int i,n,s[1000];
    double t,u;
    for(;scanf("%d",&n),n;){
        for(i=t=0;i<n;t+=s[i++])
            scanf("%d",&s[i]);
        for(t/=i,i=u=0;i<n;i++)
            u+=(s[i]-t)*(s[i]-t);
        printf("%.8f\n",sqrt((double)u/n));
    }
}


Measured memory_bytes: 2052
// header {{{
// #define NDEBUG
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)        (abs((a)-(b)) < EPS)
#define CILING(a, b)    (((a)+(b)-1)/(b))

template<class T>
using PIT = pair<int, T>;
template<class T>
using PTI = pair<T, int>;
using PII = pair<int, int>;
using PDI = pair<double, int>;
using LL  = long long;
using ULL = unsigned long long;
// }}}

vector<LL> a;
map<LL, bool> m;
map<LL, bool> kita;

bool solve(LL n){
    if(kita.find(n) != kita.end()) return false;
    kita[n] = true;
    if(lower_bound(a.begin(), a.end(), n) != a.end()){
        if(m[n]) return true;
        LL next = *lower_bound(a.begin(), a.end(), n);
        return solve(next - n) || solve(n + next);
    }else{
        return false;
    }
}

int main() {
    LL n, k;cin >> n >> k;
    a.resize(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        m[a[i]] = true;
    }
    sort(a.begin(), a.end());
    cout << (solve(k) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}


Measured memory_bytes: 9088
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

satis = 0
for j in range(n):
    ate = A[j] - 1
    satis += B[ate]
    if j > 0 and A[j] == A[j - 1] + 1:
        satis += C[A[j - 1] - 1]
print(satis)



Measured memory_bytes: 38384
#include <stdio.h>
int n,t,a[100];
void sort(int *a){
  for(int i=0;i<n;i++)for(int j=1;j<n;j++){
    if(a[j-1]<a[j]){
      t=a[j-1];
      a[j-1]=a[j];
      a[j]=t;
    }
  }
  return;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&a[i]);
  sort(a);
  int b=0,c=0;
  for(int i=0;i<n;i++){
    if(i%2==0)b+=a[i];
    else c+=a[i];
  }
  printf("%d",b-c);
  return 0;
}

Measured memory_bytes: 128
import scala.io.StdIn._

object Main extends App {
  private def isPalindrome(s: String) = {
    Range(0, s.length / 2).forall { i =>
      s.charAt(i) == s.charAt(s.length - i - 1)
    }
  }

  val s = readLine.stripMargin
  val n = s.length

  val ans = isPalindrome(s) &&
    isPalindrome(s.substring(0, (n - 1) / 2)) &&
    isPalindrome(s.substring((n + 3) / 2 - 1, n))

  println(if (ans) "Yes" else "No")
}



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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  set<int> st;
  for (int i = 0; i < N; i++) {
    st.insert(A[i]);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque>
#define rep(i,rept)	for(int i = 0; i<(ll)rept;++i)
typedef long long ll;
using namespace std;


int main() {

	int n = 0;
	cin >> n;

	for (int i = n; i <= 999; ++i) {

		if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
			cout << i << endl;
			return 0;
		}

	}

}

Measured memory_bytes: 256
n = int(input())
hlist = list(map(int, input().split()))

cnt_ind_minus_height = {}
cnt_height_plus_ind = {}
cnt_height_minus_ind = {}
cnt_minus_height_minus_ind = {}

for ind in range(n):
    height = hlist[ind]
    if ind - height not in cnt_ind_minus_height:
        cnt_ind_minus_height[ind - height] = 0
    cnt_ind_minus_height[ind - height] += 1

    if ind + height not in cnt_height_plus_ind:
        cnt_height_plus_ind[ind + height] = 0
    cnt_height_plus_ind[ind + height] += 1

    if height-ind not in cnt_height_minus_ind:
        cnt_height_minus_ind[height-ind] = 0
    cnt_height_minus_ind[height-ind] += 1

    if -ind - height not in cnt_minus_height_minus_ind:
        cnt_minus_height_minus_ind[-height-ind] = 0
    cnt_minus_height_minus_ind[-height-ind] += 1

ans = 0
# Hi - i = - (Hj + j)
for val in cnt_height_minus_ind:
    if val in cnt_minus_height_minus_ind:
        ans += cnt_height_minus_ind[val]*cnt_minus_height_minus_ind[val]

# Hi + i = j - Hj
for val in cnt_height_plus_ind:
    if val in cnt_ind_minus_height:
        ans += cnt_height_plus_ind[val]*cnt_ind_minus_height[val]

# as we double count the pair
print(ans//2)

Measured memory_bytes: 86604
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>
#include <utility>

using namespace std;
int main(){
	int n,m;
	cin >> n >> m;
	int A[n],B[n];
	for (int i =0 ; i < n; i++) {
		cin >> A[i] >> B[i];
	}
	int C[n+1][m+1];
	for(int i = 0;i <= n;i++) {
		C[i][0]=0;
	}
	for(int i = 0;i <= m;i++){
		C[0][i]=0;
	}
	for(int j = 1;j <= m;j++){
		for(int i = 1;i <= n;i++) {
			if(j < B[i-1])
				C[i][j] = C[i-1][j];
			else{
				if(C[i-1][j] >= C[i-1][j - B[i-1]] + A[i-1]) 
					C[i][j] = C[i-1][j];
				else
					C[i][j] = C[i-1][j-B[i-1]] + A[i-1];
			}
		}
	}
	cout << C[n][m] << endl;
}

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

using namespace std;

int main(){
  int ans = 0;
   int a;

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

      }

Measured memory_bytes: 3596
import itertools

H, W = map(int, input().split())
S = []
ans = []
for _ in range(H):
    S.append(list(input()))
    ans.append(['#' for i in range(W)])

op =[]
for i in itertools.product([-1, 0, 1], repeat=2):
    op.append(i)


for i, s1 in enumerate(S):
    for j, s2 in enumerate(s1):
        if(s2 == '.'):
            counter = 0
            for o in op:
                if(i == 0 and o[0] == -1):
                    continue
                elif(i == H-1 and o[0] == 1):
                    continue
                elif(j == 0 and o[1] == -1):
                    continue
                elif(j == W-1 and o[1] == 1):
                    continue
                else:
                    if(S[i + o[0]][j + o[1]] == "#"):
                        counter += 1
            ans[i][j] = str(counter)

for a in ans:
    print(''.join(a))

Measured memory_bytes: 3188
fun main(args: Array<String>) {

    val s = readLine()!!.toInt()
    val a = mutableListOf(s)
    val set = mutableSetOf(s)
    var i = 1
    while (true) {
        val ai = a[i - 1]
        a += if (ai % 2 == 0) {
            ai / 2
        } else {
            3 * ai + 1
        }
        if (!set.contains(a[i])) {
            set.add(a[i])
        } else {
            println(i + 1)
            return
        }
        i++
    }

}

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

int main()
{
  char s[200005];
  cin>>s;
  int sum=0;
  int len= strlen(s);
  for(int i=0;i<len;i++)
  {
      sum+= (s[i]-'0');
  }
  if(sum%9==0) cout<< "Yes"<<endl;
  else cout<< "No"<<endl;
}


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

static const int MAX_N = 100000;

int n;
int A[MAX_N+1], L[MAX_N];

int main(void) {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    int l = 1;
    L[0] = A[0];

    for (int i = 1; i < n; i++) {
        if (L[l-1] < A[i]) {
            L[l++] = A[i];
        } else {
            *lower_bound(L, L+l, A[i]) = A[i];
        }
    }

    cout << l << endl;

    return 0;
}

Measured memory_bytes: 1940
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.sqrt

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val d = readInteger()
    val cList = readLongList()
    val sPerDay = Array(d) { readLongList() }
    val tArray = Array(d) { 0 }

    for (i in 0 until d) {
        var maxT = 1
        var maxScore = Long.MIN_VALUE
        for (j in 0 until 26) {
            tArray[i] = j + 1
            val tmpScore = calcScore(i + 1, cList, sPerDay, tArray)

            if (tmpScore > maxScore) {
                maxT = j + 1
                maxScore = tmpScore
            }
        }

//        out.println("max score: $maxScore")
        tArray[i] = maxT
    }

    for (t in tArray) {
        out.println(t)
    }
}

fun calcScore(d: Int, cList: List<Long>, sPerDay: Array<List<Long>>, tArray: Array<Int>): Long {
    var score = 0L
    val last = IntArray(26)
    for (i in 0 until d) {
        val contestNo = tArray[i] - 1
        score += sPerDay[i][contestNo]

        last[contestNo] = i + 1

        for (j in 0 until 26) score -= cList[j] * ((i + 1) - last[j])
    }

    return score
}


fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

int main() {
    ll N,K,s=0;
    cin >> N >> K;
    vector<P> ab(N);
    rep(i,N)
        cin >> ab.at(i).first >> ab.at(i).second;
    sort(ab.begin(), ab.end());

    rep(i,N) {
        s += ab.at(i).second;
        if(s >= K) {
            cout << ab.at(i).first << endl;
            return 0;
        }
    }
}

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

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='7'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3624
/*....Abhilash's coding template....*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define in insert
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define vll vector<ll>
#define fl(i,a,b) for(ll i=a;i<=b;i++)
#define flr(i,a,b) for(ll i=a;i>=b;i--)
#define print(v) for(auto i=v.begin();i!=v.end();i++){cout<<*i<<" ";}cout<<"\n";
#define tr(c,i) for(decltype((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define test() ll te; cin >> te; while(te--)
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define PI 3.14159265
#define MOD 1000000007
#define M 998244353
#define node pair<ll , pair<ll,ll> >
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

int main()
{
    ll ans=0,n; cin>>n;
    if(n&1)cout<<0;
    else{n/=2;
    while(n!=0)
    {
        ans+=(n/5);
        n/=5;
    }
    cout<<ans;
    }
}


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 998244353;

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

  LL n;
  cin>>n;
  vector<LL> v(n);
  LL sum = 0;
  LL min = 1e10;
  LL cnt = 0;
  bool flag = false;
  REP(i, n)
  {
    cin >> v[i];
    sum += abs(v[i]);
    if(abs(v[i])<min){
      min = abs(v[i]);
    }
    if(v[i]<0){
      cnt++;
    }
    if(v[i]==0){
      flag = true;
    }
  }
  if(flag||(cnt%2==0)){
    cout << sum << endl;
  }else{
    cout << sum - min * 2 << endl;

  }
}


Measured memory_bytes: 1024
from collections import deque

di = [-1,0,1,0]
dj = [0,-1,0,1]

H,W = map(int,input().split())
si,sj = map(int,input().split())
ti,tj = map(int,input().split())
si -= 1
sj -= 1
ti -= 1
tj -= 1

s = list()
for i in range(H):
  s.append(input())

inf = 10**9

dist = [[inf] * W for i in range(H)]
dist[si][sj] = 0
q = deque()
q.appendleft([si,sj])

while(len(q) > 0):
  tmp = q.popleft()
  i = tmp[0]
  j = tmp[1]
  d = dist[i][j]
  for v in range(4):
    ni = i + di[v]
    nj = j + dj[v]
    if (ni < 0) or (ni >= H) or (nj < 0) or (nj >= W):
      continue
    if s[ni][nj] == "#":
      continue
    if dist[ni][nj] <= d:
      continue
    dist[ni][nj] = d
    q.appendleft([ni,nj])
    
  for ei in range(-2, 3, 1):
    for ej in range(-2, 3, 1):
      ni = i + ei
      nj = j + ej
      if (ni < 0) or (ni >= H) or (nj < 0) or (nj >= W):
        continue
      if s[ni][nj] == "#":
        continue
      if dist[ni][nj] <= d+1:
        continue
      dist[ni][nj] = d+1
      q.append([ni,nj])
      
ans = dist[ti][tj]
if ans == inf:
  ans = -1
print(ans)


Measured memory_bytes: 99528
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int dist[10][10];
void warshall_floyd(int n){
    rep(k,n)rep(i,n)rep(j,n){
        dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
    }
}

int main(){
    int h, w;
    cin >> h >> w;
    rep(i,10)rep(j,10) cin >> dist[i][j];
    int A[h][w];
    rep(i,h)rep(j,w) cin >> A[i][j];

    int ans = 0;
    warshall_floyd(10);
    rep(i,h)rep(j,w){
        if (A[i][j] == -1) continue;
        ans += dist[A[i][j]][1];
        //printf("%d\n", dist[A[i][j]][1]);
    }
    // rep(i,10){
    //     rep(j,10){
    //         printf("%d ", dist[i][j]);
    //     }
    //     printf("\n");
    // }

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


Measured memory_bytes: 3720
#include<stdio.h>
int main(void)
{
    int a,b,c,d;
    int i,j,k;
    scanf("%d",&a);
    for(i=0;i<a;i++)
    {
        scanf("%d%d%d",&b,&c,&d);
        if(b<=c &&c<=d || c<=b &&b<=d)//dが最高、d、c、bの順に小さくなっていく
        {
            if(b*b+c*c==d*d) printf("YES\n");
            else printf("NO\n");
        }
        else if(b<=d && d<=c || d<=b && b<=c)//cが最高
        {
            if(b*b+d*d==c*c) printf("YES\n");
            else printf("NO\n");
        }
        else//bが最高
        {
            if(c*c+d*d==b*b) printf("YES\n");
            else printf("NO\n");
        }
    }
    return 0;
}

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

using namespace std;
using ll = long long int;

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

    ll n, k;
    vector<ll> rsp(3);
    cin >> n >> k >> rsp[0] >> rsp[1] >> rsp[2];
    string t;
    cin >> t;

    vector<vector<ll>> dp(n, vector<ll>(3));
    for(ll i=0; i<n; i++) {
        for(ll j=0; j<3; j++)
        for(ll l=0; l<3; l++) {
            if(j == l) continue;
            dp[i][j] = max(dp[i][j], (i-k>=0?dp[i-k][l]:0));
        }

            switch(t[i]) {
                case 'r':
                    dp[i][2] += rsp[2];
                    break;
                case 's':
                    dp[i][0] += rsp[0];
                    break;
                case 'p':
                    dp[i][1] += rsp[1];
                    break;
            }
    }

    ll r = 0;
    for(ll i=0; i<k; i++) {
        ll t = 0;
        for(ll j=0; j<3; j++)
            t = max(t, dp[n-1-i][j]);
        r += t;
    }
    cout << r << endl;
}


Measured memory_bytes: 5840
from sys import stdin
from decimal import Decimal

def main():

    input = stdin.readline

    N = int(input())

    alphabet = "abcdefghijklmnopqrstuvwxyz"

    ans = ""
    flag = True
    while flag:
        if N <= 26:
            flag = False

        ans = alphabet[(N-1)%26] + ans

        N = (N-1) // 26

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9816
import collections

n = int(input())
A = list(map(int, input().split()))
Acoun = collections.Counter(A)

x = 0
for i in Acoun.values():
    x += i * (i - 1) // 2

for i in range(n):
    a = Acoun[A[i]] - 1
    ans = x - (a * (a - 1) // 2 - (a - 1) * (a - 2) // 2)
    print(ans - 1)


Measured memory_bytes: 26780
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt(),w=sc.nextInt();
		char[][] array = new char[h][w];
		int[][] ans = new int[h][w];
		for(int i=0;i<h;i++) array[i]=sc.next().toCharArray();
		sc.close();
		for(int i=0;i<h;i++) {
			int count=0;
			for(int j=0;j<w;j++) {
				if(array[i][j]=='.') count++;
				else {
					for(int k=1;k<=count;k++) ans[i][j-k]=count;
					count=0;
				}
			}
			for(int k=1;k<=count;k++) ans[i][w-k]=count;
		}
		for(int i=0;i<w;i++) {
			int count=0;
			for(int j=0;j<h;j++) {
				if(array[j][i]=='.') count++;
				else {
					for(int k=1;k<=count;k++) ans[j-k][i]+=count;
					count=0;
				}
			}
			for(int k=1;k<=count;k++) ans[h-k][i]+=count;
		}
		int max=0;
		for(int i=0;i<h;i++) {
			for(int j=0;j<w;j++) {
				if(ans[i][j]-1>max) max=ans[i][j]-1;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 71848