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

#define int             long long int
#define ff              first
#define ss              second
#define pb              push_back

#define vi              vector <int>
#define pii             pair <int, int>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl



template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
const int M = 1000000007;

int mul(int a, int b)
{
	return (a * b) % M;
}

int pwr(int a, int b)
{
	if (b == 0) return 1;
	int c = pwr(a, b / 2);
	if (b % 2 == 1) return mul(a, mul(c, c));
	return mul(c, c);
}

int inv(int a, int m)
{
	return pwr(a, m - 2);
}

void solve()
{
	int n, k;
	cin >> n >> k;
	int a[n];
	loop(i, 0, n) cin >> a[i];

	loop(i, k, n)
	{
		if (a[i] > a[i - k]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}




	return;

}

int32_t main()
{
	ios_base::sync_with_stdio(0); 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;
	while (t--) solve();

	return 0;
}

Measured memory_bytes: 5180
#include <stdio.h>

int main(void) {
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if((a == b && c == d)||(a == c && b == d)||(a == d && b == c)){printf("yes\n");}else{printf("no\n");}
	return 0;
}

Measured memory_bytes: 580
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while(in.hasNext()) {
			long a = in.nextInt();
			long b = in.nextInt();
			System.out.println(calc(a, b) + " " + a*b/calc(a, b));
		}
	}
	static long calc(long a, long b) {
		long r = a%b;
		if(r==0) return b;
		return calc(b, r);
	}
}

Measured memory_bytes: 17220
/* MergeSort */
#include <stdio.h>

int Merge(int *, int, int, int);
int MergeSort(int *, int, int);
int sum=0;

int MergeSort(int *A, int left, int right)
{
    int mid;

    if (left+1 < right){
        mid = (left + right) / 2;
        MergeSort(A, left, mid);
        MergeSort(A, mid, right);
        Merge(A, left, mid, right);
    }
    else { return 0; }
}

int Merge(int *A, int left, int mid, int right)
{
    int k, n1, n2, L[500000], R[500000], i, j;
    n1 = mid - left;
    n2 = right - mid;
    for(i=0; i<n1; i++){
        L[i] = A[left + i];
    }
    for(i=0; i<n2; i++){
        R[i] = A[mid + i];
    }
    L[n1] = 999999999;
    R[n2] = 999999999;
    i = 0;
    j = 0;

    for(k = left; k < right; k++){
        if(L[i] <= R[j]){
            A[k] = L[i];
            i++;
            sum++;
        } else{
            A[k] = R[j];
            j++;
            sum++;
        }
    }
}

int main()
{
    int i, n;
    int S[500000];

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

    MergeSort(S, 0, n);

    for (i=0; i<n-1; i++){
        printf("%d ", S[i]);
    }
    printf("%d\n", S[i]);
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 5700
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i,n) cin >> vec[i];
    sort(vec.begin(),vec.end());
    for(int i=0;i<n-1;i++){
        if(vec[i]==vec[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i= a ; i < b ; ++i)
#define rep(i,n) fo(i,0,n)
#define pln(n) printf("%lld\n",n)
#define sll(n) scanf("%lld",&n)
#define ss(n) scanf("%s",n)
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define dbg3(x,y,z) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) <<" , "<< #z <<": "<<(z)<<endl; }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<int>
#define tr(c, it) \
for(decltype(c.begin()) it = c.begin(); it!= c.end(); it++)
#define pis pair<int,string>
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c),x) != c.end())
using namespace std;
int main(){
    int n, W;
    cin >> n >> W;
    vector<long long> dp(W + 1, 0);
    // dp[i] is max total value we can fill with weight exactly i
    dp[0] = 0;
    for(int i = 0; i < n; i++){
    	long long wt, val;
    	cin >> wt >> val;
    	for(int wt_j = W; wt_j >= wt; wt_j--){
    		dp[wt_j] = max(dp[wt_j], dp[wt_j - wt] + val);
    	}
    }
    long long ans = 0;
    for(int w = 0; w <= W; w++){
    	ans = max(ans, dp[w]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3976
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
class Program
{
    static void Main()
    {
        char[] n = Console.ReadLine().ToCharArray();
        int ans = 0;
        for (int i = 0; i < n.Length; i++)
            ans += n[i] == '2' ? 1 : 0;
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 500
int n,a[MAXN+1][MAXN+1];
void slove(int l,int r,int id){
	if(l==r)return ;
	int mid=(l+r)>>1;
	slove(l,mid,id+1),slove(mid+1,r,id+1);
	for(int i=l;i<=mid;i++)
		for(int j=mid+1;j<=r;j++)
		a[i][j]=id; 
}
int main()
{
	scanf("%d",&n);
	slove(1,n,1);
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++)
		printf("%d ",a[i][j]);
		printf("\n");
	}
} 

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

int main(){
long long ans = 1;
int n;
bool flag = false;
cin >> n;
for(int i=0;i<n;++i){
  long long b;
  cin >> b;
  if (b == 0){
    cout << 0 << endl;
    return 0;
  }


  if(flag || K / ans < b || ans * b > K){
    flag = true;
  }
  ans *= b;

}

if (flag){
  cout << -1 << endl;
  return 0;
}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int n,sum,ans;
int main(){
        cin >> n;
        int a[n+2];
        int d[n];
        a[0]=0;
        for(int i=1; i<=n; i++) {
                cin >> a[i];
        }
        a[n+1]=0;
        for(int i=0; i<=n; i++) {
                if(a[i]<a[i+1]) {
                        d[i]=(a[i+1]-a[i]);
                        sum+=d[i];
                }
                else if(a[i]>=a[i+1]) {
                        d[i]=(a[i]-a[i+1]);
                        sum+=d[i];
                }
        }
        for(int i=1; i<=n; i++) {
                ans=(sum-(d[i]+d[i-1]));
                if(a[i+1]<a[i-1]) {
                        ans+=(a[i-1]-a[i+1]);
                }
                else if(a[i-1]<=a[i+1]) {
                        ans+=(a[i+1]-a[i-1]);
                }
                cout << ans <<endl;
        }
}


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

int gcd(int a, int b) {
  if (a < b) swap(a, b);

  while (b > 0) {
    int r = a % b;
    a = b;
    b = r;
  }
  return a;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }

  vector<int> left(n + 1, 0);
  for (int i = 0; i < n; i++) {
    left.at(i + 1) = gcd(left.at(i), a.at(i));
  }
  vector<int> right(n + 1, 0);
  for (int i = n - 1; i >= 0; i--) {
    right.at(i) = gcd(right.at(i + 1), a.at(i));
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    int l = left.at(i);
    int r = right.at(i + 1);
    ans = max(ans, gcd(l, r));
  }

  cout << ans << endl;
}


Measured memory_bytes: 1536
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <string>
using namespace std;
const int maxn=1e4+5;

struct node
{
	int x;
	int y;
	bool vis;
}red[maxn],blue[maxn];

bool cmp(node n1,node n2)
{
    return n1.x < n2.x;
}

int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>red[i].x>>red[i].y;
		red[i].vis=0;
	}
		
	for(int i=0;i<n;i++)
	{
		cin>>blue[i].y>>blue[i].x;
		blue[i].vis=0;
	}
	sort(red,red+n,cmp);
	sort(blue,blue+n,cmp);
	int i=0,j=0,ans=0;
	
	for(i=n-1;i>=0;i--)
	{
		for(j=0;j<n;j++)
		{
			if(blue[j].vis) continue;
			if(blue[j].x>red[i].y&&blue[j].y>red[i].x)
			{
			
				blue[j].vis=1;
				ans++;
				break;
			}
		}
	}
	cout<<ans<<endl;
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1LL<<62
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

struct edge {
	int from,to;
	ll cost;

	edge(int t,int c) : to(t),cost(c) {}
	edge(int f,int t,int c) : from(f),to(t),cost(c) {}

	bool operator<(const edge &e) const {
		return cost < e.cost;
	}
};

ll H[100005], Y[100005];
vector<edge> G[100005];
ll d[100005];

void dijkstra(int s, int n, int h) {
	priority_queue<PP,vector<PP>,greater<PP> > que;
	fill(d,d+n,INF);

	d[s] = 0;
	Y[s] = h;
	que.push(PP(P(0, h), s));

	while(que.size()) {
		PP p = que.top();
		que.pop();

		ll cost = p.first.first;
		ll cur = p.first.second;
		int v = p.second;
		if(d[v] < cost) continue;

		rep(i,G[v].size()) {
			edge e = G[v][i];

			if(H[v] < e.cost) continue;

			if(cur - e.cost < 0) {
				if(e.cost - cur <= H[v] - cur && d[e.to] > d[v] + (e.cost - cur) + e.cost) {
					d[e.to] = d[v] + (e.cost - cur) + e.cost;
					Y[e.to] = 0;
					que.push(PP(P(d[e.to], 0), e.to));
				}
			} else if(cur - e.cost > H[e.to]) {
				if(cur - ((cur - e.cost) - H[e.to]) >= 0 && d[e.to] > d[v] + ((cur - e.cost) - H[e.to]) + e.cost) {
					d[e.to] = d[v] + ((cur - e.cost) - H[e.to]) + e.cost;
					Y[e.to] = cur - ((cur - e.cost) - H[e.to]) - e.cost;
					que.push(PP(P(d[e.to], cur - ((cur - e.cost) - H[e.to]) - e.cost), e.to));
				}
			} else {
				if(d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					Y[e.to] = cur - e.cost;
					que.push(PP(P(d[e.to], cur - e.cost), e.to));
				}
			}
		}
	}
}

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

	memset(H, 0, sizeof(H));
	memset(Y, 0, sizeof(Y));

	rep(i, n) cin >> H[i];
	rep(i, m) {
		ll a, b, c;
		cin >> a >> b >> c;

		a--;
		b--;

		G[a].push_back(edge(b, c));
		G[b].push_back(edge(a, c));
	}
	
	dijkstra(0, n, h);

	if(d[n-1] == INF) cout << -1 << endl;
	else cout << d[n-1] + (H[n-1] - Y[n-1]) << endl;

	return 0;
}

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

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll INF = 1LL << 62;

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

    ll N, K, Q;
    cin >> N >> K >> Q;
    vector<ll> A(N);
    for (auto&& a : A) {
        cin >> a;
    }

    ll ans = INF;

    for (auto minimum_number : A) {
        vector<ll> v;
        vector<ll> candidates;
        ll maxi = -1;
        for (ll r = 0; r <= N; r++) {
            if (r < N && A[r] >= minimum_number) {
                v.push_back(A[r]);
            } else if (v.size() != 0){
                sort(v.begin(), v.end());

                if (v.size() >= K) {
                    for (ll j = 0; j < v.size() - K + 1; j++) {
                        candidates.push_back(v[j]);
                    }
                }

                v.clear();
            }
        }

        if (candidates.size() < Q) {
            continue;
        }

        sort(candidates.begin(), candidates.end());

        ans = min(ans, candidates[Q - 1] - minimum_number);
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> bool max_self(T & a, const T & b){ 
  return b > a ? a = b, true : false; 
}
template<class T> bool min_self(T & a, const T & b){ 
  return b < a ? a = b, true : false;    
}
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
  FAST_IO
  int r, d, x;
  cin >> r >> d >> x;

  for(int rep = 0; rep < 10; ++rep){
    x = r * x - d;
    cout << x << '\n';
  }

  return 0;
}



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

//#define int long long
#define X first
#define Y second
#define pb push_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 5;

int n, a[N], c[N];
pair<int, int> b[N];

main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> c[i];
    for (int i = 1; i <= n; ++i) cin >> b[i].X, b[i].Y = i;
    sort(b + 1, b + n + 1);
    set<pair<int, int>> suff;
    for (int i = 1; i <= n; ++i) {
        a[i] = c[b[i].Y];
        suff.insert({a[i], i});
    }
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        auto it = suff.upper_bound({b[i].X, 1000000});
        if (it != suff.begin()) --it;
        if (it->X > b[i].X) return cout << "No\n", 0;
        auto curr = *it;
        suff.erase(it);
        //cerr << a[i] << " " << i << ", " << curr.X << " " << curr.Y << "\n";
        if (curr.Y == i) continue;
        suff.erase({a[i], i});
        suff.insert({a[i], curr.Y});
        swap(a[i], a[curr.Y]);
        assert(a[i] <= b[i].X);
        ++cnt;
    }
    //for (auto &x : suff) cerr << "(" << x.X << ", " << x.Y << ") ";
    //cerr << "\n";
    //for (int i = 1; i <= n; ++i) cerr << a[i] << " ";
    //cerr << "\n";
    if (cnt <= n - 2) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int n,h,w;

main() {
    cin >> n >> h >> w;
    ct((n-h+1)*(n-w+1))
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;
using Graph = Vvec<int>;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

void dfs(Graph& graph, vector<ll>& dp, int tmp = 0, int from = -1){
    for(auto& to: graph[tmp]){
        if(to != from){
            dfs(graph, dp, to, tmp);
            dp[tmp] ^= dp[to]+1;
        }
    }
}

int main()
{
    int N;
    cin >> N;
    Graph graph(N);
    for(int i=0; i<N-1; i++){
        int u, v;
        cin >> u >> v;
        u--; v--;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    vector<ll> dp(N);
    dfs(graph, dp);

    cout << ((dp[0]) ? "Alice" : "Bob") << "\n";
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

struct state
{
	int a,b,c;
};

ll sm1[MAX_N];
ll sm2[MAX_N];

int main()
{
    int x,y,z;
	scanf("%d%d%d",&x,&y,&z);
	int n = x+y+z;
	vector<state> vec(n);
	rep(i,n){
		int p,q,r;
		scanf("%d%d%d",&p,&q,&r);
		vec[i] = (state){p,q,r};
	}
	sort(all(vec),[](const state& s1,const state& s2){return (s1.a-s1.b) > (s2.a-s2.b);});
	priority_queue<int,vector<int>,greater<int> > que;
	rep(i,x){
		if(i==0){
			sm1[i] = vec[i].a;
		}else{
			sm1[i] = sm1[i-1] + vec[i].a;
		}
		que.push(vec[i].a-vec[i].c);
	}
	for(int i=x;i<n-y;i++){
		int val = que.top();
		if(val < vec[i].a-vec[i].c){
			sm1[i] = sm1[i-1] - val;
			que.pop();
			que.push(vec[i].a-vec[i].c);
			sm1[i] += vec[i].a;
		}else{
			sm1[i] = sm1[i-1] + vec[i].c;
		}
	}
	priority_queue<int,vector<int>,greater<int> > que2;
	for(int i=n-1;i>=n-y;i--){
		sm2[i] = sm2[i+1] + vec[i].b;
		que2.push(vec[i].b-vec[i].c);
	}
	for(int i=n-y-1;i>=x;i--){
		int val = que2.top();
		if(val < vec[i].b-vec[i].c){
			sm2[i] = sm2[i+1] - val;
			que2.pop();
			que2.push(vec[i].b-vec[i].c);
			sm2[i] += vec[i].b;
		}else{
			sm2[i] = sm2[i+1] + vec[i].c;
		}
	}
	ll mx = 0;
	for(int i=x-1;i<n-y;i++){
		mx = max(mx,sm1[i]+sm2[i+1]);
	}
	cout << mx << endl;
    return 0;
}


Measured memory_bytes: 3008
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>

using namespace std;

bool isprime(int n)
{
	for(int j=2;j*j<=n;j++)
	{
		if(n%j==0)
		{
			return 0;
		}
	}
	return 1;
}


int q;
int a[100010];
int s[100010];

int main()
{
	for(int i=3;i<=100000;i+=2)
	{
		if(isprime(i) && isprime((i+1)/2))
		{
			a[i]=1; 
		}		
		
	}
	for(int i=1;i<=100000;i++)
	{
		s[i]=s[i-1]+a[i];
	}
	
	cin>>q;
	while(q--)
	{
		int l,r;
		cin>>l>>r;
		int tmp=0;
		tmp=s[r]-s[l-1];
		cout<<tmp<<endl;
	}
	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

int main() {
    int h, w, n, a, x, y;
    cin >> w >> h >> n;
    int d[4] = {0, w, 0, h};
    for (int i = 0; i < n; i++) {
        cin >> x >> y >> a;
        a--;
        if (a == 0)d[a] = max(d[a], x);
        if (a == 2)d[a] = max(d[a], y);
        if (a == 1)d[a] = min(d[a], x);
        if (a == 3)d[a] = min(d[a], y);
    }
    cout << max(0, (d[1] - d[0])) * max(0, (d[3] - d[2])) << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3

import sys

def solve(input_):
    input_.sort()
    min_ = input_[len(input_) // 2 - 1]
    max_ = input_[len(input_) // 2]
    return max_ - min_

def main():
    sys.stdin.readline()
    inputs = [int(s) for s in sys.stdin.readline().rstrip().split(" ")]
    print(solve(inputs))

main()

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K;cin>>N>>K;
    int H[N];int dp[N];
    const int C=1000000000;
    for(int i=0;i<N;i++){
        cin>>H[i];
    }int temp;
    dp[0]=0;
    for(int i=1;i<min(N,K);i++){
        temp=C;
        for(int j=0;j<i;j++){
           temp=min(temp,dp[j]+abs(H[i]-H[j]));
        }dp[i]=temp;//cout<<dp[i]<<endl;
    }if(N<=K){
        cout<<dp[N-1]<<endl;
        return 0;
    }for(int i=K;i<N;i++){
        temp=C;
        for(int j=1;j<=K;j++){
            temp=min(temp,dp[i-j]+abs(H[i]-H[i-j]));
        }dp[i]=temp;
    }cout<<dp[N-1]<<endl;
}

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

int main() {
  int h,w,p=0,q=0;
  cin >> h >> w;
  vector<vector<char>> s(w,vector<char>(h));
  vector<char> u(h,'.');
  for (int i=0;i<h;i++) {
    for (int j=0;j<w;j++) {
    cin >> s.at(j).at(i);
    }
  }
  for (int i=0;i<w;i++) {
   if (s.at(i)!=u)
    q++;
  }
 vector<vector<char>> t(h,vector<char>(q));
 for (int i=0;i<w;i++) {
    if (s.at(i)!=u) {
     for (int j=0;j<h;j++)
       t.at(j).at(i-p)=s.at(i).at(j);
    }
    else
      p++;
  }
  vector<char> v(q,'.');
   for (int i=0;i<h;i++) {
     if (t.at(i)!=v) {
      for (int j=0;j<q;j++)
       cout << t.at(i).at(j);
      cout << endl;
     }
   }
}

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

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

int main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    int cnt = 0;
    while (n > 0) {
        ++cnt;
        n /= k;
    }
    cout << cnt;

    return 0;
}


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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set

    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }

    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }

    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }

    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

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

    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
        return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

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

using namespace std;

int main()
{
  int A, B; cin >> A >> B;
  for (int i = 1; i <= 3; ++i) {
    if (A * B * i % 2 == 1) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std ;
bool cmp(long int a , long int b ) {
	return a>b ;
}
int main() {
	long int n  , i , k=0  ;
	long long sum=0 ;
	int flag=1 ;
	cin>>n ;
	vector<long int> v(n) ;
	for(i=0;i<n;i++) 
	   cin>>v[i] ;
	sort(v.begin() , v.end() , cmp) ;
	for(i=0;i<n-1;i++)  {
		if(flag==0)  {
			sum+=v[k] ;
			flag=1 ;
		} else {
			sum+=v[k] ;
			flag=0 ;
			k++ ;
		}
	}
	cout<<sum ;
}

Measured memory_bytes: 4788
#include<stdio.h>
#include<algorithm>
using namespace std;
char in[110];
int main(){
    scanf("%s",in);
    bool ok=true;
    for(int i=0;i<26;i++){
        int cnt=0;
        for(int j=0;in[j];j++)if(in[j]=='a'+i)cnt++;
        if(cnt%2)ok=false;
    }
    if(ok)printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)(x).size())
#define mset(a,v) memset(a,v,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
typedef long long ll;

#define MAXN 200005

ll ft[MAXN+1];
void upd(int i0, ll v){
	for(int i=i0+1;i<=MAXN;i+=i&-i)ft[i]=max(ft[i],v);
}
ll get(int i0){
	ll r=0;
	for(int i=i0;i;i-=i&-i)r=max(r,ft[i]);
	return r;
}

int n,h[200005],a[200005];

int main(){
	scanf("%d",&n);
	fore(i,0,n)scanf("%d",h+i);
	fore(i,0,n)scanf("%d",a+i);
	fore(i,0,n)upd(h[i],get(h[i])+a[i]);
	printf("%lld\n",get(n+1));
	return 0;
}

Measured memory_bytes: 3328
def judge(exp,torf,i):
	if i==3:
		return eval(exp)
	else:
		return judge(exp,torf+[True],i+1) or judge(exp,torf+[False],i+1)
		
while 1:
	exp=raw_input().split("|")
	if exp[0]=="#":break
	for j in range(len(exp)):
		dic=[]
		exp[j]=list(exp[j])[1:-1]
		for i in range(len(exp[j])):
			if exp[j][i]=="&":exp[j][i]="and"
			elif exp[j][i]=="~":exp[j][i]="not"
			else:
				if exp[j][i] not in dic:
					dic.append(exp[j][i])
					exp[j][i]="torf["+str(len(dic)-1)+"]"
				else:
					exp[j][i]="torf["+str(dic.index(exp[j][i]))+"]"
		exp[j]=" ".join(map(str,exp[j]))
	for clause in exp:
		if judge(clause,[],0):
			print "yes"
			break
	else:
		print "no"

Measured memory_bytes: 4292
N,K = map(int, input().split())
A = list(map(int, input().split()))



step = [0] * (N+1)
step[0] = 1
curr = 1
cnt = 0
visited = [False] * N
first = [0] * N

while True:
      
      if visited[curr-1]:
            break
      nxt = A[curr-1]
      first[curr-1] = cnt
      visited[curr-1] = True
      step[cnt] = curr
      cnt += 1
      curr = nxt
      
#print(step, cnt, first)

if K < cnt:
  print(step[K])
else:
  step[cnt] = curr
  num_loop = cnt - first[curr-1]
  K -= first[curr-1]
  K %= num_loop
  print(step[K + first[curr-1]])
  #print(cnt, num_loop, K)

Measured memory_bytes: 32388
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
a, b, c, d = map(int, input().split())

ans = -INF
for x in [a, b]:
    for y in [c,d]:
        ans = max(ans, x * y)
print(ans)


Measured memory_bytes: 9472
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N = int(input())
    S = []
    for _ in range(N):
        s = input()[:-1]
        S.append(s)
    
    print(len(set(S)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 106652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 1000000000;

int main(){
    double a, b, n;
    cin >> a >> b >> n;
    double xx = min(n, b - 1);
    ll ans = floor(a * xx / b) - (a * floor(xx / b));
    cout << ans;
}

Measured memory_bytes: 3724
#include <iostream>

#define rep(i, n) for (i = 1; i <= n; i++)

using namespace std;

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

int main() {
	int k;
	cin >> k;
	
	int i, j, m, res = 0;
	rep (i, k) {
		rep(j, k) {
			rep(m, k) {
				res += gcd(gcd(i, j), m);
			}
		}
	}
	
	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 3620
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    A = sorted(nl())
    D = [A[i + 1] - A[i] for i in range(2)]
    print(sum(D))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long N, M;
    cin >> N >> M;
    map<unsigned long long, bool> map_A;
    map<unsigned long long, unsigned long long> map_W;

    for(unsigned long long i=0; i<M; i++)
    {
        unsigned long long temp_p;
        string temp_S;
        cin >> temp_p >> temp_S;
        if(temp_S == "AC")
        {
            map_A[temp_p] = true;
        }
        if(temp_S == "WA")
        {
            // keyがあるか検索
            auto it = map_A.find(temp_p);
            // なければまだ正答してないので追加する
            if(it == map_A.end())
                map_W[temp_p]++;
        }
    }

    cout << map_A.size();
    cout << " ";

    // WAを出した問題のうち、ACが出てないものは除外する
    unsigned long long sum = 0;

    for(auto it = map_W.begin(); it != map_W.end(); it++)
    {
        if(map_A[(*it).first])
        {
            sum = sum + (*it).second;
        }
    }
    cout << sum << endl;
    return 0;
}

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

int main(){
    string s;
    cin>>s;
    int cnt=0;
    int ans=0;
    for(char c:s){
        if(c=='0'){
            if(cnt<0){
                ans+=2;
            }
            ++cnt;
        }
        else{
            if(cnt>0){
                ans+=2;
            }
            --cnt;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdlib>
#include <algorithm>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

long long N,M,ans;
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	if(N * 2 >= M){
		ans = M/2;
	}else{
		ans = (M + N*2)/4;
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	ios::sync_with_stdio(false);
	cin >> N >> M;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <cstring>
using namespace std;
#define ll long long

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(c + a, min(a + b, b + c)) << endl;
	return 0;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}

// ------------------- include, typedef, define END. -------------------

string solve(vector<vector<char> > in){
	char mozi[3] = { 'b', 'w', '+' };
	string ret;
	FOR(i, 0, 3){
		FOR(j, 0, 3){
			bool flg = true;
			// 横に見る
			FOR(k, 0, 3){
				if (in[j][k] != mozi[i]){
					flg = false;
				}
			}
			if (flg)
				if (mozi[i] != '+')
					return ret=mozi[i];
			
			// 縦に見る
			flg = true;
			FOR(k, 0, 3){
				if (in[k][j] != mozi[i]){
					flg = false;
				}
			}
			if (flg)
				if (mozi[i] != '+')
					return ret = mozi[i];
		}
	}
	// 斜めに見る
	FOR(i, 0, 3){
		bool flg = true;
		for (int j = 0, k = 0; j < 3, k < 3; j++, k++){
			if (in[j][k] != mozi[i])
				flg = false;
		}
		if (flg)
			if (mozi[i] != '+')
				return ret = mozi[i];

		flg = true;
		for (int j = 2, k = 0; j >=0, k <3; j--, k++){
			if (in[j][k] != mozi[i])
				flg = false;
		}
		if (flg)
			if (mozi[i] != '+')
				return ret = mozi[i];
	}
	return "NA";
}

int main(){
	int n = 0;
	string firstLine;

	while (getline(cin, firstLine), firstLine != "0"){
		vector<vector<char> > in(3,vector<char>(3));
		// 最初の行
		istringstream stream(firstLine);
		char temp;
		int count = 0;
		while (stream >> temp,!stream.eof()){
			in[0][count] = temp;
			count++;
		}
		// 2行目・3行目
		FOR(i, 1, 3){
			FOR(j, 0, 3){
				cin >> temp;
				in[i][j] = temp;
			}
		}
		cout << solve(in) << endl;
		//cin >> temp; 
		cin.ignore();
	}

	return 0;
}

Measured memory_bytes: 1228
A,B = map(int,input().split())

if A > B:
  for i in range(1,B+1):
    if A*i%B ==0:
      print(A*i)
      break
    else:
      pass
if B > A:
  for i in range(1,A+1):
    if B*i%A ==0:
      print(B*i)
      break
    else:
      pass
    

Measured memory_bytes: 2940
#include <stdio.h>
int main(){
	
	int K,X;
	int yen = 500;
	
	scanf("%d %d", &K,&X);
	
	if(K*yen>=X)
	{
		printf("Yes\n");
	}
	
	if(K*yen<X)
	{
		printf("No\n");
	}
	return 0;
	
}

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

void trace(int a[],int n){
  int i;
  for(i=0;i<n;i++){
    if(i>0) cout<<' ';
    cout<<a[i];
  }
  cout<<endl;
}

void bubblesort(int a[],int n){
  bool flag=1;
  int res=0;
  while (flag){
    flag=0;
    for(int j=n-1;j>=1;j--){
      if(a[j]<a[j-1]){
        swap(a[j],a[j-1]);
        res++;
        flag=1;
      }
    }
  }
  trace(a,n);
  cout<<res<<endl;
}

int main() {
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  bubblesort(a,n);
  return 0;
}



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

int main(){
    int N;
    cin >> N;
    map<int, int64_t> mp;
    for(int i=0; i<N; i++){
        int A;
        cin >> A;
        int a = A;
        for(int i=1; i*i<=a; i++){
            if(a%i == 0){
                mp[i] += A;
                if(i < a/i) mp[a/i] += A;
            }
        }
    }
    int64_t ans = 0;
    for(auto& p : mp) if(p.first > 1) ans = max(ans, p.second);
    cout << ans << endl;
    return 0;
}



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



int main() {
int N, M, X;
cin >> N >> M >> X;
int kane[200000];
for(int i = 0; i < M; i++){
cin >> kane[i];
}
int si = 0;
int syu = 0;

for(int i = 0; i < M; i++){
if(kane[i] > X) syu++;
else si++;
}

if(syu > si)cout << si << endl;
else cout << syu << endl;



}


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

int main(){
    char b;
    cin >> b;

    switch (b)
    {
    case 'A':
        cout << 'T' << endl;
        break;
    case 'T':
        cout << 'A' << endl;
        break;
    case 'C':
        cout << 'G' << endl;
        break;
    case 'G':
        cout << 'C' << endl;
        break;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,i;
  double ans=0;
  cin>>n;
  std::vector<double> data(n);

  for(i=0;i<n;i++){
    cin>>data.at(i);
  }

  for(i=0;i<n;i++){
    ans+=(1/data.at(i));
  }

  cout<<(1/ans)<<endl;

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;
struct edge { ll from; ll to; ll cost; };

edge es[2020];
ll d[1010];
ll n, m;

bool shortest_path(ll s, ll t) {
	rep(i, 0, n)d[i] = inf;
	d[s] = 0;
	rep(i, 0, 3*n)rep(j, 0, m) {
		edge e = es[j];
		if (d[e.from] != inf && d[e.to] > d[e.from] + e.cost) {
			d[e.to] = d[e.from] + e.cost;
			if (e.to == t && i == 3 * n - 1)return true;
		}
	}
	return false;
}

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

	rep(i, 0, m) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		es[i] = {a,b,-c};
	}
	
	if (shortest_path(0,n-1))cout << "inf" << endl;
	else cout << -d[n-1] << endl;

	return 0;
}

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

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    if(a%2 == 0 || b%2 == 0 || c%2 == 0){
        cout << 0 << endl;
        return 0;
    }
    cout << min({a*b, b*c, a*c}) << endl;
    return 0;
}   

/*

3＊5＝15
15*2=30
15*3=45


*/

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
main(){
int i,j,k,l,m,n;
char s1[10],s2[10];
while(cin>>s1>>s2){
    m=strlen(s1);
    n=strlen(s2);
    k=0;l=0;
    for(i=0;i<m+n;i++){
        if(i<m) k=(k*10+(s1[i]-48));
        else k=(k*10+(s2[i-m]-48));

    }
    for(i=0;i<m+n;i++){
        if(i<n) l=(l*10+(s2[i]-48));
        else l=(l*10+(s1[i-n]-48));

    } i=sqrt(k);
    j=sqrt(l);
    if(i*i==k||j*j==l)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
} return 0;
}


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

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    for(int i = 0; i < 100; i++)
    {
        if(A*i%B==C){
            cout << "YES" << endl;
            return 0;
        }
    }

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


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  int S=1;
  int G=N;
  set<int> s;
  set<int> g;
  set<int> x;
  REP(i,M){
    int a,b;
    cin>>a>>b;
    if(a==S)s.insert(b);
    if(a==S)s.insert(b);
    if(b==G)g.insert(a);
    if(b==G)g.insert(a);
  }
  set_intersection(ALL(s),ALL(g),inserter(x,x.end()));
  if(x.empty())cout<<"IMPOSSIBLE"<<endl;
  else cout<<"POSSIBLE"<<endl;
  // for_each(ALL(s),[](int x){
  //   cout<<x<<endl;
  // });
  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string.h>
#include <stack>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    string s;
    cin >> s;
    if(s[0] != 'A'){cout << "WA" <<endl;return 0;}
    int cnt =0;
    rep(i, 1, s.size()){
        if(2 <= i && i <= s.size()-2) {
            if(s[i] == 'C') cnt++;
            if(cnt >1){cout << "WA" <<endl;return 0;}
        } else {
            if (65 <= s[i] && s[i] <= 90 ) {
                cout << "WA" <<endl;return 0;
            }
        }
    }
    if(!cnt){cout << "WA" <<endl;return 0;}
    cout << "AC" <<endl;return 0;
    return 0;
}



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

int main() {
  int n, k;
  cin >> n >> k;
  int r, s, p;
  cin >> r >> s >> p;
  string t;
  cin >> t;

  int total = 0;

  for(int i=0;i<k;i++) {
    char previous = 'a';
    for(int j=i;j<n;j+=k) {
      if(t[j] == previous) {
        previous = 'a';
      }
      else {
        if(t[j] == 's') {
          total += r;
          previous = 's';
        }
        else if(t[j] == 'p') {
          total += s;
          previous = 'p';
        }
        else if(t[j] == 'r') {
          total += p;
          previous = 'r';
        }
      }
    }
  }

  cout << total << endl;
}

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

int main() {
	// your code goes here
	long long a;
	long long b;
	cin>>a;
	long long arr[a]={0};
	long long dif[a]={0};
	long long d=abs(a-b);
	for(int x=0;x<a;x++)
	{
		cin>>arr[x];
		dif[x]=arr[x];
	}
	sort(dif,dif+a);
	int c=0;
	for(int x=0;x<a;x++)
	{
		if(arr[x]!=dif[x])
		c++;
	}
	if(c==2||c==0)
	cout<<"YES";
	else
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lson (o<<1)
#define rson (o<<1|1)
#define fi first
#define sc second
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
using namespace std;
const double pi=acos(-1);
const double eps=1e-6;
inline int lowbit(int x){return x&(-x);}
inline int read(){
	int f=1,x=0;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return f*x;
}
template<typename T> inline T max(T x,T y,T z){return max(max(x,y),z);}
template<typename T> inline T min(T x,T y,T z){return min(min(x,y),z);}
template<typename T> inline T sqr(T x){return x*x;}
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
template<typename A,typename B,typename C> inline A fpow(A x,B p,C yql){
	A ans=1;
	for(;p;p>>=1,x=1LL*x*x%yql)if(p&1)ans=1LL*x*ans%yql;
	return ans;
}
struct FastIO{
	static const int S=1310720;
	int wpos;char wbuf[S];
	FastIO():wpos(0){}
	inline int xchar(){
		static char buf[S];
		static int len=0,pos=0;
		if(pos==len)pos=0,len=fread(buf,1,S,stdin);
		if(pos==len)return -1;
		return buf[pos++];
	}
	inline int read(){
		int c=xchar(),x=0;
		while(c<=32&&~c)c=xchar();
		if(c==-1)return -1;
		for(;'0'<=c&&c<='9';c=xchar())x=x*10+c-'0';
		return x;
	}
}io;
//#define read io.read
ll n,k,v[55];
ll solve(ll l,ll r)
{
	vector<ll> t;
	for(int i=0;i<=l;i++) t.push_back(v[i]);
	for(int i=r;i<n;i++) t.push_back(v[i]);
	sort(t.begin(),t.end());
	ll lim=k-t.size();
	if(lim<0) return 0;
	ll sum=0;
	for(int i=0;i<t.size();i++)
	{
		if(t[i]<0&&lim>0) lim--;
		else sum+=t[i];
	}
	return sum;
}
int main()
{
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	cin >> n >> k;
	for(int i=0;i<n;i++) cin >> v[i];
	ll ans=0;
	for(int i=-1;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			ans=max(ans,solve(i,j));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
cards = {'S':[], 'H':[], 'C':[], 'D':[]}
for _ in range(int(input())):
    m, n = input().split()
    cards[m].append(int(n))

for m in ['S','H','C','D']:
    cc = cards[m]
    for i in range(1,14):
        if i in cc:
            continue
        print(m,i)


Measured memory_bytes: 5596
/*input
8 6
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int n;
	cin>>n;
	if(n<1000) cout<<"ABC";
	else cout<<"ABD";
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

bool CheckN(int n, int D[]) {
	string N = to_string(n);

	int len = N.length();
	bool flag;
	REP(i, len) {

		flag = 0;
		REP(j, 10) {
			if (D[j] == 0) continue;
			if ((N[i] - '0') == j) {
				flag = 1;
				break;
			}
		}

		if (flag == 0) return 0;
	}

	return 1;
}

int main() {
	int n;
	int K;
	int D[10];
	int d;
	REP(i, 10) D[i] = 1;
	cin >> n >> K;

	REP(i, K) {
		cin >> d;
		D[d] = 0;
	}


	while (n < 1000000) {
		if (CheckN(n, D)) {
			cout << n << endl;
			return 0;
		}
		n++;
	}

	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define pi 2.0*acos(0.0)
#define INTM 1e18
#define mod 1e9+7
#define FOR(i,j,n)    for(ll i=j;i<n;i+=99999)
#define RFOR(i,j,n)    for(ll i=j;i>=n;i--)

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

int main(){
    ll a,b;
    cin>>a>>b;
    ll ans = 0;
    if(a+b==3) ans = 3;
    if(a+b==4) ans = 2;
    if(a+b==5) ans = 1;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    int n,k;
    cin >> n >> k;
    int MIN = 1e6;
    int cnt=1;
    rep(i,n)
    {
        int a;
        cin >> a;
        if(MIN>a){
            MIN=a;
            cnt=1;
        }
        else if(MIN==a)cnt++;
        
    }
    int ans;
    if((n-cnt)%(k-1)==0)ans = (n-cnt)/(k-1);
    else ans = (n-cnt)/(k-1)+1;
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int X;
 cin >> X;
 int Day = X % 7;
if(Day==0) cout << "thu" << endl;
else if(Day==1) cout << "fri" << endl;
 else if(Day==2) cout << "sat" << endl;
else if(Day==3) cout << "sun" << endl;
    else if(Day==4) cout << "mon" << endl;
    else if(Day==5) cout << "tue" << endl;
else cout << "wed" << endl;
}



Measured memory_bytes: 3096