akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(I,N) for (int I = 0; I < (N); ++I)
#define fornd(I,N) for (int I = (N) - 1; I >= 0; --I)
#define forab(I,A,B) for (int I = (A); I <= (B); ++I)
#define forabd(I,A,B) for (int I= (B); I >= (A); --I)
#define FOREACH(I,A) for (__typeof__(A)::iterator I=A.begin(); I<A.end(); I++)
#define all(V) (V).begin(), (V).end()
#define pb push_back
#define mp make_pair

typedef long long int ll;

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

const ll mod = 1000000007;

int main() {
  int N, X;
  cin >> N >> X;

  vector<int> L(N);
  forn(i, N) {
    cin >> L[i];
  }

  int d = 0;
  int ans = 1;
  forn(i, N) {
    d += L[i];
    if (d <= X) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()

{
    int n, r;
    cin >> n >> r;
    if(n>=10){
        cout << r << endl;
    }
    else{
        cout << r + 100 * (10 - n) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
         long long c=0,i,n,f=0,b=0;
         cin>>n;
         for(i=1;i<=n;i++)
        {
           b+=i;
           if((i%3)==0 || (i%5)==0) {f+=i;
           }
         }
 
         cout<<b-f<<endl;
}

Measured memory_bytes: 3620
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()

    var sumAll = 0
    for (i in 9..N step 2) {
        var sum = 0
        for (j in 1..N) {
            if(i % j == 0){
                sum++
            }
        }

        if(sum == 8){
           sumAll++
        }
    }
    println(sumAll)
}

Measured memory_bytes: 33860
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,j,n) for(int (i)=(j);(i)<(n);(i)++)
#define eFOR(i,j,n) for(int (i)=(j);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
const int INF = 1000000000;
const ll LLINF = 1LL << 62;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main(){
    int n, m;
    cin >> n >> m;
    int u, v;
    vector<VI> edge(n * 3 + 1);
    FOR(i, 0, m){
        cin >> u >> v;
        edge[u].push_back(v + n);
        edge[u + n].push_back(v + n * 2);
        edge[u + n * 2].push_back(v);
    }
    int s, t;
    cin >> s >> t;

    vector<bool> ever(n * 3 + 1, false);
    queue<pair<int, int>> bfs;
    ever[s] = true;
    bfs.push({ s, 0 });
    while (!bfs.empty()){
        int now = bfs.front().first;
        int dis = bfs.front().second + 1;
        bfs.pop();
        for (int i : edge[now]){
            if (ever[i])continue;
            ever[i] = true;
            bfs.push({ i, dis });
            if (i == t){
                cout << dis / 3 << "\n";
                return 0;
            }
        }
    }
    cout << -1 << "\n";
}


Measured memory_bytes: 16640
s = input()
n = len(s)
a = [0]*(n+1)
for i in range(n):
    if s[i] == '<':
        a[i+1] = max(a[i] + 1, a[i+1])
for i in range(-1, -n-1, -1):
    if s[i] == '>':
        a[i-1] = max(a[i] + 1, a[i-1])
print(sum(a))

Measured memory_bytes: 23348
#include <iostream>
#include <vector>

using namespace std;

int mod = 1000000007;

long long mpow(long long a, long long b)
{
	long long ans = 1;
	while (b != 0) {
		if ((b & 1) == 1) {
			ans *= a;
			ans %= mod;
		}
		a *= a;
		a %= mod;
		b >>= 1;
	}

	return ans;
}

int main()
{
	int n;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}

	long long ans = mpow(10, n);
	ans += mpow(8, n);
	ans %= mod;
	ans += mod - mpow(9, n);
	ans %= mod;
	ans += mod - mpow(9, n);
	ans %= mod;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3580
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  for( i= 0 ; i <= VMAX ; i++ ){
    C[i] = 0;
  }
  for( i = 0 ; i < n ; i++ ){
    scanf( "%hu", &A[i + 1] );
    C[A[i + 1]]++;

  }


  for( i = 0 ; i < VMAX ; i++ ){
    C[i + 1] = C[i + 1] + C[i];
  }


  for( j = 0 ; j < n ; j++ ){
    B[C[A[j+1]]] = A[j+1];
    C[A[j+1]]--;
  }


  for( i = 1 ; i <= n ; i++ ){
    printf( "%d", B[i] );
    if( i != n ){
      printf( " " );
    }
  }
  printf( "\n" );


  return 0;
}



Measured memory_bytes: 9592
from itertools import permutations, combinations,combinations_with_replacement,product
s = input()
t = product(["+",""],repeat=len(s)-1)
sum=0
for i1 in t:
    calc = ""
    for j,i2 in enumerate(i1):
        calc+=s[j]+i2
    calc += s[-1]
    sum+=eval(calc)

print(sum)


Measured memory_bytes: 3060
#include<cstdio>
#include<map>
#include<queue>
#include<vector>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int Maxn=1e5;
const int INF=0x3f3f3f3f;
int t1,t2;
int N,M;
int cnt;
int u,v,c;
struct Edge 
{
    int to,cost;
    Edge(int a,int b){to=a,cost=b;}
};
vector<Edge>way[6*Maxn+5];
void AddEdge(int u,int v,int w) 
{
    way[u].push_back(Edge(v,w));
    way[v].push_back(Edge(u,w));
}
int dis[8*Maxn+5];
int vis[8*Maxn+5];
void dijkstra()
{
	memset(dis,0x3f,sizeof dis);
    typedef pair<int,int>pii;
    priority_queue<pii,vector<pii>,greater<pii> > run;
    memset(vis,0,sizeof vis);
    dis[1]=0;
    run.push(make_pair(dis[1],1));
    while(!run.empty())
    {
        pii tmp=run.top();
        run.pop();
        int u=tmp.second;
        if(vis[u]) continue;
           vis[u]=1;
        for(int i=0;i<way[u].size();i++) 
		{
            int v=way[u][i].to,w=way[u][i].cost;
            if(!vis[v]&&dis[v]>dis[u]+w) 
			{
                dis[v]=dis[u]+w;
                run.push(make_pair(dis[v],v));
            }
        }
    }
}
map<pair<int,int>,int>pos;

int Getid(int u,int c) 
{
    if(pos.find(make_pair(u,c))!=pos.end())
        return pos[make_pair(u,c)];
    return pos[make_pair(u,c)]=++cnt;
}

int main() 
{
    scanf("%d%d",&N,&M);
    cnt=N;
    for(int i=1;i<=M;i++) 
	{
        scanf("%d%d%d",&u,&v,&c);
        t1=Getid(u,c);
		t2=Getid(v,c);
        AddEdge(t1,t2,0);
        AddEdge(u,t1,1);
        AddEdge(v,t2,1);
    }
    dijkstra();
    if(dis[N]==INF)puts("-1");
    else printf("%d\n",dis[N]/2);
}


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

using namespace std;

string s;

long long dfs(string t, int it);
long long check(string t);

int main()
{
	cin >> s;

	string t = "";
	cout << dfs(t + s[0], 1) << endl;

	return 0;
}

long long dfs(string t, int it)
{
	if (it == s.length()) {
		return check(t);
	}

	long long sum = 0;
	sum += dfs(t + s[it], it + 1);
	t += "+";
	sum += dfs(t + s[it], it + 1);

	return sum;
}

long long check(string t)
{
	long long sum = 0;
	long long num = 0;

	for (int i = 0; i < t.length(); i++) {
		if (t[i] == '+') {
			sum += num;
			num = 0;
		} else {
			num = num * 10 + (t[i] - '0');
		}
	}

	return sum + num;
}

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

using namespace std;

typedef long long int64;
typedef pair< int64, int64 > Pi;
const int64 INF = 1LL << 60;

Pi operator-(Pi &a, Pi &b)
{
  return {a.first - b.first, a.second - b.second};
}


int64 cross(Pi a, Pi b)
{
  return (a.first * b.second - b.first * a.second);
}

vector< int64 > beet(vector< Pi > point)
{
  auto f = [](vector< Pi > st)
  {

    vector< int64 > area(st.size(), 0);
    vector< Pi > upper;
    upper.emplace_back(st[0]);
    upper.emplace_back(st[1]);
    for(int i = 2; i < st.size(); i++) {
      area[i] += area[i - 1];
      while(upper.size() >= 2) {
        int sz = (int) upper.size();
        if(cross(upper[sz - 1] - upper[sz - 2], st[i] - upper[sz - 1]) >= 0) break;
        if(upper.size() > 2) area[i] -= cross(upper[upper.size() - 2] - upper[0], upper.back() - upper[0]);
        upper.pop_back();
      }
      upper.push_back(st[i]);
      if(upper.size() > 2) area[i] += cross(upper[upper.size() - 2] - upper[0], upper.back() - upper[0]);
    }
    return (area);
  };

  vector< int64 > latte(point.size(), 0LL);
  auto lala = f(point);
  for(int i = 0; i < point.size(); i++) point[i].second *= -1;
  auto rara = f(point);
  for(int i = 0; i < point.size(); i++) latte[i] += lala[i];
  for(int i = 0; i < point.size(); i++) latte[i] += rara[i];
  return (latte);
}

int main()
{
  int N;
  scanf("%d", &N);
  vector< Pi > P(N);
  for(auto &p : P) scanf("%lld %lld", &p.first, &p.second);
  sort(begin(P), end(P));
  auto pp = beet(P);
  reverse(begin(P), end(P));
  auto qq = beet(P);
  reverse(begin(P), end(P));
  reverse(begin(qq), end(qq));
  int64 ret = min(pp.back(), qq.front());
  for(int i = 1; i < N; i++) {
    if(P[i - 1].first != P[i].first) ret = min(ret, pp[i - 1] + qq[i]);
  }
  printf("%lld\n", (ret + 1) / 2);
}

Measured memory_bytes: 14352
import java.util.Scanner;

public class Main {


    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int r = scan.nextInt();//r?????¨?????????
		int c = scan.nextInt();//c?????¨????¨????
		
		int numlist[][] = new int[r + 1][c + 1];//????¨???¨?????????????????????

		//????¨???¨??????????????????
		for (int cnt_r = 0; cnt_r < r + 1; cnt_r++){
			for (int cnt_c = 0; cnt_c < c + 1 ; cnt_c++) {
				numlist[cnt_r][c] += 0;//????????¨???????¨?????¨????
				numlist[r][cnt_c] += 0;//????????¨???????¨?????¨????
			}
		}

		//???????????????????????????????????????????´???¨????¨???¨?????????????¨?????????????
		for (int cnt_r = 0; cnt_r < r; cnt_r++){
			for (int cnt_c = 0; cnt_c < c ; cnt_c++) {
				numlist[cnt_r][cnt_c] = scan.nextInt();//????????????????´?
				numlist[cnt_r][c] += numlist[cnt_r][cnt_c];//????????¨???????¨?????¨????
				numlist[r][cnt_c] += numlist[cnt_r][cnt_c];//????????¨???????¨?????¨????
				numlist[r][c] += numlist[cnt_r][cnt_c];//??¨??????????¨?????¨????
			}
		}
		for (int cnt_r = 0; cnt_r < r + 1; cnt_r++){
			for (int cnt_c = 0; cnt_c < c + 1 ; cnt_c++) {
				System.out.print( numlist[cnt_r][cnt_c]);
				if(cnt_c != c)//?????????????????°?????§???????????°?????????????????\??????
					System.out.print(" ");
			}
			System.out.print("\n");
		}
		scan.close();
	}
}

Measured memory_bytes: 41592
import sys
lst = [input() for i in range(3)]
#print(lst)
init = lst[0][0]
while True:
    if init == 'a':
        if len(lst[0]) == 0:
            print('A')
            sys.exit()
        else:
            init = lst[0][0]
            lst[0]=lst[0][1:]
        
    elif init =='b':
        if len(lst[1]) == 0:
            print('B')
            sys.exit()
        else:
            init = lst[1][0]
            lst[1]=lst[1][1:]
        
    else:
        if len(lst[2]) == 0:
            print('C')
            sys.exit()
        else:
            init = lst[2][0]
            lst[2]=lst[2][1:]
    
    #print(lst)

Measured memory_bytes: 9132
#include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
static const ll MAX_L = (ll)1 << 62;

ll m[31][200001] = {};
ll sum[200001] = {};
int main() {
	ll n, C; cin >> n >> C;

	rep(i, 0, n) {
		ll s, t, c; cin >> s >> t >> c;

		if (m[c][2 * s] < 0) {
			m[c][2 * s]++;
		}
		else {
			m[c][2 * s - 1]++;
		}

		if (m[c][2 * t - 1] > 0) {
			m[c][2 * t - 1]--;
		}
		else {
			m[c][2 * t]--;
		}

		//m[c][2 * s - 1]++;
		//m[c][2 * t]--;
	}
	repe(i, 1, C) {
		rep(j, 1, 200001) {
			m[i][j] += m[i][j - 1];
		}
	}

	ll maxV = 0;
	rep(i, 1, 200001) {
		repe(j, 1, C) {
			//if (m[j][i] >= 1) {
			//	sum[i]++;
			//}

			if (m[j][i] >= 2) {
				cout << endl;
			}

			sum[i] += m[j][i];//wrong!!
		}
		maxV = max(maxV, sum[i]);
	}

	cout << maxV << endl;
	return 0;
}

Measured memory_bytes: 49792
using System.Collections.Generic;
using System.Linq;
using System;
class Program
{
    static void Main()
    {
        int count = int.Parse(Console.ReadLine());
        string line = Console.ReadLine();
        string[] strs = line.Split(' ');
        int[] nums = new int[count];

        for (int i = 0; i < count; i++)
        {
            nums[i] = int.Parse(strs[i]);
        }


        int swapCount = 0;
        for (int i = 0; i < count - 1; i++)
        {
            if(nums[i] == i + 1)
            {
                int temp = nums[i];
                nums[i] = nums[i + 1];
                nums[i + 1] = temp;
                swapCount++;
            }
        }
        if(nums[count-1] == count)
        {
            int temp = nums[count - 1];
            nums[count - 1] = nums[count - 2];
            nums[count - 2] = temp;
            swapCount++;
        }

        Console.WriteLine(swapCount.ToString());
    }
}

Measured memory_bytes: 18784
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    h = True
    for x in range(n):
        if all(s[(x+i)%n][y]==s[(y+i)%n][x] for y in range(x, n)):
            continue
        else:
            h = False
            break
    if h:
        result += 1
print(result*n)

Measured memory_bytes: 44636
import sys
c = [list(map(int, input().split())) for _ in range(3)]

x = []
for i in range(3):
    x.append([c[i][1]-c[i][0], c[i][2]-c[i][0], c[i][2]-c[i][1]])
if x[0] != x[1] or x[1] != x[2]:
    print("No")
    sys.exit()

y = []
for j in range(3):
    y.append([c[1][i]-c[0][i], c[2][i]-c[0][i], c[2][i]-c[1][i]])
if y[0] != y[1] or y[1] != y[2]:
    print("No")
    sys.exit()
print("Yes")

Measured memory_bytes: 3064
n=int(input())
a=list(map(int,input().split()))
a.append(0)
a.insert(0,0)
ctr=0
for i in range(n+1):
    ctr+=abs(a[i+1]-a[i])

for i in range(1,n+1):
    if a[i-1]<=a[i]<=a[i+1] or a[i-1]>=a[i]>=a[i+1]:
        print(ctr)
    elif a[i]==max(a[i-1],a[i],a[i+1]):
        print(ctr-(a[i]-max(a[i-1],a[i+1]))*2)
    elif a[i]==min(a[i-1],a[i],a[i+1]):
        print(ctr-(min(a[i-1],a[i+1])-a[i])*2)



Measured memory_bytes: 14036
def main():
    N, X = map(int, input().split())
    p, t = 1, 1
    P = [p]
    T = [t]
    for i in range(1, N + 1):
        p = p * 2 + 1
        t = t * 2 + 3
        P.append(p)
        T.append(t)
    r = 0
    i = N
    while i >= 0 and X > 0:
        if X >= T[i]:
            r += P[i]
            X -= T[i]
            if X >= 1:
                r += 1
                X -= 1
        else:
            X -= 1
            i -= 1
    print(r)
main() 


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>


using namespace std;

int main(){

    
    int a,b,n;
    while(cin>>a>>b>>n){
        int rest=a%b;
        int out=0;
        for(int i=0; i<n; i++){
            rest*=10;
            out+=rest/b;
            rest=rest%b;
        }
        cout<<out<<endl;

    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
  int n;
  cin >> n;
  int mid = n/2;
  vector<int> x(n,0);
  vector<pair<int,int>> cp_x(n,{0,0});
  rep(i,n) {
    cin >> x[i];
    cp_x[i].first = x[i];
    cp_x[i].second = i;
  };
  sort(all(cp_x));
  for(int i=0;i<n;i++){
    pair<int,int> ser = {x[i],i};
    int index = lower_bound(all(cp_x),ser) - cp_x.begin();
    if(mid > index) cout << cp_x[mid].first << endl;
    else cout << cp_x[mid-1].first << endl;
  }
}

Measured memory_bytes: 4480
import sys
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]

# エントリーポイント
def main():
    N = input(int)
    TA = input([int, int, N])

    a, b = 1, 1
    for x, y in TA:
        # n = max(ceil(a / x), ceil(b / y))
        n = max((a - 1) // x, (b - 1) // y) + 1
        a, b = n * x, n * y
    print(a + b)

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 3572
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int cnt6 = 0;
        while(Math.pow(6, cnt6 + 1) <= n)
        	cnt6++;

        int cnt9 = 0;
        while(Math.pow(9, cnt9 + 1) <= n)
        	cnt9++;

        List<Integer> coins = new ArrayList<>();
        coins.add(1);
        for(int i = 0; i <= cnt6; i++)
        	coins.add((int) Math.pow(6, i));
        for(int i = 0; i <= cnt9; i++)
        	coins.add((int) Math.pow(9, i));

        int[][] dp = new int[coins.size() + 1][n+1];
        for(int i = 1; i <= n; i++) 
            dp[0][i] = Integer.MAX_VALUE;
            
        for(int i = 1; i <= coins.size(); i++) {
            int coin = coins.get(i - 1);
        	for(int j = 1; j <= n ; j++) {
        	    if(j < coin) dp[i][j] = dp[i-1][j];
        	    else dp[i][j] = Math.min(dp[i-1][j], 1 + dp[i][j - coin]);
        	}
        }
        System.out.println(dp[coins.size()][n]);
    }
}


Measured memory_bytes: 26836
N = gets.chomp.to_i
S = gets.chomp
 
w = 0
b = 0
bstart = -1
bend = -1
 
for x in 0...N
  if S[x] == "."
    w += 1
    bend = -1
  else
    if bstart == -1
      bstart = x
    end
    if bend == -1
      bend = x
    end
    b += 1
  end
end
 
if bend == -1
  bend = N
end
 
if w == 0 || b == 0
  puts 0
  exit
end
 
w2 = w - bstart
#b2 = b - (N-bend)
#answer = [w2,b2].min
answer = w2
a = w2
 
for x in bstart ... bend
  if S[x] == "#"
    a += 1
  else
    a -= 1
    answer = [a,answer].min
  end
end
 
puts answer

Measured memory_bytes: 2172
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
 
int main(){
  int N, chk = 1;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < N-1; i++){
    if (A[i] == A[i+1]){
      chk = 0;
    }
  }
  if(chk){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
int a[110];
signed main()
{
    int n;
    cin >> n;
    REP(i, n)
        cin >> a[i];
    for (int i = 0; i < n; i++)
    {
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;

    return 0;
}

Measured memory_bytes: 256
import bisect

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0

for b in B:
    a = bisect.bisect_left(A, b)
    c = N-bisect.bisect_right(C, b)
    ans += a * c
    
print(ans)


Measured memory_bytes: 23368
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<lint>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

vector<P> en;

int main() {
    lint n, d, a;
    cin >> n >> d >> a;
    vec x(n), h(n);
    rep(i, n) cin >> x[i] >> h[i];

    en.resize(n);
    rep(i, n) en[i] = make_pair(x[i], h[i]);

    sort(all(en));

    lint res = 0;
    lint cur = 0;
    queue<pair<lint, lint>> que;

    rep(i, n) {
        lint x = en[i].first;
        lint h = en[i].second;

        while (!que.empty() && que.front().first < x) {
            cur -= que.front().second;
            que.pop();
        }

        h -= cur;
        if (h > 0) {
            lint c = (h+a-1) / a;
            res += c;
            lint damage = a * c;
            cur += damage;
            que.push(make_pair(x + d * 2, damage));
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 6528
N = int(input())
A = list(map(int,input().split()))

sum = 0
key = 0
para = A[0]
for i in range(N):
    if i == 0:
        continue
    else:
        if para > A[i]:
            key = para - A[i]
            sum = sum + key
        else:
            key = 0
            sum = sum + key
            para = A[i]

print(sum)

Measured memory_bytes: 32180
def main():
  import fractions
  
  a,b,c,d=map(int,input().split())
  e=fractions.gcd(c,d)
  f=c*d//e
  x = (b//c - (a-1)//c)+ (b//d - (a-1)//d) - (b//f-(a-1)//f)
  y = (b-a+1)-x
  print(y)
  
if __name__=="__main__":
  main()

Measured memory_bytes: 5048
n = gets.strip.to_i
ab = readlines.map {|line| line.strip.split.map(&:to_i) }

graph = Array.new(n+1) { [] }
ab.each do |a, b|
  graph[a] << b
  graph[b] << a
end

checked = [false]*(n+1)
checked[1] = checked[n] = true
fq = [1]
sq = [n]
fp=sp=0

until fq.empty? && sq.empty?
  
  cq = fq.dup
  fq=[]
  until cq.empty?
    cf = cq.shift
    graph[cf].each do |to|
      next if checked[to]
      fq.push(to)
      fp+=1
      checked[to]=true
    end
  end

  cq = sq.dup
  sq=[]
  until cq.empty?
    cs = cq.shift
    graph[cs].each do |to|
      next if checked[to]
      sq.push(to)
      sp+=1
      checked[to]=true
    end
  end

end

#p [sp, fp]

if sp >= fp
  puts 'Snuke'
else
  puts 'Fennec'
end



Measured memory_bytes: 25580
N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

now = sum(A) % mod
ans = 0

for i in range(N):
  now -= A[i]
  now %= mod
  ans += A[i] * now
  ans %= mod
print(ans % mod)  




Measured memory_bytes: 31436
#include<iostream>
using namespace std;
 
int main()
{
  int N,A,B,C,X,Y,y,f;
  while(cin>>N>>A>>B>>C>>X,N||A||B||C||X){
    f=0;
y=-1;
    while(N-->0){
      cin>>Y;
if(Y==y){X=(A*X+B)%C;f++;}
      while(X!=Y&&f<10001){
        X=(A*X+B)%C;
        f++;
      }
y=Y;
    }
    if(f>10000)f=-1;
    cout<<f<<endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;

 
int main() {
	
	string S;
	cin>>S;
	reverse(S.begin(),S.end());
	
	int here=0;
	while(here<S.size()){
		if(S.substr(here,5)=="maerd"){
			here+=5;
		}else if(S.substr(here,5)=="esare"){
			here+=5;
		}else if(S.substr(here,7)=="remaerd"){
			here+=7;
		}else if(S.substr(here,6)=="resare"){
			here+=6;
		}else {
			break;
		}
		
	}
	
	if(here==S.size()){
		ce("YES")
	}else{
		ce("NO")
	}
	
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace SolutionCS
{
    class Program
    {
        class ELEMENT
        {
            public string str;
            public bool startIsB;
            public bool endIsA;
            public bool onlyA;
            public bool onlyB;
        }


        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int startB = 0;
            int endA = 0;
            int bothBA = 0;

            int result = 0;

            for (int i = 0; i < N; i++)
            {
                ELEMENT e = new ELEMENT();
                string inStr = Console.ReadLine();

                char start = inStr[0];
                char end = inStr[inStr.Length - 1];

                if( start == 'B' && end == 'A')
                {
                    bothBA++;
                }
                else if ( start == 'B')
                {
                    startB++;
                }
                else if ( end == 'A')
                {
                    endA++;
                }

                int ind;
                do
                {
                    ind = inStr.IndexOf("AB");

                    if (ind >= 0)
                    {
                        inStr = inStr.Substring(ind + 2);
                        result++;
                    }
                }
                while (ind >= 0);
            }

            // 開始と終了が両方条件を満たすものは何も考えず接続
            if ( bothBA >= 2)
            {
                result += (bothBA - 1);
            }

            if ( bothBA > 0 && endA > 0)
            {
                result++;
                endA--;
            }
            if ( bothBA > 0 && startB > 0)
            {
                result++;
                startB--;
            }

            result += Math.Min(endA, startB);

            Console.WriteLine("{0}", result);
        }
    }
}


Measured memory_bytes: 13408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)


const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef long long ll;
typedef pair<int, int> P;

const int MAX_V = 200;

struct edge{int to, cost;};

//V := number of nodes
//G := adj
//rest := number of nodes which are not determined yet
int V;
vector<edge> G[MAX_V];
int d[MAX_V];
int rest = V-1;
void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        rep(G[v].size(), i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

void solve(void){
    int H, W; cin >> H >> W;
    V = 10;
    rep(10, i) rep(10, j) {
        int c; scanf("%d\n", &c);;
        G[j].push_back({i, c});
    }
    dijkstra(1);
    int ans = 0;
    rep(H, i) rep(W, j) {
        int w;
        scanf("%d\n", &w);
        if (w == -1) continue;
        ans += d[w];
    }
    //rep(10, i) cout << d[i] << ' ';
    printf("%d\n", ans);
}

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


Measured memory_bytes: 256
#include <cstdio>

int pn[233333],pk[233333],pl[233333];
char pi[233333];

int main()
{
	int n,k; scanf("%d%d",&n,&k);
	if(k>=n)
	{
		printf("%d",n); return 0;
	}
	scanf("%s",pi); int p=0,t;
	for(int i=0; i<k; i++) if(pi[i]=='0')
	{
		p++; pn[p]=i; pk[p]=1;
	}
	pk[1]=0; t=p; pn[0]=1;
	for(int i=k; i<=n; i++)
	{
		if(t==0) break;
		if(pi[i]=='0')
		{
			while(pn[pn[0]]<i-k) pn[0]++;
			pn[++p]=i; pk[p]=pn[0]; t++;
		}
		if(pi[i-k]=='0') t--;
	}
	if(t==0)
	{
		printf("-1"); return 0;
	}
	int x=p;
	while(x!=0)
	{
		pl[++pl[0]]=pn[x]; x=pk[x];
	}
	for(int i=pl[0]; i>1; i--) printf("%d ",pl[i-1]-pl[i]);
	return 0;
}

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

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


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
using ll = long long;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++){
    ll tmp;
    cin>>tmp;
    a[i]=tmp-i;
  }
  // ll med1=0,med2=0,median=0,ans1=0,ans2=0,ans=0;
  ll  med1=0,med2=0,median=0,ans=0;
  // bool flag=0;
  sort(a,a+n);
  // for(int i=0;i<n;i++){
  //   cout<<a[i]<<",";
  // }
  // cout<<endl;
  if(n%2==0){
    // cout<<"n/2-1="<<n/2-1<<",n/2="<<n/2<<endl;
    med1=a[n/2-1];
    med2=a[n/2];
    median=(med1+med2)/2;
  }else{
    median=a[n/2];
    // flag=1;
  }
  // if(flag){
  //   for(int i=0;i<n;i++){
  //     ans1+=abs(a[i]-med1);
  //   }
  //   cout<<ans1<<endl;
  // }else{
  //   for(int i=0;i<n;i++){
  //     ans1+=abs(a[i]-med1);
  //     ans2+=abs(a[i]-med2);
  //   }
    // cout<<"med1="<<med1<<",med2="<<med2<<endl;
    // cout<<"ans1="<<abs(ans1)<<",ans2="<<abs(ans2)<<endl;
    // cout<<min(ans1,ans2)<<endl;
  // }
  for(int i=0;i<n;i++){
    ans+=abs(a[i]-median);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            var a = Reads();
            /*var n = 6;
            var a = new long[6];
            Random r = new Random();
            for (int i = 0; i < 6; i++)
            {
                a[i] = r.Next(1, 20);
                Write(a[i]);
                Write(" ");
            }
            WriteLine();*/
            var str = new string[] { "zouka", "kugiri", "gensyo" };
            var f = "";
            long ans = 1;
            if (n > 1 && a[1] > a[0]) f =str[0];
            if (n > 1 && a[0] > a[1]) f =str[2];
            for (int i = 1; i < n-1; i++)
            {
                if (a[i] < a[i + 1])
                {
                    if (f == str[1])
                        f = str[0];
                    if (f==str[2])
                    {
                        ans++;
                        f = str[1];                 
                    }               
                }
                else if (a[i] > a[i + 1])
                {
                    if (f == str[1])
                        f = str[2];
                    if (f==str[0])
                    {
                        ans++;
                        f = str[1];
                    }
                    
                }
                //WriteLine(f);
            }
            WriteLine(ans);










          
            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 29340
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int n;
	cin >> n;
	if ((n / 100) == (n % 10))cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

int main() {
  int N; scanf("%d", &N);
  static int L[100000];
  for(int i = 0; i < N; ++i) {
    scanf("%d", &L[i]); --L[i];
  }
  int cnt = 0;
  for(int i = 0; i < N; ++i) {
    if(i < L[i] && L[L[i]] == i) {
      ++cnt;
    }
  }
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 512
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let x = read!(usize);
    let a = read!(usize);
    let b = read!(usize);
    let mut remain = x;
    remain -= a;
    remain -= b * (remain / b);
    println!("{}", remain);
}


Measured memory_bytes: 4352
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
    
    ll n;
    cin>>n;
    ll ha = (n + 1000 -1 )/1000;
    cout<<1000*ha - n;
}

Measured memory_bytes: 3620
/*
Created on Thu Aug 27 21:32:39 2020

@author: roastedcoder

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long int ull;
const int mod = 1e9+7;
const int INF = INT_MAX;
#define endl "\n"
#define append push_back
#define roastedcoder ios_base::sync_with_stdio(false); cin.tie(NULL);
//__________________________________________________________________


int main() {
	roastedcoder
	int d, t, s; cin>>d>>t>>s;
	double tmp = 1.0*d/s;
	t<tmp ? cout<<"No" : cout<<"Yes";
}

//__________________________________________________________________
/*
Sample Input:


Sample Output:


*/


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <map>
#include <set>
#include <random>
#include <sstream>
#include <stack>
#include <deque>

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

string N;


int main() {
    cin >> N;
    if (N[0] == '9' || N[1] == '9') cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
local n,k=io.read("n","n")
local a={}
local dp={}
for i=1,n do
    local input=io.read("n")
    a[i]=input
    dp[input]=true
end

for i=0,k do
    for j=1,n do
        if not dp[i] then
            dp[i+a[j]]=true
        end
    end
end
print(dp[k] and "First" or "Second")

Measured memory_bytes: 8564
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    vector<P> vt;
    for(int i=0; i<N; i++){
        ll x,l;
        cin >> x >> l;
        vt.push_back(P(x-l, x+l));
    }
    sort(vt.begin(), vt.end());
    ll ans=0;
    ll s=vt[0].first, t=vt[0].second;
    
    for(int i=1; i<N; i++){
        ll stmp=vt[i].first, ttmp=vt[i].second;
        if(t<=stmp){
            s=stmp;
            t=ttmp;
            ans++;
        }else if(t<ttmp){
            continue;
        }else{
            s=stmp;
            t=ttmp;
        }
    }
    ans++;
    cout << ans << endl;


    
    return 0;
}

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

#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long int lli;

int main()
{
	fio;
	int n,m;
	cin>>n>>m;
	pair<int,int> a[m];
	vector<int> v[(int)1e5+1];
	for(int i=0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		a[i]={x,y};
		v[x].push_back(y);
	}
	sort(a,a+m);
	set<int> st;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		//cout<<"i "<<i<<endl;
		if(*st.begin()==i)
		{
			ans++;
			st.clear();
		}
		for(int j:v[i])
		{
			//cout<<"j "<<j<<endl;
			st.insert(j);
		}
	}
	cout<<ans<<endl;
	cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

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

int n;
string s, t;
set<int> a[30], b[30];
bool dd[30];

int main(){
	cin >> s >> t;
	n = s.length();
	for (int i=0; i<n; ++i){
		a[s[i]-'a'].insert(i);
	}

	for (int i=0; i<n; ++i){
		b[t[i]-'a'].insert(i);
	}
	for (int i=0; i<n; ++i){
		if (!dd[s[i]-'a']){
			if (a[s[i]-'a'].size() != b[t[i]-'a'].size()){ 
				cout << "No";
				return 0;
			}
			for (auto j : a[s[i]-'a']){
				if (b[t[i]-'a'].find(j) == b[t[i]-'a'].end()){
					cout << "No";
					return 0;
				}
			}
			dd[s[i]-'a'] = true;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 19336
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

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

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

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());

	vector<int> b_larger_than_a(n), c_larger_than_b(n);
	for (int i = 0; i < n; ++i) {
		vector<int>::iterator low1 = lower_bound(a.begin(), a.end(), b[i]);
		vector<int>::iterator low2 = lower_bound(b.begin(), b.end(), c[i]);
		if (low1 == a.end()) {
			b_larger_than_a[i] = n;
		} 
		else if (low1 != a.begin()) {
			b_larger_than_a[i] = (low1 - a.begin());
		}

		if (low2 == a.end()) {
			c_larger_than_b[i] = n;
		} 
		else if (low2 != a.begin()) {
			c_larger_than_b[i] = (low2 - b.begin());
		}
	}

	vector<long long> pre_sum_b(n);
	pre_sum_b[0] = b_larger_than_a[0];
	for (int i = 1; i < n; ++i) {
		pre_sum_b[i] = pre_sum_b[i - 1] + b_larger_than_a[i];
	}

	long long ans = 0;
	for (int i = 0; i < n; ++i) {
		if (c_larger_than_b[i]) {
			ans += pre_sum_b[c_larger_than_b[i] - 1];
		}
	}

	cout << ans << "\n";

	return 0;

}

Measured memory_bytes: 6112
#include<bits/stdc++.h>
#define int long long 
using namespace std;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
int A,B,C,D;
int check(int x) {
	return x-(x/C+x/D-x/(C*D/__gcd(C,D)));
}
main() {
	A=read(),B=read(),C=read(),D=read();
	cout<<check(B)-check(A-1);
}

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

int main(){

    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a) > abs(x-b)) cout << 'B' << endl;
    else cout << 'A' << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
 
using namespace std;

bool vis[30][30];
int cnt;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
int w,h;

void dfs(vector<string> &vs,int y,int x){

	if(vis[y][x]) return;
	vis[y][x]=true;
	cnt++;

	for(int i=0;i<4;i++){
		int ny=y+dy[i],nx=x+dx[i];
		if( 0<=ny && ny<h && 0<=nx && nx<w && vs[ny][nx]=='.') dfs(vs,ny,nx);
	}

}

int main(){

	while(cin>>w>>h,w||h){

		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++) vis[i][j]=false;
		}
		cnt=0;

		vector<string> vs(h);
		int x,y;
		for(int i=0;i<h;i++){
			cin>>vs[i];
			for(int j=0;j<w;j++){
				if(vs[i][j]=='@') y=i,x=j;
			}
		}

		dfs(vs,y,x);
		cout<<cnt<<endl;

	}

	return 0;
}

Measured memory_bytes: 3056
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

#define POS(i,j) ((i)*w+(j))

int func(int i,int j,char *board,int h,int w){
  int k;
  for(k=0;k<h;k++){
    if(board[POS(k,i)]!=board[POS(h-1-k,j)]) return 0;
  }
  return 1;
}

int calcCol(char *board,int h,int w){
  int flag[16];
  int i,j;
  for(i=0;i<w;i++) flag[i]=0;
  int useCenter=0;
  for(i=0;i<w;i++){
    if(flag[i]) continue;
    for(j=i+1;j<w;j++){
      if(flag[j]) continue;
      if(func(i,j,board,h,w)){
	flag[i]=1;
	flag[j]=1;
	break;
      }
    }
    if(flag[i]==0){
      if(w%2==0 || useCenter) return 0;
      for(j=0;j<h-1-j;j++){
	if(board[POS(j,i)]!=board[POS(h-1-j,i)]) return 0;
      }
      useCenter=1;
      flag[i]=1;
    }
  }
  return 1;
}

void swapRow(int a,int b,char *board,int h,int w){
  int i;
  for(i=0;i<w;i++){
    char t=board[POS(a,i)];
    board[POS(a,i)]=board[POS(b,i)];
    board[POS(b,i)]=t;
  }
  return;
}

int loopRow(int d,char *board,int h,int w){
  if(d>=h-1-d) return calcCol(board,h,w);
  int i;
  for(i=d+1;i<h-d;i++){
    if(h%2==1 && i==h/2) continue;
    swapRow(i,h-1-d,board,h,w);
    if(loopRow(d+1,board,h,w)) return 1;
    swapRow(i,h-1-d,board,h,w);
  }
  return 0;
}

int calc(char *board,int h,int w){
  if(h%2==0) return loopRow(0,board,h,w);
  int center=h/2;
  int i;
  for(i=0;i<h;i++){
    swapRow(i,center,board,h,w);
    if(loopRow(0,board,h,w)) return 1;
    swapRow(i,center,board,h,w);
  }
  return 0;
}

void run(void){
  int h,w;
  scanf("%d%d",&h,&w);
  char *board=(char *)malloc(sizeof(char)*(h*w+1));
  int i;
  for(i=0;i<h;i++) scanf("%s",board+POS(i,0));
  printf("%s\n",calc(board,h,w)?"YES":"NO");
  free(board);
  return;
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 256