akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> bingo(3, vector<int>(3));
vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;

	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

struct Connection {
	vector<int>friends;
	vector<int>block;
	vector<int>friendable;
	Connection() {};
};

int main() {

	int N;
	cin >> N;
	vector<ll>A(N);
	map<int, ll>am;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		am[A[i]]++;
	}

	ll all = 0;
	for (auto a : am) {
		all += 1 < a.second ? a.second * (a.second - 1) / 2 : 0;
	}

	for (int i = 0; i < N; ++i) {
		ll ans = all - ((am[A[i]] + (am[A[i]] - 1) - 1) / 2);
		cout << ans << endl;
	}
}



Measured memory_bytes: 13440
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 998244353;//1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max() / 100;
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, acost, bcost; };
struct edge {
	LL from, to, cost;
};
vector<vector<LL>>g;
vector<edge>ed;
vector<Pll>pv;
map<Pll, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, s, t, ans, cnt, sum, a[200000],b[200000];
string str;
bool f;
char c[1100][1100];
int main() {
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cnt = 0; LL cur = i;
		while (cur >= 10) {
			cur /= 10;
			cnt++;
		}
		if (cnt % 2 == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

ll N, A;

int chk(ll a, ll b, ll c){
	//return a^b >= c
	if(pow(a, b) > c+c)return 1;
	ll res = 1;
	rep(i, b)res = res * a;
	return res >= c;
}

void solve(){
	scanf("%lld%lld", &N, &A);
	ll ans = N;
	for(int i=2;i<=40;i++){
		ll low = 2, high = N, res = 2;
		while(low <= high){
			ll mid = (low + high) >> 1;
			if(chk(mid, i, N))res = mid, high = mid-1;
			else low = mid+1;
		}
		ll cnt = A * (i-1) + res * i;
		ll N2 = N;
		for(int j=1;j<=i;j++){
			ll N3 = (N2 + res - 2) / (res - 1);
			if(chk(res, i-j, N3)){
				N2 = N3;
				cnt--;
			}
			else break;
		}
		ans = min(ans, cnt);
	}
	printf("%lld", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 512
program main
  implicit none
  integer(8) :: n, k, mi, ma, md, i
  integer(8), allocatable :: a(:)
  read *, n, k
  allocate (a(n))
  read *, a(:)
  call quicksort(a)

  ! 積がthres以下になるペアがk個以上ある最小のthres
  mi = -2 * 10_8 ** 18  ! NG
  ma = 2 * 10_8 ** 18  ! OK
  do i = 1, 70
    md = mi + (ma - mi) / 2
    if (isok(md)) then
      ma = md
    else
      mi = md
    end if
    if (ma - mi <= 1) exit
  end do

  print "(i0)", ma

  contains

  logical function isok(x)
    ! 積がx以下になるペアがk個以上ある
    integer(8), intent(in) :: x
    integer(8) :: i, cnt, jmin, jmax, count_lower, mi, ma, md, j
    cnt = 0
    jmax = n
    jmin = 1
    do i = 1, n - 1
      if (a(i) >= 0) then
        ! a(i) * a(j) <= x となる最大のjを求める
        jmax = max(jmax, i)
        do while (jmax > i)
          if (a(jmax) * a(i) > x) then
            jmax = jmax - 1
          else
            exit
          end if
        end do
        count_lower = jmax - i
      else
        ! a(i) * a(j) <= x となる最小のjを求める
        ! jmin = max(jmin, i + 1)
        ! do while (jmin <= n)
        !   if (a(jmin) * a(i) > x) then
        !     jmin = jmin + 1
        !   else
        !     exit
        !   end if
        ! end do
        ! count_lower = n - jmin + 1
        ! a(i) * a(j) <= x となる最小のjを求める
        mi = i  ! ng
        ma = n + 1  ! ok
        do j = 1, 30
          md = mi + (ma - mi) / 2
          if (a(i) * a(md) <= x) then
            ma = md
          else
            mi = md
          end if
          if (ma - mi <= 1) exit
        end do
        count_lower = n - (ma - 1)
      end if
      cnt = cnt + count_lower
    end do
    isok = (cnt >= k)
  end function isok

  recursive subroutine quicksort(a)
    integer(8), intent(inout) :: a(:)
    integer(8) :: pivot, i, j, k, tmp, n
    real(8) :: r
    n = size(a)
    if (n <= 1) return
    i = 1
    j = n
    call random_number(r)
    k = 1 + floor(r * n)
    k = max(1_8, min(k, n))
    pivot = a(k)
    do
      do while (.not. pivot <= a(i))
        i = i + 1
      end do
      do while (.not. a(j) <= pivot)
        j = j - 1
      end do
      if (i >= j) exit
      tmp = a(i)
      a(i) = a(j)
      a(j) = tmp
      i = i + 1
      j = j - 1
    end do
    call quicksort(a(1:i - 1))
    call quicksort(a(j + 1:n))
  end subroutine quicksort
end program main


Measured memory_bytes: 2304
//#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)//初期値a,i<bの範囲でループ
#define REP(i,n) FOR(i,0,n)//初期値0,i<nの範囲でループ
#define INF 1145141919810810810
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;

long long int q,h,s,d;
long long int n;

//long long int dp[5000000090];
ll dp[19];

int main(){
    cin>>q>>h>>s>>d;
    cin>>n;
    /*
    REP(i,4*n+1)dp[i]=INF;
    dp[0]=0;

    REP(i,4*n+1){
        dp[i+1]=min(dp[i+1],dp[i]+q);
        dp[i+2]=min(dp[i+2],dp[i]+h);
        dp[i+4]=min(dp[i+4],dp[i]+s);
        dp[i+8]=min(dp[i+8],dp[i]+d);
    }
    
    cout<<dp[4*n]<<endl;*/
    h=min(h,2*q);
    s=min(2*h,s);

    cout<<(n/2)*min(2*s,d)+(n%2)*s;

    
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p.at(i);
  }
  
  int count = 0;
  for(int i = 1; i < n-1; i++){
    if(p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1)){
      count++;
    }
    else if(p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1)){
      count++;
    }
  }
  cout << count;
  
}

Measured memory_bytes: 3600
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
c = 0
for i in range(n-2):
    if d[i][0] == d[i][1] and d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
        print("Yes")
        break
    else:
        c += 1
        if c == n-2:
            print("No")
            break

Measured memory_bytes: 9204
N = int(input())
Stemp = str(input())
S = []
for i in range(N):
  temp = int(Stemp[i])
  S.append(temp)
ans = set([])
L = [[] for _ in range(10)]
for i in range(N):
  L[S[i]].append(i)
#print(L)
for v in range(1000):
  a = v//100
  b = (v-a*100)//10
  c = v-a*100-b*10
  if not L[a]:
    continue
  left = min(L[a])
  Flag = False
  for x in L[b]:
    if x > left:
      mid = x
      Flag = True
      break
  if not Flag:
    continue
  Flag = False
  for y in L[c]:
    if y > mid:
      right = y
      Flag = True
      break
  if not Flag:
    continue
  ans.add(v)
  #print(v,left,mid,right)
print(len(ans))        

Measured memory_bytes: 74420
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;



int main()
{
	int a, b;
	char op;

	while (true) {
		int ans = 0;
		cin >> a >> op >> b;
		if (op == '?') break;
		else if (op == '+') ans = a + b;
		else if (op == '-') ans = a - b;
		else if (op == '*') ans = a * b;
		else  ans = a / b;
		cout << ans << endl;
	}



	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <cctype>
#define rep(x,y,z) for(long long x=y;x<z;++x)
#define dwn(x,y,z) for(long long x=y;x>z;--x)
using namespace std;

typedef long long ll;

int main() {
    ll n, m;
    cin >> n >> m;
    ll res = 1;
    if (n == 1) {
        cout << m << endl;
        return 0;
    }
    for (ll i = 2; m / i >= n; i++) {
        if (m % i == 0) res = i;
    }

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

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define yn(f) cout << (f ? "Yes" : "No") << endl;
#define YN(f) cout << (f ? "YES" : "NO") << endl;

int n,a[200000],ans;
map<int,int> m;

signed main() {
    cin >> n;
    rep(i,n) cin >> a[i];
    int now = 0;
    rep(i,n) {
        ans += m[now-a[i]];
        m[a[i]+now]++;
        now++;
    }
    cout << ans << endl;
}




Measured memory_bytes: 27828
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int D;
    cin >> D;
    vector<int>c(26);
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    vector<vector<int>>s(D,vector<int>(26));
    for(int i = 0; i < D; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int>t(D);
    for(int i = 0; i < D; i++) {
        t[i] = rand()%26+1;
    }
    int ans = 0;
    vector<int>Last(26);
    for(int i = 0; i < D; i++) {
        ans+=s[i][t[i]-1];
        Last[t[i]-1] = i+1;
        for(int j = 0; j < 26; j++) {
            ans-=c[j]*(i+1-Last[j]);
        }
    }
    int M = 2877777;
    for(int i = 0; i < M; i++) {
        int d = rand()%D+1;
        int q = rand()%26+1;
        int ord = ans;
        int X = 0;
        int Y = 0;
        int A = 0;
        int B = 0;
        ans+=s[d-1][q-1]-s[d-1][t[d-1]-1];
        for(int j = 0; j < D; j++) {
            if(t[j] == t[d-1]) {
                if(j == d-1) {
                    Y = j+1;
                }
                else {
                    X = j+1;
                }
                A = j+1;
            }
            if(t[j] == q) {
                Y = j+1;
                B = j+1;
            }
            ans-=c[t[d-1]-1]*(j+1-X)-c[t[d-1]-1]*(j+1-A);
            ans+=c[q-1]*(j+1-B)-c[q-1]*(j+1-Y);
        }
        if(ans > ord) {
            ord = ans;
            t[d-1] = q;
        }
        else {
            ans = ord;
        }
    }
    for(int i = 0; i < D; i++) {
        cout << t[i] << endl;
    }
}


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

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def main():
	D = int(input())  # days
	vC = [0,]+linput()     # decrine rate
	
	#sumC = sum(vC)
	
	# satis (d,i)
	mS = [[0,]+linput() for _ in [0,]*D]
	
	## sample output
	vT = [int(input()) for _ in [0,]*D] ## for p.B

	vL = [-1,]*(26+1)   # last day of Type
	
	#day = -1
	res = 0      # manzoku
	vR = []
	rapp = vR.append
	
	for d in range(D): #[0,364] day
		t = vT[d] ## sample output
		vS = mS[d]
		Sdt = vS[t]
		res += Sdt
		
		vL[t] = d
		C = sum(c*(d-l) for c,l in zip(vC,vL))
		res -= C
		
		rapp(res)
	
	
	#sT = "No Yes".split()
	#print(sT[res])
	#print(res)
	print(*vR, sep='\n')

if __name__ == "__main__":
	main()


Measured memory_bytes: 9372
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<long double,long double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<61;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int x;

int main(){
	cin>>x;
	int f=0,y=x;
	while(y){
		f+=y%10;
		y/=10;
	}
	if(x%f==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int T = sc.nextInt();
        
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
        	int cost = sc.nextInt();
        	int time = sc.nextInt();
        	if (T >= time) {
        		min = Math.min(min, cost);
        	}
        }
        
        System.out.println(min == Integer.MAX_VALUE ? "TLE" : min);
    }
}




Measured memory_bytes: 25300
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node *Node;
#define NIL NULL
 
Node root;

  Node treeMinimum(Node x){
  while(x->left != NIL){
  x=x->right;
  }
  return x;
  }
   
  Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key){
  return u;
  }
  if(k<u->key){
  return treeSearch(u->left,k);
  } else {
  return treeSearch(u->right,k);
  }
  }
   
  Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL){
  return treeMinimum(x->right);
  }
  y=x->parent;
  while(y!=NIL && x==y->right){
  x=y;
  y=y->parent;
  }
  return y;
  }
   /*
  void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
   
   
   
  }
*/
void insert(int k){
   
  Node y = NIL;
  Node x = root;
  Node z;
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
   
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root= z;
  } else if(z->key < y->key){
    y->left = z;
  } else{
    y->right = z;
  }
}
 
void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u!=NIL){  
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}
 
 
int main(){
  int n, i, x;
  char com[20];
  Node z;
  scanf("%d", &n);
   
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
    Node t = treeSearch(root, x);
       if ( t != NIL ) printf("yes\n");
       else printf("no\n");
    } else if ( com[0] == 'i' ){
    scanf("%d", &x);    
    insert(x);
      } else if ( com[0] == 'p' ){
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
      } else if ( com[0] == 'd' ){
    scanf("%d", &x);
    //treeDelete(treeSearch(root, x));
      }
  }
   
  return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
typedef long long ll;
const long mod = 1e9 + 7;

ll lcm(ll x, ll y) {
    return x / __gcd(x, y) * y;
}

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  ll a, b, l;
  l = lcm(C, D);
  a = (A -1) / C;
  a += (A -1) / D;
  a -= (A -1) / l;
  b = B / C;
  b += B / D;
  b -= B / l;
  ll ans;
  ans = B - (A - 1) - (b - a);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        Stack<Integer> st = new Stack<Integer>();
        while (stdin.hasNext()) {
            int i = stdin.nextInt();
            if (i == 0) {
                System.out.println(st.pop());
            } else {
                st.push(i);
            }
 
 
 
 
        }
    }
}


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

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = 0;
        int x = 0;

        while(true){
            String imput = br.readLine();
            String[] strArray = imput.split(" ");
            n = Integer.parseInt(strArray[0]);
            x = Integer.parseInt(strArray[1]);

            if(n == 0 && x == 0){
                break;
            }

            int count = 0;

            for(int i = 1; i <= n; i++){
                for(int j = 1; j < i; j++){
                    for(int k = 1; k < j; k++){

                        if(i + j + k == x){
                            count++;
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }
}

Measured memory_bytes: 24636
def main():
    MOD = 10**9+7
    n = int(input())
    A = list(map(int,input().split()))

    ans = 0
    Asum = sum(A)%MOD
    for a in A:
        Asum-=a
        ans += a*Asum
        ans %=MOD
    print(ans)
main()

Measured memory_bytes: 105152
def main():
    N, K = map(int, input().split())
    B = [0]*(N+2-K)
    full = (((N+1)*(N)) // 2)
    for n in range(K, N+2):
        mi = (n*(n-1)) // 2
        ma = full - ((N-n)*(N-n+1)//2)
        B[n-K] = ma-mi+1

    print(sum(B) % (10**9 + 7))


if __name__ == '__main__':
    main()


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



int main(){
    string S;
    cin>>S;
    ll N = S.size();
    vector<ll> res(N,0);
    ll sum=0;
    for(ll i=0;i-1<N;i++)
    {
        if(S[i]=='R') {
            sum++;
            if(S[i+1]=='L'){
                res[i+1]+=(int)(sum/2);
                res[i]+=(int)((sum+1)/2);
            }
        }else{
            sum=0;
        }
    }
    sum=0;
    for(ll i=N-1;0<i;i--)
    {
        if(S[i]=='L') {
            sum++;
            if(S[i-1]=='R'){
                res[i-1]+=(int)(sum/2);
                res[i]+=(int)((sum+1)/2);
            }
        }else{
            sum=0;
        }
    }

    for(ll i=0;i<N;i++){
        cout<<res[i];
        if(i!=N-1)cout<<' ';
    }
}

Measured memory_bytes: 4264
#include<iostream>

using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(b%2==0)
    {
       if(a>=13)
       {
           cout<<b;
       }
       else if(a>=6&&a<=12)
       {
           cout<<b/2;
       }
       else
       {
           cout<<0;
       }
    }






    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<map>
#include<cmath>
#define int long long int
bool prime(int x)
{
	if(x==1||x==4)
	    return false;
	if(x==2||x==3||x==5)
	    return true;
   else if(x%2==0||x%3==0||x%5==0)
        return false;
    for(int i=7;i*i<=x;i++)
    {
		if(x%i==0)
		   return false;
	}
	return true;
}
int32_t main()
{
     int n,p;
     cin>>n>>p;
     int j;
     map<int,int> mp;
     for(j=1;j<=sqrt(p);j++)
     {
		 if(p%j==0)
		 {
			 int temp=p;
			 int f1=j;
			 int f2=p/j;
			 if(prime(f1))
			 {
				 while(temp%f1==0)
				 {
					 mp[f1]++;
					 temp/=f1;
				 }
			 }
			 if(prime(f2))
			 {
				 while(temp%f2==0)
				 {
					 mp[f2]++;
					 temp/=f2;
				 }
		     }
		 }
	 }
	 int answer=1;
	 for(auto x:mp)
	 {
		 int k=x.second/n;
		 while(k!=0)
		 {
			 answer=answer*x.first;
			 k--;
		 }
	 }
	 cout<<answer<<endl;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var NK = ReadSplitInt();
            if (NK[0] % NK[1] == 0)
            {
                Println(0);
            }
            else
            {
                Println(1);
            }
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using Graph = vector<vector<int>>;

int main(){
    FIN;
    ll n; cin >> n;
    ll a,b; cin >> a >> b;
    a--; b--;
    vector<int> ans(n,0);

    Graph G(n);
    for(int i=0;i<n-1;i++){
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    G[a].push_back(b);
    G[b].push_back(a);


    for(int i=0;i<n;i++){
        vector<int> dist(n,-1);
        queue<int> que;

        dist[i] = 0;
        que.push(i);

        while(!que.empty()){
            int v = que.front();
            que.pop();

            for(int nv : G[v]){
                if(dist[nv] != -1) continue;

                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }

        for(int j=0;j<n;j++){
            ans[dist[j]]++;
        }
    }

    for(int i=1;i<n;i++) cout << ans[i]/2 << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fastio   ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll        long long
#define yes       printf("YES\n")
#define no        printf("NO\n")
#define pb        push_back
#define srtd(x)   sort(x.begin(),x.end())
#define rvsd(x)   reverse(x.begin(),x.end())
#define scn(n)    scanf("%lld",&n)
#define scab(a,b) scanf("%lld %lld",&a,&b)
#define pn(n)     printf("%lld\n",n)
#define pab(a,b)  printf("%lld %lld",a,b)
#define nl        cout<<endl
#define MAX       1000011
#define PI        acos(-1.0)
#define mmst(a,b) memset(a,b,sizeof(a));
#define FOR(i,n)  for(ll i=1;i<=n;i++)
#define LOP(i,n)  for(ll i=0;i<n;i++)
//Emama_ Nahid//
using namespace std;

int main()
{
    fastio;
    ll n,m,i,j,k,t,r,p;
    cin>>t;
    vector<ll>v;
    LOP(i,t)
    {
        cin>>k;
        v.pb(k);
    }
    srtd(v);
    rvsd(v);
    p=v[0];
    ll c=0;
   i=1;
   LOP(j,t-2)
    {
        if(c>=2)
          {
              i++;
              c=0;
          }
       p+=v[i];
       c++;
       //cout<<p<<endl;
    }

    cout<<p<<endl;


    return 0;
}













Measured memory_bytes: 5308
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		int c = (b-1)/(a-1);
        if((b-1)%(a-1)!=0){c++;}
		System.out.println(c);
	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define fin freopen("input", "r", stdin);
#define fout freopen("output", "w", stdout);
#define wt(x) cerr << #x << ": " << x << " ";
#define whatis(x) {cerr << #x << ": " << x << endl;}
#define whatis2(x, y) {wt(x); wt(y); cerr << endl;}
#define whatis3(x, y, z) {wt(x); wt(y); wt(z); cerr << endl;}
#define whatis4(x, y, z, a) {wt(x); wt(y); wt(z); wt(a); cerr << endl;}
using namespace std;

typedef long long ll; typedef unsigned long long ull; typedef long double ld;
const ll MOD = 1000000007; const ld PI = acos(-1.0);

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

    int n;
    cin >> n;
    int x = n % 10;
    if (x == 2 || x == 4 || x == 5 || x == 7 || x == 9) {
        cout << "hon" << endl;
    } else if (x == 0 || x == 1 || x == 6 || x == 8) {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }


    return 0;
}


Measured memory_bytes: 3612
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int n;
    cin >> n;
    vector<vector<ll> > data(n + 1, vector<ll>(3));
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 3; j++){
            cin >> data.at(i).at(j);
        }
    }
    vector<vector<ll> >dp(n + 1, vector<ll>(3));
    for(int i = 0; i < 3; i++){
        dp.at(1).at(i) = data.at(1).at(i);
    }
    for(int i = 2; i <= n; i++){
        dp.at(i).at(0) = data.at(i).at(0) + max(dp.at(i - 1).at(1), dp.at(i - 1).at(2));
        dp.at(i).at(1) = data.at(i).at(1) + max(dp.at(i - 1).at(0), dp.at(i - 1).at(2));
        dp.at(i).at(2) = data.at(i).at(2) + max(dp.at(i - 1).at(0), dp.at(i - 1).at(1));
    }
    cout << max(dp.at(n).at(0), max(dp.at(n).at(1), dp.at(n).at(2))) << endl;
    return 0;
}



Measured memory_bytes: 11136
#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>

int main() {
  std::string s, t; std::cin >> s >> t;
  t.pop_back();

  printf("%s\n", (s == t ? "Yes" : "No"));
  return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public  class Main
{
  public static void main(String []args)
  {
    Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   long d = sc.nextLong();
   int cnt = 0;
   for(int i = 0 ; i < n ; i++)
   {
       long x = sc.nextLong();
       long y = sc.nextLong();
       
       if(x*x + y*y <= d*d)
       cnt++;
       
   }
   System.out.println(cnt);
   
  }
}

Measured memory_bytes: 60620
#include <iostream>

using namespace std;

int n, re;
long long r;

int euclid (int d, int i) {
  int r;
  while (i != 0) {
    r = d % i;
    d = i;
    i = r;
  }
  return d;
}

int main()
{
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= n; k++)
        r += euclid (euclid (i, j), k);
  cout << r;
  return 0;
}


Measured memory_bytes: 3608
#D
from collections import deque
import sys
k=int(input())
que = deque()
count=0
for i in range(1, 10):  #1~9まで
    que.append(i)
    count += 1
    if count == k:
        print(que.pop())
        sys.exit()
# print(que)
# print(count)
while True:
    tmp = que.popleft()  #データを左から取り出す
    tmp = tmp * 10 + tmp % 10  #中心整数を求める 中心整数＋下一桁
    if tmp % 10 != 0:  #下一桁目が0でない場合
        que.append(tmp- 1)
        count += 1
        # print(count)
        if count == k:
            break
    que.append(tmp)
    count += 1
    # print(count)
    if count == k:
        break
    if tmp % 10 != 9:
        que.append(tmp + 1)
        count += 1
        # print(count)
        if count == k:
            break
    # print(que)
print(que.pop())


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

ll P = 1000000007;
ll dp[100][101010] = {0};
ll sdp[100][101010] = {0};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, k;
  cin >> n >> k;

  vector<ll> p;

  p.push_back(0);
  for (ll i = 1; i <= n; i++) {
    ll r = n / i;
    if (n / r != i) p.push_back(i);
    i = n / r;
    p.push_back(i);
  }

  // (p[0], p[1]], (p[1], p[2]], ..

  for (int i = 1; i < p.size(); i++) {
    dp[0][i - 1] = (p[i] - p[i - 1] + P) % P;
  }
  ll m = p.size();

  sdp[0][0] = 0;
  for (int i = 1; i <= m; i++) sdp[0][i] = (sdp[0][i - 1] + dp[0][i - 1]) % P;

  for (int i = 0; i < k - 1; i++) {
    for (int j = 1; j < m; j++) {
      // p[j - 1], p[j]
      ll id = upper_bound(p.begin(), p.end(), n / p[j]) - p.begin();
      id--;
      dp[i + 1][j - 1] = (dp[0][j - 1] * sdp[i][id]) % P;
    }
    sdp[i + 1][0] = 0;
    for (int j = 1; j <= m; j++) sdp[i + 1][j] = (sdp[i + 1][j - 1] + dp[i + 1][j - 1]) % P;
  }

  cout << sdp[k - 1][m] << endl;

  return 0;
}


Measured memory_bytes: 158708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char s[10005];
int n;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n-1;i++)
	{
		if(s[i]=='A'&&s[i+1]=='C')
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 502

int main (void) {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);

  int a[N][N] = {{0}};  
  for (int i = 0; i < m; i++)  {
    int l, r;
    scanf("%d %d", &l, &r);
    a[l][r]++;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      a[i][j] = a[i-1][j] + a[i][j-1] - a[i-1][j-1] + a[i][j];
  
  for (int i = 0; i < k; i++) {
    int p, q;
    scanf("%d %d", &p, &q);
    printf("%d\n", a[q][q] - a[p-1][q] - a[q][p-1] + a[p-1][p-1]);
  }

  return 0;
}


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

using namespace std;
int main()
{
    int n,k;
    int c=0,c2=0;
    cin>>n>>k;
    map<int,int> a;
    map<int,int>b;
    string s[k];
    int e[k];
    for(int i=0;i<k;i++){
        cin>>e[i]>>s[i];
        if(s[i]=="AC"&&a[e[i]-1]==0){
            a[e[i]-1]=1;
            c++;
        }
    }
    for(int i=0;i<k;i++){
        if(s[i]=="WA"&&a[e[i]-1]==1&&b[e[i]-1]==0){
            c2++;
        }
        else if(s[i]=="AC"&&b[e[i]-1]==0){
            b[e[i]-1]=1;
        }
    }
    cout<<c<<" "<<c2<<endl;
}


Measured memory_bytes: 15488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int k;
vl a;

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	cin >> k;
	a.resize(k);
	rep(i,0,k) {
		cin >> a[i];
	}
	reverse(all(a));
	if(a[0] != 2) {
		cout << -1 << endl;
		return 0;
	}
	ll l = 2;
	ll r = 3;
	rep(i,1,k) {
		if(a[i] == a[i-1]) {
			continue;
		}

		ll nr = (r/a[i]) * a[i];
		if(nr < l) {
			cout << -1 << endl;
			return 0;
		}
		ll nl = (l/a[i]) * a[i];
		if(nl < l) nl += a[i];
		nr = nr + a[i] - 1;
		l = nl;
		r = nr;
	}
	cout << l << ' ' << r << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;
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;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int cnt = 0;
  while (a >= b) {
    cnt++;
    b *= 2;
  }
  while (b >= c) {
    cnt++;
    c *= 2;
  }
  if (cnt <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	int X;
	cin >> X;

	int val = 599;
	int ans = 8;

	while (val < X) {
		val += 200;
		ans -= 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, M: int, A: "List[int]"):
    return max(N-sum(A), -1)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    print(solve(N, M, A))


if __name__ == '__main__':
    main()


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

#ifndef ONLINE_JUDGE
#define debarr(a,x,y)cerr<<#a<<":";for(int i=x;i<=y;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define deb(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S, class T>ostream &operator<<(ostream &os, const pair<S, T> &p) {return os << "(" << p.first << "," << p.second << ")";}
template<class T>ostream &operator<<(ostream &os, const vector<T> &p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class T>ostream &operator<<(ostream &os, const set<T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class T>ostream &operator<<(ostream &os, const multiset<T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class S, class T>ostream &operator<<(ostream &os, const map<S, T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class T>void dbs(string str, T t) {cerr << str << ":" << t << "\n";}
template<class T, class...S>void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << ":" << t << ","; dbs(str.substr(idx + 1), s...);}
#else
#define deb(...){}
#define debarr(a,x,y){}
#define debmat(mat,row,col){}
#endif
#define pr(x) {cout << x << "\n"; return;}
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

#define int              long long
#define ld               long double
#define fi               first
#define se               second
#define mp               make_pair
#define pb               push_back
#define rep(i,n)         for(int i=0;i<n;i++)
#define re(i,n)          for(int i=1;i<=n;i++)
#define fr(i,a,b)        for(int i=a;i<=b;i++)
#define fb(i,a,b)        for(int i=a;i>=b;i--)
#define sz(x)            (int)x.size()
#define all(x)           x.begin(),x.end()
#define ini(x,y)         memset(x,y,sizeof(x))
typedef vector<int>      vi;
typedef pair<int, int>   pii;
typedef vector<pii>      vii;
typedef map<int, int>    mii;
typedef set<int>         si;
const int N = 2e5 + 10;
int n, sz[N];

void solve(int tc)
{
	int x; cin >> x;
	cout << 1 - x << endl;

}

signed main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	//cin >> t;
	for (int i = 1; i <= t; i++) solve(i);
	return 0;
}

Measured memory_bytes: 3660
N, M = map(int, input().split())
ac_count = 0
penalty_count = 0
all_number_list = dict()
ac_number_list = dict()
for i in range(M):
    temp_number, temp_result = map(str, input().split())
    if temp_number in all_number_list :
        if temp_number not in ac_number_list :
            temp_count = all_number_list[temp_number]
            if temp_result == 'AC' :
                ac_number_list[temp_number] = temp_count
            else :
                all_number_list[temp_number] = temp_count + 1
    else :
        if temp_result == 'AC' :
            all_number_list[temp_number] = 0
            ac_number_list[temp_number] = 0
        else :
            all_number_list[temp_number] = 1

ac_count = len(ac_number_list)
penalty_count = sum(ac_number_list.values())
print('{} {}'.format(ac_count, penalty_count))

Measured memory_bytes: 23348
import * as fs from 'fs'

const reader = (data: string) => parseInt(data, 10)

function Main(input) {
  const N = reader(input)
  let bool = false
  for (let i = 1; i < 10; i++) {
    if (N % i === 0 && N / i <= 9) {
      bool = true
      break
    }
  }

  console.log(bool ? 'Yes' : 'No')
}

Main(fs.readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 11468
# 解説AC
n = int(input())
board = [input() for i in range(n)]

def check(a, b):
    for i in range(n):
        for j in range(n):
            if board[(i-a)%n][(j-b)%n] != board[(j-a)%n][(i-b)%n]:
                return False
    return True

ans = 0
for i in range(n):
    if check(i,0):
        ans += n-i
    if check(0,i) and i >0:
        ans += n-i
print(ans)

Measured memory_bytes: 42980
let rec comb n l = match n, l, List.length l with
    | _, [], _ -> []
    | 0, _, _  -> [[]]
    | n, (head::tail), r -> if n = r then [l]
                            else List.append (List.map (fun x -> head :: x) (comb (n-1) tail)) (comb n tail)

let rec range x y = if x > y then [] else x :: range (x+1) y
let sum x = List.fold_left (fun x y -> x + y) 0 x

let () =
  let rec loop () =
    let n, x = Scanf.scanf "%d %d\n" (fun n x -> n, x) in
    if n = 0 && x = 0 then ()
    else (range 1 n
      |> comb 3
      |> List.map sum
      |> List.filter ((=) x)
      |> List.length
      |> Printf.printf "%d\n";
      loop ()) in
  loop ()

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

int main()
{
    int time;
    int h,m,s;
    cin >> time;
    h = time/3600;
    m = (time%3600)/60;
    s = (time%3600)%60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}

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

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

  int n, m;
  cin >> n >> m;
  vector<vector<int>> adj(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    adj[a].emplace_back(b);
    adj[b].emplace_back(a);
  }

  int ans = 0;
  vector<int> vis(n);
  for (int i = 0; i < n; i++) {
    if (vis[i]) {
      continue;
    }
    queue<int> q;
    q.emplace(i);
    int cnt = 0;
    vis[i] = 1;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      cnt++;
      for (auto v : adj[u]) {
        if (!vis[v]) {
          q.emplace(v);
          vis[v] = 1;
        }
      }
    }
    ans = max(ans, cnt);
  }
  cout << ans << "\n";
  return 0;
}


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

int main()
{
    vector<int>q;
    int n;
    cin>>n;
    REP(i,n)
    {
        int q1;
    cin>>q1;
    if(q1==0)
    {
        int x;
        cin>>x;
        q.push_back(x);
    }else if(q1==1)
    {
        int x;
        cin>>x;
        cout<<q.at(x)<<endl;
    }else if(q1=2)
    {
        q.pop_back();
    }
    }
    
}


Measured memory_bytes: 3920
// C++ program to find 3 elements such that max(abs(A[i]-B[j]), abs(B[j]- 
// C[k]), abs(C[k]-A[i])) is minimized. 
  
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define pb push_back  
#define MOD 998244353 
// Driver program 


int main() 
{
  int s,w;
  cin>>s>>w;
  if(w>=s) cout<<"unsafe";
  else cout<<"safe";
} 

Measured memory_bytes: 3632