akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  agc
//
//  Created by zhangdenny on 2017/7/23.
//  Copyright © 2017年 Kirito. All rights reserved.
//

#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <list>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
int n,k;
int a[100005];
bool f,f2;
int gcd(int a, int b)
{
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    cin>>n>>k;
    if(n==1)
    {
        int a;
        cin>>a;
        if(a==k)
            cout<<"POSSIBLE";
        else
            cout<<"IMPOSSIBLE";
        return 0;
    }
    int g=1;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(i==1)
            g=gcd(a[0],a[1]);
        else
            if(i>1)
            {
                int t=g;
                g=gcd(t,a[i]);
            }
        if(a[i]>=k)
            f=1;
    }
    if(!f || k%g!=0)
    {
        cout<<"IMPOSSIBLE";
    }
    else
    {
        cout<<"POSSIBLE";
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k; cin >> n >> k;
    cout << n-k+1 << '\n';
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int n,i,j,k,v;
    int a[100];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(k=0;k<n;k++){
            printf("%d",a[k]);
            if(k!=n-1){
                printf(" ");
            }else{
                printf("\n");
            }
    }
    for(i=1;i<n;i++){
        v=a[i];
        j=i-1;
        while(j>=0&&a[j]>v){
            a[j+1]=a[j];
            j--;
            a[j+1]=v;
            }
        for(k=0;k<n;k++){
            printf("%d",a[k]);
            if(k!=n-1){
                printf(" ");
            }else{
                printf("\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define SORT(x) sort((x).begin(),(x).end())
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define F_ first
#define S_ second

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

const int INF=1<<30;
//const long long int INF_=1<<60;

bool compare(const pair<int,string> &p1,const pair<int,string> &p2){
	if(p1.F_>p2.F_) return true;
	else if(p1.F_<p2.F_) return false;
	else return p1.S_<p2.S_;
}

int main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int N;
    while(cin >> N&&N){
		cin.ignore();
		map<string,int> cnt;
		vector<string> str;
		REP(i,0,N){
			string sentence;
			getline(cin,sentence);
			stringstream ss(sentence);
			while(!ss.eof()){
				string tmp;
				ss >> tmp;
				++cnt[tmp];
				if(cnt[tmp]==1) str.push_back(tmp);
				ss.ignore();
			}
		}
		char initial;
		cin >> initial;
		vector<pair<int,string> > ans;
		for(auto it=cnt.begin(); it!=cnt.end(); ++it) ans.push_back(make_pair(it->S_,it->F_));
		sort(ans.begin(),ans.end(),compare);
		int k=0;
		REP(i,0,ans.size()) if(k<5&&ans[i].S_[0]==initial){
			if(k) cout << ' ';
			cout << ans[i].S_;
			++k;
		}
		if(!k) cout << "NA";
		cout << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    ll g = 0;
    vector<ll> a(n+1);
    REP(i, n+1) {
        cin >> a[n-i];
        g = __gcd(g, abs(a[n-i]));
    }

    auto test = [&](ll p) {
        if(a[0]%p) return false;
        vector<ll> sum(p);
        FOR(i, 1, n+1) sum[i%(p-1)] += a[i];
        bool flag = true;
        REP(i, p) if(sum[i]%p != 0) flag = false;
        return flag;
    };

    vector<ll> ans;

    // P <= N
    vector<bool> prime(n+2, true);
    prime[0] = prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (prime[i]) {
            if(test(i)) ans.push_back(i);
            for (int j = 2 * i; j <= n; j += i) {
                prime[j] = false;
            }
        }
    }

    for(ll i=2; i*i<=g; ++i) {
        if(g%i==0) ans.push_back(i);
        while(g%i==0) g/=i;
    }
    if(g>1) ans.push_back(g);

    // // P > N
    // ll t = a[n];
    // vector<ll> div;
    // for(ll i=2; i*i<=t; ++i) {
    //     if(t%i==0) div.push_back(i);
    //     while(t%i==0) t/=i;
    // }
    // if(t>1) div.push_back(t);
    // for(auto i: div) {
    //     if(i <= n) continue;
    //     bool flag = true;
    //     REP(j, n+1) if(a[j]%i != 0) flag = false;
    //     if(flag) ans.push_back(i);
    // }

    for(auto i: ans) cout << i << endl;

    return 0;
}


Measured memory_bytes: 384
def a_diverse_word(S):
    from string import ascii_lowercase
    if len(S) < 26:
        # 26字未満なら、Sにまだ現れていない文字で辞書順最小のものを末尾に加えたものが解
        ans = S + min(set(list(ascii_lowercase)) - set(S))
    else:  # Sの長さは定義上26字以下なので、Sが26字のときこの処理を行う
        idx = 0  # S[idx]以降末尾まで降順になっている
        for k in range(len(S) - 1, 0, -1):
            if S[k] > S[k - 1]:
                idx = k
                break
        if idx == 0:
            ans = '-1'  # Sは辞書の最後の単語だった。「次」はない
        else:
            for c in sorted(S[idx:]):
                if S[idx - 1] < c:
                    ans = S[:idx - 1] + c
                    break
    return ans

S = input().strip()
print(a_diverse_word(S))

Measured memory_bytes: 4020
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX 1000001

bool isPrime[MAX];

void eratos() {
    fill(isPrime, isPrime + MAX, true);
    for (int i = 2; i < MAX; i++) {
        if (!isPrime[i]) continue;
        for (int j = i + i; j < MAX; j += i) {
            isPrime[j] = false;
        }
    }
}

int main() {
    eratos();
    int n;
    while (true) {
        cin >> n;
        if (n == 0) return 0;
        int count = 0;
        for (int i = 2; i <= n / 2; i++) {
            if (!isPrime[i]) continue;
            if (isPrime[n - i]) count++;
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 3976
'use strict'
function main(inp) {
  inp = inp.trim().split('\n');
  let N = inp[0].split(' ')*1;
  let As = inp[1].split(' ').map(x => x*1);
  let ansArr = {};
  for(let i = 0; i < N - 1; i++){
    if(ansArr[As[i]] == undefined){
    	ansArr[As[i]] = 1; 
    }
    else {
        ansArr[As[i]]++; 
    }
  }
  for(let j = 1; j <= N; j++){
    console.log(ansArr[j] ? ansArr[j] : 0);
  }  
}

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


Measured memory_bytes: 63512
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort(all(v))
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
#define fcout cout << fixed << setprecision(15)
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



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

  int n;
  ll a[100010][3], dp[100010][3] = {};
  cin >> n;
  rep(i, n) rep(j, 3) cin >> a[i][j];

  rep(i, n) {
    rep(j, 3) {
      rep(k, 3) {
        if(j == k) continue;
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }
    }
  }
  ll res = 0;
  rep(i, 3) {
    chmax(res, dp[n][i]);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4992
import sys
input = sys.stdin.readline

def main():
    N,M,P = map(int,input().split())
    edges = []


    for _ in range(M):
        A,B,C = map(int,input().split())
        edges.append([A-1,B-1,P-C])

    inf = 10000*(10**5)
    dist = [inf for _ in range(N)]
    dist[0] = 0

    for i in range(N-1):
        for edge in edges:
            if dist[edge[1]] > dist[edge[0]] + edge[2]:
                dist[edge[1]] = dist[edge[0]]+edge[2]
    ans = -1*dist[N-1]
    
    for i in range(N-1):
        for edge in edges:
            if dist[edge[1]] > dist[edge[0]]+edge[2]:
                dist[edge[1]] = dist[edge[0]]+edge[2]
    ans2 = -1*dist[N-1]

    if ans2<=ans: 
        print(max(0,ans))         
    else:
        print(-1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 42436
#include <bits/stdc++.h>
#include <unordered_map>
 
using namespace std;
 
#define endl '\n'
#define ll long long
#define int long long
const int32_t INFint = 1e9;
const ll INFll = 1e18;
const ll INF = 1LL << 60;
#define MOD 1000000007ll
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define foreach(it,v) for( __typeof((v).begin())it = (v).begin() ; it != (v).end() ; it++ )
 
#define deb1(x)                cout<<#x<<": "<<x<<endl
#define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
#define For(i, a, b) for (ll i = a; i < b; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define all(v) v.begin(),v.end()
#define gll(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define gint(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define setZero(a,n) for(int i=0;i<n;i++) a[i]=0;
#define printArray(a,s,e) for(int i=s;i<e;i++) {cout << a[i] << " ";} cout << endl;
#define nl cout << endl
//---------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------- 
int32_t main(){fast;
    

    int t = 1;
    // cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        int arr[n];
        gint(arr, n);

        int dp[k+1];
        memset(dp, 0, sizeof(dp));

        for(int i=1;i<=k;i++){
        	for(int j=0;j<n;j++){
        		if((i - arr[j]) >= 0){
        			if(dp[i - arr[j]] == 0){
        				dp[i] = 1;
        			break;
        			}
        		}
        	}
        }

        if(dp[k]==1) cout << "First" << endl;
        else cout << "Second" << endl;
    }  
}

















Measured memory_bytes: 1024
# coding: utf-8
N = int(input())
X = list(map(int, input().split()))
X.sort()
ans = float("inf")
for p in range(X[0], X[-1] + 1):
    tmp = 0
    for i in range(N):
        tmp += (p - X[i]) ** 2
    ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] o = sc.next().toCharArray();
        char[] e = sc.next().toCharArray();
        boolean stop = o.length != e.length;
        String ans = "";
        for(int i = 0; i < o.length; i++){
            ans += o[i];
            if(i == o.length-1 && stop) continue;
            ans += e[i];
        }
        System.out.println(ans);
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

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

    int n, m;
    cin >> n >> m;
    vector<PII> a(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i].first >> a[i].second;
    }

    for (int i = 0; i < 1000; i++) {
        string s = to_string(i);
        if (s.size() > n) {
            cout << -1;
            return 0;
        }
        if (s.size() == n) {
            int j;
            for (j = 0; j < m; j++) {
                int pos = a[j].first;
                char c = a[j].second + '0';
                if (s[pos-1] != c) break;
            }
            if (j == m) {
                cout << s;
                return 0;
            }
        }
    }


    cout << -1;





    return 0;
}


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

int main() {
  
  int x,y,z;
  cin >> x >> y >> z;
  
  int a = 0,count = 0;
  
  while( a <= x ){
    count++;
    a = y * count + z * ( count + 1 );
  }
  
  count--;  
  
  cout << count << endl;
   
}

Measured memory_bytes: 256
import numpy as np
import math
A, B, C, D = [int(i) for i in input().split()]
 
large = np.max([C, D])
small = np.min([C, D])
 
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
def lcm(a, b):
    return a * b // gcd (a, b)
 
num_B_1 = B // C
num_B_2 = B // D
num_B_3 = B // lcm(large, small)
 
num_A_1 = (A-1) // C
num_A_2 = (A-1) // D
num_A_3 = (A-1) // lcm(large, small)
 
numB = num_B_1 + num_B_2 - num_B_3
numA = num_A_1 + num_A_2 - num_A_3
 
print((B-A+1) - (numB - numA))

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

using namespace std;

char c;

int main() {
  scanf("%c", &c);
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') puts("vowel");
  else puts("consonant");
  return 0;
}

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

int indx(char chr);

int main() {
	char s[100000][20], tmp;
	int n, i, j, k;
	long long int cnt[5], ans = 0;

	for (i = 0; i < 5; i++)cnt[i] = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)scanf("%s", &s[i]);
	for (i = 0; i < n; i++) {
		tmp = s[i][0];
		if ((j = indx(tmp)) != -1) cnt[j]++;
	}
	for (i = 0; i < 5; i++)for (j = i + 1; j < 5; j++)for (k = j + 1; k < 5; k++) {
		ans += cnt[i] * cnt[j] * cnt[k];
	}
	printf("%lld", ans);
	return 0;
}

int indx(char chr) {
	if (chr == 'M') return 0;
	if (chr == 'A') return 1;
	if (chr == 'R') return 2;
	if (chr == 'C') return 3;
	if (chr == 'H') return 4;
	return -1;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

string f(int i) {
  string ret;
  ret.push_back((char)((i%10)+'0'));
  i /= 10;
  ret.push_back((char)((i%10)+'0'));
  i /= 10;
  ret.push_back((char)((i%10)+'0'));
  reverse(all(ret));
  return ret;
}

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

  int n;
  cin >> n;
  string s;
  cin >> s;

  int ans = 0;
  rep(i, 1000) {
    string a = f(i);
    int cnt = 0;
    rep(j, n) {
      if (cnt == 0 && s[j] == a[cnt]) cnt++;
      else if (cnt == 1 && s[j] == a[cnt]) cnt++;
      else if (cnt == 2 && s[j] == a[cnt]) cnt++;
    }

    if (cnt == 3) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
N = int(input())
H = list(map(int, input().split()))

dp = [0] * N
dp[0] = 0

for i in range(1, N):
  tmp1 = dp[i-1] + abs(H[i] - H[i-1])
  tmp2 = dp[i-2] + abs(H[i] - H[i-2]) if i > 1 else 2**64
  dp[i] = min(tmp1, tmp2)
  
print(dp[N-1])
  
    
             
  


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

using namespace std;
using ll = long long;

int main() {
    ll n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    for (int i = 0; i < s.size(); ++i) {
        if (i == k-1) {
            cout << (char)tolower(s.at(i));
        } else {
            cout << s.at(i);
        }
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int n, q, a, b, e, k;
	cin >> n;
	vector<int> A;
	rep(i, n)
	{
		cin >> a;
		A.push_back(a);
	}
	cin >> q;
	rep(i, q)
	{
		cin >> b >> e >> k;
		cout << count(A.begin() + b, A.begin() + e, k) << endl;
	}
}


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

int main() {
    string s, t, ss, tt;
    cin >> s;
    cin >> t;


    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

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

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 0x20000000;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}


void execute()
{
    ll N;
    cin >> N;

    int f = 0;
    for(int i = 0; i < N; i++){
        int a, b;
        cin >> a >> b;
        f++;
        if(a != b) f = 0;
        if(f == 3) {cout << "Yes" << endl;return; }
    }

    cout << "No" << endl; 
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    s[5] = s[13] = ' ';
    cout << s;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop_b pop_back
#define pf push_front
#define pop_f pop_front
#define mt make_tuple
#define eb emplace_back
#define sf(x) sizeof(x)
#define len(x) x.length()
#define sz(x) x.size()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld; 
typedef vector<int> vi;
typedef vector<set<ll>> vset;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef deque<ll> dql;
typedef deque<int> dqi;
typedef unsigned long long ull;
typedef tuple<int,int,int> State;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define vmax(type)   std::numeric_limits<type>::max()
#define vmin(type)   std::numeric_limits<type>::min()
#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define cinai(a, n) vi a(n); rep(i, n) { cin>>a[i]; }
#define cinal(a, n) vl a(n); rep(i, n) { cin>>a[i]; }
#define coutai(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define coutal(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define ent cout<<endl;
#define resize_vec(a) a.resize(unique(a.begin(), a.end()) - a.begin());
#define ms(dp, x) memset(dp, x, sf(dp))
#define endl '\n'

ll powm(ll a, ll b, ll mod) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

const ll mod = 1e9 + 7;
const ll N = 1000005;
const ll inf = 1e9;

void solve()
{
	int n;
	ld d;
	cin>>n>>d;
	int cnt = 0;
	rep(i, n){
		ld a, b;
		cin>>a>>b;
		if(d*d >= a*a+b*b)
			cnt++;
	}
	cout<<cnt<<endl;
}

// #define _DEBUG 
// #define testCases
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	
	int tc = 1;
#ifdef testCases
	cin>>tc;
#endif
	while(tc--)
	{
#ifdef _DEBUG
	int tt = clock();
#endif
		solve();
		
#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	return 0;
}



Measured memory_bytes: 3808
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
 
class Program {
    static List<int>[] Sub;
    static int[] Salary;
    
    
    static void Main(string[] args) {
        var N  = int.Parse(Console.ReadLine());
        var A  = Console.ReadLine().Split().Select(a => long.Parse(a)).ToArray();
      
        var dic = new Dictionary<long,int>();
        for(int i = 0; i < N;i++){
          if(dic.ContainsKey(A[i])){
            dic[A[i]] += 1;
          }else{
            dic.Add(A[i],1);
          }
        }
        
        var count = 0;
        var even = 0;
        foreach(KeyValuePair<long,int> item in dic) {
          count++;
          if(item.Value%2 == 0){
            even++;
          }
        }
        
        if(even%2 == 0){
          Console.WriteLine(count);
        }else{
           Console.WriteLine(count-1);
        }
        
        }
         
}


Measured memory_bytes: 27488
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;

int main(){
    ll n;
    cin >> n;
    
    vector<ll> h; h.resize(n);

    ll max_cnt = 0;
    ll tmp_cnt = 0;

    cin >> h[0];
    for (ll i=1; i<n; i++){
        cin >> h[i];
        if (h[i-1]>=h[i]) {
            tmp_cnt++;
        }
        else{
            max_cnt = max(max_cnt, tmp_cnt);
            tmp_cnt = 0;
        }
    }
    max_cnt = max(max_cnt, tmp_cnt);

    cout << max_cnt << endl;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def get_distance(a,b):
    return abs(a[1]-b[1])+abs(a[2]-b[2])


def solve(N: int, T: "List[int]", X: "List[int]", Y: "List[int]"):

    prev = (0,0,0)
    for cur in zip(T,X,Y): 
        dist = get_distance(prev,cur)
        deltaT = cur[0] - prev[0]
        if dist > deltaT or (dist-deltaT) % 2 == 1:
            print(NO)
            return

        prev = cur

    print(YES)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    t = [int()] * (N)  # type: "List[int]" 
    x = [int()] * (N)  # type: "List[int]" 
    y = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        t[i] = int(next(tokens))
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, t, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 11636
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <climits>

using namespace std;




int main(int argc, char *argv[])
{
	int n;
	int t;

	cin >> n;
	cin >> t;

	int min_cost = INT_MAX;
	for (int i = 0; i < n; i++){
		int cost, time;

		cin >> cost;
		cin >> time;

		if (time <= t && cost < min_cost){
			min_cost = cost;
		}
	}

	if (min_cost < INT_MAX){
		cout << min_cost << endl;
	}
	else{
		cout << "TLE" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::vector<std::pair<int, int>> lr;
	
	std::cin >> N;
	lr.resize(N);
	for (auto& x : lr) {
		std::cin >> x.first >> x.second;
	}
	
	int result = 0;
	for (auto& x : lr) {
		result += (x.second - x.first + 1);
	}
	
	std::cout << result << "\n";
}


Measured memory_bytes: 256
a,b = map(int,input().split())
A = list(range(a+1))
count = 0
if b < 10:
  print(0)
else:
  for i in range(2,b+1):
    q = i % 10
    p = i // 10
    if q*p in A and p >= 2 and q >= 2:
      count += 1
  print(count)
        

Measured memory_bytes: 2940
#include <stdio.h>
int main(){ 

     char search[21], word[21]; 
     int count=0; 
     int i; 
     scanf("%s", search); 
     while(1){ 
         scanf(" %s", word); 
         if(strcmp(word, "END_OF_TEXT")==0)break; 
         for(i=0;word[i]!='\0';i++){ 
             word[i]=tolower(word[i]); 
         } 
         if(strcmp(word, search)==0){ 
             count++; 
         } 
     } 
     printf("%d\n", count); 
     return 0; 
 } 





Measured memory_bytes: 2100
from math import ceil

def check(N_:int,S_:list,F_:list,upper:int,K_:int)->bool:
    #A_i > A_j (i < j)
    cnt = 0
    for i in range(N_):
        s = S_[i]
        if s > upper:
            cnt += ceil((s - upper)/F_[i])
            if cnt > K_:
                return False
    return True


def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    F = list(map(int,input().split()))
    A.sort(reverse = True)
    F.sort()
    S = [f*a for f,a in zip(F,A)]
    right = max(S)
    left = -1
    while left + 1 < right:
        mid = (right + left) // 2
        if mid == right:
            break
        if check(N,S,F,mid,K):
            right = mid
        else:
            left = mid
    print(right)
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 120780
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	string s="";
	while(n>0)
	{
		int rm=n%26;
		if(rm==0)
		{
			s+="z";
			n=n/26-1;
		}
		else
		{
			s+=rm-1+'a';
			n/=26;
		}
		
	}
	//s+=(char)('a'+(n%27)-1);
	reverse(s.begin(),s.end());
	cout<<s;    
    return 0;
}


Measured memory_bytes: 3532
N,M=map(int,input().split())
H=list(map(int,input().split()))

k=list(range(1,N+1))

d=dict(zip(k,H))

arr=[1]*N

for _ in range(M):
    a,b=map(int,input().split())
    if d[a]>d[b]:
        arr[b-1]=0
    elif d[a]<d[b]:
        arr[a-1]=0
    else:
        arr[a-1]=0
        arr[b-1]=0

print(sum(arr))

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

int main() {
  int a, b;
  cin >> a >> b;
  
  int num;
  int count = 0;
  
  for(int i = a; i <= b; i++){
    num = i;
    
    int x0, x1, x2, x3, x4;
    x4 = num % 10;
    num = num / 10;
    x3 = num % 10;
    num = num / 10;
    x2 = num % 10;
    num = num / 10;
    x1 = num % 10;
    num = num / 10;
    x0 = num % 10;
    
    if(x0 == x4 && x1 == x3){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\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;}

typedef long long lint;

using namespace std;

bool isprime(lint num){
	if(num<=1)return false;
	for(lint i=2;i*i<=num;i++)if(num%i==0)return false;
	return true;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x;
	cin>>x;
	while(!isprime(x))x++;
	cout<<x<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
    long long int a,b[100001],d=0;
    cin>>a;
    for(int i=0; i<a; i++)
    {
        cin>>b[i];
    }
    for(int i=0; i<a; i+=2)
    {
        if(b[i]%2 !=0)
        {
            d++;
        }
    }
    cout<<d<<endl;
}


Measured memory_bytes: 3552
class Tree {
  static get Node() {
    return class {
      constructor(id, parent, children) {
        this.id = id;
        this.parent = parent;
        this.children = children;
      }

      get type() {
        if (this.parent === null) return 'root';
        if (this.children.length === 0) return 'leaf';
        return 'internal node';
      }

      get depth() {
        const getDepth = (node, i) => {
          return node.parent === null ? i : getDepth(node.parent, i + 1);
        };
        return getDepth(this, 0);
      }

      toString() {
        return `node ${this.id}: parent = ${this.parent !== null ? this.parent.id : -1}, depth = ${this.depth}, ${this.type}, [${this.children.map(n => n.id).join(', ')}]`;
      }
    };
  }

  constructor(n) {
    this.nodes = [];
  }

  add(id, childrenIds) {
    let node = this.find(id);
    if (!node) {
      node = new Tree.Node(id, null, []);
      this.nodes[id] = node;
    }
    childrenIds.forEach((cid) => {
      let c = this.find(cid);
      if (!c) {
        c = new Tree.Node(cid, null, []);
        this.nodes[cid] = c;
      }
      c.parent = node;
      c.id = cid;
      node.children.push(c);
    });
  }

  find(id) { return this.nodes[id] }

  print() { console.log(this.nodes.sort((a, b) => a.id - b.id).map(n => n.toString()).join('\n')); }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  let tree = new Tree(n);
  let id, k, childrenIds;
  lines.map(l => l.split(' ')).forEach(function(line) {
    id = Number(line.shift());
    k = Number(line.shift());
    childrenIds = line.map(Number);
    tree.add(id, childrenIds);
  });
  tree.print();
})();



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


// 区間加算　一点取得 RAQ 平方分割で実装
template <typename T>
struct RAQ{// 0-index
	int n,rn,bn; // rn個のかたまりをbn個
	vector<T> data,bucket;
	RAQ(int n_){init(n_);}
	void init(int n_){
		n = n_;
		rn = sqrt(n);
		bn = ceil((double)n/rn);
		data.resize(n,0);
		bucket.resize(bn,0);
	}
	T get(int i){
		return data[i]+bucket[i/rn];
	}
	void add(int s,int t,T x){ // s~tにxを加算
		for(int i=s;i<=t;++i){
			if(i%rn==0 && (i+rn-1)<=t){
				bucket[i/rn] += x;
				i += rn-1;
			}else{
				data[i] += x;
			}
		}
	}
};


int main(){
	
	int n,q;
	cin >> n >> q;
	RAQ<ll> raq(n);
	while(q--){
		int com,s,t;
		ll x;
		cin >> com;
		if(com){
			cin >> s;
			cout << raq.get(s-1) << "\n";
		}else{
			cin >> s >> t >> x;
			raq.add(s-1,t-1,x);
		}
	}
}



Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
  int n,a[100],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=n-1;i>=0;i--){
    if(i!=0) {printf("%d ",a[i]);
    }else{printf("%d",a[0]);
}
  }
  printf("\n");
  return 0;
}

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

using namespace std;

int main() {
    int n; cin >> n;
    vector<int> c(n-1);
    vector<int> s(n-1);
    vector<int> f(n-1);
    for(int i = 0; i < n-1; i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    vector<int> ans(n);

    for(int i = 0; i < n; i++) {
        int arriveTime = s[i] + c[i];
        // cout << arriveTime << endl;
        for(int j = i + 1; j <n-1; j++){
            if(arriveTime <= s[j]) {
                arriveTime = s[j] + c[j];
                // cout << arriveTime << endl;
                continue;
            } else {
                int diff = arriveTime%f[j];
                if(diff == 0)
                    arriveTime += c[j];
                else
                    arriveTime += (f[j] - diff) + c[j];
                // cout << arriveTime << endl;
            }
        }
        if(i == n -1)
            cout << 0 << endl;
        else
            cout << arriveTime << endl;
        // cout << endl;
    }

}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8


def main():
    N = int(input())
    ret = 0
    for _ in range(N):
        x, u = input().split()
        x = float(x)
        if u == 'BTC':
            ret += x * 380000.0
        else:
            ret += x
    print(ret)


if __name__ == '__main__':
    main()


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

int main(){
	int a, b;
	cin>>a>>b;
	if (a < b) cout<<"a < b"<<endl;
	if (a > b) cout<<"a > b"<<endl;
	if (a == b) cout<<"a == b"<<endl;
	
	return 0;
}


Measured memory_bytes: 3096
// https://atcoder.jp/contests/abc153/tasks/abc153_e

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll H, N;
  cin >> H >> N;

  struct Mg {
    ll h, m;
  };

  V<Mg> mgs(N);

  rep(i, N) {
    ll h, m;
    cin >> h >> m;

    mgs[i] = {h, m};
  }

  // dp[i][h] // i 番目の魔法までで h 減らすのに必要な m
  VVL dp(N + 1, VL(H + 1, INF));
  dp[0][0] = 0;

  // 同じ要素ありのナップサック
  rep(i, N) rep(h, H + 1) {
    auto mg = mgs[i];
    chmin(dp[i + 1][h], dp[i][h]);
    chmin(dp[i + 1][min(H, h + mg.h)], dp[i + 1][h] + mg.m);
  }

  cout << dp[N][H] << endl;
}

void solve2() {
  ll H, N;
  cin >> H >> N;

  struct Mg {
    ll h, m;
  };

  V<Mg> mgs(N);

  rep(i, N) {
    ll h, m;
    cin >> h >> m;

    mgs[i] = {h, m};
  }

  VL dp(H + 1, INF);
  dp[0] = 0;

  rep(i, N) rep(h, H + 1) {
    auto mg = mgs[i];
    chmin(dp[min(H, h + mg.h)], dp[h] + mg.m);
  }

  cout << dp[H] << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve2();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(){
  string str;
  cin >> str;
  int min=1000;
  for(int i=0;i<str.size()-2;i++){
    int sub=stoi(str.substr(i,3));
    int dif=abs(753-sub);
    if(dif<min) min=dif;
  }
  cout << min << "\n";
  return 0;
}


Measured memory_bytes: 256
list=[int(input()) for j in range(6)]

x=[list[0],list[1],list[2],list[3]]
y=sorted(x)
sum=0
for i in range(1,4):
    sum+=int(y[i])
    
if list[4]>list[5]:
    sum+=int(list[4])
else:
    sum+=int(list[5])
print(sum)


Measured memory_bytes: 5604
#include<stdio.h>
int main(void){

int a, b, c, t;
scanf("%d %d %d", &a, &b, &c);
	
	if(b<a){
		t=b;
		b=a;
		a=t;
	}
	
	if(c<a){
		t=c;
		c=a;
		a=t;
	}
	
	if(c<b){
		t=c;
		c=b;
		b=t;
	}
	
	printf("%d %d %d\n",a, b, c);
	
return 0;
}


Measured memory_bytes: 2144
// O O O O O O O O O O O O O O O OO O OO O OO O O O TTCH O TTTCH O TTTCH O O O O
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
// #include <random>
#include <iomanip>
#include <bitset>
#include <cassert>
 
using namespace std;

#define y1 y11
#define double long double
#define less less228
#define left left228
#define right right228
#define list list228
#define all(v) v.begin(), v.end()
 
 
 
template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}
template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n + 1);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        cnt[a] ^= 1;
        cnt[b] ^= 1;
    }
    for (int i = 1; i <= n; ++i) {
        if (cnt[i]) {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
    return 0;
}
// RU_023
 
/*
4 2
2 1 3 3
1 2 4 3
6 1 7 4
5 3 7 5

3 3
1 1 1 1
1 2 1 2
1 3 1 3

*/

Measured memory_bytes: 640
import java.util.*

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

  println(abc165a(k, a, b))
}

private fun abc165a(k: Int, a: Int, b: Int): String {
  for (i in a..b) {
    if (i % k == 0) return "OK"
  }
  return "NG"
}


Measured memory_bytes: 36492
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string S;
    cin>>S;
    int flg=0;
    for(int i=0;i<S.size()-1;i++){
        if(S[i]=='A'&&S[i+1]=='C')flg=1;
    }
    if(flg)puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main { 
	public static void main(String arts[]) { 
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int begin = 0; //0番目を選んだときのスコアを格納しておく
		for(int i = 1 ; i < n ; i ++){
			if(s.charAt(i)=='E'){
				begin ++;
			}
		}
		int ans = begin;
		int now = begin ;
		for(int i = 1; i < n ; i++){
			if(s.charAt(i-1)=='W') now++;
			if(s.charAt(i)=='E') now--;
			if(ans>now){
				ans = now;
			}
		}	
		System.out.println(ans);
	} 
} 




Measured memory_bytes: 31836
s = list(input())
d = 3
def operate1(string):
  string += "-"
  return string
def operate2(string):
  string += "+"
  return string
def bfs(list_hoge = [s[0]],depth = 0,deepest = d):
    queue = []
    for e in list_hoge:
        for b in [0,1]:
            if b == 0:
                operated = operate1(e)
                operated += s[depth + 1]
                queue.append(operated)
            elif b == 1:
                operated = operate2(e)
                operated += s[depth + 1]
                queue.append(operated)
    list_hoge = queue[:]
    depth += 1
    if depth == deepest:
        return list_hoge
    else:
        return bfs(list_hoge,depth)
for e in bfs():
  if eval(e) == 7:
    print(e + "=7")
    break

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

public class Main {

	public static void main(String[] args) throws IOException {
		// 宣言
		double money = 100000;
		final double rate = 1.05;
		int amari = 0;

		// 文字列の入力
		 BufferedReader input = new BufferedReader(new
		 InputStreamReader(System.in), 1);
		 int week = Integer.parseInt(input.readLine());

		for (int i = 1; i <= week; i++) {
			// 5%の利子を加算し、1000円未満を切り上げる
			money = money * rate;
			amari = (int) money % 1000;
			if (amari != 0) {
				money = money + 1000;
				money = money - amari;
			}
		}
		System.out.println((int)money);
	}
}

Measured memory_bytes: 16848
package main

import "fmt"

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	ans := 0
	if s[0] == t[0] {
		ans++
	}
	if s[1] == t[1] {
		ans++
	}
	if s[2] == t[2] {
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-

def partition(A, p, r):
    x = A[r][0]
    i = p-1
    for j in range(p, r):
        if A[j][0] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i+1

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q-1)
        quick_sort(A, q+1, r)

n = int(raw_input())
data = []
s = set()
for i in range(n):
    c, num = map(str, raw_input().split())
    data.append((int(num), c))
    s.add(int(num))
out = data[:]
quick_sort(out, 0, n-1)
for i in s:
    if [d for d in data if d[0] == i] != [d for d in out if d[0] == i]:
        print "Not stable"
        break
else:
    print "Stable"
for num, c in out:
    print "%s %s" %(c, num)

Measured memory_bytes: 21412
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int A,B,Q;
  cin>>A>>B>>Q;
  lint s[A];
  lint t[B];
  lint x[Q];
  REP(i,A)cin>>s[i];
  REP(i,B)cin>>t[i];
  REP(i,Q)cin>>x[i];
  REP(i,Q){
    int si=lower_bound(s,s+A,x[i])-s;
    int ti=lower_bound(t,t+B,x[i])-t;
    lint ans=1e11;
    if(si>0 and ti>0)ans=min(ans,x[i]-min(s[si-1],t[ti-1]));
    if(si>0 and ti<B)ans=min(ans,t[ti]-s[si-1]+min(t[ti]-x[i],x[i]-s[si-1]));
    if(si<A and ti>0)ans=min(ans,s[si]-t[ti-1]+min(s[si]-x[i],x[i]-t[ti-1]));
    if(si<A and ti<B)ans=min(ans,max(s[si],t[ti])-x[i]);
    cout<<ans<<endl;
  }

  return 0;
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int a, b;
    cin >> a >> b;
    if (a % 2 != 0 && b % 2 != 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

int x, y, sol;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> x >> y;
sol += max(0, 4 - x) * 100000;
sol += max(0, 4 - y) * 100000;
if(x == 1 && y == 1){
	sol += 400000;
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 256
#include <cstdio>

int main(){
    int H,W;
    while(1){
        scanf("%d %d",&H,&W);
    if(H == 0 && W ==0){break;}
    for(int x = 0; x < H;x++){
        for(int y = 0;y < W;y++){
            if(x == 0 || x == H - 1){printf("#");}
            else if(y == 0 || y == W - 1){printf("#");}
            else{printf(".");}}
        printf("\n");}
    printf("\n");}
    return 0;
}


Measured memory_bytes: 2604