akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << c - (d - b) << endl << d + (c - a) << endl << a - (d - b) << endl << b + (c - a) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

class MaxFlow {
public:
    typedef long long Int;
    static const Int INF = 1LL << 60;
    
    struct edge{Int to, cap, rev;};
    
    Int N;
    vector<vector<edge> > G;
    vector<Int> level;
    vector<Int> iter;
    
    MaxFlow(Int N) {
        this->N = N;
        G = vector<vector<edge> >(N);
        level = vector<Int>(N);
        iter = vector<Int>(N);
    }
    
    void add_edge(Int from, Int to, Int cap) {
        G[from].push_back((edge){to, cap, G[to].size()});
        G[to].push_back((edge){from, 0, G[from].size() - 1});
    }
    
    void bfs(Int s) {
        fill(level.begin(), level.end(), -1);
        queue<Int> que;
        level[s] = 0;
        que.push(s);
        while (!que.empty()) {
            Int v = que.front(); que.pop();
            for (Int i = 0; i < (Int)G[v].size(); i++) {
                edge &e = G[v][i];
                if (e.cap > 0 && level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }
    }
    
    Int dfs(Int v, Int t, Int f) {
        if (v == t) return f;
        for (Int &i = iter[v]; i < (Int)G[v].size(); i++) {
            edge &e = G[v][i];
            if (e.cap > 0 && level[v] < level[e.to]) {
                Int d = dfs(e.to, t, min(f, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    
    Int run(Int s, Int t) {
        Int flow = 0;
        for (;;) {
            bfs(s);
            if (level[t] < 0) return flow;
            fill(iter.begin(), iter.end(), 0);
            Int f;
            while((f = dfs(s, t, INF)) > 0) {
                flow += f;
            }
        }
    }
};

int main() {
    int m, n;

    while (cin >> m >> n, m) {
        vector<int> b(m), r(n);

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

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

        MaxFlow flow(m + n + 2);
        int source = m + n, sink = m + n + 1;
        for (int i = 0; i < m; i++) {
            flow.add_edge(source, i, 1);
        }

        for (int i = 0; i < n; i++) {
            flow.add_edge(m + i, sink, 1);
        }

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (__gcd(b[i], r[j]) != 1) {
                    flow.add_edge(i, m + j, 1);
                }
            }
        }

        cout << flow.run(source, sink) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 9592
from collections import defaultdict
from math import gcd

def resolve():
    MOD = 1000000007

    N = int(input())
    dic = defaultdict(int)
    zeros = 0
    for _ in range(N):
        a, b = map(int, input().split())
        if a == 0 and b == 0:
            zeros += 1
        else:
            g = gcd(a, b)
            a //= g
            b //= g
            if a < 0:
                a *= -1
                b *= -1
            if a == 0 and b == -1:
                b = 1
            dic[(a, b)] += 1

    ans = 1
    free = 0
    for (a, b), n in dic.items():
        if b > 0:
            if (b, -a) in dic:
                m = dic[(b, -a)]
                ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
            else:
                free += n
        else:
            if (-b, a) not in dic:
                free += n
                
    ans = (ans * pow(2, free, MOD) + zeros - 1) % MOD
    print(ans)

if __name__ == "__main__":
    resolve()

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

int main()
{
    ll n;
    cin >> n;
    //vector<ll> a(n);
    //vector<ll> b(n);

    priority_queue<ll, vector<ll>, greater<ll>> qu;
    map<ll, ll> memo;
    rep(i, n)
    {
        int a, b;
        cin >> a >> b;
        qu.push(b);
        //これだとindexはない。memo[]
        memo[b] += a; //(bが締め切りの課題はaだけ時間がかかる)

    } //これだとbの最小値から取り出すのがめんどくさい
    //bを優先度に入れて、マップ形式で取り出せば良い
    ll t = 0; //時間の管理
    int l = 0;
    int u = 0;
    while (l < n)
    {
        if (u == qu.top())
        {
            l++;
            qu.pop();
            continue;
        }
        t += memo[qu.top()]; //もっとも締め切りが早いもの
        if (t > qu.top())
        {
            cout << "No" << endl;
            break;
        }
        u = qu.top();
        qu.pop();
        l++;
    }

    if (l == n)
    {
        cout << "Yes";
    }
}

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

int bubbleSort(int A[],int N){

   int sw=0;
   bool flag = 1;
   for(int i=0;flag;i++){
      flag =0;
      for(int j=N-1;j>=i+1;j--){
         if(A[j]<A[j-1]){
            swap(A[j],A[j-1]);
            flag=1;
            sw++;
         }
      }
   }
   return sw;
}

int main(){

   int A[100],N,sw;
   cin>>N;
   for(int i=0;i<N;i++) cin>>A[i];

   sw=bubbleSort(A,N);

   for(int i=0;i<N;i++){
      if(i) cout << " ";
      cout<<A[i];
   }
   cout << endl;
   cout << sw <<endl;

   return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    int n; cin >> n;
    int x = 800 * n;
    int y = n / 15; y *= 200;
    cout << x-y << endl;
    return 0;
}

Measured memory_bytes: 256
//#include "stdafx.h"
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, P> PP;

struct edge {
	int to, cost;
	edge(int t, int c) :to(t), cost(c) {}
};

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

ll mypow(ll x, ll n, ll m) {	//xのn乗をmで割った余り
	if (n == 0) return 1;
	if (n % 2 == 0) return mypow(x*x%m, n / 2, m);
	else return x*mypow(x, n - 1, m) % m;
}

//-----------------------------------------------------------------------------

int n;
int a[100000];
map<int, int> mp;

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

	cin >> n;
	REP(i, n) {
		cin >> a[i];
		mp[a[i]]++;
	}
	int cnt = 0;
	for (auto x : mp) {
		if (x.first > x.second) cnt += x.second;
		else if (x.first < x.second) cnt += (x.second - x.first);
	}
	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 5120
N,K,C=list(map(int,input().split()))
S=input()
R=[]
L=[]

i=0
while i<N:
    if S[i]=="o":
        R.append(i)
        i+=C+1
    else:
        i+=1
i=N-1
while i>=0:
    if S[i]=="o":
        L.append(i)
        i-=(C+1)
    else:
        i-=1
R=R[:K+1]
L=L[:K+1]
L.reverse()
for i in range(K):
    if R[i]==L[i]:
        print(str(R[i]+1),end=" ")


Measured memory_bytes: 20840
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

vector<ll> inv,fac;

void inverse(ll n){
    //要素数:n+1 (0~n)
    inv[0]=1;
    inv[1]=1;
    for(ll i=2;i<=n;i++){
        inv[i]=(MOD-inv[MOD%i]*(MOD/i))%MOD;
    }
}

void inverse_u(ll n){
    //要素数:n+1 (0~n)
    for(ll i=2;i<=n;i++){
        inv[i]=(inv[i]*inv[i-1])%MOD;
    }
}

void factorial(ll n){
    //要素数:n+1 (0~n)
    fac[0]=1;
    fac[1]=1;
    for(ll i=2;i<=n;i++){
        fac[i]=(fac[i-1]*i)%MOD;
    }
}

ll nCr(ll n,ll r){
    return fac[n]*inv[r]%MOD*inv[n-r]%MOD;
}

ll proinverse(ll x,ll m){
    ll res=1,M=m-2;
    while(M>0){
        if(M&1) res=res*x%m;
        x=x*x%m;
        M>>=1;
    }
    return res;
}

void init_nCr(ll n){
    inv.assign(n+1,0);
    fac.assign(n+1,0);
    inverse(n); inverse_u(n);
    factorial(n);
}

int main(){
    ll s; cin>>s;
    init_nCr(10000);
    ll ans=0;
    for(ll i=1;i*3<=s;i++){
        ans=ans+nCr(i-1+s-3*i,i-1);
        ans%=MOD;
    }
    cout<<(MOD+ans)%MOD<<endl;
}

Measured memory_bytes: 3752
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,t = mi()
data = []
for i in range(n):
    data.append(li())

data.sort()

dp = [[0]*t for i in range(n+1)]
for i in range(n):
    for k in range(t):
        dp[i+1][k] = max(dp[i+1][k],dp[i][k])
        if k + data[i][0] <= t-1:
            dp[i+1][k+data[i][0]] = max(dp[i+1][k+data[i][0]],dp[i][k] + data[i][1])
ans = 0
for i in range(n):
    ans = max(ans,dp[i][t-1] + data[i][1])
print(ans)






Measured memory_bytes: 117848
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
    std::ios::sync_with_stdio(false);
	std::cin.tie(0);
    LL X;
    cin >> X;
    LL n = 100;
    LL t = 0;
    while(n < X){
        n = floor((LD)n*1.01);
        t++;
    }
    cout << t << "\n";
	return 0;
}


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

using namespace std;

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

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

	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	vector< vector<long long> > arr(n, vector<long long>(m, -1));
	auto dist = arr;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			char c; cin >> c;
			arr[i][j] = (c != '.');
		}
	}

	queue< pair<int, int> > q;
	x1--; y1--;
	x2--; y2--;

	q.push({x1, y1});
	dist[x1][y1] = 0;

	while (!q.empty()) {
		pair<int, int> u = q.front(); q.pop();
		for (int i = 0; i < 4; i++) {
			for (int j = 1; j <= k; j++) {
				int tx = u.first + dx[i] * j; int ty = u.second + dy[i] * j;
				if (tx == n || ty == m || tx < 0 || ty < 0 || arr[tx][ty] || dist[tx][ty] != -1 && dist[tx][ty] <= dist[u.first][u.second])
					break;
				if (dist[tx][ty] == -1) dist[tx][ty] = dist[u.first][u.second] + 1, q.push({tx, ty});
			}
		}
	}

	cout << dist[x2][y2];
	return 0;
}


Measured memory_bytes: 19948
#include<stdio.h>
#include<math.h>
#include<string.h>
#define MAX 25
double x[MAX],y[MAX],z[MAX],Dis[MAX][MAX],Max;
int N,M,ipos[MAX];
double dis(int n,int m)
{
	return pow(x[n]-x[m],2)+pow(y[n]-y[m],2)+pow(z[n]-z[m],2);
}
void dfs(int cur,int count,double ans)
{
	double k=ans;
	int i;
	if(count==M)
	{
		if(Max<ans)
			Max=ans;
		return ;
	}
	if(cur>=N)
		return;
	if(count>M)
		return;
	dfs(cur+1,count,ans);
	ipos[cur]=1;
	for(i=0;i<cur;i++)
	{
		if(ipos[i]==1)
			k+=Dis[i][cur];
	}
	dfs(cur+1,count+1,k);
	ipos[cur]=0;
	return ;
}
int main()
{	
	int i,j;
	while(scanf("%d%d",&N,&M)!=EOF)
	{
		for(i=0;i<N;i++)
			scanf("%lf%lf%lf",&x[i],&y[i],&z[i]);
		memset(Dis,0,sizeof(Dis));
		memset(ipos,0,sizeof(ipos));
		Max=0;
		for(i=0;i<N;i++)
			for(j=i+1;j<N;j++)
				Dis[i][j]=dis(i,j);
			dfs(0,0,0);
			printf("%.20lf\n",Max);
	}
	return 0;
}

Measured memory_bytes: 820
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int v,w,x,y,z;
  cin >> v >> w >> x >> y >> z;
  vector<int> vec(5);
  vec = {v,w,x,y,z};
  rep(i,5) 
  {
    if(vec[i]==0) cout << i+1 << endl;
  }
  return 0;
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int h, w;
  cin >> h >> w;

  vector<vector<char>> s(h, vector<char>(w));
  int cnt = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> s[i][j];
      if (s[i][j] == '#') {
        cnt++;
      }
    }
  }

  // (i, j, cost)
  vector<vector<int>> costs(h, vector<int>(w, -1));
  queue<array<int, 3>> q;
  q.push({0, 0, 0});
  while (!q.empty()) {
    int i = q.front()[0], j = q.front()[1], cost = q.front()[2];
    q.pop();
    if (costs[i][j] != -1 || s[i][j] == '#') {
      continue;
    }

    costs[i][j] = cost;

    if (i != 0) {
      q.push({i - 1, j, cost + 1});
    }

    if (i != h - 1) {
      q.push({i + 1, j, cost + 1});
    }

    if (j != 0) {
      q.push({i, j - 1, cost + 1});
    }

    if (j != w - 1) {
      q.push({i, j + 1, cost + 1});
    }
  }

  if (costs[h - 1][w - 1] == -1) {
    cout << -1 << '\n';
  } else {
    cout << h * w - (costs[h - 1][w - 1] + 1) - cnt << '\n';
  }

  return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdlib>
using namespace std;
int main() {
	int n, q,cnt=0;
	cin >> n;
	int *p1 = (int *)malloc(sizeof (int)*n);
	for (int i = 0; i < n; i++) {
		cin >> p1[i];
	}
	cin >> q;
	int *p2 = (int*)malloc(sizeof(int)*q);
	for (int i = 0; i < q; i++) {
		cin >> p2[i];
		//cout << *find(p1, p1 + n, p2[i]) << endl;
		if (find(p1, p1 + n, p2[i])!=p1+n) {
			cnt++;
		}
	}
	free(p1); free(p2);
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>
#include <string.h>
int main()
{
    int n, sum = 0, min = 0, num,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&num);
        if(!i) sum++, min = num;
        else if(min > num) sum++, min = num;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


bool ng[333];
int A[333][333];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    REP(i,N) REP(j,M) cin >> A[i][j], A[i][j]--;

    int ans = INF;
    REP(x,M){
        vector<int> cnt(M);
        REP(i,N){
            REP(j,M){
                if(!ng[A[i][j]]){
                    cnt[A[i][j]]++;
                    break;
                }
            }
        }
        int ma = max_element(cnt.begin(), cnt.end()) - cnt.begin();
        chmin(ans, cnt[ma]);
        ng[ma] = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
n = int(input())
s1 = input()
s2 = input()
mod = 10**9+7
def tate(i, s1, s2):
    return s1[i] == s2[i]

ans = 1
for i in range(n-1):
    if s1[i] == s1[i+1]:
        continue
    cur_tate = tate(i, s1, s2)
    nex_tate = tate(i+1, s1, s2)
    if cur_tate and nex_tate:
        ans *= 2
    elif cur_tate and not nex_tate:
        ans *= 2
    elif not cur_tate and not nex_tate:
        ans *= 3
    else:
        continue
    ans %= mod

if tate(0, s1, s2):
    print(3*ans%mod)
else:
    print(6*ans%mod)


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
  int n,k;cin >>n>>k;
  ll ans=0;
  ans=k;
  n--;
    for (int i = 0; i < n; ++i) {
        ans*=(k-1);
    }
    cout <<ans <<endl;

}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  vector<array<int, 256>> cnts(n);
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < s.size(); ++j) {
      cnts[i][s[j]]++;
    }
  }

  string result;
  for (char c = 'a'; c <= 'z'; ++c) {
    int min_sz = 50;
    for (int i = 0; i < n; ++i) {
      min_sz = min(min_sz, cnts[i][c]);
    }

    for (int i = 0; i < min_sz; ++i) {
      result += c;
    }
  }

  cout << result << '\n';

  return 0;
}

Measured memory_bytes: 3644
// https://atcoder.jp/contests/abc128/tasks/abc128_b
#include <bits/stdc++.h>
using namespace std;

struct Data{
  string S;
  int P;
  int index;

  // 最後のconstを忘れると"instantiated from here"というエラーが出てコンパイルできないので注意
  bool operator<(const Data &right) const
  {
    return S == right.S ? P > right.P : S < right.S;
  }
};

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

  vector<Data> d(N);
  for (int i = 0; i < N; i++){
    string s;
    int P;
    cin >> s >> P;
    d[i].S = s;
    d[i].P = P;
    d[i].index = i+1;
  }
  sort(d.begin(), d.end());

  for (int i = 0; i < N; i++){
    cout << d[i].index << endl;
  }
}

Measured memory_bytes: 256
using System;

class Program
{
    static public void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        int c = int.Parse(input[2]);
        int d = int.Parse(input[3]);

        Console.WriteLine(Math.Max(a*b,c*d));
    }
}

Measured memory_bytes: 2648
//Be Name Khoda
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
const ll M=2e3+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=1e9+7;
 
ll n,m,h,w;
 
int main()
{
	ios::sync_with_stdio(0);
	cin >> n >> m >> h >> w;
	ll f=10000;
	f*=f;
	f=10*f/(h*w);
	ll g=(h*w-1)*f+1;
	ll su=0;
	For(i,1,n+1)
	{
	    For(j,1,m+1)
	    {
	        if (i%h==0 && j%w==0)
	        {
	            su-=g;
	        }
	        else su+=f;
	    }   
	}
	if (su<=0) RET("No");
	cout << "Yes\n";
	For(i,1,n+1)
	{
	    For(j,1,m+1)
	    {
	        if (i%h==0 && j%w==0)
	        {
	            cout << -g << ' ';
	        }
	        else cout << f << " ";
	    }   
	    cout << '\n';
	}
} 

Measured memory_bytes: 2816
n, k, q = map(int,input().split())
points = [k-q]*n

for i in range(q):
  m = int(input())
  points[m-1] = points[m-1] + 1

for j in range(len(points)):
  if points[j] <= 0:
    print('No')
  else:
    print('Yes')


Measured memory_bytes: 6576
#include <iostream>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>

using namespace std;

int main(void) {
    int n, z, w;
    int a[2000];
    cin >> n >> z >> w;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int res = 0;
    if (n == 1)
        res = abs(w - a[0]);
    else
        res = max(abs(w - a[n - 1]), abs(a[n - 2] - a[n - 1]));
    cout << res << endl;
}

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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    char c = S[0];
    int cnt = 1;
    for (int i = 1; i < (N); ++i) {
        if (S[i] != c) {
            cnt++;
        }
        c = S[i];
    }
    cout << cnt << endl;

    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,b) FOR(i,0,b)

typedef vector<int> vi;
typedef vector<vi> vvi;

const vvi nul = {{1},{1}}, e = {{1,0},{0,1}};
const int P = 998244353, maxn = 410;

int n, a[maxn], pow2[maxn], C[maxn][maxn];

vvi dfs(int l, int r, int b) {
	int len = r-l+1;
	if (l == r) return nul;
	if (r-l == 1 && a[l] == b) return e;
	vvi dp = vvi(2, vi(len));
	FOR(i,l,r) if (a[i] == b) {
		auto dp1 = dfs(l, i, b), dp2 = dfs(i+1, r, b);
		F0R(j,i-l+1) F0R(k,r-i) {
			dp[0][j+k] = (dp[0][j+k]+1ll*dp1[0][j]*dp2[0][k])%P;
			dp[1][j+k+1] = (dp[1][j+k+1]+1ll*dp1[1][j]*dp2[1][k])%P;
		}
		return dp;
	}
	auto dp1 = dfs(l, r, b+1);
	F0R(i,len) dp[0][i] = dp1[1][i];
	F0R(i,len) FOR(j,i,len) {
		dp[1][i] = (dp[1][i]+1ll*dp1[1][j]*C[j][i]%P*pow2[len-1-j])%P;
	}
	F0R(i,len) FOR(j,i,len) {
		dp[0][i] = (dp[0][i]+1ll*dp1[0][j]*C[j][i]%P*(pow2[len-1-j]-(i==j)))%P;
	}
	return dp;
}

int main() {
	C[0][0] = 1;
	FOR(i,1,maxn)
		F0R(j,i+1) {
			C[i][j] = j?(C[i-1][j-1]+C[i-1][j])%P:1;
		}
	pow2[0] = 1;
	FOR(i,1,maxn) pow2[i] = 2*pow2[i-1]%P;

	cin >> n;
	F0R(i,n) cin >> a[i];
	auto dp = dfs(0, n, 0);
	cout << dp[0][0] << endl;
}


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

int H, W, maxn; char c[33][33];

int main() {
	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) cin >> c[i][j];
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			for (int k = 1; k <= H; k++) {
				for (int l = 1; l <= W; l++) {
					if (c[i][j] == 'B' && c[k][l] == 'B') maxn = max(maxn, abs(i - k) + abs(j - l));
				}
			}
		}
	}
	cout << maxn << endl;
	return 0;
}


Measured memory_bytes: 3136
#ifdef debug
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define vec vector
#define ALL(x) begin(x), end(x)

typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;

const int inf = 1e9;
const ll inf64 = ll(1e18);

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    string s;

    cin >> s;

    int n = (int)s.size();
    int k;

    cin >> k;

    set< string > q;

    for(int l = 0;l < n;l++) {
        int ad = 0;
        string t = "";
        for(int r = l;r < n && ad < 5;r++) {
            t.push_back(s[r]);
            if(!q.count(t)) {
                ad++;
                q.insert(t);
                if((int)q.size() > k) q.erase(--q.end());
            }
        }
    }

    for(string t : q) {
        if(!--k) {
            cout << t << "\n";
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
    stack<int> sDowns;
    int i;
    char input;
    int init;
    int lake;
    int sum = 0;
    stack< pair<int,int> > sPools;
    vector<int> answer;
    
    for(i = 0; cin >> input; i++){
        if(input == '\\') sDowns.push(i);
        if(input == '/' && !sDowns.empty()){
            init = sDowns.top(); sDowns.pop();
            lake = i - init;
            sum += lake;
            while(!sPools.empty() && sPools.top().first > init){
                lake += sPools.top().second; sPools.pop();
            }
            sPools.push(make_pair(init, lake));
        }
        
    }
    
    while(!sPools.empty()){
        answer.push_back(sPools.top().second);
        sPools.pop();
    }
    reverse(answer.begin(), answer.end());
    
    cout << sum << endl;
    cout << answer.size();
    
    for(i = 0; i < answer.size(); i++){
        cout << " " << answer[i];
    }
    
    cout << endl;
    return 0;
}

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

int n, a, odds = 0;

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a;
		if (a % 2 == 1){
			odds++;
		}
	}

	if (odds % 2 == 0){
		cout << "YES";
	}
	else{
		cout << "NO";
	}

	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0] != b[0][0]:
    print(n-a[0][1]-b[0][1])
else:
    print(n-max(a[0][1]+b[1][1],a[1][1]+b[0][1]))


Measured memory_bytes: 20572
import scala.io.StdIn

object Main extends App {

  val Array(n, k) = StdIn.readLine().split(' ').map(_.toLong)
  val a = StdIn.readLine().split(' ').foldLeft(Map.empty[String, Int]){ (acc ,c) =>
    if(acc.contains(c)){
      acc.updated(c, acc(c) + 1)
    } else {
      acc ++ Map(c -> 1)
    }
  }.toList.sortBy( p => -1*p._2)

  def loop(lst: List[(String, Int)], sum: Int, cnt: Int): Int = {
    if(lst.isEmpty || cnt == k) {
      sum
    } else {
      loop(lst.tail, sum + lst.head._2, cnt + 1)
    }
  }
  println(n - loop(a, 0, 0))
}

Measured memory_bytes: 111028
import sys
read=sys.stdin.buffer.readline

class BIT:
    def __init__(self,N):
        self.N=N
        self.bit=[0]*N
    def add(self,a,w):
        x=a
        while(x<self.N):
            self.bit[x]+=w
            x|=x+1
    def get(self,a):
        ret,x=0,a-1
        while(x>=0):
            ret+=self.bit[x]
            x=(x&(x+1))-1
        return ret
    def cum(self,l,r):
        return self.get(r)-self.get(l)

def main():
    def update(x,i):
        if good[x]==-1:
            good[x]=i
            bit.add(i,1)
        else:
            bit.add(good[x],-1)
            good[x]=i
            bit.add(good[x],1)
        return
    
    N,Q=map(int,read().split())
    c=tuple(map(int,read().split()))
    Query=[]
    for i in range(Q):
        l,r=map(lambda x:int(x)-1,read().split())
        Query.append((l,r,i))
    Query.sort(key=lambda x:x[1])
    ans=[-1]*Q
    good=[-1]*(N+1)
    bit=BIT(N)

    i=0
    for L,R,w in Query:
        while(i<=R):
            update(c[i],i)
            i+=1
        ans[w]=bit.cum(L,R+1)

    print(*ans,sep='\n')
    return
    
if __name__=='__main__':
    main()

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

int n, a;
set<int> s;

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

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		s.insert(a);
	}
	cout << s.size() - (!(s.size()&1));

	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
int main(void){
	int k,s,ans=0;
	scanf("%d%d",&k,&s);
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			int x=s-i-j;
			if(x>=0 && x<=k)ans++;
		}
	}
	printf("%d",ans);
	
	return 0;
}

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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 1000 + 10, K = 5000;
const int MOD = 1000000007;
const int LOG = 20;
const int INF = 10000010;

int dp[2][N][K], n, X[N], DP[N];
vi G[N];

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 2; i <= n; i++){
		int p;
		cin >> p;
		G[p].pb(i);
	}
	for (int i = 1; i <= n; i++) cin >> X[i];
	memset(dp, 31, sizeof dp);
	for (int i = n; i >= 1; i--){
		bool f = 1;
		dp[0][i][0] = 0;
		for (auto u:G[i]){
			memset(dp[f][i], 31, sizeof dp[f][i]);
			for (int j = X[i]; j >= 0; j--){
				int x = j + X[u];
				if (x <= X[i]) dp[f][i][x] = min(dp[f][i][x], dp[f ^ 1][i][j] + DP[u]);
				x = j + DP[u];
				if (x <= X[i]) dp[f][i][x] = min(dp[f][i][x], dp[f ^ 1][i][j] + X[u]);
			}
			f ^= 1;
		}
		int mn = INF;
		f ^= 1;
		for (int j = 0; j <= X[i]; j++){
			mn = min(mn, dp[f][i][j]);
		}
		if (mn == INF) return cout << "IMPOSSIBLE", 0;
		DP[i] = mn;
	}
	cout << "POSSIBLE";
	return 0;
}

Measured memory_bytes: 39808
# B - Time Limit Exceeded
N, T = map(int, input().split())
CT = [list(map(int, input().split())) for _ in range(N)]

ans = float("inf")

for i in range(N):
	if CT[i][1] <= T:
		ans = min(ans, CT[i][0])
	else:
		pass

if ans == float("inf"):
	ans = "TLE"

print(ans)


Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll ans = 0;
    int n;
    ll a, b;
    cin >> n >> a >> b;
    ll x[n];
    ll x_dif[n];
    rep(i, n){
        cin >> x[i];
        if(i > 0) x_dif[i - 1] = x[i] - x[i - 1];
    }
    rep(i, n - 1){
        if(x_dif[i] * a > b)ans += b;
        else ans += x_dif[i] * a;
    }
    cout << ans << endl;

}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

double pow(double d, ll a) {
  double ret = 1.0;
  if (a > 0) {
    for (ll i = 1; i <= a; ++i) ret *= d;
  }
  return ret;
}

ll dev2(const ll K, const ll i) {
  ll ret = 0, p = i;
  while (p < K) {
    p *= 2;
    ret += 1;
  }
  return ret;
}

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

  ll N,K; cin >> N >> K;
  double ans = 0, d = 0.5;
  for (ll i = 1; i <= N; ++i) {
  	ll roll = dev2(K,i);
    ans += pow(d,roll);
  }
  ans /= N;
  printf("%.10f",ans);
  return 0;
}

Measured memory_bytes: 384
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void 
debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int n,q;

lint ar[100005];
lint coef[100005];

lint pref[100005],res[100005];
int main(){
  cin>>n>>q;
  int m=0;
  ar[m++]=n;
  REP(i,q){
    lint a;cin>>a;
    while(m>0 && ar[m-1]>=a) --m;
    ar[m++]=a;
  }
  int n2=n;
  n=m;

  coef[n-1]=1;
  for(int i=n-1;i>0;--i){
    coef[i-1]+=coef[i]*(ar[i]/ar[i-1]);
    lint b=ar[i]%ar[i-1],c=coef[i];
    while(b>0){
      int p=upper_bound(ar,ar+n,b)-ar;--p;
      if(p==-1){
        pref[b]+=c;
        break;
      }else{
        coef[p]+=b/ar[p]*c;
        b%=ar[p];
      }
    }
  }

  pref[ar[0]]+=coef[0];
  lint sum=0;
  for(int i=n2-1;i>=0;--i){
    sum+=pref[i+1];
    res[i]=sum;
  }
  REP(i,n2){
    printf("%lld\n",res[i]);
  }




  return 0;
}





Measured memory_bytes: 4864
//In the name of God:)
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define int long long
using namespace std;
const int MAXN = 1e5 + 10;
void solve(){

}

int32_t main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  int n , k;
  scanf("%lld\n", &n);
  scanf("%lld\n", &k);
  int v[MAXN];
  int dp[MAXN];
  for(int i = 1 ; i <= n ;i++){
    scanf("%lld\n", &v[i]);
  }
  fill(dp , dp + MAXN, INT_MAX);
  dp[1] = 0;
  for(int i = 1 ; i < n ; i++){
    for(int j = 1 ; j <= k ; j++){
      if(i + j > n) break;
      dp[i + j] = min(dp[i+j], dp[i] + abs(v[i + j] - v[i]));
    }
    // cout<<i<<' '<<dp[i]<<endl;
  }
  printf("%lld\n", dp[n]);
}


Measured memory_bytes: 1792
#include <atcoder/all>
#include <iostream>

using namespace std;
using namespace atcoder;

int main() {
  int n, q;
  cin >> n >> q;
  fenwick_tree<long long> fw(n);

  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    fw.add(i, a);
  }

  for(int i = 0; i < q; i++){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == 0){
      fw.add(b, c);
    } else {
      cout << fw.sum(b, c) << "\n";
    }
  }

  return 0;
}


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

typedef long long ll;

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k, a, b; cin >> k >> a >> b;
	int temp = k * (a/k + (a%k != 0));
	if (temp >= a && temp <= b) cout << "OK" << '\n';
	else cout << "NG" << '\n';
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N;
    ll sum = 0;
    
    cin >> N;
    rep(i,N+1) if(i % 3 != 0 && i % 5 != 0) sum += i;

    print(sum);
    return 0;    
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
    int r, g, b, n = 0;
    cin >> r >> g >> b >> n;
    int ct = 0;

    for (int i = 0; i <= 3000; i++)
    {
        for (int j = 0; j <= 3000; j++)
        {
            int num = (r * i) + (g * j);
            if (n >= num && (n - num) % b == 0)
            {
                ct++;
            }
        }
    }

    COUT(ct);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, t;
    cin >> a >> b >> t;
    int ans = 0;
    for(int i = a; i <= t; i += a)
    {
        ans += b;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)

ans = 1
flag = nil
(n-1).times do |i|
  next if a[i+1] == a[i]
  if a[i+1] > a[i]
    if flag == nil
      flag = 'up'
    elsif flag == 'up'
      next
    else
      flag = nil
      ans += 1
      next
    end
  elsif a[i+1] < a[i]
    if flag == nil
      flag = 'down'
    elsif flag == 'down'
      next
    else
      flag = nil
      ans += 1
      next
    end
  end
end

puts ans

Measured memory_bytes: 11020
import java.util.Scanner;

public class Main {
    int n, k;
    long[] as;
    long[] qs;
    public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    }

    void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 78856
#include<bits/stdc++.h>
using namespace std;
int a,b,n;
int main()
{
    bool f=1;
	cin>>a>>b;
	if(b==100)n=a*1000+b;
	else if(b<100&&b>=10)n=a*100+b;
	else n=a*10+b;
	for(int i=2;i<=n-1;i++)
	{
		if(i*i==n)
		{
		    f=0;
		    break;
		}
	}
	if(f==1)cout<<"No"<<endl;
	else if(f==0)cout<<"Yes"<<endl;;
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
int main (void){
        int N,A,ans=0;
        int mochi[101];
        for (int i = 1; i <= 100; i++) {
                mochi[i]=0;
        }
        scanf("%d",&N);
        for (int i = 1; i <= N; i++) {
                scanf("%d",&A);
                mochi[A]=1;
        }
        for (int i = 1; i <= 100; i++) {
                if (mochi[i]==1) {
                        ans++;
                }
        }
        printf("%d",ans);
        return 0;
}


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

int main(){
  string s;
  cin>>s;
  string t;
  cin>>t;
  
  rep(i,s.size()){
    if(s[i]!=t[i]){
      cout<<"No"<<endl;
      return 0;
    }else continue;
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 3588
a, b = map(int, input().split())

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

print(lcm(a, b))

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a / g * b;
}

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

  ll ans = 1LL;
  for(int i = 0; i < n; ++i) {
    ll t; cin >> t;
    ans = lcm(ans, t);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/* code by AbhiTaker  */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
ll pre[N],p[N];

void sieve()
{
    for(ll i=2; i<=100000; i++)
    {
        if(!p[i])
        {
            for(ll j=2*i; j<=100000; j+= i)
                p[j]=1;
        }
    }
}


int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    sieve();
    ll q,i;

    pre[1]=0;
    pre[2]=0;
    for(i=3; i<=100000; i++)
    {
        if(i%2==0)
            pre[i] = pre[i-1];
        else{
            if(!p[i] && !p[(i+1)/2])
                pre[i] = pre[i-1] + 1;
            else
                pre[i] = pre[i-1];
        }
    }

    cin>>q;
    while(q--)
    {
        ll l,r;
        cin>>l>>r;
        if(l==1)
            cout<<pre[r]<<"\n";
        else
            cout<<pre[r]-pre[l-1]<<"\n";

    }



    return 0;
}


Measured memory_bytes: 5504
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        var hash = new HashSet<string>();

        for(int i=0; i<n; i++) {
            var s = input.ReadLine();
            if (!hash.Contains(s))
                hash.Add(s);
        }

        return hash.Count;
    }
}


Measured memory_bytes: 47324
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


map< int, int > prime_factor(int n) {
  map< int, int > ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


//FUNCTION
void solve(void)
{

  int S;
  cin>>S;
  // map<int,int> mp = prime_factor(S);
  // for (auto i : mp)
  // {
  //   cout<<i.first<<endl;
  // }
  
  
  int X = 0,Y = 0;
  int M = 1000000000;
  X = (M - S%M)%M;
  Y = (S+X)/M;

  cout<<0<<" "<<0<<" "<<M<<" "<<1<<" "<<X<<" "<<Y<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


Measured memory_bytes: 256
A, B, C, D = gets().strip().split(/ /).collect(&:to_i)

def calc_gcm(a, b)
	if a > b
		r = a % b
		a = r
	end
	
	while a > 0
		r = b % a
		b = a
		a = r
	end
	
	return b
end

def calc_lcm(a, b)
	gcm = calc_gcm(a, b)
	return a * b / gcm
end

def calc(a, c, d)
	lcm = calc_lcm(c, d)
	return a - (a / c) - (a / d) + (a / lcm)
end

puts calc(B, C, D) - calc(A - 1, C, D)


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

#define ll long long
const int MOD = 1e9 + 7, INF = 1e9;
int n, k, cnt1 = 0, cnt2 = 0;

ll Rec(int curr, int mx, int *weights, int *values)
{
    cnt1++;
    if (curr >= n || mx <= 0)
        return 0;
    ll temp1 = 0, temp2;
    if (mx - weights[curr] >= 0)
        temp1 = (ll)values[curr] + Rec(curr + 1, mx - weights[curr], weights, values);
    temp2 = Rec(curr + 1, mx, weights, values);
    return max(temp1, temp2);
}
ll Memo(int curr, int mx, int *weights, int *values, vector<vector<ll>> &memo)
{
    //cout << curr << " "<<mx<<'\n';
    if (curr >= n || mx <= 0)
        return 0;
    if (memo[curr][mx] != -1)
    {

        return memo[curr][mx];
    }
    ll temp1 = 0, temp2;

    if (mx - weights[curr] >= 0)
        temp1 = (ll)values[curr] + Memo(curr + 1, mx - weights[curr], weights, values, memo);
    temp2 = Memo(curr + 1, mx, weights, values, memo);
    memo[curr][mx] = max(temp1, temp2);
    return memo[curr][mx];
}
ll dp(int w, int *weights, int *values)
{
    ll dp[n][w + 1];
    for (int i = 0; i <= w; i++)
        dp[0][i] = (i - weights[0] >= 0) ? values[0] : 0;
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j <= w; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j - weights[i] >= 0 && j)
                dp[i][j] = max(dp[i][j], (ll)values[i] + dp[i - 1][j - weights[i]]);
        }
    }
    return dp[n - 1][w];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    int weights[n], values[n];
    for (int i = 0; i < n; i++)
    {
        cin >> weights[i];
        cin >> values[i];
    }
    cout << dp(k, weights, values);
}


Measured memory_bytes: 81636