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

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

  string s;
  cin >> s;
  for (int i = 0; i < s.size();)
    if (i + 1 < s.size() && s[i] == 'R' && s[i + 1] == 'L')
    {
      int cnt[2] = {1, 1};
      for (int j = i - 1; j >= 0; j--)
        if (s[j] == 'L') break;
        else cnt[(i - j) % 2]++;
      for (int j = i + 2; j < s.size(); j++)
        if (s[j] == 'R') break;
        else cnt[(j - i) % 2]++;
      cout << cnt[0] << ' ' << cnt[1] << ' ';
      i += 2;
    }
    else
    {
      cout << 0 << ' ';
      i++;
    }
}


Measured memory_bytes: 720
// AUTHOR : RUTVIK KOTHARI
// DA-IICT

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

#define ll long long int 
#define ull unsigned long long
#define pll pair<ll,ll>
#define MS(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define INFL 10000000000000000
#define pb push_back
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const ll N = 2e5 + 5;
const ll M = 1e5 + 5;
const ll mod = 1e9 + 7;
const ll m1 = 1e9 + 7;
const ll m2 = 1e9 + 9;
const ll p1 = 402653189;
const ll p2 = 1610612741;
const int LN = 61;

ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll dx[4]={-1,  1,  0,  0};
ll dy[4]={ 0,  0,  1, -1};

ll pw[LN],fact[N],invfact[N];

void pre()
{
    fact[0]=1;
    for(int i=0;i<LN;i++)pw[i]=power(2,i);
    for(int i=1;i<N;i++)fact[i]=(i*fact[i-1])%mod;
    for(int i=0;i<N;i++)invfact[i]=powermodm(fact[i],mod-2,mod);
}


int main()
{
    FIO;
    //pre();

    ll i,j;
    
    ll n;
    cin>>n;
    ll a,b;
    cin>>a>>b;
    
    ll c1=0,c2=0,c3=0;
    
    for(i=1;i<=n;i++)
    {
        ll val;
        cin>>val;
        if(val<=a)
            c1++;
        else if(val<=b)
            c2++;
        else
            c3++;
    }
    
    cout<<min(c1,min(c2,c3));
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 2e9;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	string s, t;
	cin >> s >> t;
	t.pop_back();
	if (s == t) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	
	
 	return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // cin, cout の高速化
#define MOD 1000000007
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i <= (n); i++)
const ll INF = 1e15;
int main()
{
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A+2), t(B+2); 
    REP1(i,A){
        cin >> s[i];
    }
    REP1(i,B){
        cin >> t[i];
    }
    s[0]=-INF;
    t[0]=-INF;
    s[A+1]=INF;
    t[B+1]=INF;
    ll tmp;
    REP(i, Q)
    {
        cin >> tmp;
        ll s1,s2,t1,t2;
        auto it = lower_bound(s.begin(), s.end(), tmp);
        int si = it-s.begin();
        s1=s[si-1];
        s2=s[si];
        auto it2 = lower_bound(t.begin(), t.end(), tmp);
        int ti = it2-t.begin();
        t1=t[ti-1];
        t2=t[ti];
        ll ans = tmp-min(s1,t1);
        ans = min(ans,max(s2,t2)-tmp);
        ans = min(ans,min(abs(tmp-s1),abs(tmp-t2)) + (t2-s1));
        ans = min(ans,min(abs(tmp-t1),abs(tmp-s2))+(s2-t1));
        // cout << tmp << " " << " " << s1 << " " << t2 << endl; 
        cout << ans <<endl;
    }
}

Measured memory_bytes: 2944
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
  
using namespace std;

int w, h;
int board[21][21];
int tesu[21][21];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void solve(int sx, int sy)
{
    // cout << sx << " " << sy << endl;
    if(tesu[sx][sy] > 10) return;
    for(int i = 0; i < 4; i++){
        int nx = sx + dx[i];
        int ny = sy + dy[i];
        if(board[nx][ny] == 1) continue;
        while(nx >= 0 && ny >= 0 && nx < h && ny < w && board[nx][ny] != 1){
            if(board[nx][ny] == 3){
                tesu[nx][ny] = min(tesu[sx][sy] + 1, tesu[nx][ny]);
                break;
            }
            nx += dx[i];
            ny += dy[i];
        }
        if(board[nx][ny] == 3) continue;
        // cout << " " << nx << " " << ny << endl;
        if(nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
        nx -= dx[i];
        ny -= dy[i];
        // cout << tesu[sx][sy] << endl;
        int tmp = tesu[nx][ny];
        tesu[nx][ny] = tesu[sx][sy] + 1;
        board[nx + dx[i]][ny + dy[i]] = 0;
        solve(nx, ny);
        tesu[nx][ny] = tmp;
        board[nx + dx[i]][ny + dy[i]] = 1;       
    }
    return;
}

int main()
{
    while(1){
        cin >> w >> h;
        if(w == 0 && h == 0) break;
        int sx, sy, gx, gy;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin >> board[i][j];
                if(board[i][j] == 2){
                    sx = i;
                    sy = j;
                    board[i][j] = 0;
                } else if(board[i][j] == 3){
                    gx = i;
                    gy = j;
                }
                tesu[i][j] = 11;
            }
        }
        tesu[sx][sy] = 0;
        solve(sx, sy);
        if(tesu[gx][gy] != 11) cout << tesu[gx][gy] << endl;
        else cout << -1 << endl;
    }
}

Measured memory_bytes: 1164
#include<stdio.h>
#include<stdlib.h>
 
#define NMIN 1
#define NMAX 36
 
struct Card{
char suit;
char value;  
};
 
 
void bubble(struct Card A[],int N){
  int i,j;
 struct Card t;
  for(i=0;i<N;i++){
for(j=N-1;j>=i;j--){
  if(A[j].value<A[j-1].value){
    t=A[j];
    A[j]=A[j-1];
    A[j-1]=t;
  }
}    
  }
}
 
void selection(struct Card A[],int N){
  int i,j,minj;
 struct Card t;
  for(i=0;i<N;i++){
minj=i; 
for(j=i;j<N;j++){
  if(A[j].value<A[minj].value) minj=j;
}
t=A[i];
A[i]=A[minj];
A[minj]=t;
  }
}
 
void print(struct Card A[],int N){
int i;
for(i=0;i<N;i++){
  if(i>0) printf(" ");
  printf("%c%c",A[i].suit,A[i].value);
}
 printf("\n");
}
 
int isStable(struct Card C1[],struct Card C2[],int N){
int i;
  for(i=0;i<N;i++){
    if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
}
 
 
 
int main(){
int N,i,j;
struct Card C1[NMAX],C2[NMAX];
char ch;
scanf("%d",&N);
if(N<NMIN||N>NMAX) exit(1);
for(i=0;i<N;i++){
  scanf(" %c%c",&C1[i].suit,&C1[i].value);
}
for(i=0;i<N;i++){
C2[i]=C1[i];
}
bubble(C1,N);
selection(C2,N);
 
print(C1,N);
printf("Stable\n");
print(C2,N);
if(isStable(C1,C2,N)==1){
  printf("Stable\n");
}
else{
  printf("Not stable\n");
}
  return 0;
}



Measured memory_bytes: 2108
L, R = map(int, input().split())
mod = 2019

if R - L >= 2019 or L == 0:
    print(0)
else:
    ans = False
    for i in range(R - L):
        for j in range(i + 1, R - L + 1):
            if ans is not False:
                ans = min(ans, (L + i) * (L + j) % mod)
            else:
                ans = (L + i) * (L + j) % mod
    print(ans)

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

"""
参考：https://atcoder.jp/contests/abc047/submissions/4077573
"""

import sys
import re
from collections import deque, Counter, defaultdict
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, product, combinations, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, T = MAP()
aN = LIST()

mx = -INF
l = aN[0]
cnt = 0
for i in range(1,N):
    # 最低値更新なら始点を動かす
    if aN[i] < l:
        l = aN[i]
    else:
        # 最高値更新ならその場所が操作対象になる
        if aN[i] - l > mx:
            mx = aN[i] - l
            cnt = 1
        # 同率最高値なら操作対象が1つ増える
        elif aN[i] - l == mx:
            cnt += 1
print(cnt)


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

int main() 
{
    int n;
    cin >> n;
    int a[n];
    int b[n];
    int c[n];
    rep(i,n) cin >> a[i] >> b[i] >> c[i];

    int dp[n][3];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    
    for(int i = 1; i< n; i++) {
        dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][2], dp[i-1][0]);
        dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }
    int ans = 0;
    ans = max(dp[n-1][0], dp[n-1][1]);
    ans = max(ans, dp[n-1][2]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
n,x,y = map(int,input().split())

l = [0]*n

x -= 1
y -= 1

for i in range(n):
    for j in range(i+1,n):
        a = j - i
        if i<=x:
            b1 = x - i
        else:
            b1 = i - x
        if j<=y:
            b2 = y - j
        else:
            b2 = j - y
        b = b1 + b2 + 1
        l[min(a,b)] += 1

for i in range(1,n):
    print(l[i])

Measured memory_bytes: 3444
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k  = Integer.parseInt(scanner.next());
        int n  = Integer.parseInt(scanner.next());
        int[] a = new int[n];
        int cost;
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(scanner.next());
        }
        cost = k - Math.abs(k - a[n-1] + a[0]);
        for (int i = 1; i < n; i++) {
            cost = Math.min(cost, k - Math.abs(a[i] - a[i-1]));
        }
        System.out.println(cost);
        
    }
}


Measured memory_bytes: 51904
N = int(input())
AB = []
for i in range(N):
    a,b = map(int,input().split())
    AB.append((b,a))
AB.sort()
last = 0
for i in range(N):
    if last+AB[i][1]<=AB[i][0]:
        last +=AB[i][1]
    else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 65240
from fractions import gcd
from functools import reduce
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9+7

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

def inv(x):
    return pow(x,R-2,R)

n = inn()
a = inl()
#l = a[0]
#for i in range(1,n):
#    l = l*a[i]//gcd(l,a[i])
l = reduce(lcm_base,a,1)
sm = 0
for i in range(n):
    sm = (sm + inv(a[i]))%R
print((sm*l)%R)


Measured memory_bytes: 67672
# Problem https://atcoder.jp/contests/abc088/tasks/abc088_a
# Python 2nd Try
yes = "Yes"
no = "No"


def canpay(needMoney, oneYen):
    zangaku = needMoney % 500
    if zangaku <= oneYen:
        return True
    else:
        return False


if __name__ == "__main__":

    N = int(input())
    A = int(input())
    result = True
    if canpay(N, A):
        print(yes)
    else:
        print(no)
exit


Measured memory_bytes: 2940
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
const int MAX_V = 3000;
struct Flow{
    const ll INF=ll(1e9);
//辺の構造体　
struct edge{
    //行き先、容量、逆辺の場所
    ll to,cap,rev;
    edge(ll to,ll cap,ll rev):to(to),cap(cap),rev(rev){}
};
//グラフの隣接リスト
V<edge> G[MAX_V];//vectorの"配列"
//DFSで調べた頂点を記録
bool used[MAX_V]={};
//辺の情報を代入する関数
void add_edge(ll from,ll to,ll cap){
    G[from].emplace_back(to,cap,ll(G[to].size()));
    G[to].emplace_back(from,0,ll(G[from].size()-1));
}
//増加パスをDFSで探す
ll dfs(ll v,ll t,ll f){
    if(v==t)return f;
    used[v]=true;
    for(int i=0;i<G[v].size();i++){
        edge &e=G[v][i]; //辺の容量を更新するためのアドレス
        if(!used[e.to]&&e.cap>0){
            ll d=dfs(e.to,t,min<ll>(f,e.cap));
            if(d>0){
                e.cap-=d;//使った分減らす
                G[e.to][e.rev].cap+=d;//使った分逆辺の容量を増やす
                return d;
            }
        }
    }
    return 0;
}
//sからtへの最大流を求める
ll fmax(ll s,ll t){
   ll flow=0;
   while(1){
       for(int i=0;i<MAX_V;i++)used[i]=false;
       ll f=dfs(s,t,INF);
       if(f==0)return flow;
       flow+=f;
   }
}
};
int main(){
 int h,w;
 cin>>h>>w;
 V<string> s(h);
 for(int i=0;i<h;i++)cin>>s[i];
 int S=0,T=h+w+2;
 Flow flow;
 int ma=int(1e5);
 for(int i=0;i<h;i++){
     for(int j=0;j<w;j++){
         if(s[i][j]=='o'){
             flow.add_edge(i+1,j+h+1,1);
             flow.add_edge(j+h+1,i+1,1);
         }
         if(s[i][j]=='S'){
             flow.add_edge(S,i+1,ma); 
             flow.add_edge(S,j+h+1,ma);
                         
         }
         if(s[i][j]=='T'){
             flow.add_edge(i+1,T,ma);
             flow.add_edge(j+h+1,T,ma);              
         }
     }
 }
 int f=flow.fmax(S,T);
 if(f<ma)cout<<f<<"\n";
 else cout<<-1<<"\n";
}

Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
int deg[1000055];
int main() {
    int n,m,x,y;
    cin>>n>>m;
    for(int i=0;i<m;i++) {
        cin>>x>>y;
        deg[x]++;
        deg[y]++;
    }
    for(int i=1;i<=n;i++) cout<<deg[i]<<endl;
    return 0;
}


Measured memory_bytes: 256
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,s[1000005],t[1000005],ans;
bool ok;
deque<int> q;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        char c;
        scanf(" %c",&c);
        s[i]=c-96;
    }
    for(int i=1;i<=n;++i){
        char c;
        scanf(" %c",&c);
        t[i]=c-96;
        if(s[i]!=t[i])ok=1;
    }
    if(!ok){
        puts("0");
        return 0;
    }
    int k=n,o=0;
    q.pb(n+1);
    for(int i=n;i;--i){
        int p=k;
        while(k&&(k>i||s[k]!=t[i]))--k;
        if(!k){
            puts("-1");
            return 0;
        }
        if(p==k){
            while(!q.empty()&&q.back()>=o+i)q.pop_back();
            q.pb(o+i);
        }
        else{
            ++o;
            if(i!=k){
                ans=max(ans,(int)q.size());
                q.push_front(o+k);
            }
        }
    }
    printf("%d\n",ans);
    //system("pause");
    return 0;
}


Measured memory_bytes: 12160
#include<stdio.h>
void swap(int *,int *);
int gcd(int,int);
int main(){
  int x,y;
  int i;
  scanf("%d%d",&x,&y);


  printf("%d\n",gcd(x,y));
  return 0;
}
int gcd(int x,int y){
  int r = 1;
  if(x<y){
    swap(&x,&y);
  }
    while(r != 0){
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}

void swap(int *x,int *y){
  int r;
  r = *x;
  *x = *y;
  *y = r;
}



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

main() {
    int N,K; cin >> N >> K; ll ans=K;
    rep(i,N-1){
        ans*=(K-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int[M];
		int count = 0;
		for(int i = 0; i<N; i++) {
			int K = sc.nextInt();
			for(int j = 0; j<K;j++) {
			 	int hi = sc.nextInt();
			 	A[hi-1]++;
			}
		}      
		
		for(int i = 0; i<M; i++) {
			if(A[i] == N) {
			count++;	
			}
		}
		
		System.out.println(count);
    }

}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string s;
    while (cin >> s)
    {
        string t = "";
        rep(i, s.size())
        {
            if (s[i] == '@')
            {

                t += string(s[i + 1] - '0', s[i + 2]);
                i += 2;
            }
            else
            {
                t += s[i];
            }
        }
        OP(t);
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int a,b,c;cin>>a>>b>>c;
  if(a<=c&&c<=b)out("Yes")
  else out("No")

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	int count=0;
	cin>>a>>b>>c;
	for(int i=a; i<=b; i++) {
		if(c%i==0) count++;
	}
	cout<<count<<'\n';
	return 0;
}



Measured memory_bytes: 3204
#include <iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a[n][n];
	int b[m][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
				char x;
				cin>>x;
				if(x=='#')
					a[i][j]=0;
				else
					a[i][j]=1;
		}
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<m;j++){
				char x;
				cin>>x;
				if(x=='#')
					b[i][j]=0;
				else
					b[i][j]=1;
		}
	}
	int count=0;
	for(int i=0;i<=n-m;i++){
		for(int j=0;j<=n-m;j++){
			count=0;
			for(int k=i;k<i+m;k++){
				for(int l=j;k<j+m;l++){
					if(a[k][l]==b[k-i][l-j])
						count++;
					else{
						break;
						count=0;
					}
					if(count==m*m){
						cout<<"Yes";
						return 0;
					}
				}
				if(count==0) break;
			}
		}
	}
	cout<<"No";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int D = scanner.nextInt();
    int X = scanner.nextInt();
    int[] A = new int[110];
    for (int i = 0; i < N; i++){
      A[i] = scanner.nextInt();
    }
    int count = N + X;

    for (int i = 0; i < N; i++){
      for (int j = 1; j <= D; j++){
        if (j * A[i] + 1 <= D){
          count++;}
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 22740
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/arc082/tasks/arc082_c>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 998244353;
vector<ll> fact;
ll N;
ll solve(){
    ll res = 0;
    cin >> N;
    vector<pll> ps(N); for(auto& in:ps) cin >> in.first >> in.second;
    fact.resize(N+1);
    fact[0] = 1;
    for(int i = 1; i <= N;i++) fact[i] = fact[i-1]*2%MOD;

    res = (fact[N] + MOD - 1 - N - N*(N-1)/2)%MOD;
    
    vector<vector<int>> checked(N,vector<int>(N,0));
    for(int i = 0; i < N;i++){
        for(int j = 0; j < i;j++){
            if(checked[i][j]) continue;
            vector<int> idx{i,j};
            for(int k = 0; k < N;k++){
                if(k == i || k == j) continue;
                if((ps[i].first-ps[j].first)*(ps[i].second-ps[k].second)-(ps[i].first-ps[k].first)*(ps[i].second-ps[j].second) == 0){
                    idx.push_back(k);
                }
            }
            for(auto v:idx){
                for(auto vv:idx){
                    checked[v][vv] = 1;
                }
            }
            int sz = (int)idx.size();
            if(sz >= 3){
                res = (res + MOD - fact[sz] + sz + sz*(sz-1)/2 + 1)%MOD;
            }
        }
    }
    (res += MOD)%=MOD;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

// 任意の個数の変数をスペース区切りで出力します
void dump() {
  cout << endl;
}
template <class Head, class... Tail>
void dump(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) != 0)
    cout << " ";
  dump(std::move(tail)...);
}

// ====================================================================

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  tx -= sx;
  ty -= sy;
  sx = sy = 0;

  for (int i = 0; i < ty; i++) cout << "U";
  for (int i = 0; i < tx; i++) cout << "R";
  for (int i = 0; i < ty; i++) cout << "D";
  for (int i = 0; i <= tx; i++) cout << "L";
  for (int i = 0; i <= ty; i++) cout << "U";
  for (int i = 0; i <= tx; i++) cout << "R";
  cout << "DR";
  for (int i = 0; i <= ty; i++) cout << "D";
  for (int i = 0; i <= tx; i++) cout << "L";
  cout << "U" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];

    if(a[0]!=0){
        cout<<-1<<endl;
        return 0;
    }

    ll ans=0;
    rep(i,n-1){
        if(a[i+1]-a[i]>1){
            cout<<-1<<endl;
            return 0;
        }

        if(a[i+1]<=a[i]) ans+=a[i+1];
        else ans++;
    }

    cout<<ans<<endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x3 = y1 - y2 + x2, y3 = -x1 + x2 + y2;
    int x4 = y2 - y3 + x3, y4 = -x2 + x3 + y3;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

int dp[103][103];

int main() {
	int n; cin >> n;
	int d[200];
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	sort(d, d + n);
	int cur = d[n - 1];
	int cnt = 1;
	for (int i = n - 2; i >= 0; --i) {
		if (d[i] < cur) {
			cnt++;
			cur = d[i];
		}
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    cout << n - k + 1;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX 10000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
ll sumprime[MAX];
bool is_prime[MAX];
void sieve(){
    is_prime[0]=is_prime[1]=true;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=true;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(!is_prime[i]){
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=true;
            }
        }
    }
    for(int i=0;i<MAX;i++){
        if(!is_prime[i]){
            sumprime[i]=sumprime[i-1]+i;
        }else{
            sumprime[i]=sumprime[i-1];
        }
    }
}
*/
/*
void lcs(char s1[],char s2[]){
    int n=strlen(s1);
    int m=strlen(s2);
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int sum=0;
            if(s1[i-1]==s2[j-1]){
                sum=1+dp[i-1][j-1];
            }
            else{
                sum=max(dp[i-1][j],dp[i][j-1]);
            }
            dp[i][j]=sum;
        }
    }
    
    int index=dp[n][m];
    //cout<<index<<endl;
    char ans[index+1];
    ans[index]='\0';
    index--;
    int x=n;
    int y=m;
    while(x>0 and y>0){
        if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
            ans[index]=s1[x-1];
            index--;
            x--;
            y--;
        }else if(dp[x-1][y]>dp[x][y-1]){
            x--;
        }else{
            y--;
        }

    }
    //reverse(ans.begin(),ans.end());

    cout<<ans;
    return;
}
*/

int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    int t=1;
    //cin>>t;
    for(int tc=1;tc<=t;tc++){
        int n;
        cin>>n;
        if(n>=400 and n<=599){
            cout<<"8\n";
        }else if(n>=600 and n<=799){
            cout<<"7\n";
        }else if(n>=800 and n<=999){
            cout<<"6\n";
        }else if(n>=1000 and n<=1199){
            cout<<"5\n";
        }else if(n>=1200 and n<=1399){
            cout<<"4\n";
        }else if(n>=1400 and n<=1599){
            cout<<"3\n";
        }else if(n>=1600 and n<=1799){
            cout<<"2\n";
        }else{
            cout<<"1\n";
        }
        

    }
    
    
    
    
    return 0;
    
}

Measured memory_bytes: 3648
using System;
using System.Linq;

namespace MSBPC2019
{
    class A
    {
        static void Main(string[] args)
        {
            int[] input1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int M1 = input1[0];
            int D1 = input1[1];
            int[] input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int M2 = input2[0];
            int D2 = input2[1];

            if (M1 + 1 == M2 || (M1 == 12 && M2 == 1)) { Console.WriteLine(1); }
            else { Console.WriteLine(0); }
        }
    }
}


Measured memory_bytes: 11348
#include<stdio.h>
int main(void){
  int N,i,sum=0,count=0;
  int H[100000];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&H[i]);
  }
  for(i=N-1;i>0;i--){
    if(H[i]<=H[i-1]){
      count++;
    }else{
      if(count>sum){
        sum=count;
      }
      count=0;
    }
  }
  if(count>sum){
    sum=count;
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 512
import Data.Char
import Text.Printf
main :: IO()
main = do
  val <- getLine
  printf "%s" $ slv val

slv :: String -> String
slv val | intVal `mod` sumVal == 0 = "Yes"
        | otherwise = "No"
  where intVal = read val :: Int
        sumVal = sum $ map digitToInt val

Measured memory_bytes: 508
#include<iostream>
using namespace std;
int x[20][20] , y[20][20] , a[20] , ans=0 , bo[20] , n;
void dfs(int node , int sum)
{
	/*for(int i=1;i<=n;i++)
		cout<<bo[i]<<" ";
	cout<<endl;*/
	if(node==n+1)
	{
		bool OK=true;
		for(int i=1;i<=n;i++)
			if(bo[i]==1)
			{
				for(int j=1;j<=a[i];j++)
					if(bo[x[i][j]]!=y[i][j])
						OK=false;
			}
		/*if(sum==2){
			for(int i=1;i<=n;i++)
				cout<<bo[i]<<" ";
			cout<<endl;
		}*/
		if(OK) ans=max(sum , ans);
		return;
	}
	
	bo[node]=1;
	dfs(node+1 , sum+1);
	bo[node]=0;
	dfs(node+1 , sum);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		for(int j=1;j<=a[i];j++)
			cin>>x[i][j]>>y[i][j];
	}
	dfs(1 , 0);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var input = new int[num][];
        for (var i = 0; i < num; i++)
            input[i] = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var max = input.Select(c => c[0]).Max();
        var gr = new int[max][];
        for (var i = 0; i < max; i++)
            gr[i] = new int[max];

        for(var i = 0; i < num; i++)
        {
            for(var j = 0; j < input[i][1]; j++)
            {
                gr[input[i][0] - 1][input[i][j + 2] - 1] = 1;
            }
        }
        WriteLine(string.Join("\n", gr.Select(g => string.Join(" ", g)).ToArray()));
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};

int n;
int d[505][505];
int ima[505][505];
vector <int> v;
bool de;

void dfs(int i, int j, int k) {
	if (i<0 or j<0 or i>=n or j>=n) return ;
	if (d[i][j] <= k) return ;
	d[i][j] = k;
	for (int s=0 ; s<4 ; s++) {
		int nx = i+dx[s];
		int ny = j+dy[s];
		dfs(nx, ny, k+ima[i][j]);
	}
}

int main() {
	scanf("%d", &n);
	for (int i=0 ; i<n ; i++) {
		for (int j=0 ; j<n ; j++) {
			int x;
			scanf("%d", &x);
			v.pb(--x);
			d[i][j] = min(min(i, n-i-1), min(j, n-j-1));
			ima[i][j] = 1;
		}
	}
	int sol = 0;
	for (int k=0 ; k<v.size() ; k++) {
		int i = v[k]/n;
		int j = v[k]%n;
		sol += d[i][j];
		ima[i][j] = 0;
		dfs(i, j, d[i][j]++);
	}
	printf("%d\n", sol);
	return 0;
}

Measured memory_bytes: 21520
N,X=gets.split.map(&:to_i)
AS=Array.new(N+1).map.with_index{|e,i|2**(i+2)-3}
PS=Array.new(N+1).map.with_index{|e,i|2**(i+1)-1}
def function(n,x)
  if n==0
    if x==0
      return 0
    else
      return 1
    end
  else
    if x==1
      return 0
    elsif x<=1+AS[n-1]
      return function(n-1,x-1)
    elsif x==1+AS[n-1]+1
      return PS[n-1]+1
    elsif x<=1+AS[n-1]+1+AS[n-1]
      return PS[n-1]+1+function(n-1,x-AS[n-1]-2)
    else
      return 1+PS[n-1]*2
    end
  end
end
puts function(N,X)


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

int main()
{
	int n;
	long long int ans = 1;
	int num;

	cin >> n;

	for(int i = n+1; i>1; i--)
	{
		ans *= (i-1);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1156
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, A);
    IN(string, B);
    string ans = "EQUAL";
    if (A.size() > B.size())
    {
        ans = "GREATER";
    }
    if (A.size() < B.size())
    {
        ans = "LESS";
    }
    if (A.size() == B.size())
    {
        REP(i, A.size())
        {
            if (A[i] > B[i])
            {
                ans = "GREATER";
                break;
            }
            if (A[i] < B[i])
            {
                ans = "LESS";
                break;
            }
        }
    }
    OUT(ans);
}

Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main(void)
{
	int A, B, C;

	cin >> A >> B;

	C = A - 2*B;
	if (C > 0)
	{
		cout << C << endl;
		return 0;
	}
	else
	{
		cout << 0 << endl;
		return 0;
	}

}

Measured memory_bytes: 256
using namespace std;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int n,a,b;
    cin >> n >> a >> b;

    int sum = 0;
    for (int i = 1; i <= n; i++){
        string s = to_string(i);
        int sumn = 0; 
        for (int k = 0; k < s.size(); k++){
            sumn += (int)s[k] - '0';
        }
        if (sumn >= a && sumn <= b){
            sum+= stoi(s);
        }
    }

    cout << sum;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<unordered_map>

using namespace std;


template<class Node, class Hash=hash<Node>>
class UpdatablePriorityQueue{
public:
    vector<Node> heap;
    unordered_map<Node,size_t,Hash> index_hash;
    UpdatablePriorityQueue(void) : heap(1),index_hash() {}
    void push(const Node & node){
        heap.push_back(node);
        index_hash[node]=heap.size()-1;
        bubble_up(heap.size()-1);
    }
    Node pop(void){
        exchange(1,heap.size()-1);
        Node max=heap.back();
        heap.pop_back();
        index_hash[max]=0;
        bubble_down(1);
        return max;
    }
    void change(const Node & old_node,const Node & new_node){
        size_t index=index_hash[old_node];
        heap[index]=new_node;
        bubble_up(index);
        bubble_down(index);
    }
    size_t size(void){
        return heap.size()-1;
    }
    bool include(const Node & node){
        return index_hash[node]==0;
    }
    void bubble_up(size_t index){
        size_t parent_index=index/2;
        if(index<=1) return;
        if(!(heap[parent_index]<heap[index])) return;
        exchange(index, parent_index);
        bubble_up(parent_index);
    }
    void bubble_down(size_t index){
        size_t child_index=index*2;
        if(child_index>heap.size()-1) return;
        if(child_index<heap.size()-1 && heap[child_index]<heap[child_index+1]) child_index+=1;
        if(heap[child_index]<heap[index]) return;
        exchange(index,child_index);
        bubble_down(child_index);
    }
    void exchange(size_t i, size_t j){
        swap(index_hash[heap[i]],index_hash[heap[j]]);
        swap(heap[i],heap[j]);
    }
};


typedef long long LL;
typedef pair<LL,LL> task;

struct fobj{
    inline size_t operator()(const task & x) const{
        size_t h1=hash<tuple_element<0,task>::type>()(x.first);
        size_t h2=hash<tuple_element<1,task>::type>()(x.second);
        return h1^(h2<<1);
    }
};

int main(void){
    UpdatablePriorityQueue<task,fobj> pq;
    int N,M;
    cin >> N >> M;
    vector<vector<int>> task_part(100000);
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        task_part[a-1].push_back(b);
    }
    LL ans=0;
    int id=0;
  
    for(int i=0;i<M;i++){
        for(auto &v : task_part[i]){
            pq.push(make_pair(v,id++));
        }
        if(pq.size()!=0){
            ans+=pq.pop().first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11300
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e7 + 2;

long long int sum[MAXN];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	for (int i = 1; i < MAXN; ++i) {
		for (int j = i; j < MAXN; j += i)
			++sum[j];
		sum[i] = 1LL*i*sum[i] + sum[i-1];
	}
	int n; cin >> n;
	cout << sum[n] << '\n';
}

Measured memory_bytes: 81760
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using ld=long double;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
const long double PI = acos(-1.0);
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;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int par[100010];//親
int rnk[100010];// rankだと怒られる

void init(int n){//初期化
  for(int i=0;i<n;i++){
     par[i]=i;
     rnk[i]=1;
  }
}

int find(int x){//親を求める
  if(par[x]==x) return x;
  return par[x]=find(par[x]);
}

void unite(int x,int y){//union
  x=find(x);
  y=find(y);
  if(x==y)return;
  if(rnk[x]<rnk[y]){//rankが小さい方にくっつける
    par[x]=y;
  }
  else{
   par[y]=x;
    if(rnk[x]==rnk[y])rnk[x]++;//rankが同じ時は1増やす
  }
}

bool same(int x,int y){
 return find(x)==find(y); 
}

int main(){//cout<<fixed<<setprecision(20);
  int n,m;
  cin>>n>>m;
  init(n);
  rep(i,0,m){
   int a,b;
    cin>>a>>b;
    a--;b--;
    unite(a,b);
  }
  int ans=0;
  rep(i,0,n){
   if(!same(0,i)){
     ans++;
     unite(0,i);
   }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4332
s = int(input())
mod = 10 ** 9 + 7
dp = [0 for i in range(s + 1)]
dp[0] = 1
 
for i in range(0, s + 1):
    for j in range(0, (i - 3) + 1):
        dp[i] += dp[j]
        dp[i] = dp[i] % mod 
 
ans = dp[s]
print(ans)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct BinomialCoefficient  {
    BinomialCoefficient() {
        
    }
    
    BinomialCoefficient(int n) : fac(n + 2), finv(n + 2), inv(n + 2) {
        initialize(n, false);
    }
    
    void initialize(int n, bool resize = true) {
        if (resize) {
            fac.resize(n + 2);
            finv.resize(n + 2);
            inv.resize(n + 2);
        }
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i <= n; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    
    ll factorial(int n) {
        return fac[n];
    }
    
    ll combination(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
    
    ll permutation(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * finv[n - r] % mod;
    }
    
private:
    int mod = 1e9 + 7;
    vector<ll> fac, finv, inv;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll mod = 1e9 + 7;
    ll n, k;
    cin >> n >> k;
    BinomialCoefficient bc(2 * n);
    ll ans = 0;
    rep(i, min(n, k + 1)) {
        ll emp = bc.combination(n, i);
        ll sty = 1;
        if (i > 0) sty = bc.combination((n - i) + i - 1, i);
        ans = (ans + emp * sty) % mod;
    }
    cout << ans << endl;
    return 0;
}


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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

int main() {
    {
        _time time(disable);
        _i64 n; vector<_i64> a;
        cin >> n; a.resize(n); _foreach(e, a) { cin >> e; }
        for(_i64 i = n - 1; i >= 0 ; --i) { cout << a[i] << (i != 0 ? " " : ""); }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = (int)1e9 + 7, INF = (int)1e9;


int main(void) {
	double r;
	const double pi = 3.14159265;

	scanf("%lf", &r);

	printf("%.12lf\n", r * pi * 2);

	return 0;
}


Measured memory_bytes: 3812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <climits>
#include <stack>
#define ll long long int
#define MOD 1000000007
#define eps 0.001 ;

using namespace std ;

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


int n,m;
cin>>n>>m ;


int p ;
cin>>p  ;
int sasa[p] ;
for(int i =  0 ; i< p  ;++i)
{
cin>>sasa[i] ;

}
int arr[n][m] ;
int k = 0 ;
for(int i = 0 ;  i< n  ; ++i)
{

  if(i %2 == 0)
 for(int  j  = 0 ;  j< m ; ++j)
 {
    if(sasa[k] == 0)
      {
       k++;
      }
      arr[i][j]  = k + 1 ;
       sasa[k]-- ;
 }
 else
 for(int j =  m-1 ;  j>= 0  ;--j)
 {
  if(sasa[k] == 0)
      {
       k++;
      }
      arr[i][j]  = k + 1 ;
       sasa[k]-- ;

 }


}

for(int i = 0 ;  i < n ; ++i)
{
  for(int j =  0 ; j < m ; ++j)
     cout<<arr[i][j]<<" " ;

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


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
const int N=1e5+5;
const int MAXN=1e5+5;
const ll inf=0x3f3f3f3f;
char s[5],t[5];
int main(){
    std::ios::sync_with_stdio(false);
    int n,l,r;
    cin>>s>>t;
    int ans=0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 256
#include<stdio.h>


int main() {
	int N;
	scanf("%d", &N);

	char S[N];
	/*for (int i = 0; i < N; i++) {
		scanf("%c", &S[i]);
	}*/
	scanf("%s", S);
	
	bool answer = true;
	
	int halfN = N/2;
	
	if (N % 2 == 1) {
		printf("No\n");
		return 0;
	}
	else {
	    //printf("N%2==1は通過\n");
		for (int i = 0; i < halfN; i++) {
		    //printf("%d ",i);
		    
			if (S[i] != S[i+halfN]) {
				answer = false;
				printf("No\n");
				return 0;
			}
		}
		//printf("比較も通過\n");
	}
	
	printf("Yes\n");
	
	return 0;
}

Measured memory_bytes: 128
def resolve():
    N, X = map(int, input().split())

    As = [1]  # レベルiバーガーの厚さ（層の総数）（必ず奇数）
    Ps = [1]  # レベルiバーガーのパティの総数

    for i in range(N):
        As.append(As[i] * 2 + 3)  # レベルが1上がると、総数は2倍+3になる
        Ps.append(Ps[i] * 2 + 1)  # レベルが1上がると、パティの数は2倍+1になる

    def f(n, x):
        if n == 0:
            return 0 if x <= 0 else 1
        mid = (As[n] + 1) // 2

        # バーガーの真ん中にはパティがある。そのパティを含むかの場合分けをする
        if x < mid:
            return f(n - 1, x - 1)
        elif x == mid:
            return Ps[n - 1] + 1
        elif x > mid:
            return Ps[n - 1] + 1 + f(n - 1, x - mid)

    ans = f(N, X)

    print(ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 9196