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

LL fz_add(LL x) {
    return (x / 3LL) + (x / 5LL);
} 

LL fz_cnt(LL x) {
    return (x / 3LL) + (x / 5LL) - (x / 15LL);
}

LL count_char(LL x) {
    LL count = 0;

    for (LL z = 1, inc = 1; z <= x; ++inc) {
        z *= 10;
        if (z <= x) {
            count += inc * (z - (z/10)) + 4 * (fz_add(z-1) - fz_add(z/10-1)) - inc * (fz_cnt(z-1) - fz_cnt(z/10-1));
        } else {
            count += inc * (x - (z/10-1)) + 4 * (fz_add(x) - fz_add(z/10-1)) - inc * (fz_cnt(x) - fz_cnt(z/10-1));
        }
    }

    return count;
}

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

    LL l, r, count;
    l = 0LL;
    r = 1000000000000000001LL;
    while (l + 1 < r) {
        LL m = (l + r) / 2;

        LL count = count_char(m);

        if (count < N) {
            l = m;
        } else {
            r = m;
        }
    }

    count = count_char(l);

    stringstream ss;
    for (LL x = l + 1; x <= l + 20; ++x) {
        if (x % 15 == 0) {
            ss << "FizzBuzz";
        } else if (x % 3 == 0) {
            ss << "Fizz";
        } else if (x % 5 == 0) {
            ss << "Buzz";
        } else {
            ss << x;
        }
    }

    string ret;
    ss >> ret;
    cout << ret.substr(N - count - 1, 20) << endl;

    return 0;
}

Measured memory_bytes: 1224
s=list(input())

odd = 0;
even = 0;

for i in range(len(s)):
    if i%2==0:
        if s[i] == "0":
            odd += 1
        else:
            even += 1
    else:
        if s[i] == "0":
            even += 1
        else:
            odd += 1

print(min(odd,even))

Measured memory_bytes: 3956
#include <stdio.h>

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    int n = 0;
    for (int i = a; i <= b && i <= c; i++)
    {
        if (c % i == 0)
        {
            n++;
        }
    }

    printf("%d\n", n);

    return 0;
}


Measured memory_bytes: 2736
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
v = list(map(int, input().split()))

# 価値の昇順にソート
v.sort(reverse=False)

# 価値の低いものから順に合成していく
result = (v[0] + v[1])/2

if n > 2:
    for i in range(2, n):
        result = (result + v[i]) / 2

print(str(result))


Measured memory_bytes: 2940
inp = input()
a = inp.split()
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
c = 0
for i in range(a[0],a[1]+1):
    if a[2] % i == 0:
        c += 1
print(c)


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

i64 count(i64 n,i64 x){
    // x以下でnビット目が立っている数の個数

    i64 p=1LL<<n;

    if(x<p){
        return 0;
    }

    if(x&p){
        i64 y=(x-(x&(p-1)))-1;
        return (x-y)+(y-p+1)/2;
    }else{
        return count(n,(x-(x&(p-1)))-1);
    }
}

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 A,B;
    cin >> A >> B;

    i64 ans=0;
    rep(n,0,48){
        i64 cnta=count(n,A-1);
        i64 cntb=count(n,B);
        if((cntb-cnta)%2==1) ans+=1LL<<n;
    }

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
import collections
from functools import lru_cache


def read():
    return input().strip()


def readInt():
    return int(input().strip())


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


def solve(n, arr, d):
    ans = 0

    for x, y in arr:
        dis = x**2 + y**2

        if dis <= d**2:
            ans += 1

    return ans


[n, d] = readList()
arr = []
for i in range(n):
    arr.append(readList())


print(solve(n, arr, d))


Measured memory_bytes: 102260
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////
int n, m, l;
vector<pii>G[310];
ll ans[310][310];
void def(int a, int b) {

}
int main() {
	int n; cin >> n;
	string s; cin >> s;
	int ans = 1;
	for (int i = 0; i < n-1; ++i) {
		if (s[i] != s[i + 1]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
def factorial(n):
    'n!を返す関数'
    ans = 1
    while(n > 0):
        ans *= n
        n -= 1
    return ans

def nCr(n, r):
    '''
    nCrを返す関数
    階乗を返すfactorial()関数に依存している
    組み合わせの値は必ず整数値になるのでintとしてreturnしている
    '''
    ans = factorial(n) / (factorial(r) * factorial(n-r))
    return int(ans)

class UnionFind:
    def __init__(self, N):
        '''
        親の番号を格納する。親だった場合は-(その集合のサイズ)とする。
        作る時はparentの値を全て-1にすることで、全てバラバラになる。
        '''
        self.N = N
        self.parent = [-1 for i in range(self.N)]

    def root(self, A):
        'Aがどのグループに属しているか調べる。'
        if self.parent[A] < 0:
            return A
        else:
            self.parent[A] = self.root(self.parent[A])
            return self.parent[A]

    def size(self, A):
        '自分のいるグループの頂点数を調べる。'
        return -self.parent[self.root(A)]

    def connect(self, A, B):
        '''
        AとBをくっつける。
        AとBを直接繋ぐのではなく、root(A)にroot(B)をくっつける。
        '''
        A = self.root(A)
        B = self.root(B)
        if A == B:
            # すでにくっついているからくっつけない。
            return False
        elif self.size(A) < self.size(B):
            # 大小が逆だったらひっくり返す。
            A, B = B, A
        else:
            pass
        # Aのサイズを変更する。
        self.parent[A] += self.parent[B]
        # Bの親をAに変更する。
        self.parent[B] = A
        return True

islands, bridges = map(int, input().split())
A, B = [], []
ans = [0 for i in range(bridges)]
# ans[bridges-1] = nCr(islands, 2)
ans[bridges-1] = int(islands * (islands-1) / 2)

UF = UnionFind(islands)

for i in range(bridges):
    a, b = map(int, input().split())
    A.append(a-1)
    B.append(b-1)

for i in range(bridges-1, 0, -1):
    if UF.root(A[i]) != UF.root(B[i]):
        ans[i-1] = ans[i] - UF.size(A[i]) * UF.size(B[i])
        UF.connect(A[i], B[i])
    else:
        ans[i-1] = ans[i]

for i in range(bridges):
    print(ans[i])


Measured memory_bytes: 16948
#include <stdio.h>

#define S_MAX       201

char data[100][S_MAX+2] = {{}};
int adrs[100][S_MAX+2] = {{}};

void show(int n);

void shuffle(int d_idx, int n)
{
    int i, idx;
    int front_head, back_head;
    int *front_tail, *back_tail;
    int *head = &adrs[d_idx][0], *tail = &adrs[d_idx][S_MAX+1];

    front_head = adrs[d_idx][0];
    back_tail = &adrs[d_idx][adrs[d_idx][S_MAX+1]];

    i = 0;
    idx = front_head;
    while(i < n-1) {
        idx = adrs[d_idx][idx];
        i++;
    }
    *tail = idx;
    front_tail = &adrs[d_idx][idx];
    back_head = adrs[d_idx][idx];

    *head = back_head;
    *back_tail = front_head;
    *front_tail = S_MAX+1;

    return;
}

int read(int d_idx)
{
    int i;
    int n, h;
    int flag = 0;
    int len = 0;
    char c;
//    printf("in read() : d_idx=%d\n", d_idx);
//printf("reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed\n");

    while(1) {
        scanf("%c", &c);

        if(c == '-') {
            flag = 1;
//            printf("breeeeeeeeeeek!!!\n");
            break;
        }

        if(c == '\n') {
            adrs[d_idx][len] = S_MAX+1;
            adrs[d_idx][S_MAX+1] = len;
            break;
        }

        data[d_idx][len+1] = c;
        adrs[d_idx][len] = len + 1;
        len++;
    }
    if(flag == 1) {
//        printf("retuuuuuuuuuuunnnnnnnnn!!!\n");
        return 0;
    }
//    printf("%s", data[d_idx]);

    scanf("%d", &n);

    for(i=0;i<n;i++) {
        scanf("%d", &h);
        shuffle(d_idx,h);
    }
    scanf("%*c");
    show(d_idx);

    return 1;
}

void show(int n)
{
    int i;

//    for(i=0;i<n;i+=2) {
//        int idx = adrs[i][0];
        int idx = adrs[n][0];
        while(1) {
//            printf("%c", data[i][idx]);
            printf("%c", data[n][idx]);
//            idx = adrs[i][idx];
            idx = adrs[n][idx];
            if(idx == S_MAX+1) break;
        }
//        printf(" %d", i);
        putchar('\n');
//    }
    return;
}

int main(void)
{
    int idx = 0;

    while(read(idx++) != 0);
//    printf("idx=%d\n", idx-1);

//    show(idx-1);

    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<ll> a(N), b(N);

    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];

    ll A = 0, B = 0;
    rep(i, N) {
        if (a[i] > b[i]) {
            A += a[i] - b[i];
        } else {
            B += (b[i] - a[i]) / 2;
        }
    }

    if (B - A >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
const main = stdin => {
  const input = stdin.trim().split('\n')
  const N = parseInt(input[0])
  for (let i = N; ; i += N) {
    if (i % 2 === 0) {
      console.log(i)
      break
    }
  }
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29500
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n) cin >> a[i];
  
  int M = *max_element(a,a+n);
  int m = *min_element(a,a+n);
  
  cout << (M-m) << endl;
  
  return 0;
}

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

int main(){
    int     w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;

    string res = "No";
    if ((x - r) >= 0 
    && (x + r) <= w
    && (y - r) >= 0 
    && (y + r) <= h ) res = "Yes";

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3200
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int a[1000008],b[1000008],n;
bool cmp(int x,int y){
    return x>y;
}
bool ch(long long fk,long long po){
    long long ft=0;
    for(int i=0;i<n;i++){
        ft+=max((long long)0,a[i]-fk/b[i]);
    }
 //   printf("%lld %lld\n",ft,po);
    if(ft<=po)
        return 1;
    return 0;
}
int main()
{
	long long k,s=0;
	scanf("%d%lld",&n,&k);
	for(int i=0;i<n;i++)
        scanf("%d",a+i);
    for(int i=0;i<n;i++)
        scanf("%d",b+i);
    sort(a,a+n);
    sort(b,b+n,cmp);
    for(int i=0;i<n;i++){
         s=max(s,(long long)a[i]*b[i]);
    }
    long long l=0,r=s,mid;
    while(l<s){
        mid=(l+s)>>1;
  //  printf("%lld\n",mid);
        if(ch(mid,k)){
            s=mid;
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    printf("%lld\n",s);
}


Measured memory_bytes: 4992
#include<cstdio>
#include<algorithm>
#define maxn 300005
using namespace std;
int n,ans=2e9,a[maxn],b[maxn];
char s[maxn];
int main()
{
	scanf("%d%s",&n,s);
	for (int i=n-1,t=0;i>=0;--i) a[i]=(t+=s[i]=='E');
	for (int i=0,t=0;i<n;++i) ans=min(ans,a[i+1]+t),t+=s[i]=='W';
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    ll n;
    cin >> n;
    cout << (n-1)*n/2 << endl;   
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

ll dp[10001][100];
int main(){
	string k;
	int d;
	cin>>k>>d;
	dp[0][0]=1;
	int sum=0;
	FOR(i,0,k.size()){
		FOR(j,0,d){
			FOR(jj,0,10){
				(dp[i+1][(j+jj)%d]+=dp[i][j])%=MOD;
			}
		}	
	}
	ll ans=0;
	FOR(i,0,k.size()){
		int dgt=k[i]-'0';
		FOR(j,0,dgt){
			ans+=dp[k.size()-1-i][(d*1000000-sum-j)%d];
			ans%=MOD;
		}
		sum+=dgt;
	}
	if(sum%d) (ans+=(MOD-1))%=MOD;
	co(ans);
	
}


Measured memory_bytes: 8064
#include <iostream>

int main() {
  int n, m;
  std::cin >> n >> m;
  char a[n][n], b[m][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      std::cin >> a[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      std::cin >> b[i][j];
    }
  }

  bool imageFound;
  for (int i = 0; i <= n - m; i++) {
    for (int j = 0; j <= n - m; j++) {
      imageFound = true;
      for (int k = 0; k < m; k++) {
        for (int l = 0; l < m; l++) {
          if (a[i + k][j + l] != b[k][l]) {
            imageFound = false;
          }
        }
      }
      if (imageFound) {
        break;
      }
    }
    if (imageFound) {
        break;
      }
  }

  if (imageFound) {
    std::cout << "Yes" << "\n";
  } else {
    std::cout << "No" << "\n";
  }

  return 0;
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp> 	// Common file
#include <ext/pb_ds/tree_policy.hpp> 		// Including tree_order_statistics_node_update
#include<bits/stdc++.h>
#define int            		long long
#define x              		first
#define y              		second
#define all(aaa)       		(aaa).begin(),(aaa).end()
#define REP(i,sss,eee) 		for(int i=sss;i<=eee;++i)
#define pb             		push_back
#define pii            		pair<int,int>
#define vi             		vector<int>
#define speed          		ios_base::sync_with_stdio(0);cin.tie(0);
#define N              		1000000007
#define inf 				10000000000000
using namespace __gnu_pbds;
using namespace std;
template <class T>
T MAX(T a, T b){return ((a>b)?a:b);}
template <class T>
T MIN(T a, T b){return ((a<b)?a:b);}
template <class T>
T MOD(T a){return ((a>=0)?a:(-1*a));}
template <class T>
void SWAP(T &a,T &b){T temp=a;a=b;b=temp;}

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

inline int ex(int a, int b){
	if(b==0||a==1){return 1;}
	if(a==0||b==1){return a;}
	int tmp=ex(a,(b/2));
	if(b%2){return ((((tmp*tmp)%N)*a)%N);}
	else{return ((tmp*tmp)%N);}
}
inline int inv(int k){
	if(k==1){return 1;}
	else{return ex(k,N-2);}
}

/*****************default********************/
int solve()
{
	int n,w;cin>>n>>w;
	std::vector<int> wt(n+1,0),v(n+1,0);
	std::vector<std::vector<int>> dp;dp.resize(n+1,vector<int>(100010,inf));
	dp[0][0]=0;
	int vmax=100005,ans=0;
	REP(i,1,n){cin>>wt[i]>>v[i];}
	REP(i,1,n)
	{
		REP(val,0,vmax)
		{
			dp[i][val]=dp[i-1][val];
			if((val-v[i])>=0)
			{
				dp[i][val]=MIN(dp[i][val],dp[i-1][val-v[i]]+wt[i]);
			}
			if(dp[i][val]<=w){ans=MAX(ans,val);}
		}
	}
	cout<<ans<<"\n";
}
signed main(){
	speed
	int tt=1;
	//cin>>tt;
	while(tt--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
char s[300][300];
bool chk[300][300];
int main()
{
    int h,w; cin>>h>>w;
    for(int i=0;i<h;i++) scanf("%s",s[i]);
    for(int i=0;i<h;i++)
    {
        bool flag=false;
        for(int j=0;j<w;j++) if(s[i][j]=='#') flag=true;
        if(!flag) for(int j=0;j<w;j++) chk[i][j]=true;
    }
    for(int i=0;i<w;i++)
    {
        bool flag=false;
        for(int j=0;j<h;j++) if(s[j][i]=='#') flag=true;
        if(!flag) for(int j=0;j<h;j++) chk[j][i]=true;
    }
    for(int i=0;i<h;i++)
    {
        bool flag=false;
        for(int j=0;j<w;j++) if(!chk[i][j]) flag=true,printf("%c",s[i][j]);
        if(flag) puts("");
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

const int MAX_V=1e4+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,W; cin >> N >> W;
    vector<int> v(N),w(N);
    rep(i,N) cin >> v[i] >> w[i];
    vector<int> dp(MAX_V,INF+10);
    dp[0]=0;
    rep(i,N) for (int j=MAX_V;j>=v[i];--j){
        chmin(dp[j],dp[j-v[i]]+w[i]);
    }
    int ans=0;
    rep(i,MAX_V) if (dp[i]<=W) chmax(ans,(int)i);
    cout << ans << endl;
}


Measured memory_bytes: 3260
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int maxN = 100005;

class TaskB {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int k;
		cin >> k;
		string s;
		cin >> s;
		if(s.size() <= k){
			cout << s << endl;
		}else{
			cout << s.substr(0,k) + "..." << endl;
		}
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskB solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main(){
    string sd,t;
    cin >> sd >> t;

    string s = sd;
    //存在したかしなかったかで使う。
    bool res = false;

    //後ろから調べる。
    for(int i = sd.size()-1; i >= 0; i--){
        int cnt = 0;
        //毎回使う配列を別に初期化して用意する。
        string a = s;
        //jを増やすことでtの文字を全て調べている。
        for(int j = 0; j < t.size(); j++){
            int index = i - t.size() + 1 + j;
            //もし全て調べ終わったらbreak
            if(index >= sd.size()) break;
            //もし同じか「？」なら置き換える。
            if(sd[index] == t[j] || sd[index] == '?'){
                cnt++;
                a[index] = t[j];
            }
            //揃わんかったら抜ける！
            else{
                break;
            }
        }
        //もしtと調べ終わったサイズが一緒なら見つかったってことやから記録して抜ける。
        if(cnt == t.size()){
            s = a;
            res = true;
            break;
        }
    }

    //出力
    if(!res){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '?'){
            cout << 'a';
        }
        else{
            cout << s[i];
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
c1 = [a,b]
c2 = [c,d]
if(a <= 0 <= b):
    c1.append(0)
if(c <= 0 <= d):
    c2.append(0)

ans = -1 * 10**20
for x in c1:
    for y in c2:
        ans = max(ans,x*y)
print(ans)

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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;


void solve() {
	lli n = 3, m, q, k;
	vcL num( n, 0 );

	lli _min = INT_MAX, _max = 0;

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

	sort( num.begin(), num.end() );
	
	cout << num[0]+num[1]+10*num[2] << '\n';
}

int main() {
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
# Python program to print all paths from a source to destination. 
cnt=0 
ans=0 
from collections import defaultdict 
from collections import Counter 
def check(arr): 
    c=Counter(arr)
    for i in range(n):
        if c[i]!=1:
            return 0 
    return 1 
#This class represents a directed graph 
# using adjacency list representation 
class Graph: 

	def __init__(self,vertices): 
		#No. of vertices 
		self.V= vertices 
		
		# default dictionary to store graph 
		self.graph = defaultdict(list) 

	# function to add an edge to graph 
	def addEdge(self,u,v): 
		self.graph[u].append(v) 
	def printAllPathsUtil(self, u, d, visited, path):
	   
		# Mark the current node as visited and store in path 
		visited[u]= True
		path.append(u) 
		global ans 
		# If current vertex is same as destination, then print 
		# current path[] 
		if u ==d: 
		   # print(path)
		    if check(path): 
		        ans+=1 
		else: 
			# If current vertex is not destination 
			#Recur for all the vertices adjacent to this vertex 
			for i in self.graph[u]: 
				if visited[i]==False: 
					self.printAllPathsUtil(i, d, visited, path) 
					
		# Remove current vertex from path[] and mark it as unvisited 
		path.pop() 
		visited[u]= False


	# Prints all paths from 's' to 'd' 
	def printAllPaths(self,s, d): 

		# Mark all the vertices as not visited 
		visited =[False]*(self.V) 

		# Create an array to store paths 
		path = [] 

		# Call the recursive helper function to print all paths 
		self.printAllPathsUtil(s, d,visited, path) 



# Create a graph given in the above diagram 
n,m=map(int,input().split())
g = Graph(n)
for i in range(m): 
    a,b=map(int,input().split())
    g.addEdge(a-1,b-1)
    g.addEdge(b-1,a-1)
s = 2 ; d = 3
s=0 
for d in range(0,n): 
    g.printAllPaths(s, d) 
print(ans)

Measured memory_bytes: 48220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD =1e9+7;
using ll=long long;


int main(){
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "NO";
  for(int n = 1; n <= b-1; n++){
    if(a*n %  b == c) ans = "YES";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
H,W = map(int, input().split())
S=[list(map(str,list(input()))) for i in range(H)] 

A = [['.']*(W+2) for i in range(H+2)]
for i in range(1,H+1):
    for j in range(1,W+1):
        A[i][j] = S[i-1][j-1]
        
ans = 'Yes'
for i in range(W+2):
    if(ans == 'No'):
        break
    for j in range(H+2):
         if(A[j][i] == '#'):
            if (A[j-1][i] != '#' and A[j+1][i] != '#' and A[j][i-1] != '#' and A[j][i+1] != '#'):
                ans = 'No'
                break

if(H == 1 and W ==1 and S[0][0] == '#'):
    ans = 'Yes'

print(ans)

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

using namespace std;

int main(void) {
	vector<string> map;
	string tmp;
	int w, h;
	int i;

	while(true) {
		cin >> h >> w;
		if(w == 0 && h == 0) { break; }
		map.clear();
		for(i = 0; i < h; i++) {
			cin >> tmp;
			map.push_back( tmp );
		}
		w = 0;
		h = 0;
		while(true) {
			if(map[h][w] == '>') {
				map[h][w] = '*';
				w++;
			} else if(map[h][w] == 'v') {
				map[h][w] = '*';
				h++;
			} else if(map[h][w] == '<') {
				map[h][w] = '*';
				w--;
			} else if(map[h][w] == '^') {
				map[h][w] = '*';
				h--;
			} else if(map[h][w] == '.') {
				cout << w << " " << h << endl;
				break;
			} else {
				cout << "LOOP" << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,M,ans=0,temp;

int main(){
    cin>>N;
    string s[N];
    rep(i,N)cin>>s[i];
    cin>>M;
    string t[M];
    rep(i,M)cin>>t[i];
    rep(i,N){
        temp=0;
        rep(j,N){
            if(s[i]==s[j])temp++;
        }
        rep(j,M){
            if(s[i]==t[j])temp--;
        }
        ans=max(ans,temp);
    }
    out(ans);
}


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

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"

using namespace std;

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

  bool flag = true;
  int num = 0;

  int n, a, b; cin >> n >> a >> b;

  num = min(a * n, b);

  cout << num << endl;
  // cout << (flag ? YES : NO) << endl;
  
  return 0;
}


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

int main(){
  int r;
  cin >> r;
  cout << r * 2 * 3.14 << endl;
}

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

int main(void){
    int n;
    cin>>n;
    map<ll, int> mp;
    rep(i, n) {
        int a;
        cin>>a;
        mp[a]++;
    }
    vector<ll> v;
    for(auto p : mp){
        int c=p.second/2;
        rep(i, c) v.push_back(p.first);
    }
    if(v.empty()) {
        cout<<0<<endl;
        return 0;
    }
    sort(v.begin(), v.end(), greater<ll>());
    ll ans=v[0]*v[1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6528
import java.io.*; 
import java.util.*; 
public class Main
{     
	public static void main(String[] args) 
	{
         Scanner cin = new Scanner(System.in);
         int a[] = new int [10];
         for(int i=0;i<a.length;++i)
    	   a[i] = cin.nextInt();
         Arrays.sort(a);
         for(int i=a.length-1;i>a.length-4;--i)
    	   System.out.println(a[i]);
    	  
	} 
}

Measured memory_bytes: 17168
import math

a =[]
a = list(map(int,input().split()))
x=a[0]
y=a[1]

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

if (x+y)%3 != 0:
    print(0)
else:
    k=(x+y)//3
    i=(2*x-y)//3
    a=cmb(k,i,mod)
    print(a)



Measured memory_bytes: 122112
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
def rec(v):
    if dp[v]!=-1:return dp[v]
    res=0
    for nv in graph[v]:
        res=max(res,rec(nv)+1)
    dp[v]=res
    return res
def main():
    n,m=map(int,input().split())
    XY=[tuple(map(int,input().split())) for i in range(m)]
    global dp,graph
    graph=[[]for _ in range(n)]
    for x,y in XY:
        graph[x-1].append(y-1)
    dp=[-1]*n #頂点i(0-)を始点としたときの有効パスの長さの最大値
    ans=0
    for v in range(n):
        ans=max(ans,rec(v))
    print(ans)

if __name__=='__main__':
    main()


Measured memory_bytes: 72384
#!/usr/bin/env python3
#B

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
ans = 1
for i in range(1,n+1):
    ans *= i
    ans %= mod
print(ans)

Measured memory_bytes: 38512
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int pri[5]={0,6000,4000,3000,2000};
    for(int i=0;i<4;i++){
        int a,b;
        scanf("%d %d",&a,&b);
        printf("%d\n",pri[a]*b);
    }
	return 0;
}

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

int main()
{
    string S;   cin >> S;
    int len = S.size();
    string T;   T.resize(len);

    bool st = false;
    for(int i=len-1; i>0; --i)
    {
        T[i] = '9';
        if(S[i] != '9')
            st = true;
    }
    if(st)
        T[0] = S[0] - 1;
    else
        T[0] = S[0];

    int ans = 0;
    for(int i=0; i<len; ++i)
        ans += T[i] - '0';
    cout << ans;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    Ss = [input() for _ in range(n)]
    U = [[0, 0] for _ in range(n)]
    for i in range(n):
        for c in Ss[i]:
            if c == "(":
                U[i][1] += 1
            else:
                if U[i][1] == 0:
                    U[i][0] += 1
                else:
                    U[i][1] -= 1
    L, R = 0, 0
    P = []
    for i in range(n):
        if U[i][0] == 0 and U[i][1] > 0:
            L += U[i][1]
        elif U[i][0] > 0 and U[i][1] == 0:
            R += U[i][0]
        elif U[i][0] > 0 and U[i][1] > 0:
            P.append([U[i][0], U[i][1]])
    P.sort(key=lambda x: (x[0]-x[1], x[0], -x[1]))
    if L == 0 and R == 0 and len(P) == 0:
        print("Yes")
    elif (L == 0 or R == 0) and len(P) > 0:
        print("No")
    else:
        f = True
        for i in range(len(P)):
            L -= P[i][0]
            if L < 0:
                f = False
                break
            L += P[i][1]
        if L == R and f:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define DIM (long long)100007
#define INF (long long)100000007

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pairll;

ll n,m,i,j,k,res;
ll v[DIM];
ll w[DIM];
ll dp[107][DIM];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m;
    for(i=1; i<=n; i++) cin >> w[i] >> v[i];
    for(i=1; i<=n; i++){
        for(j=0;j<=min(k,m); j++){
            dp[i][j]=dp[i-1][j];

        }
        for(j=0;j<=min(k,m); j++){

            if(j==0 || dp[i-1][j]!=0){

                if( dp[i-1][j]+v[i]>dp[i][j+w[i]]){
                    dp[i][ j+w[i] ] =dp[i-1][j]+v[i];
                }
            }
        }
        k+=w[i];
    }

    for(j=1; j<=m; j++) res=max(res,dp[n][j]);
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 80512
#include <stdio.h>

int main(void){
	int a,b;
	char op;
	while(1){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='?') break;
		switch(op){
			case '+':
			printf("%d\n",a+b);
			break;
			case '-':
			printf("%d\n",a-b);
			break;
			case '*':
			printf("%d\n",a*b);
			break;
			case '/':
			printf("%d\n",a/b);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >>N;
    vector<int>vec(N);
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
    }
    int count=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(vec.at(i)==vec.at(j)||vec.at(j)==vec.at(k)||vec.at(i)==vec.at(k)){
                    continue;
                }
                if(vec.at(i)+vec.at(j)>vec.at(k)&&vec.at(i)+vec.at(k)>vec.at(j)&&vec.at(j)+vec.at(k)>vec.at(i)){
                    count++;
                }
                
            }
        }
    }
    cout <<count<<endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>

using namespace std;

typedef long long ll;


int main(void) {
    ll N;
    ll lt = 0, lx = 0, ly = 0;
    cin >> N;
    for (ll i = 0; i < N; i++) {
        ll t, x, y;
        cin >> t >> x >> y;
        ll dt = t - lt;
        ll dx = abs(x - lx);
        ll dy = abs(y - ly);
        ll d = dx + dy;

        if (!(dt % 2 == d % 2 && dx + dy <= dt)) { 
            cout << "No" << endl;
            return 0;
        }
        
        lt = t;
        lx = x;
        ly = y;
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
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;
}

signed main()
{
    int N;
    cin >> N;
    vi a;
    a.resize(N);
    REP(i, N)
    cin >> a[i];

    int cnt = 0;
    int ans = 0;
    int mi = INF;
    REP(i, N)
    {
        ans += abs(a[i]);
        chmin(mi, abs(a[i]));
        if (a[i] < 0)
            cnt++;
    }

    if (cnt % 2 == 0)
        cout << ans << endl;
    else
        cout << ans - 2 * mi << endl;

    // system("pause");
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    int h,n,cnt=0;
    cin >> h >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        cnt += a;
    }
    if(cnt<h) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
R = [0] * (N+1)
S = [0] * (N+1)
S_dict = {}

ans = 0
temp = 0

for i in range(N):
    R[i+1] = temp + A[i]
    S[i+1] = R[i+1] % M
    temp = R[i+1]

for s in S:
    if s in S_dict:
        S_dict[s] += 1
    else:
        S_dict[s] = 1

for v in S_dict.values():
    ans += int(v*(v-1)/2)

print(ans)

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

using namespace std;

int main(){
    long i, k, na;
    string s, t;
    while(cin>>s){
        t="";
        na=0;
        for(i=0; i<s.size(); i+=2){

            if(49>s[i] || s[i]>54 || 49>s[i+1] || s[i+1]>53){
                na=1;
                break;
            }

            k= (s[i]-48)*5 + 91 + (s[i+1]-48);
            if(s.substr(i,2)=="62"){
                k = 46;
            } else if(s.substr(i,2)=="63"){
                k = 63;
            } else if(s.substr(i,2)=="64"){
                k = 33;
            } else if(s.substr(i,2)=="65"){
                k = 32;
            }
            t+=k;
        }

        if(na) cout << "NA";
        else cout << t;
        cout << endl;
    }
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define fo(i, n) for(int i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ i)
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
template<typename tp> inline void arr(tp *a, int n) {
  for(int i = 1; i <= n; i ++)
    cout << a[i] << " ";
  puts("");
}
int a, b, c, f[62][62][62];
inline int dfs (int a, int b, int c, int st) {
  if(a > 60 || b > 60 || c > 60) return 1e9;
  if(f[a][b][c] != -1) return f[a][b][c];
  if(a == b && b == c) return st;
  int ans = min(dfs(a + 1, b + 1, c, st + 1),
                min(dfs(a + 1, b, c + 1, st + 1),
                    dfs(a, b + 1, c + 1, st + 1)));
  int t = min(dfs(a + 2, b, c, st + 1),
              min(dfs(a, b + 2, c, st + 1), dfs(a, b, c + 2, st + 1)));
  return f[a][b][c] = min(t, ans);
}

main(void) {
  memset(f, -1, sizeof f);
  cin >> a >> b >> c;
  cout << dfs(a, b, c, 0) << "\n";
}


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

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

    string S;
    cin>>S;

    vector<size_t> cnts(S.size());
    int f = 0;
    bool isR = true;
    for (int i = 0; i < S.size(); i++) {
        if (isR) {
            if (S[i+1] == 'L') {
                auto len = i-f+1;
                cnts[i] += (len+1)/2;
                cnts[i+1] += len/2;
                f = i+1;
                isR = false;
            }
        } else {
            if (i == S.size()-1 or S[i+1] == 'R') {
                auto len = i-f+1;
                cnts[f] += (len+1)/2;
                cnts[f-1] += len/2;
                f = i+1;
                isR = true;
            }
        }
    }
    for (auto c : cnts)
        cout << c << ' ';
    cout << endl;

    return 0;
}


Measured memory_bytes: 1488
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
string name;
long long N;
long long m = 0,
		  a = 0,
		  r = 0,
		  c = 0,
		  h = 0;
int main()
{
	cin >> N;
	for(int i = 1;i <= N;i ++){
		cin >> name;
		switch(name[0]){
			case 'M' :m += 1; break;
			case 'A' :a += 1; break;
			case 'R' :r += 1; break;
			case 'C' :c += 1; break;
			case 'H' :h += 1; break;
		}
	}
	cout << m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n,i;
   cin >> n>>i;
   cout << n-i+1 << endl;



   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int, int);
void swap(int *, int *);

int main()
{
  int x, y, n = 0, ans = 0;

  scanf("%d %d", &x, &y);

  ans = gcd(x, y);

  printf("%d\n", ans);

  return 0;
}

int gcd(int x, int y)
{
  int r = 0;
  
  /*xとyの順番を入れ替える(x > yの順にする)*/
  if(x < y)
    swap(&x, &y);

      while(y > 0){
	r = x % y;
	x = y;
	y = r;
      }

  return x;
}

/*swap関数(ポインタを利用)*/
void swap(int *x, int *y)
{
  int tmp;

  tmp = *x;
  *x = *y;
  *y = tmp;
}



Measured memory_bytes: 2128
using System;
class AOJ{
public static void Main(){
int a=int.Parse(Console.ReadLine());
string[] st=Console.ReadLine().Split(' ');
for(int i=a-1;i>=0;i--){
Console.Write(st[i]);
if(i!=0)
Console.Write(" ");
}
Console.WriteLine();
}
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  long double a,b,c; cin >> a >> b >> c;
  cout << (sqrt(a)+sqrt(b)+(1.0e-14) < sqrt(c) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;

long long N, M, L[1 << 18], R[1 << 18], C[1 << 18];
long long dist[1 << 18];
vector<pair<int, int>> X[1 << 18];
priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> Q;

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) cin >> L[i] >> R[i] >> C[i];
	for (int i = 1; i <= M; i++) X[L[i]].push_back(make_pair(R[i], C[i]));
	for (int i = N - 1; i >= 1; i--) X[i + 1].push_back(make_pair(i, 0));
	for (int i = 1; i <= N; i++) dist[i] = (1LL << 60);

	Q.push(make_pair(0, 1)); dist[1] = 0;
	while (!Q.empty()) {
		int pos = Q.top().second; Q.pop();
		for (pair<int, int> i : X[pos]) {
			int to = i.first;
			long long cost = i.second;
			if (dist[to] > dist[pos] + cost) {
				dist[to] = dist[pos] + cost;
				Q.push(make_pair(dist[to], to));
			}
		}
	}

	if (dist[N] == (1LL << 60)) cout << "-1" << endl;
	else cout << dist[N] << endl;
	return 0;
}

Measured memory_bytes: 16908
import copy
n,m = map(int, input().split())
town = [[] for _ in range(n+1)]
for i in range(m):
  p,y = map(int, input().split())
  town[p].append((i,y))
res = []
for i in range(1,n+1):
  tw = copy.copy(town[i])
  for j,x in enumerate(sorted(tw, key=lambda x: x[1])):
    res.append((x[0],str(i).zfill(6)+str(j+1).zfill(6)))

for x in sorted(res, key=lambda x: x[0]):
  print(x[1])

Measured memory_bytes: 43836
#include<iostream>
using namespace std;
int main(){
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	int x=max(A,C);
	int y=min(B,D);
	if(y-x>=0){
        cout<<y-x<<endl;
	}
	else
	cout<<0<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, check = 1;
  cin >> N;
  
  for(int i=0; i<N; i++){
    cin >>  A;
    if( A%2==0 && A%3!=0 && A%5!=0 )
      check = 0;
  }
  
  if(check==1)
    cout << "APPROVED" << endl;
  else
    cout << "DENIED" << endl;
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

using namespace std;

//mem(a, b) memset(a, (b), sizeof(a))

typedef long long ll;

#define f(i,a,b) for (ll i=a ; i<b ; i++)

#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define faster ios::sync_with_stdio(0);cin.tie(0);
typedef pair<int, int> p;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<p> vii;
typedef vector<vi> vvi;
typedef map<int,int> mp;
typedef set<int> se;
typedef multiset<int> MSETI;


// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())


struct duo{
    ll x,y;
};

bool mycomp(duo a,duo b) { return a.x < b.x ;}

bool comp(int a,int b){
	return a<b;
}


int main()
{
	faster


	ll t,n,b=0,d,i,j,k,c,sum;
    char a;
    cin>>a;
    if(isupper(a))
    {
        cout<<"A";
    }
    else if(islower(a))cout<<"a";
    
	
	
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 1e5 + 10;
const ll INF = (ll) 10000000000ll;
const ld EPS = (ld) 1e-8;

ll a[MAXN], b[MAXN];

vector<ll> D;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> b[i];
	ll s = 0;
	for(int i = 0; i < n; i++){
		s += (a[i] - b[i]);
		D.pb(a[i] - b[i]);
	}
	sort(all(D));
//	debug(s);
	if(s < 0) return cout << -1, 0;
	ll ans = 0;
	ll sn = 0;
	for(int i = 0;i<n;i++){
		if(D[i] < 0){
			ans ++;
			sn += abs(D[i]);
		}else break;
	}
	for(int i  = n - 1; i>=0;i--){
		if(sn > 0){
			sn -= D[i];
			ans ++;
		}
		//debug()
	}
	cout << ans;
	return 0;
}


/*
6
7 3 4 2 3 1
                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 2936