akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct _Node {
  int key;
  struct _Node *next, *prev;
} Node;

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(void) {
  int key, n, i;
  int size = 0;
  int np = 0, nd = 0;
  char com[20];
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') {
      insert(key);
      np++;
      size++;
    } else if(com[0] == 'd') {
      if(strlen(com) > 6) {
        if(com[6] == 'F')
          deleteFirst();
        else if(com[6] == 'L')
          deleteLast();
      } else {
        deleteKey(key);
        nd++;
      }
      size--;
    }
  }
  printList();
  return 0;
}



Measured memory_bytes: 32996
from itertools import product

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]


def has_neighbor(_i: int, _j: int) -> bool:
    patterns = [
        (-1, 0), (1, 0), (0, -1), (0, 1),
    ]
    cnt = 0
    for pattern in patterns:
        y, x = _i + pattern[0], _j + pattern[1]
        if y in range(H) and x in range(W):
            c = S[y][x]
            if c == "#":
                cnt += 1
        else:
            pass
    if cnt:
        return True
    else:
        return False


for i, j in product(range(H), range(W)):
    if S[i][j] == "#" and not has_neighbor(i, j):
        print("No")
        break
else:
    print("Yes")


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>

#define MIN(a,b) ((a)<(b)?(a):(b))

typedef struct zabuton{
  int h,p;
} node;

int cmp(const void *a,const void *b){
  node *p=(node *)a;
  node *q=(node *)b;
  return (p->h+p->p)-(q->h+q->p);
}

void run(void){
  int n;
  scanf("%d",&n);
  node *a=(node *)calloc(n,sizeof(node));
  int i,j;
  for(i=0;i<n;i++){
    int h,p;
    scanf("%d%d",&h,&p);
    a[i]=(node){h,p};
  }
  qsort(a,n,sizeof(node),cmp);
  int *dp=(int *)calloc(n+1,sizeof(int));
  const int inf=2000000001;
  for(i=1;i<=n;i++) dp[i]=inf;
  for(i=0;i<n;i++){
    for(j=i+1;j>0;j--){
      if(dp[j-1]>a[i].h) continue;
      dp[j]=MIN(dp[j],dp[j-1]+a[i].p);
    }
  }
  for(i=1;i<=n && dp[i]<inf;i++);
  printf("%d\n",i-1);
}

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


Measured memory_bytes: 380
#include <cstdio>
#include <algorithm>
#include <cmath>
#define Rint register int
#define LL double
#define F(x,y,z) for(Rint x=y;x<=z;++x)
#define D(x,y,z) for(Rint x=y;x>=z;--x)
using namespace std;
LL Min(LL x,LL y){return x<y?x:y;}
LL Max(LL x,LL y){return x>y?x:y;}
LL Abs(LL x){return x<0?-x:x;}
inline LL R(){
    char c='!';LL x=0,z=1;
    for( ; c>'9'||c<'0';c=getchar()) if(c=='-')z=-1;
    for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
    return x*z;
}
int n,m;
int a[1000010];
LL ans=10000000000000000;
double ck(double u){
	LL an=0;
	F(i,1,n) an+=Abs(a[i]-u-i);
	return an;
}
           
int main(){
	
	n=R();
	F(i,1,n)a[i]=R();
	//sort(a+1,a+1+n);
	a[n+1]=1000000000;
	double ll=-1000000000000000,rr=1000000000000000,m1,m2;
	ck(0);
	while (ll<=rr){
		m1=rr/3+2*ll/3;
		m2=2*rr/3+ll/3;
		m1=(long long)m1;
		m2=(long long)m2;
		LL n1=ck(m1);
		LL n2=ck(m2);  
		if (n1<n2){     
			ans=Min(ans,n1);
			rr=m2-1;
		}
		else{
			ans=Min(ans,n2);
			ll=m1+1;
		}
		 }
	printf("%.0lf\n",ans);
		 return 0;    
}  

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define fi first
#define se second
#define vi vector< int > 
#define pii pair<int,int>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	int x[5];
	for (int i  = 0; i < 5; i++) cin >> x[i];
	for(int i = 0; i < 5; i++) {
		if (x[i] == 0) {
			cout << i+1;
			exit(0);
		}
	}
	
}

Measured memory_bytes: 3552
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;

int main() {
    ll h, n;
    cin >> h >> n;
    ll a[n];
    ll cnt = 0;
    rep(i , n) cin >> a[i];
    int t = 0;
    rep(i, n) {
        t += a[i];
    }
    if (t >= h) {
        cout << "Yes" << endl;
    } else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1024
function main(input){
    let int = parseInt;
    
    let lines = input.split("\n");
    let length = int(lines[0]);
    let nums = lines[1].split(" ");
    nums= nums.map(item=>int(item));
    let sortedIndex=0;
    let swapCount=0;
    let numsPut = "";
    let swapped = false;
    if(length===1){
        console.log(nums[0]);
        console.log(0);
        return;
    }
    
    do{
        swapped = false;
        
        for(let i=length-1;i>sortedIndex;i--){
            if(nums[i]<nums[i-1]){
                let temp = nums[i];
                nums[i] = nums[i-1];
                nums[i-1] = temp;
                swapped = true;
                swapCount++;
            }
        }
        sortedIndex++;
    }while(swapped);
    for(let i=0;i<length;i++){
        numsPut +=String(nums[i])+" ";
    }
    console.log(numsPut.trim());
    console.log(String(swapCount));



}




main(require("fs").readFileSync("/dev/stdin","utf-8"));


Measured memory_bytes: 15560
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <deque>
using namespace std;

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

    const string s = "CODEFESTIVAL2016";

    string t;
    cin >> t;
    int result = 0;
    for (int i = 0; i < (int) t.length(); ++i) {
        result += (t[i] != s[i]);
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;main(){string s;cin>>s;long long r=0,d=0,i=0,b,c;for(;i++<s.size();d=b^c?0:d){b=s[i-1]==66,c=s[i]==67;s[i-1]<66?d++:r+=b&c?d:0;}cout<<r;}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=10050;
//↑templete
#define int long long
signed main(){

	string S, T;
	cin>>S>>T;
	int A, B;
	cin>>A>>B;
	string U;
	cin>>U;

	if(S==U)
		cout<<A-1<<" "<<B<<endl;
	else
		cout<<A<<" "<<B-1<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string str;cin>>str;
	llint i,X=1,A=0,B=0,C=0;
	for(i=0;i<str.size();i++){
		if(str[i]=='A'){A+=X;A%=mod;}
		if(str[i]=='B'){B+=A;B%=mod;}
		if(str[i]=='C'){C+=B;C%=mod;}
		if(str[i]=='?'){
			C*=3;C+=B;C%=mod;
			B*=3;B+=A;B%=mod;
			A*=3;A+=X;A%=mod;
			X*=3;X%=mod;
		}
	}
	cout<<C<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main ()
{
  prep();
  int w, h;
  cin >> w >> h;
  int warr[w];
  int harr[h];
  pair<int, int> sorted[w+h];
  int cnt = 0;
  for (int i=0; i<w; i++){
      cin >> warr[i];
      sorted[cnt] = {warr[i], 0};
      cnt++;
  }
  for (int j=0; j<h; j++){
      cin >> harr[j];
      sorted[cnt] = {harr[j], 1};
      cnt++;
  }
  int wcnt = w+1;
  int hcnt = h+1;
  sort(sorted, sorted+w+h);
  long long res = 0;
  for (int i=0; i<w+h; i++){
      long long val = sorted[i].first;
      int which = sorted[i].second;
      if (which == 0){
          res += hcnt*val;
          wcnt--;
      }else{
          res += wcnt*val;
          hcnt--;
      }
  }
  cout <<res;
  return 0; 
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define forsn(i,x,y) for(long long i = (x) ; i <= (y) ; ++i)
typedef long long ll;
typedef long double ld;

int main() {
  int n;
  cin >> n;
  vector<int> a;
  vector<int> ns(100009,0);
  int m_a = 0;
  forn(n0,n) {
    int t;
    cin >> t;
    a.push_back(t);
    ns[t]++;
    m_a = max(m_a,t);
  }
  int carry_over = 0;
  int minus = 0;
  for(int i = 1;i <= m_a; i++) {
    int k = ns[i];
    if(k == 0) {
      continue;
    }
    else if(k % 2 == 1) {
      minus += k - 1;
      continue;
    }
    else if(k % 2 == 0) {
      if(carry_over == 0) {
        minus += k - 1;
        carry_over++;
      }
      else {
        minus += k - 1;
        carry_over--;
      }
    }
  }
  int total = n - minus - carry_over;
  cout << total << endl;
  return 0;
}

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

int main(void){
    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>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

int n;
string S, s, t;
typedef pair<string, string> PS;
map<PS, int> mp1, mp2;
set<PS> st;

void dfs(int p, string a, string b, bool f)
{
    if (p == n)
    {
        if (f)
        {
            mp1[PS(a, b)]++;
            st.insert(PS(a, b));
        }
        else
            mp2[PS(a, b)]++;
        return;
    }
    if (f)
    {
        dfs(p + 1, a + s[p], b, true);
        dfs(p + 1, a, b + s[p], true);
    }
    else
    {
        dfs(p + 1, a + t[p], b, false);
        dfs(p + 1, a, b + t[p], false);
    }
}

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

    cin >> n >> S;
    s = S.substr(0, n);
    t = S.substr(n, n);
    reverse(all(t));
    dfs(0, "", "", true);
    dfs(0, "", "", false);
    int ans = 0;
    for (auto x = st.begin(); x != st.end(); x++)
    {
        PS ps = *x;
        ans += mp1[ps] * mp2[ps];
    }
    cout << ans << endl;
}

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

int main() {
  string S;
  cin >> S;
  
  if( S.at(0) == S.at(1) && S.at(1) == S.at(2) ) {
    cout << "No" << endl;
    
  }
  else {
  cout << "Yes" << endl;
    
  }
}


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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  i32 x;
  cin >> x;

  cout << (8 - (x - 400) / 200);

  return 0;
}


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

const ULL M = 1000000007;

#define mulmatrix(A,B,C,n){ \
  rep(i,n)rep(j,n) C[i][j] = 0; \
  rep(i,n)rep(j,n)rep(k,n) C[i][j]=(C[i][j]+A[i][k]*B[k][j])%M; \
}

int main() {
    int H, W, K; cin >> H >> W >> K;

    ULL F[9]; F[0] = F[1] = 1; rep(i, 7) F[i + 2] = F[i] + F[i + 1];
    ULL X[8][8] = {};
    rep(i, W) X[i][i] = F[i] * F[W - i - 1] % M;
    rep(i, W - 1) X[i + 1][i] = X[i][i + 1] = F[i] * F[W - i - 2] % M;
    ULL WPow[8][8] = {}; rep(i, W) rep(j, W) WPow[i][j] = X[i][j];
    ULL buf[8][8] = {}; rep(i, W) buf[i][i] = 1;
    while (H) {
        ULL tmp[8][8];
        if (H % 2) {
            mulmatrix(buf, WPow, tmp, W);
            rep(i, W) rep(j, W) buf[i][j] = tmp[i][j];
        }
        mulmatrix(WPow, WPow, tmp, W);
        rep(i, W) rep(j, W) WPow[i][j] = tmp[i][j];
        H /= 2;
    }
    cout << buf[0][K - 1] << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#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;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    string s;cin>>s;
    int n=s.size();
    int ans=0;
    REP(i,n-1)if(s[i]!=s[i+1])ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,ans,res,tot,rt,mx[N],se[N],dep[N],head[N],nex[N<<1],to[N<<1];
char s[N];
bool vis[N],vv[N],path[N];
void add(int u,int v){to[++tot]=v;nex[tot]=head[u];head[u]=tot;}
void dfs(int u,int p)
{
    vis[u]=s[u]=='W';
    if(p) dep[u]++;
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];if(v==p) continue;
        dfs(v,u);
        if(vis[v]) vis[u]=true,dep[u]++;
    }
}
void dfs1(int u,int p)
{
    int x=0;
    if(dep[u]>1)
       x=(s[u]=='B'?-1:1);
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];if(v==p||!vis[v])continue;
        dfs1(v,u);
        if(mx[v]+1+x>mx[u])
            se[u]=mx[u],mx[u]=mx[v]+1+x;
        else se[u]=max(se[u],mx[v]+1+x);
    }
}
void dfs2(int u,int p)
{
    res=max(res,mx[u]);
    int y=0;
    if(dep[u]>1) y=(s[u]=='B'?-1:1);
    for(int i=head[u];i;i=nex[i])
    {
        int x=0;
        int v=to[i];if(v==p||!vis[v]) continue;
        if(dep[v]>1) x=(s[v]=='B'?-1:1);
        int t1=mx[u],t2=se[u],t3=mx[v],t4=se[v];
        if(t1==t3+y+1)
        {
            if(t2+1+x>mx[v]) se[v]=mx[v],mx[v]=t2+1+x;
            else se[v]=max(se[v],t2+1+x);
        }
        else
        {
            if(t1+1+x>mx[v]) se[v]=mx[v],mx[v]=t1+1+x;
            else se[v]=max(se[v],t1+1+x);
        }
        dfs2(v,u);
        mx[u]=t1;se[u]=t2;mx[v]=t3;se[v]=t4;
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        int u,v;scanf("%d%d",&u,&v);
        add(u,v);add(v,u);
    }
    scanf("%s",s+1);
    for(int i=1;i<=n;i++)
        if(s[i]=='W')
        {dfs(i,0);rt=i;break;}
    if(!rt){printf("0\n");return 0;}
    for(int i=1;i<=n;i++)
        if(vis[i])
         ans++;
    if(ans==1){printf("1\n");return 0;}
    ans--;ans*=2;
    for(int i=1;i<=n;i++)
        if(vis[i]&&dep[i]>1)
        {
            if(dep[i]&1)
            {
                if(s[i]=='W') s[i]='B';
                else s[i]='W';
            }
            if(s[i]=='W') ans++;
        }
    ans++;
    dfs1(rt,0);
    dfs2(rt,0);
    assert(res>=0);
    printf("%d\n",ans-res);
}


Measured memory_bytes: 11392
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;  
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update> 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
#define setbits __builtin_popcount
#define endl '\n'
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int main()
{
  fastIO;
  ll n,r;
  cin>>n>>r;
  ll x,y,val,val1;
  x=r+100*max(0LL,(10-n));
  cout<<x<<endl;
}

Measured memory_bytes: 256
import collections


class Solution:
    def solve(self, A, N, B):
        mark = [[False for _ in range(3)] for _ in range(3)]
        bSet = set(B)

        for i, row in enumerate(A):
            for j, val in enumerate(row):
                if val in bSet:
                    mark[i][j] = True

        for row in mark:
            if all(row):
                return True

        for i in range(3):
            isMarked = True

            for j in range(3):
                isMarked &= isMarked & mark[j][i]

            if isMarked:
                return True

        isMarked = True

        # Top Left Diagonal
        for i in range(3):
            isMarked &= isMarked & mark[i][i]

        if isMarked:
            return True

        isMarked = True

        # Top Left Diagonal
        for i in range(3):
            isMarked &= isMarked & mark[i][3-i-1]

        return isMarked


sol = Solution()

A = []

for j in range(3):
    A.append(list(map(int, input().strip().split())))

N = int(input().strip())
B = []

for i in range(N):
    B.append(int(input().strip()))

print("Yes" if sol.solve(A, N, B) else "No")


Measured memory_bytes: 3828
n, m = map(int, input().split())
a = [input().split() for i in range(n)]
b = [a[i][1:] for i in range(n)]
def l(n):
  if n == 1:
    return b[0]
  else:
    return set(l(n-1)) & set(b[n-1])
print(len(l(n)))

Measured memory_bytes: 3060
#include<stdio.h>

int checkRain(char c) {
  if(c == 'R') return 1;
  else return 0; 
}

int updateMax(int count, int max) {
  int returnNum=0;
  if(count>max) returnNum = count;
  else returnNum = max;
  return returnNum;
}

int main() {
  char s[3];
  int count=0;
  int max=0;
  int i;

  scanf("%c%c%c", &s[0], &s[1], &s[2]);

  for (i=0; i<3; i++) {
    if (checkRain(s[i]) == 1) {
      count++;
    } else {
      count = 0;
    }
    max = updateMax(count, max);
  }

  printf("%d", max);
  return 0;
}

Measured memory_bytes: 2088
#include<stdio.h>

int main()
{
	int i,max1=0,max2=0,max3=0,h;

	for(i=0;i<10;i++){
		scanf("%d",&h);
		if(h>max1){	
			max3=max2;		
			max2=max1;
			max1=h;
		}
		else if(h>max2){
			max3=max2;
			max2=h;
		}
		else if(h>max3)
			max3=h;
	}

	printf("%d\n%d\n%d\n",max1,max2,max3);

	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	set<int> p;
	while (n--)
	{
		int type;
		cin >> type;
		switch (type)
		{
			int num;
		case 0:
			cin >> num;
			p.insert(num);
			cout << p.size() << endl;
			break;
		case 1:
			cin >> num;
			cout << p.count(num) << endl;
			break;
		case 2:
			cin >> num;
			p.erase(num);
			break;
		case 3:
			int head, end;
			cin >> head >> end;
			set<int>::iterator hed=p.lower_bound(head);
			set<int>::iterator ed = p.upper_bound(end);
			for (; hed != ed;hed++)
			{
				cout << (*hed) << endl;
			}
			break;


		}
	}
}


Measured memory_bytes: 12380
#include <stdio.h>
#define MAX_LEN 10

char s[11];

int main()
{
	int i,j,max;
	scanf("%s",s);
	max = 0;

	for (i=0,j=0;s[i]!='\0' && i<=MAX_LEN;i++) {
		if (s[i]=='A' || s[i]=='T' || s[i]=='C' || s[i]=='G') {
			j++;
		} else {
			if (max < j) max = j;
			j = 0;
		}
	}
	if (max < j) max = j;

	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 128
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		String S=next();
		String T=next();
		int ans=0;
		for(int i=0;i<S.length();i++){
			char a=S.charAt(i);
			char b=T.charAt(i);
			if(a!=b)
				ans++;
		}
		System.out.println(ans);
		out.flush();
	}
	static boolean isOK(int index,int key,ArrayList<Integer>a){
		if (a.get(index) >= key) return true;
	    else return false;
	}
	static int binary_search(int key,ArrayList<Integer> a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;

	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}


Measured memory_bytes: 35428
import sys

N, K = map(int, sys.stdin.readline().split())

if K == 0:
    print(N*N)
    sys.exit()

ans = 0
for b in range(K+1, N+1):
    r = N // b
    # tmp = (b - K) * r
    # tmp2 = (N % b + 1 - K)
    # print(b, tmp, tmp2)
    tmp = (b - K) * r + max(0, N % b + 1 - K)
    ans += tmp

print(ans)

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

int main()
{
    vector<char> ch;
    int n;
    scanf("%d",&n);
    string str;
    cin>>str;
    for(int i=0;i<str.length()&&i<n;i++)
    {
        ch.push_back(str[i]);
    }

    if(str.length()>n)
    {
        ch.push_back('.');
        ch.push_back('.');
        ch.push_back('.');
    }


    for(char d: ch)
        cout<<d;

}


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

int main() {
    int N; cin >> N;
    auto rec = [&](auto &&rec, long long n, int mask) -> int {
        if(n > N) return 0;
        int res = mask == 0b111;
        res += rec(rec, 10 * n + 3, mask | 0b001);
        res += rec(rec, 10 * n + 5, mask | 0b010);
        res += rec(rec, 10 * n + 7, mask | 0b100);
        return res;
    };
    cout << rec(rec, 0LL, 0b000) << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int D,N;cin>>D>>N,D|N;){
    int a[999],e[999],r[999];
    for(int i=0;i<N;i++){
      cin>>a[i]>>e[i]>>r[i];
    }
    static int dp[999][999];
    fill(dp[0],dp[999],1e9);
    dp[D][0]=0;
    int ans=1e9;
    for(int i=D;i>0;i--){
      for(int j=0;j<=100;j++){
	for(int k=0;k<N;k++){
	  if(j>=r[k]){
	    int nexp=min(100,j+e[k]);
	    int hp=i-a[k];
	    int n=dp[i][j]+1;
	    if(hp<=0){
	      ans=min(ans,n);
	    }else{
	      dp[hp][nexp]=min(dp[hp][nexp],n);
	    }
	  }
	}
      }
    }
    if(ans>1e8){
      cout<<"NA"<<endl;
    }else{
      cout<<ans<<endl;
    }
  }
}

Measured memory_bytes: 5072
#include <stdio.h>

#define N 200000

int main(){
  int n, i, j, maxi;
  scanf("%d", &n);
  int num[N];
  for(i = 0; i < n; i++) scanf("%d", &num[i]);
  int max = num[1] - num[0];
  maxi = num[0];
  for(i = 0; i <= n - 2; i++){
    if(num[i] > maxi) continue;
    for(j = i + 1; j <= n - 1; j++){
      int diff = num[j] - num[i];
      if(diff > max) {
        max = diff;
        maxi = num[i];
      }
    }
  }
  printf("%d\n", max);
  return 0;
}

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

bool helper(){

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double d,t,s;
    cin >> d >> t >> s;
    d/s <= t?cout << "Yes" << endl :cout << "No" << endl;


    return 0;
}


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

long long a,b,q;
long long A[100002],B[100002],Q[100000],Q2[100000];
map<long long, long long> M;

int main(){
	cin>>a>>b>>q;
	for(int i=1;i<=a;i++){
		cin>>A[i];
	}
	for(int i=1;i<=b;i++){
		cin>>B[i];
	}
	for(int i=0;i<q;i++){
		cin>>Q[i];
		Q2[i]=Q[i];
	}
	sort(Q,Q+q);
	long long x;
	A[0]=-10000000000;
	B[0]=-10000000000;
	A[a+1]=20000000000;
	B[b+1]=20000000000;
	int ss=0,se=0,ts=0,te=0,y=0;
	int qq=q;
	while(q--){
		x=Q[y];
		y++;
		long long ans=20000000000;
		while(A[ss]<x){
			ss++;
		}
		se=ss;
		ss--;
		while(B[ts]<x){
			ts++;
		}
		te=ts;
		ts--;
		//cout<<ss<<" "<<se<<" "<<ts<<" "<<te<<endl;
		ans=min(ans,x-min(A[ss],B[ts]));
		ans=min(ans,max(A[se],B[te])-x);
		ans=min(ans,B[te]-A[ss]+min(B[te]-x,x-A[ss]));
		ans=min(ans,A[se]-B[ts]+min(A[se]-x,x-B[ts]));
		M[x]=ans;
	}
	for(int i=0;i<qq;i++){
		cout<<M[Q2[i]]<<endl;
	}
}

Measured memory_bytes: 10752
#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

int main()
{
    int n, a, b, c, x, y[111];
    
    while (cin >> n, n) {
        cin >> a >> b >> c >> x;
        rep (i, n) cin >> y[i];
        
        int cur = 0, cnt = 0;
        if (y[0] == x) ++cur;
        if (cur == n) { cout << 0 << endl; continue; }
        
        do {
            x = (a * x + b) % c;
            if (x == y[cur]) ++cur;
            ++cnt;
        } while (cur < n && cnt < 10000);
        
        if (cur == n)
            cout << cnt << endl;
        else
            cout << -1 << endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int arr[100000];
int main(void) {
	int n; cin >> n;
	int maxsum = 0;
	int sum = 0;
	cin >> arr[0];
	for (int i = 1; i < n; i++) {
		cin >> arr[i];
		if (arr[i] <= arr[i - 1]) {
			sum++;
			if (maxsum < sum)maxsum = sum;
		}
		else sum = 0;
	}
	cout << maxsum << endl;
return 0;
}

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

ll Pow(ll a, ll b, ll c){
    ll ans = 1;
    a %= c;
    while (b){
        if (b & 1) ans = (ans * a) % c;
        a = (a * a) % c;
        b >>= 1;
    }
    return (ans % c);
}

bool cmp(const int &a, const int &b){
    return a > b;
}

int gcd(int x, int y){
    return x % y == 0 ? y : gcd(y, x % y);
}

int main(){
    string s;
    int a[1000];
    cin>>s;
    memset(a, 0, sizeof(a));
    for (int i = 0; i < 4; i++)
        a[(int)s[i]]++;
    sort(a, a + 1000, cmp);
    if (a[0] == 2 && a[1] == 2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
		int q, c, a, n;
		int ccc = 0, cca = 0, can = 0;
		Scanner scan = new Scanner(System.in);
		q = scan.nextInt();
		for(int i = 0; i < q; i++){
			c = scan.nextInt();
			a = scan.nextInt();
			n = scan.nextInt();
			while(true){
				if(c >= 1 && a >= 1 && n >= 1){
					c--;
					a--;
					n--;
					can++;
				} else if(c >= 2 && a >= 1){
					c -= 2;
					a--;
					cca++;
				} else if(c >= 3){
					c -= 3;
					ccc++;
				} else{
					break;
				}
			}
			System.out.println(can + cca + ccc);
			can = 0;
			cca = 0;
			ccc = 0;
		}
	}
}

Measured memory_bytes: 20648
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
   int x,a,b;
   cin >> x >> a >> b;  
   cout << (x-a)%b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n,i;
    int result=0;
    scanf("%d",&n);
    int P[n];

    for(i=0;i<n;i++){
        scanf("%d",&P[i]);
    }

    for(i=0;i<n-2;i++){
        if((P[i]<P[i+1] && P[i+1]<P[i+2]) || (P[i+2]<P[i+1] && P[i+1]<P[i])){
            result+=1;
        }
    }
    printf("%d\n",result);
    return 0;
}

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

int main()
{
	int a,b;
	cin>>a>>b;
	int c=a/b;
	int d=a%b;
	double f=double(a)/b;
	cout<<c<<" "<<d<<" ";
	cout<<setiosflags(ios::fixed)<<setprecision(5)<<f<<endl;

	return 0;
}


Measured memory_bytes: 3288
#include<iostream>
#include<map>
using namespace std;
#define N 2*100000+5

//long long a[N];
map< long long, int > a;

long long sum=0;

long long cnt=0;

int main(){
	int n;
	cin>>n;
	a[0]++;
	int x;
	for(int i=1;i<=n;i++){
		cin>>x;
		sum+=x;///保存的是前面第一个元素到这个位置的和
		cnt+=a[sum];
		a[sum]++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n; cin >> n;
    VI a(n); cin >> a;

    string ans = "second\n";
    FOR(i, 0, n)if (a[i] % 2)ans = "first\n";
    cout << ans;
}


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

public class Main {
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		reader.close();
		System.out.println(fibonacci(n));
	}
	private int fibonacci(int n) {
		if (n < 2) return 1;
		int f[] = new int[n+1];
		f[0] = f[1] = 1;
		for (int i = 2; i <= n; i++) {
			f[i] = f[i-1] + f[i-2];
		}
		return f[n];
	}
}


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

int main() {
  int n, k;
  cin >> n >> k;

  int l = (n - 1) * (n - 2) / 2;
  if (l < k) {
    cout << -1 << endl;
    return 0;
  } else {
    cout << (n - 1) + l - k << endl;
    for (int i = 2; i <= n; i++) cout << 1 << " " << i << endl;

    for (int i = 2; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (l == k)
          return 0;
        else {
          cout << i << " " << j << endl;
          l--;
        }
      }
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,x;
	int l[105];
	int d[105];
	while(~scanf("%d %d",&n,&x)){
		int t=0;
		for(int i=0;i<n;i++)
		scanf("%d",&l[i]);
		d[0]=0;
		for(int i=1;i<=n;i++)
		d[i]=d[i-1]+l[i-1];
		for(int j=0;j<=n;j++)
		if(d[j]<=x)
	         t++;
		printf("%d\n",t);
}
	return 0;
}//

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
const int MAXN = (int)303;
const int infint = (int)1e9;
const int MOD = (int)1e9 + 9;
const ll inf = (ll)2e18 + 2;
int n, m, cnt[MAXN];
vector<int> v[MAXN];
void del(int idx, int a)
{
	vector<int> tmp;
	for (int i = 0; i < v[idx].size(); i++)
		if(v[idx][i] != a)
			tmp.push_back(v[idx][i]);
	v[idx].clear();
	for (auto u : tmp)
		v[idx].push_back(u);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			int a;
			cin >> a;
			v[i].push_back(a);
		}
	}
	int MN = infint;
	for (int i = 0; i < m; i++)
	{
		memset(cnt, 0, sizeof cnt);
		for (int j = 0; j < n; j++)
			cnt[v[j][0]]++;
		
		int mx = -1, CNT = 0;
		for (int j = 1; j <= m; j++)
			if(cnt[j] > CNT)
				CNT = cnt[j], mx = j;
		for (int j = 0; j < n; j++)
			del(j, mx);
		MN = min(MN, CNT);
	}
	cout << MN;
}

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

int main() {
    int n;
    string s;
    cin >> s;
    n = s.size();
    vector<int> ans(n);
    rep(ri,2){
        {
            int cnt = 0;
            rep(i,n) {
                if (s[i] == 'R') cnt++;
                else {
                    ans[i] += cnt/2;
                    ans[i-1] += (cnt+1)/2;
                    cnt = 0;
                }
            }
        }
        reverse(ans.begin(), ans.end());
        reverse(s.begin(), s.end());
        rep(i,n) {
            if (s[i] == 'L') s[i] = 'R';
            else s[i] = 'L';
        }
    }

    rep(i,n) {
        printf("%d%c", ans[i], ' ');
    }
    return 0;
}


Measured memory_bytes: 3852
from numpy import *
N = int(input())
A = array([input().split() for _ in range(N)], dtype=int64)

fill_diagonal(A, 10**10)

ans = 0
for i in range(N):
  for j in range(i+1,N):
    d = min(A[i]+A[j])
    if A[i][j] < d:
      ans += A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)


Measured memory_bytes: 38308
#include <bits/stdc++.h>
#define MAXN 100000
using namespace std;
typedef long long ll;
int H,N;

int main()
{
    cin>>H>>N;
    int sum = 0;
    for(int i =0 ;i <N;i ++)
    {
        int x;
        cin>>x;
        sum += x;
        if(sum >= H)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

int main()
{
    int n, w;
    cin >> n >> w;
    vector<ll> dp(100005, 0x3f3f3f3f3f3f3f3fll);
    dp[0] = 0;
    vector<pair<int, int>> item(n);
    for (int i = 0; i < n; i++)
        cin >> item[i].first >> item[i].second;
    for (int i = 0; i < n; i++)
    {
        for (int j = 100003; j >= item[i].second; j--)
            dp[j] = min(dp[j], dp[j - item[i].second] + item[i].first);
    }
    ll ans = 123456;
    for (int i = 100003; i >= 0; i--)
    {
        if (dp[i] <= w)
        {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4052
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, ll> P;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,m,ans[55],i,a,b;
	fill(ans,ans+55,0);
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> a >> b;
		a--; b--;
		ans[a]++;
		ans[b]++;
	}
	for(i=0; i<n; ++i){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(0);

int main()
{
  Hello;
  
  int a, b, c=0;
  cin>>b>>a;
  
  while(b>0)
  {
    b-=a;
    c++;
  }
  
  cout<<c;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{
	int x;
	int y;
}a[20005];
vector<int> vec[20005];
int n,k,x,y,ans,sum;
void dfs(int pos,int fa,int x)
{
	if(x>k/2) sum++;
	for(int i=0;i<vec[pos].size();i++)
	{
		if(vec[pos][i]==fa) continue;
		dfs(vec[pos][i],pos,x+1);
	}
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		a[i].x=x;
		a[i].y=y;
		vec[x].push_back(y);
		vec[y].push_back(x);
	}
	ans=n;
	if(!(k%2))
	{
		for(int i=1;i<=n;i++)
		{
			sum=0;
			dfs(i,-1,0);
			ans=min(ans,sum);
		}
	}
	else
	{
		for(int i=1;i<n;i++)
		{
			sum=0;
			dfs(a[i].x,a[i].y,0);
			dfs(a[i].y,a[i].x,0);
			ans=min(ans,sum);
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 896
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N = int(input())
edge = [set() for _ in range(N)]
ab = []
for i in range(N-1):
    a, b = inpl()
    a -= 1
    b -= 1
    ab.append((a,b))
    edge[a].add(i)
    edge[b].add(i)

K = 0
ans = [0]*(N-1)
pool = deque([(0,0)])
while pool:
    node, prev = pool.popleft()
    c = 0
    for i in edge[node]:
        c += 1
        if c == prev:
            c += 1
        a, b = ab[i]
        if node == a:
            x = b
        else:
            x = a
        edge[x].remove(i)
        ans[i] = c
        pool.append((x,c))
    if c >= K:
        K = c

print(K)
for i in range(N-1):
    print(ans[i])


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

int main() {
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < N; i++) cin >> p[i];
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (p[i] != i+1) count++;
  }
  
  if (count <= 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 256
//in the name of allah
#include<iostream>
#include<algorithm>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
typedef pair<int , int> ii;
typedef long long ll;

const int maxn = 801 , inf=1e9;
int dp[maxn][maxn] , dis[maxn][maxn] , mp[maxn][maxn] , ldp[maxn][maxn] , h , w , k;
queue<ii> q;
int dx[4] = {0 , 0 , -1 , 1};
int dy[4] = {-1 , 1 , 0 , 0};
bool ok(ii x){
	return ((x.first == 0 || x.first == w-1) || (x.second == 0 || x.second == h-1));
}
bool valid(ii x){
	return (x.first<w && x.second<h && x.first>=0 && x.second>=0);
}
ii mv(ii x , int i){
	return ii(x.first + dx[i] , x.second + dy[i]);
}
void smin(int &a , int b){
	if(a>b)
		a = b;
}

int main(){
	scanf("%d%d%d" , &w , &h , &k);
	memset(dis , 63 , sizeof dis);
	memset(dp , 63 , sizeof dp);
	memset(ldp , 63 , sizeof ldp);
	for(int i=0 ; i<w ; i++)
		for(int j=0 ; j<h ; j++){
			char c;
			scanf(" %c" , &c);
			if(c == '#')
				mp[i][j] = 1;
			if(c == 'S'){
				q.push(ii(i , j));
				dis[i][j] = 0;
			}
		}
	int ans=1;
	while((int)q.size()){
		ii v = q.front();
		q.pop();
		int d = dis[v.first][v.second];
		dp[v.first][v.second] = 0;
		if(d == k)
			continue;
		if(ok(v)){
			puts("1");
			return 0;
		}
		for(int i=0 ; i<4 ; i++){
			ii nx = mv(v , i);
			if(valid(nx) && dis[nx.first][nx.second] >= inf && mp[nx.first][nx.second] == 0){
				dis[nx.first][nx.second] = d + 1;
				q.push(nx);
			}
		}
	}
	if(k>min(w,h)/2){
		puts("2");
		return 0;
	}
	while(true){
		ans ++;
		for(int _=0 ; _<k ; _++){
			for(int i=0 ; i<w ; i++)
				for(int j=0 ; j<h ; j++)
					if(dp[i][j] < inf)
					for(int it=0 ; it<4 ; it++){
						ii nx = mv(ii(i , j) , it);
						if(!valid(nx))
							continue;
						if(dp[i][j] + mp[nx.first][nx.second] <= k){
							smin(ldp[nx.first][nx.second] , dp[i][j] + mp[nx.first][nx.second]);
						}
					}
			for(int i=0 ; i<w ; i++)
				for(int j=0 ; j<h ; j++){
					smin(dp[i][j] , ldp[i][j]);
					ldp[i][j] = inf+100;
				}
		}
		for(int i=0 ; i<w ; i++)
			for(int j=0 ; j<h ; j++){
				if(dp[i][j] >= inf)
					continue;
				dp[i][j] = dp[i][j] - k;
				if(ok(ii(i , j))){
					printf("%d\n" , ans);
					return 0;
				}
			}
	}
}


Measured memory_bytes: 10240
#include <climits>
#include <iostream>
#include <vector>

using namespace std;

int cnt = 0;

void merge(vector<int>& A, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	
	vector<int> L(n1 + 1), R(n2 + 1);
	for (int i = 0; i <= n1 - 1; ++i)
		L[i] = A[left + i];
	for (int i = 0; i <= n2 - 1; ++i)
		R[i] = A[mid + i];
	L[n1] = R[n2] = INT_MAX;

	int i = 0, j = 0;
	for (int k = left; k <= right - 1; ++k)
	{
		cnt++;
		if (L[i] <= R[j])
			A[k] = L[i], i += 1;
		else
			A[k] = R[j], j += 1;
	}
}

void mergeSort(vector<int>& A, int left, int right)
{
	if (left + 1 < right)
	{
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

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

	int n;
	cin >> n;
	
	vector<int> S(n);
	for (int i = 0; i < n; ++i)
		cin >> S[i];

	mergeSort(S, 0, n);

	cout << S[0];
	for (int i = 1; i < n; ++i)
		cout << " " << S[i];
	cout << endl;
	cout << cnt << endl;

	return 0;
}

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

int N;
vector<int> C, S, F, T;

void input_data(void) {
	cin >> N;
	C.resize(N);
	S.resize(N);
	F.resize(N);
	for (int i = 0; i < N - 1; ++i)
		cin >> C[i] >> S[i] >> F[i];
}

void calcu(int x) {
	T[x] = S[x] + C[x];
	for (int i = x + 1; i < N - 1; ++i) {
		if (T[x] <= S[i])
			T[x] += (S[i] - T[x]) + C[i];
		else {
			int a = 1;
			while (true) {
				if (T[x] <= F[i] * a + S[i])
					break;
				++a;
			}
			T[x] += (F[i] * a + S[i] - T[x]) + C[i];
		}
	}
}

void solve(void) {
	T.resize(N);
	T[N - 1] = 0;
	for (int i = 0; i < N - 1; ++i)
		calcu(i);
}

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

	input_data();
	solve();

	for (int i = 0; i < N; ++i)
		cout << T[i] << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll sum = 0;
    for(ll i = 1LL; i <= n; i++) {
        if(i%15 == 0) continue;
        else if(i%5 == 0) continue;
        else if(i%3 == 0) continue;
        else sum += i;
    }
    cout << sum << endl;
}


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

#define var auto
#define long long long
#define ll long
#define Max std::max
#define Min std::min
#define Abs std::abs

void Solve();

using namespace std;

int main() {
    while (true) {
        Solve();
    }
}

void Solve() {
    int n;
    cin >> n;
    if (n == 0) exit(0);
    long sum = 0;
    long max = INT32_MIN;
    long min = INT32_MAX;
    for (int i = 0; i < n; ++i) {
        long a;
        cin >> a;
        sum += a;
        max = Max(max, a);
        min = Min(min, a);
    }
    cout << (sum - max - min) / (n - 2) << endl;
}



Measured memory_bytes: 3032
#include <bits/stdc++.h>
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define deb(x) cout<<#x<<" "<<endl;
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
//-------------------------------------------------------------------------------




const int  inf =1e9+5;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin>>n;
 	vi dp(3);//dp[i]-total cost if activity i is performed on that day
 	for(int day=0;day<n;day++){
 		vi c(3);
 		for(int i=0;i<3;++i){
 			cin>>c[i];
 		}
 		vi new_dp(3,-inf);
 		for(int i=0;i<3;++i){//iterate over the prev state
 			for(int j=0;j<3;++j){//iterate over the current day
 				if(i!=j){
 					new_dp[j]=max(new_dp[j],dp[i]+c[j]);
 				}
 			}
 		}
 		dp=new_dp;
 	}
 	cout<<max(dp[0],max(dp[1],dp[2]))<<endl;	


}
 

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int a = 0, b = 0, c = 0;
    int i, n;
    
    scanf("%d %d %d", &a, &b, &c);
    if(a > b) {
        printf("0\n");
        return 0;
    }
    
    n = 0;
    for(i = a; i <= b; i++) {
      if(c%i == 0) n++;
    }
    printf("%d\n", n);
    return 0;
}


Measured memory_bytes: 2084