akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

struct Card {
	char suit; int rank;
	Card() : suit('.'), rank(0) {}
	Card(string s) {
		suit = s[1];
		
		if (isdigit(s[0]))    rank = s[0] - '0';
		else if (s[0] == 'T') rank = 10;
		else if (s[0] == 'J') rank = 11;
		else if (s[0] == 'Q') rank = 12;
		else if (s[0] == 'K') rank = 13;
		else if (s[0] == 'A') rank = 14;
	}
};

int main() {
	cin.sync_with_stdio(false); cin.tie(0);
	cin.exceptions(cin.failbit);

	for (;;) {
		char trump; cin >> skipws >> trump; if (trump == '#') break;
		vector<vector<Card>> v(13, vector<Card>(4));
		vector<int> w(4);
		rep(j, 0, 4) {
			rep(i, 0, 13) {
				string s; cin >> s;
				v[i][j] = Card(s);
			}
		}
		int d = 0;
		rep(i, 0, 13) {
			Card dcard = v[i][d];
			int wid = d;
			rep(j, 0, 4) if (j != wid) {
				Card ncard = v[i][j], wcard = v[i][wid];
				if (ncard.suit == trump && wcard.suit != trump || 
					ncard.suit == wcard.suit && ncard.rank > wcard.rank)
					wid = j;
			}
			w[wid]++;
			d = wid;
		}
		
		if (w[0] + w[2] > w[1] + w[3]) {
			cout << "NS " << (w[0] + w[2] - 6) << endl;
		} else {
			cout << "EW " << (w[1] + w[3] - 6) << endl;
		}
	}
}



Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#pragma GCC optimize("O2")
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
const int mod = 1e9 + 7;
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
const int MAXN = 2e5+ 10;
const ll inf = 1e18;

int intlog(double base, double x) {
    return (int)(log(x) / log(base));
}
void read(vi & a) {
    for (int i = 0; i < sz(a); ++i) {
        cin >> a[i];
    }
}
int32_t main() {
    fio
    int n,m;
    cin >> n >> m;
    string s[n];
    int ans = 0;
    for (int i = 0; i < n; ++i) cin >> s[i];
    queue<pair<int,pair<int,int>>>q; // i,j,level
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < m; ++i) {
            vvi vis(n,vi(m,0));

            if(s[j][i] == '.') {
                q.push({j,{i,0}});
            }

            while(!q.empty()) {
                int x = q.front().first;
                int y = q.front().second.first;
                int l = q.front().second.second;
                q.pop();
                if(vis[x][y] == 1) continue;
                else vis[x][y] = 1;
                if(x > 0 && s[x-1][y] == '.')  q.push({x-1, {y,l+1}});
                if(x < n - 1 && s[x + 1][y] == '.') q.push({x + 1,{y,l+1}});
                if(y > 0 && s[x][y-1] == '.')q.push({x,{y-1,l+1}});
                if(y < m-1 && s[x][y+1] == '.')q.push({x,{y+1,l+1}});
                ans = max(ans,l);
            }

        }
    }


    cout << ans << endl;

}






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

int main(){
	string n;
	cin >> n;
	bool judge=false;
	for(int i=0; i<n.size(); i++){
		if(n.at(i)=='9'){
			judge=true;
			break;
		}
	}
	if(judge) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3540
package main

import (
	"fmt"
	"os"
)

var (
	s string
	a = make([]bool, 26)
)

func main() {
	fmt.Scan(&s)

	for _, v := range s {
		a[v-97] = true
	}

	for i, v := range a {
		if !v {
			fmt.Printf("%c\n", i+97)
			os.Exit(0)
		}
	}

	fmt.Println("None")
}


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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = n;
    for (char c : s) {
        int pcnt = 0;
        int cnt = 0;
        int tmp = 0;
        for (int i = 0; i < n;) {
            if (s[i] == c) {
                i++;
                continue;
            }
            int j = i;
            while (j < n && s[j] != c) j++;
            tmp = max(tmp, j - i);
            i = j;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int b[] = new int [n];
 
        for (int i=0;i<n;i++){
          int m = sc.nextInt();
          b[i] = m;
        }
 
        int w;
        for (int h=0;h<(n/2);h++){
          w=b[h];
          b[h]=b[n-1-h];
          b[n-1-h]=w;
        }
 
        for (int j=0;j<n-1;j++){
          System.out.print(b[j] + " ");
        }
        System.out.print(b[n-1]);
        System.out.println("");
    }
}


Measured memory_bytes: 26252
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

people = [a,b,c,d,e]
if n<=min(people):
    print("5")
elif (n-min(people))%min(people) == 0:
    print(5+(n-min(people))//min(people))
else:
    print(5+(n-min(people))//min(people)+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3
#define LINF 0x3f3f3f3f3f3f3f
#define MAXN 2*100005
#define fim '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << fim
#define debug2(x, y) cout << "DEBUG " << x << " " << y << fim
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< fim
#define max3(x, y, z) max(x, max(y, z))
using namespace std;
using namespace __gnu_pbds;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<unsigned ll, pair<int, int> > piii;
typedef pair<pair<int, int>, int> piii2;
typedef tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])
        cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
        int r = sc.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        a:for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                if(i*j % 2019 < remain)
                    remain = i*j % 2019;
                if(remain == 0)
                    break a;
            }
        }
		System.out.println(remain);
	}
}

Measured memory_bytes: 23124
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	string S;
	ll N;
	cin>>N>>S;
	REP(i,S.size()){
		S[i]+=N;
		if(S[i]>'Z'){
			S[i]-=26;
		}
	}
	cout<<S<<endl;
	return 0;
}


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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

int min(int a, int b) {
    if (a > b)
        return b;
    else
        return a;
}

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}

//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
  int  a ,b, c, d, e, X, Y ,r;
//  long long  a, b, c, d, e, X, Y;
  //  double  c;
//  int  A[200003]={};
  int  A[100003]={};
  int  B[100003]={};
  int  C[100003][11]={};

  int  flg=0;

//  char s[101][101]={};
  char s[100001]={};
  char t[101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p,q;
//  int flag=0;
//  int tmp=0;
//  char tmp[101]={};
//  long long min=10000000000;
//  long long min=100000001;
  int len=0;
  int l=0;
//  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  int ans=0;
  int max=0;
  int sum=0;
  int addr=0;
  int ptn=0;
  long long  tmp=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
  scanf("%s", &t);
  len=strlen(t);  
  //printf("%d", len);
  for(i=0;i<len/2;i++){
    if(t[i]!=t[len-i-1]){
      t[len-i-1]=t[i];
      cnt++;
//  printf("%s\n", t);
    }
  }
//  printf("%s", t);
  printf("%d\n", cnt);
return 0;
}


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

int main () {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    int res = 0;
    while (true) {
        bool exist_odd = false;
        for (int i = 0; i < N; i++) {
            if (A.at(i) % 2 != 0) {
                exist_odd = true;
            }
        }
        if (exist_odd) {
            break;
        }
        for (int i = 0; i < N; i++) {
            A.at(i) /= 2;
        }
        res++;
    }
    cout << res << endl;
}

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

int N, Q;
string s;
vector<char> t, d;

int L, R;

int check(int m) {
    for (int i = 0; i < Q; i++) {
        if (t[i] == s[m]) {
            if (d[i] == 'L') {
                m--;
            } else {
                m++;
            }
            if (m == -1 || m == N) {
                return m;
            }
        }
    }
    return m;
}

int right() {
    int l = L, r = N;
    for (int i = 0; i < 30; i++) {
        int m = (l + r) / 2;
        if (check(m) == N) {
            r = m;
        } else {
            l = m + 1;
        }
    }
    return r;
}

int left() {
    int l = -1, r = N;
    for (int i = 0; i < 30; i++) {
        int m = (l + r) / 2;
        if (check(m) == -1) {
            l = m;
        } else {
            r = m;
        }
    }
    return l;
}

int main() {
    cin >> N >> Q;
    cin >> s;
    t.resize(Q);
    d.resize(Q);
    for (int i = 0; i < Q; i++) {
        cin >> t[i] >> d[i];
    }
    L = left();
    R = right();
    cout << R - L - 1 << endl;
}

Measured memory_bytes: 900
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main()
{
	string s;
	cin >> s;
	ll k;
	cin >> k;
	rep(i,k){
		if(s[i] != '1'){
			cout << s[i] << endl;
			return 0;
			
		}
	}
	cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
#define inf 1000000007
using namespace std;


int main() {
	int n,i,j,t;
    
    cin >> j;
    if(j){
        cout << 0 << endl;
    }
    else{
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
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(){
  int n;
  cin >> n;
  vl l(n);
  rep(i,n) {
    cin >> l.at(i);
  }
  sort(all(l));
  long ans = 0;
  rep(i,n){
    REP(j,i+1,n){
      REP(k,j+1,n){
        if((l[i] != l[j]) && (l[j] != l[k]) && (l[i] != l[k]) && (l[i] + l[j] > l[k])){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
n = int(input())

cnt = {}
A = []
for i in range(n):
    x = int(input())
    A.append(x)

A_sort = sorted(A, reverse=True)

for a in A:
    if a == A_sort[0]:
        print(A_sort[1])
    else:
        print(A_sort[0])
        

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

using namespace std;

#define ll long long
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define Loop(i, a, b) for(int i = a ; i < b ; ++i)
#define loop(i, n) Loop(i, 0, n)
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vvii vector<vii>
#define vl vector<ll>
#define vvl vector<vl>
#define pll pair<ll, ll>
#define vll vector<pll>
#define vvll vector<vll>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18+5
#define inf 1e9+5
#define _69e27 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

template <typename T> T max(T a, T b, T c){ return max(a, max(b, c));}
template <typename T> T min(T a, T b, T c){ return min(a, min(b, c));}

int M = 1e9+7; //check


int main() {
	_69e27;
	int n;
	cin >> n;
	pair<double, double> v[10];
	loop(i, n) cin >> v[i].ff >> v[i].ss;
	int arr[8];
	iota(arr, arr+8, 0);
	double sum = 0;
	do
	{
		Loop(i, 1, n)
		{
			sum += sqrt(pow((v[arr[i]].ff-v[arr[i-1]].ff), 2) + pow((v[arr[i]].ss-v[arr[i-1]].ss), 2));
		}
	}while(next_permutation(arr, arr+n));
	double fact = 1;
	Loop(i, 1, n+1) fact*= i;
	double ans = sum/double(fact);
	cout << fixed << setprecision(8) << ans;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

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


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n,k;
  int t[SIZE], b[SIZE];;
  ll ans = 0;
  
  scanf("%d%d",&n,&k);
  ans += n;
  
  for(int i=0;i<n;i++){
    scanf("%d",t+i);

    if(i > 0){
      b[i-1] = t[i] - (t[i-1]+1);
    }
  }

  sort(b,b+(n-1));

  for(int i=0;i<n-k;i++){
    ans += b[i];
  }

  printf("%lld\n",ans);
  
  return 0;
}



Measured memory_bytes: 4036
#include <cstdint>
#include <iostream>

int main() {
  int n, k;
  std::cin >> n >> k;
  std::uint32_t x = 1;
  for (int ni = 0; ni < n; ++ni) {
    x = std::min(2 * x, x + k);
  }
  std::cout << x << std::endl;
  return 0;
}

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

using namespace std;

#define EPS 1e-10
#define INF (1e50)

struct Point{
    double x,y;

    Point(){}
    Point(double x,double y) : x(x),y(y) {}
    Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y); }
    Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y); }
    Point operator * (const double &k)const{ return Point(x*k,y*k); }
    bool operator < (const Point &p)const{ return x != p.x ? x < p.x : y < p.y; }
};

double dot(const Point &a,const Point &b){ return a.x*b.x+a.y*b.y; }
double cross(const Point &a,const Point &b){ return a.x*b.y - b.x*a.y; }
double norm(const Point &p){ return dot(p,p); }

typedef vector<Point> Polygon;

bool compare_y(const Point &a,const Point &b){
  return a.y < b.y;
}

double closest_pair(Point *a,int n){
    if(n <= 1) return INF;
    int m = n / 2;
    double x = a[m].x;
    double d = min(closest_pair(a,m),closest_pair(a+m,n-m));
    inplace_merge(a,a+m,a+n,compare_y);

    Polygon b;
    for(int i = 0 ; i < n ; i++){
        if(fabs(a[i].x - x) >= d) continue;
        for(int j = 0 ; j < (int)b.size() ; j++){
            double dx = a[i].x - b[b.size()-j-1].x;
            double dy = a[i].y - b[b.size()-j-1].y;
            if(dy >= d) break;
            d = min(d,sqrt(dx * dx + dy * dy));
        }
        b.push_back(a[i]);
    }
    return d;
}

int main(){
    int N;
    cin >> N;
    Point p[N];
    for(int i = 0 ; i < N ; i++){
        cin >> p[i].x >> p[i].y;
    }
    sort(p,p+N);
    printf("%.12f\n",closest_pair(p,N));
    return 0;
}

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

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    vector<int>  a(4,0);
    for(int i = 0; i < 4; i++){
        cin >> a[i];
    }
    sort(all(a));
    int res = 0;
    for(int i = 3; i >= 0; i--){
        res += a[i]*pow(10,i);
    }
    cout << (res==9741?"YES":"NO") << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

void dfs(ll n,string s,ll lim) {
  if(n==0) {
    cout << s << endl;
  }
  else {
    for(ll i=0;i<=lim;i++) {
      char tmp='a'+i;
      if(i!=lim) {
        dfs(n-1,s+tmp,lim);
      }
      else {
        dfs(n-1,s+tmp,lim+1);
      }
    }
  }
}

int main() {
  ll n;
  cin >> n;
  string s="a";
  dfs(n-1,s,1);
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { 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; }

ll partition(vector<ll> &a, ll p, ll r){
    ll x=a[r];
    ll i=p-1;
    for(ll j=p; j<r; j++){
        if(a[j]<=x){
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}

int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll x=partition(a, 0, n-1);
    rep(i,n){
        if(i==x) cout<<'['<<a[i]<<']';
        else cout<<a[i];

        if(i<n-1) cout<<' ';
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3532
# 2019/06/22
# AtCoder Beginner Contest 131 - B

# Input
n, l = map(int,input().split())

psum = 0
pmin = 1000

for i in range(n):
    wkl = l + i
    psum += wkl
    if abs(wkl) < pmin:
        pmin = abs(wkl)
        pmin_v = wkl

psum -= pmin_v

# Output
print(psum)


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

int main() {
    int N, T, A;
    cin >> N >> T >> A;

  	vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }

    T *= 1000;
    int ans = 0;
    int res = 100000000;
    for (int i = 0; i < N; i++) {
        if (abs(T - H[i] * 6 - 1000 * A) < res) {
            ans = i + 1;
            res = abs(T - H[i] * 6 - 1000 * A);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readIntList()
    val isAc = Array(n) { false }
    val waArr = Array(n) { 0 }
    var ac = 0
    var wa = 0

    repeat(m) {
        val (p, s) = readStringList()
        if (!isAc[p.toInt() - 1]) {
            when (s) {
                "AC" -> {
                    isAc[p.toInt() - 1] = true
                    wa += waArr[p.toInt() - 1]
                    ac++
                }
                "WA" -> {
                    waArr[p.toInt() - 1]++
                }
            }
        }
    }

    println("$ac $wa")
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 57676
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long l;
char D[10]; int n,k;
main()
{
    cin>>n>>k;
    for(int i=0;i<k;i++){char F;cin>>F;D[F-'0']=1;}
    for(int i=n;i<100000;i++)
    {
        string s=to_string(i);
        for(int j=0;j<s.size();j++)
        {
            if(D[(s[j]-'0')]==1)goto E;
        }
        cout<<i;
        break;
        E:;
    }
    return 0;
}

Measured memory_bytes: 256
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		
		for(int i = 0; i < n ; i++){
			String[] strArray = br.readLine().split(" ");
			Point2D.Double o1 = new Point2D.Double(Double.parseDouble(strArray[0]), Double.parseDouble(strArray[1]));
			double r1 = Double.parseDouble(strArray[2]);
			Point2D.Double o2 = new Point2D.Double(Double.parseDouble(strArray[3]), Double.parseDouble(strArray[4]));
			double r2 = Double.parseDouble(strArray[5]);
			
			double dist = o1.distance(o2);
			int result;
			if(dist > r1+r2){
				result = 0;
			}
			else if (r1 >= r2 && r1 > dist+r2) {
				result = 2;
			}
			else if (r1 < r2 && r2 > dist+r1){
				result = -2;
			}
			else {
				result = 1;
			}
			System.out.println(result);
		}
	}

}

Measured memory_bytes: 24060
#include <iostream>
#include <vector>
using namespace std;
int d[110][110],e[110][110] = {};
int main(){
    int i,j,k,n,m; cin >> n >> m;
    for(i=0;i<m;i++){
        int a,b,c; cin >> a >> b >> c;
        a--; b--;
        e[a][b] = c; e[b][a] = c;
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            d[i][j] = 10000000;
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(e[i][j]!=0) d[i][j] = e[i][j];
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            for(k=0;k<n;k++){
                d[j][k] = min(d[j][k],d[j][i] + d[i][k]);
            }
        }
    }
    /*for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            cout << d[i][j] << " ";
        }
        cout << endl;
    }*/
    int ans = 0;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(e[i][j]>d[i][j]) ans++;
        }
    }
    cout << ans/2 << endl;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int a,b,c; cin>>a>>b>>c;
  cout<<min(c,b/a)<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<double> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  double sum=0;
  vector<double> reverse(N);
  for(int i=0; i<N; i++){
    reverse.at(i)=1/A.at(i);
    sum+=reverse.at(i);                                                                          
  }
  printf("%.7f\n",1/sum);
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <utility>

using namespace std;
typedef long long ll;
typedef long double ld;

ll solve(void);

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

ll solve(void)
{
	string s;
	cin >> s;

	for (ll i = 1; i < s.length(); i++)
		if (s[i-1] == s[i]) { cout << "Bad" << endl; return 0; }

	cout << "Good" << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    int num = 0;
    while(1) {
        if ( num >= s.length() ) break;
        cout << s[num];
        num += 2;
    }
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;

//static const ll MOD = 1000000007;

int main() {
    ll N, answer = 0;

    // input
    cin >> N;

    // process
    answer = N * N * N;
    cout << answer << endl;

    return 0;
}

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

using namespace std;

bool allSame(string &s) {
  if (s.size() == 0) return true;
  for (int i = 1; i < (int)s.size(); i++) {
    if (s[i] != s[0]) return false;
  }
  return true;
}

int solve(string &s, char c) {
  if (allSame(s)) return 0;
  string t = "";
  for (int i = 0; i < (int)s.size() - 1; i++) {
    if (s[i] == c) t.push_back(s[i]);
    else if (s[i + 1] == c) t.push_back(s[i + 1]);
    else t.push_back(s[i]);
  }
  if (allSame(t)) return 1;
  else return 1 + solve(t, c);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int result = 100000;
  for (char c = 'a'; c <= 'z'; c++) {
    result = min(result, solve(s, c));
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#!python3.4
# -*- coding: utf-8 -*-
# abc155/abc155_c
import sys
import collections

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    c = collections.Counter()
    most_n = 0
    most_s = []
    for _ in range(N):
        s = i2s()
        c[s] += 1
        if c[s] == most_n:
            most_s.append(s)
        elif c[s] > most_n:
            most_s = [s]
            most_n = c[s]
        # print(most_s)
    for ms in sorted(most_s):
        print(ms)
    return

main()


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

int main() {
  int x, t;
  cin >> x >> t;
  cout << max(x-t, 0) << endl;
  return 0;
}

Measured memory_bytes: 3524
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007LL
using namespace std;

int main(void){
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<vector<bool>> same(N, vector<bool>(N));

    for(int i = 0; i < N; i++){
        for(int j = i; j < N; j++){
            if(S[i] == S[j]){
                same[i][j] = true;
                same[j][i] = true;
            }
        }
    }
    ll ans = 0;
    for(int offset = 1; offset < N; offset++){
        ll len = 0;
        for(int pos = 0; pos + offset < N; pos++){
            if(same[pos][pos + offset]) len++;
            else len = 0;
            if(len > ans && len <= offset) ans = len;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
import java.util.*;

public class Main {
 
	public static void main(String[] args) {
      Scanner sr = new Scanner(System.in);
      String str = sr.next();
      if(Character.isUpperCase(str.charAt(0)))
        System.out.println( "A" );
      else 
        System.out.println( "a" );
	}
}

Measured memory_bytes: 35640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,t,p;
    cin>>n;
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    for(i=0;i<n;i+=2){
        if(s[i]!=s[i+1]){
            cout<<"No"<<endl;return 0;
        }

    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var l = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i])
	}

	sort.Ints(l)

	sum := 0
	for i := n - 1; i > n-k-1; i-- {
		sum += l[i]
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();//500円玉
    int b = sc.nextInt();//100円玉
    int c = sc.nextInt();//50円玉
    int x = sc.nextInt();//目標額
    int ans = 0;

for(int i = 0; i <= a; i++){
  for (int j = 0; j <= b; j++) {
    for(int k = 0; k <= c; k++){
      if((500*i + 100*j + 50*k) == x){
        ans++;
      }
    }
  }
}
    System.out.println(ans);
}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define QS ios_base::sync_with_stdio(false);
typedef long long ll;
const ll INF = 1e18;
const int MOD = 1e9+7;
using namespace std;

int main(){
//freopen("output.txt", "w", stdout);
    QS
    int res = -1;
    int n, m; cin >> n >> m;
    for(int i = 1; i * i <= m; ++i){
        if(m % i == 0){
            int t = m/i;
            if(i >= n) res = max(res, t);
            if(t >= n) res = max(res, i);
        }
    }
    cout << res << '\n';
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace contest_Csharp
{

    class Program
    {
        public static (long m, long s)[,] dp;
        public static long mod;


        static void Main(string[] args)
        {
            checked
            {
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);

                var vals = Console.ReadLine().Split(' ')
                    .Select(x => int.Parse(x)).ToList();


                var N = vals[0];
                var counter = 0;
                var ans = "No";
                for (int i = 0; i < N; i++)
                {
                    var dice = Console.ReadLine().Split(' ')
                    .Select(x => int.Parse(x)).ToList();
                    if (dice[0]==dice[1])
                    {
                        counter++;
                        if (counter == 3)
                            ans = "Yes";
                    }
                    else
                    {
                        counter = 0;
                    }
                }
                

                Console.WriteLine(ans);

                Console.Out.Flush();
            }//cheked




        }
    }

}




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

using namespace std;
int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i++) {
    cout << s[i] << t[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x[105];
int main()
{
	int n,i,j,minv=2147483647,ans;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>x[i];
	for(i=1;i<101;i++)
	{
		ans=0;
		for(j=0;j<n;j++)
			ans+=(x[j]-i)*(x[j]-i);
		minv=min(minv,ans);
	}
	cout<<minv;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<int> > G;
int d[111],f[111],u[111];
void dfs(int v,int& p){
  if(u[v]) return;
  u[v]=1;
  sort(G[v].begin(),G[v].end());
  d[v]=++p;
  for(int u:G[v]) dfs(u,p);
  f[v]=++p;
}
signed main(){
  int n;
  cin>>n;
  G.resize(n,vector<int>());
  for(int i=0;i<n;i++){
    int u,k;
    cin>>u>>k;
    u--;
    for(int j=0;j<k;j++){
      int c;
      cin>>c;
      c--;
      G[u].push_back(c);
    }
  }
  int p=0;
  for(int i=0;i<n;i++)
    if(!u[i]) dfs(i,p);
  for(int i=0;i<n;i++) cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;;
  return 0;
}

Measured memory_bytes: 3116
#include <iostream>

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

using namespace std;
int main()
{
	int a, n, ans[7]={0};
	
	while (cin>>n, n!=0) {
		rep(i, 7) ans[i]=0;
		
		rep(i, n) {
			cin >> a;
			if (a < 10)
				ans[0]++;
			else if (a <20)
				ans[1]++;
			else if (a < 30)
				ans[2]++;
			else if (a <40)
				ans[3]++;
			else if (a<50)
				ans[4]++;
			else if (a<60)
				ans[5]++;
			else
				ans[6]++;
		}
		
		rep(i, 7) {
			cout << ans[i] << endl;
		}
	}
	return 0;
}

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

int fun(int h,int w,int i,int j){
	int a,b;
	a = h*h + w*w;
	b = i*i + j*j;
	if(a>b) return 1;
	else if(a == b && h>i) return 1;

  return 0;
}
int main(){
  int h,w,a,b;
  while(1){
	int mh = 150,mw = 150; 
	cin >> h >> w;
	if(h==0 && w==0) break;

	for(int i=1; i<150; i++){
	  for(int j=i+1; j<= 150; j++){
		if(h == i && w == j){
		} else if(fun(i,j,h,w) == 1){
			if(fun(mh,mw,i,j) == 1){
			  mh = i;
			  mw = j;
		  	}
		}
	  }
	}
	cout << mh << " " << mw << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N, T; cin >> N >> T;
    Int res = 0;
    Int prev, now; cin >> prev;

    rep(i, 1, N) {
        cin >> now;
        res += min(T, now-prev);
        prev = now;
    }
    res += T;

    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    ll n, s;
    cin >> n >> s;
    ll ans = 0;
    ll t[n];
    rep(i, n) cin >> t[i];

    rep(i, n-1) ans += min(s, t[i+1]-t[i]);
    ans += s;

    cout << ans << endl;


    return 0;
}


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

class disjointset{

  public:

    vector<int>rank,parent,sz;

    disjointset(int size){
        rank=parent=sz=vector<int>(size+1);
        for(int i=0;i<=size;i++)rank[i]=0,parent[i]=i,sz[i]=1;
    }

    int root(int n){return (parent[n]==n?n:parent[n]=root(parent[n]));}

    void unite(int x,int y){
        x=root(x);y=root(y);
        if(x==y)return;
        (rank[x]>rank[y])?parent[y]=x,sz[x]+=sz[y]:parent[x]=y,sz[y]+=sz[x];
        rank[root(x)]+=(rank[x]==rank[y]);
    }
};

int main(){
    int n,m,x,y,z;
    cin>>n>>m;
    disjointset ds(n);
    for(int i=0;i<m;i++){
        cin>>x>>y>>z;
        ds.unite(x-1,y-1);
    }
    set<int>s;
    for(int i=0;i<n;i++)s.insert(ds.root(i));
    cout<<s.size()<<endl;
    return 0;
}

Measured memory_bytes: 6144
import java.util.*;

public class Main {
public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int m = scanner.nextInt();
    int n = scanner.nextInt();
    int[] arr = new int[m];
    for (int i = 0; i < m; i++) {
        arr[i] = scanner.nextInt();
    }
    Arrays.sort(arr);
    reverse(arr);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += arr[i];
    }
    System.out.println(sum);
}

public static void reverse(int[] arr) {

    for (int min = 0, max = arr.length - 1; min < max; min++, max--) {
//对数组的元素进行位置交换
        int temp = arr[min]; //定义了一个什么都没有的变量 保存下标为min的元素 然后min就空了
        arr[min] = arr[max];
        arr[max] = temp;
    }
}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string in; cin >> in;
    bool ok = false;
    if(in[1] == in[2]){
        if(in[0] == in[1] or in[2] == in[3]){
            ok = true;
        }
    }

    cout << (ok ? "Yes":"No") << endl;

    return 0;
}


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

int main() {
int N;
cin >> N;
int a = 0;
  for ( int i = 0; i < N; i++ ) {
	int b, c;
    cin >> b >> c;
    a += c - b + 1;
  }
  cout << a << endl;
}

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

def solve():
    n, k = map(int, input().split())
    ans = 0
    if n >= k:
        ans = (n - k + 1) / n
    al = [2 ** i for i in range(1, 18)]
    for i in range(1, min(n + 1, k)):
        for j in al:
            if i * j >= k:
                ans += (1 / n) * (1 / j)
                break
    print(ans)

if __name__=="__main__":
    solve()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
  double a, b, n;
  ll ans;
  cin >> a >> b >> n;
  if(n<b){
    ans = floor(a*n/b)-a*floor(n/b);
  }else{
    ans = ll(floor(a*(b-1)/b)-a*floor((b-1)/b));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
long long int min(long long int a, long long int b)
{
    return a<b?a:b;
}
long long int max(long long int a, long long int b)
{
    return a>b?a:b;
}
int main()
{
	string s;
	cin>>s;
	int a[26];
	for(int i=0;i<26;i++)
	a[i]=0;
	for(int i=0;i<s.length();i++)
	a[s[i]-'a']++;
	for(int i=0;i<26;i++)
	if(a[i]&1)
	{
	   cout<<"No";
	   return 0;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	char a, b; cin >> a >> b;
	if (a == 'H'&&b == 'H') {
		cout << 'H' << endl;
	}
	else if (a == 'D'&&b == 'D') {
		cout << 'H' << endl;
	}
	else {
		cout << 'D' << endl;
	}
	return 0;
}

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

int dtoi(double d)
{
  return d>0 ? floor(d) : ceil(d);
}

int main(void)
{
  double x = 0;
  double y = 0;
  int orientation = 90;
  while(1){
    int step,rotation;
    scanf("%d,%d", &step, &rotation);

    if(step==0 && rotation==0){
      printf("%d\n", dtoi(x));
      printf("%d\n", dtoi(y));
      break;
    }else{
      x += step*cos(orientation*M_PI/180);
      y += step*sin(orientation*M_PI/180);
      orientation -= rotation;
    }
  }

  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
import java.lang.Math;

public class Main {
	private static int[] treeList;
	private static int n;
	private static int tempIdx;
	
	public static int getLeft(int idx) {
		tempIdx = idx*2;
		if (tempIdx > n) {
			return -99999;
		}
		return treeList[tempIdx];
	}
	public static int getRight(int idx){
		int tempIdx = idx*2+1;
		if(tempIdx >n) {
			return -99999;
		}
		return treeList[tempIdx];
	}
	public static int getParent(int idx) {
		int tempIdx = (int) Math.floor(idx/2);
		if (tempIdx < 1) {
			return -99999;
		}
		return treeList[tempIdx];
	}
	public static int getKey(int idx) {
		return treeList[idx];
	}
	
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		n = input.nextInt();
		treeList =  new int[n+1];
		
		// Take inputs to build an array of binary trees
		for (int i=1; i <= n; i++) {
			treeList[i] = input.nextInt();
		}
		input.close();
		
		for (int i=1; i<=n;i++) {
			// String result = "node "+i+": key = "+getKey(i)+", ";
			System.out.print("node "+i+": key = "+getKey(i)+", ");
			
			if (getParent(i)!=-99999) {
				// result += "parent key = "+getParent(i)+", ";
				System.out.print("parent key = "+getParent(i)+", ");
			}
			if (getLeft(i)!=-99999) {
				// result += "left key = "+getLeft(i)+", ";
				System.out.print("left key = "+getLeft(i)+", ");
			}			
			if (getRight(i)!=-99999) {
				// result += "right key = "+getRight(i)+", ";
				System.out.print("right key = "+getRight(i)+", ");
			}
			System.out.println();
		}	
	}
}



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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct state{
  int i,j;
  int dist;
  int predir,crtdir;
};

int n,q;
int sx,sy;
bool road[4][55][55];
bool vis[55][55][11][4][4];
int dirtable[0x100];
vector<state> restst;
int di[]={0,+1,0,-1};
int dj[]={+1,0,-1,0};

int main(){
  dirtable['E']=0; dirtable['N']=1; dirtable['W']=2; dirtable['S']=3;
  cin>>n>>sx>>sy>>q;
  rep(i,n){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    if(x1==x2){
      for(int i=min(y1,y2);i<max(y1,y2);i++)road[1][i][x1]=road[3][i+1][x1]=true;
    }else{
      for(int i=min(x1,x2);i<max(x1,x2);i++)road[0][y1][i]=road[2][y1][i+1]=true;
    }
  }

  rep(nxtdir,4){
    //if(crtdir==(nxtdir+2)%4)continue;
    if(road[nxtdir][sy][sx]){
      restst.push_back((state){sy,sx,0,0,(int)nxtdir});
    }
  }

  rep(i,q){
    int d;
    char c;
    cin>>d>>c;

    memset(vis,0,sizeof(vis));
    queue<state> que;
    for(state s : restst){
      vis[s.i][s.j][0][s.predir][s.crtdir]=true;
      que.push((state){s.i,s.j,0,s.predir,s.crtdir});
    }
    restst.clear();
    while(que.size()){
      state s=que.front(); que.pop();
      if(s.dist==d){
        if(s.crtdir==dirtable[c]||s.predir==dirtable[c]){
          restst.push_back(s);
        }
        continue;
      }
      int ni=s.i+di[s.crtdir],nj=s.j+dj[s.crtdir];
      rep(nxtdir,4){
        if(nxtdir==(s.crtdir+2)%4)continue;
        if(road[nxtdir][ni][nj]){
          if(!vis[ni][nj][s.dist+1][s.crtdir][nxtdir]){
            vis[ni][nj][s.dist+1][s.crtdir][nxtdir]=true;
            que.push((state){ni,nj,s.dist+1,s.crtdir,(int)nxtdir});
          }
        }
      }
    }
  }
  vector<P> res;
  for(state s : restst)res.push_back(P(s.j,s.i));
  sort(all(res));
  uni(res);
  rep(i,res.size()){
    cout<<res[i].fi<<" "<<res[i].se<<endl;
  }
  return 0;
}



Measured memory_bytes: 3756