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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int m,t,p,r;
    cin >> m >> t >> p >> r;
    if(m==0) return 0;
    vector<vector<int>> w(t,vector<int>(p,0));
    vector<int> ac(t,0);
    vector<int> pn(t,0);
    int keika,team,prob,judge;
    rep(i,r){
      cin >> keika >> team >> prob >> judge;
      team--,prob--;
      if(judge==0){
        ac[team]++;
        pn[team]+=keika+w[team][prob]*20;
      }else{
        w[team][prob]++;
      }
    }
    vector<int> id(t);
    iota(all(id),0);
    sort(all(id),[&](const int &l, const int &r){
      return ac[l]==ac[r]?(pn[l]==pn[r]?l>r:pn[l]<pn[r]):ac[l]>ac[r];
    });
    rep(i,t){
      if(i>0){
        if(ac[id[i-1]]==ac[id[i]]&&pn[id[i-1]]==pn[id[i]]) cout << '=';
        else cout << ',';
      }
      cout << id[i]+1;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int n;
    cin >> n;
    ll a[n], odd = 1;
    rep(i, n) cin >> a[i];
    ll ans = 1;    
    rep(i, n){
        ans *= 3;
        if (!(a[i]%2)) odd *= 2;
    }
    cout << ans - odd << endl;

    return 0;
}

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

int main(){
	while(true){
		int N;
		cin >> N;
		
		if(N <= 0){
			break;
		}
		
		char c[200];
		cin >> c;
		
		int field = 0;
		
		int count[N];
		for(int i=0; i<N; ++i){
			count[i] = 0;
		}
		
		for(int i=0; i<100; ++i){
			int user = (i % N);
			switch(c[i]){
				case 'M': // man
					count[user]++;
					break;
				case 'S': // bouzu
					field += count[user]+1;
					count[user]=0;
					break;
				case 'L': // lady
					count[user] += field+1;
					field = 0;
					break;
			}
		}
		
		sort(count, count+N);
		
		for(int i=0; i<N; ++i){
			cout << count[i] << " ";
		}
		cout << field <<endl;
	}
}


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

int main()
{
    long long N, X, D;
    cin >> N >> X >> D;

    if (D == 0)
    {
        if (X == 0)
        {
            cout << 1 << endl;
        }
        else
        {
            cout << N + 1 << endl;
        }
        return 0;
    }
    if (D < 0)
    {
        D *= -1;
        X *= -1;
    }

    map<long long, set<pair<long long, long long>>> count;
    for (long long i = 0; i <= N; i++)
    {
        long long idx = ((X % D) * (i % D)) % D;
        while (idx < 0)
        {
            idx += D;
        }
        long long offset = X * i / D;
        long long maximum = (N * (N - 1) / 2) - (N - i) * (N - i - 1) / 2;
        long long minimum = i * (i - 1) / 2;
        count[idx].insert(make_pair(minimum + offset, maximum + offset));
    }
    long long ans = 0;
    for (auto c : count)
    {
        long long minimum = LONG_LONG_MIN;
        long long maximum = LONG_LONG_MIN;
        for (auto p : c.second)
        {
            minimum = max(minimum, p.first);
            maximum = max(maximum, p.second);
            ans += max(0ll, maximum - minimum + 1);
            minimum = maximum + 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 31488
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,A,B = LI()
    G = LIR(n)
    n1 = n>>1
    n2 = n-n1
    s1 = defaultdict(lambda : float("inf"))
    s2 = defaultdict(lambda : float("inf"))
    for j in range(1<<n1):
        sa = 0
        sb = 0
        sc = 0
        for i in range(n1):
            if j&(1<<i):
                a,b,c = G[i]
                sa += a
                sb += b
                sc += c
        if s1[(sa,sb)] > sc:
            s1[(sa,sb)] = sc
    m = 1
    for j in range(1<<n2):
        sa = 0
        sb = 0
        sc = 0
        for i in range(n2):
            if j&(1<<i):
                a,b,c = G[i+n1]
                sa += a
                sb += b
                sc += c
        if sa > m:
            m = sa
        if s2[(sa,sb)] > sc:
            s2[(sa,sb)] = sc
    ans = float("inf")
    for (a,b),c in s1.items():
        for i in range(m+1):
            s = B*(i+a)
            if s%A:
                continue
            j = (s//A)-b
            nc = s2[(i,j)]
            cost = c+nc
            if a == b == i == j:
                continue
            if cost < ans:
                ans = cost
    if ans == float("inf"):
        print(-1)
        return
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 55644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

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

using P = pair<int,int>;
vector<vector<int>> s;

int solve(int y, int x, int k, set<P> st,int depth){
    if(depth > 10) return INF;
    if(k == -1){
        int res = INF;
        rep(i,4) {
            int ny = y+dy[i];
            int nx = x+dx[i];
            if(ny<0 || nx<0 || ny>=Y || nx>=X) continue;
            if(s[ny][nx] == 3) return 1;
            if(!(s[ny][nx] == 1 && st.count({ny,nx})==0)){
                res = min(solve(ny,nx,i,st,depth+1),res);
            }
        }
        return res+1;
    }
    while(true){
        int ny = y+dy[k];
        int nx = x+dx[k];
        if(ny<0 || nx<0 || ny>=Y || nx>=X) return INF; //fall
        if(s[ny][nx] == 3) return 0;
        if(s[ny][nx] == 1 && st.count({ny,nx})==0){
            st.insert({ny,nx});
            return solve(y,x,-1,st,depth);
        }
        y = ny, x = nx;
    }
}

int main(void){
    while(cin>>X>>Y, X|Y){
        s.clear(); s.resize(Y);

        int sy,sx,gy,gx;
        rep(y,Y){
            s[y].resize(X);
            rep(x,X){
                cin>>s[y][x];
                if(s[y][x] == 2){
                    sy = y, sx = x;
                    s[y][x] = 0;
                }
                if(s[y][x] == 3){
                    gy = y, gx = x;
                }
            }
        }
        set<P> st;
        int res = solve(sy,sx,-1,st,0);
        cout<<(res>10 ? -1 : res)<<endl;
    }
    return 0;
}



Measured memory_bytes: 2988
#include <stdio.h>
int n,k,a[1000010];
bool check(int ans){
    int now=0,t=0;
    for(int i=0;i<n;i++){
        if(now+a[i]>ans){
            t++;
            now=0;
        }
        now+=a[i];
    }
    
    return t<k;
}
int main(){
    int top=0,tot=0,mid;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(a[i]>top)top=a[i];
        tot+=a[i];
    }
    while(tot-top>1){
        mid=(tot+top)/2;
        if(check(mid))tot=mid;
        else top=mid;
    }
    if(check(top))printf("%d\n",top);
    else printf("%d\n",tot);
}

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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;

vector<int> x;
vector<int> y;
vector<bool> visited;

int N;
double ans = 0;
double sum = 0;

signed main() {
  cin >> N;

  x = vector<int>(N);
  y = vector<int>(N);

  REP(i, N) cin >> x[i] >> y[i];

  REP(i, N) REP(v, N){
    if(i == v) continue;
    ans += sqrt(pow(x[i]-x[v], 2)+pow(y[i]-y[v], 2));
  }

  /* FOR(i, 1, N+1){ */
  /*   ans /= i; */
  /* } */

  printf("%.9f\n", ans/N);

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<unordered_map>
#include<cmath>
#include<iterator>
using namespace std;

int main()
{
    unordered_multimap<int, int> mp;
    unordered_map<int, int> :: iterator it;
    int N, A, B, C, ans=0;
    cin>>N;
    for(A=1;A<=N;A+=1)
    {
        if(A>=N)
        {
            break;
        }
        for(B=1;B<=N;B+=1)
        {
            if(A*B>=N)
            {
                break;
            }
            if(A*B<N)
            {
                mp.insert(pair<int, int> (A, B));   
            }
        }
    }
    cout<<mp.size()<<endl;
}


Measured memory_bytes: 580052
def main():
    n = int(input())
    result = {
        'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0
    }
    for _ in range(n):
        s = input()
        result[s] += 1

    for key in result.keys():
        print('{} x {}'.format(key, result[key]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 74724
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define rep(a,b) for(int a=0;a<b;a++)
int main() {
	int n;
	int nt, nx, ny;
	cin >> n;
	cin >> nt >> nx >> ny;
	if (n == 1) {
		if ((nx + ny) % 2 != nt % 2 || nx + ny > nt) {
			cout << "No" << endl;
			return 0;
		}
	}
	rep(i, n - 1) {
		int t, x, y;
		cin >> t >> x >> y;
		int ts = t - nt, xs = abs(x - nx), ys = abs(y - ny);
		if ((xs + ys) % 2 != ts % 2 || xs + ys > ts) {
			cout << "No" << endl;
			return 0;
		}
		nt = t, nx = x, ny = y;
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <set>
using namespace std;

int main(){
	int N,i,flag;
	scanf("%d",&N);
	set<int> a;
	for(i=0;i<N;i++){
		scanf("%d",&flag);
		a.insert(flag);
	}
    if(N==a.size())
        printf("YES\n");
    else
	    printf("NO\n");    
	return 0;
}


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

using namespace std;

int main(){
    int a,b,ans = -1;
    cin >> a >> b;
    for(int i = 0;i <= 10000;i++){
        int x = i;
        if(x*8/100 == a && x/10 == b){
            ans = x;
            break;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  Rep(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) Rep(i,0,(n))
#define  all(a) begin(a),end(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
 
int main()
{
    int a,b;
    char c;
    cin>>a>>c>>b;
    if(c=='+') cout<<a+b<<endl;
    if(c=='-') cout<<a-b<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    
    int w,h;
    int i,j;
    
    while(1){
        scanf("%d %d",&h,&w);
        
        if(h==0&&w==0){
            break;
        }
        
        for(j=0;j<w;j++){
            printf("#");
        }
        printf("\n");
        
        for(i=1;i<h-1;i++){
            printf("#");
            for(j=1;j<w-1;j++){
                printf(".");
            }
            printf("#\n");
        }
        
        for(j=0;j<w;j++){
            printf("#");
        }
        printf("\n\n");

    }
    return 0;
}

Measured memory_bytes: 1736
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		char[] c=s.toCharArray();
		int count1=0;
		int count2=0;
		for(int i=0;i<c.length;i++){
			if((i%2==0&&c[i]=='0')||(i%2!=0&&c[i]=='1'))
				count1++;
			if((i%2==0&&c[i]=='1')||(i%2!=0&&c[i]=='0'))
				count2++;
		}
		System.out.println(count1<count2?count1:count2);		
	}
	
}

Measured memory_bytes: 28420
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int n, i;
	cin >> n;
	int arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	int ans = 0;
	fo(i, 1, n - 1){
		int mx = max(arr[i], max(arr[i + 1], arr[i - 1]));
		int mn = min(arr[i], min(arr[i + 1], arr[i - 1]));
		if(arr[i] != mx && arr[i] != mn)
		ans++;
	}
	cout << ans;
}

Measured memory_bytes: 256
/*https://atcoder.jp/contests/dp/tasks/dp_d*/
#include <bits/stdc++.h>
#include <sstream> 
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define pi 2*acos(0.0)
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repe(i,a,b) for(ll i=a;i<=b;++i)
#define CPrint(c)  for(auto i:(c)) { cout<<i<<" "; } nl 
#define eb   emplace_back
#define ef   emplace_front
#define pb   push_back
#define pf   push_front
#define popb pop_back
#define popf pop_front
#define mp   make_pair
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
//Allows to traverse any type of macro
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
//debuggers
#define trace2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define trace3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define trace4(w,x,y,z) cout<<#w<<"="<<w<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
typedef long long ll;
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<ll,ll> pll;
const int INF = 1e9+5;
int main()
{
	FAST_IO;
	ll n,w;
	cin >> n >> w;
/*total weight and total value is known. Total weight is huge and now let's use total value as dim*/
vector<ll> weight(n),val(n);
// dp[i]=min total weight of items with total value = i

rep(i,0,n)
{
	cin >> weight[i] >> val[i];
}
ll valsum = 0;
rep(i,0,n)
{
	valsum+=val[i];
}
vector<ll>dp(valsum+1,INF);
dp[0] = 0;//base case
for(int item=0;item<n;item++)
{
	for(int j = valsum-val[item];j>=0;j--)
	{
		dp[j+val[item]] = min(dp[j+val[item]], dp[j]+weight[item]);
	}
}

/*for(int i=0;i<=valsum;i++)
{
	if(dp[i]!=INF)
		cout << dp[i] << " " << i << " " << "\t";
}*/
cout << endl;
ll ans = 0;
for(ll i=0;i<=valsum;i++)
{
	if(dp[i]<=w)
		ans = max(ans,i);
}
cout << ans << endl;
//min total weight with value i
}


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

int main() {
    ios::sync_with_stdio(false);
    int n, r, minv, maxv;
    cin >> n >> r;
    minv = r; // R[0]
    
    cin >> r; // R[1]
    maxv = r-minv; 
    minv = min(r, minv);
    
    n = n - 2;
    while (n) {
        cin >> r; 
        maxv = max(maxv, r-minv);
        minv = min(r, minv);
        n--;
    }
    cout << maxv << endl;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  string s1, s2, s3, s4, s5;
  s1 = s;
  int N = s.size();
  reverse(begin(s), end(s));
  if (s1 == s)
  {
    s2 = s1.substr(0, (N - 1) / 2);
    s3 = s2;
    reverse(begin(s2), end(s2));
    if (s2 == s3)
    {
      s4 = s3.substr((N + 3)/2-2, N -(N + 3)/2-2);
      s5 = s4;
      reverse(begin(s4), end(s4));
      if (s5 == s4)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

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

const ll INF = 1e18;
const int MX = 2005;

int main() {
  int k,a,b,A,B;
  cin >> k >> a >> b;
  A = a / k;
  B = b / k;
  if(A < B || a % k == 0 || b % k == 0){
    cout << "OK" << endl;
  }else{
    cout << "NG" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    ll ans,c,i;
    cin>>s;
    ans=0; c=0;
    for(i=0;i<s.length();i++) {
    	if(s[i]=='S') {
    		ans=max(ans,c);
    		c=0;
		} else c++;
	}
	ans=max(ans,c);
	cout<<ans;
}

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

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

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

int cx[]{ 0,1,1,1,2,2,2,2,2,3,3,3,4 }, cy[]{ 2,1,2,3,0,1,2,3,4,1,2,3,2 };
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
int d[5][5], lim, D, x[2], y[2];
bool dfs(int p) {
	if (D == 0)return true;
	if (p + D > lim)return false;
	rep(j, 2)rep(i, 4) {
		int nx = x[j] + dx[i], ny = y[j] + dy[i];
		if (nx < 0 || 5 <= nx || ny < 0 || 5 <= ny || !d[nx][ny])continue;
		int a = abs(cx[d[nx][ny]] - nx) + abs(cy[d[nx][ny]] - ny);
		int b = abs(cx[d[nx][ny]] - x[j]) + abs(cy[d[nx][ny]] - y[j]);
		D += b - a; swap(d[x[j]][y[j]], d[nx][ny]); swap(x[j], nx); swap(y[j], ny);
		if (dfs(p + 1))return true;
		D -= b - a; swap(d[x[j]][y[j]], d[nx][ny]); swap(x[j], nx); swap(y[j], ny);
	}
	return false;
}
int main() {
	while (1) {
		D = 0; int p = 0;
		rep(i, 13) {
			scanf("%d", &d[cx[i]][cy[i]]);
			if (d[cx[i]][cy[i]] == -1)return 0;
			if (d[cx[i]][cy[i]] == 0) {
				x[p] = cx[i]; y[p++] = cy[i];
			}
			else D += abs(cx[i] - cx[d[cx[i]][cy[i]]]) + abs(cy[i] - cy[d[cx[i]][cy[i]]]);
		}
		for (lim = 0; lim <= 20; lim++) {
			if (dfs(0)) {
				printf("%d\n", lim); break;
			}
		}
		if (lim == 21)puts("NA");
	}
}

Measured memory_bytes: 3144
N,K = map(int,input().split())
min = N
x = N

div = int(N/K)
x = abs(x - (div*K))
if x < min:
    min = x
while x >= K:
    x = abs(x-K)
    if x < min:
        min = x
x = abs(x-K)
if x < min:
    min = x
print(min)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int d1[1000004]={0};

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(9)<<fixed;
	
	int n;
	cin>>n;
	map<string,int> m;
	string s;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		m[s]++;
	}
	cout<<"AC "<<"x "<<m["AC"]<<endl;
	cout<<"WA "<<"x "<<m["WA"]<<endl;
	cout<<"TLE "<<"x "<<m["TLE"]<<endl;
	cout<<"RE "<<"x "<<m["RE"]<<endl;
	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) //cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a[11][11],b,d,n,m,x,y,z,k[11],h,w,sum,mi,ma,ans,s,t,l,r,res,tmp,itr,p[11],q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<int, int> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<int,int> > VP;

int main(){
    cin>>n>>m;
    rep(i,m){
        cin>>k[i];
        rep(j,k[i])cin>>a[i][j];
    }
    rep(i,m)cin>>p[i];
    rep(i,1<<n){
        flag=1;
        d(i)
        rep(r,m){
            d(r)
            sum=0;
            rep(j,k[r]){
                d(a[r][j])
                if(i>>a[r][j]-1 & 1)sum++;
            }
            d(sum)
            if(sum%2!=p[r]){flag=0;break;}
        }
        if(flag==1)ans++;
    }
    p(ans);
    return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
slist=[]
for i in range(M):
    slist.append(list(map(int,input().split())))
ans=["0"]*N


for i in range(len(slist)):
    #print("i",i)
    if ans[slist[i][0]-1] == "0":
        ans[slist[i][0]-1] = slist[i][1]
    elif ans[slist[i][0]-1] == slist[i][1]:
        continue
    else:
        ans=["-1"]
        break

#print(ans)

if N>=2:
    if ans[0]=="0":
        ans[0]=1
    elif ans[0]==0:
        ans=["-1"]


    
for i in range(len(ans)):
    if ans[i]=="0":
        ans[i]=0

print(*ans,sep=(""))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;
	string s, t;
	cin >> N >> s >> t;
	int common = 0;
	for(int i = 1; i <= N; i++){
		if(s.substr(N - i, i) == t.substr(0, i)) common = i;
	}
	cout << N * 2 - common << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i,high[3]={0,0,0},temp=0;
	for (i=0;i<10;i++){
		scanf("%d",&temp);
		if (high[2]<temp){
			high[2]=high[1];
			if (high[1]<temp){
				high[1]=high[0];
				if (high[0]<temp){
					high[0]=temp;
				}else{
					high[1]=temp;
				}
			}else{
				high[2]=temp;
			}
		}
	}
	
	for (i=0;i<3;i++){
		printf("%d\n",high[i]);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	vector<bool> dp((ll)s.size()+1,false);
	dp[(ll)s.size()]=true;
	REP(i,(ll)s.size()) {
		bool buf=false;
		if(i+1<5) continue;
		if(i+1>=5) {
			if(s.substr((ll)s.size()-1-i,5)=="dream") {
				buf=buf|dp[(ll)s.size()-1-i+5];
			}
			if(s.substr((ll)s.size()-1-i,5)=="erase") {
				buf=buf|dp[(ll)s.size()-1-i+5];
			}
		}
		if(i+1>=6) {
			if(s.substr((ll)s.size()-1-i,6)=="eraser") {
				buf=buf|dp[(ll)s.size()-1-i+6];
			}
		}
		if(i+1>=7) {
			if(s.substr((ll)s.size()-1-i,7)=="dreamer") {
				buf=buf|dp[(ll)s.size()-1-i+7];
			}
		}
		dp[(ll)s.size()-1-i]=buf;
	}
	if(dp[0]) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


Measured memory_bytes: 512
#include<stdio.h>

int n;
int A[2000001],B[2000001];

void CountingSort(int k);

int main(){
  int i;
  int max = 0;

  scanf("%d", &n);
  for(i = 1; i <= n; i++){
    scanf("%d", &A[i]);
    if(max < A[i]) max = A[i];
  }

  CountingSort(max);

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

void CountingSort(int k){
  int i, j;
  int C[10000];

  for(i = 0; i <= k; i++){
    C[i] = 0;
  }

  /* C[i] に i の出現数を記録する */
  for(j = 1; j <= n; j++){
    C[A[j]]++;
  }

  /* C[i] に i 以下の数の出現数を記録する*/
  for(i = 1; i <= k; i++){
    C[i] = C[i] + C[i - 1];
  }

  for(j = n; j >= 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}




Measured memory_bytes: 17388
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }

int n,a[N],k;

int can(int x)  {
	   int ct=0;	   
	   rep(i,0,n) {
		   ct+=ceil((long double)a[i]/x)-1;	       
		 }		 
		 return (ct<=k);	
	}
	
	
void solve() {
    cin>>n>>k;
    rep(i,0,n)
      cin>>a[i];
      
    
    int lo=0,hi=*max_element(a,a+n)+1;
    int ans=hi;
    
    while(hi-lo>1) {
		  int mid=(lo+hi)>>1;
		  
		  if(can(mid)) {
			    hi=mid;
			    ans=min(ans,hi); 
			  }
		  else
		    lo=mid;	  
		}
		
		cout<<ans<<endl;
      
	  
 }

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


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

int main () {
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    for(int i = 0;i<m;++i){
        cin >> b[i];
    }
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n){
        rep(j,m){
            cin >> a[i][j];
        }
    }
    int ans = 0;
    rep(i,n){
        int sum = 0;
        rep(j,m){
            sum += a[i][j] * b[j];
        }
        if ( sum + c > 0) {
            ++ ans ;
        }
    }
    cout << ans << endl ;
}

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

int main() {
	int n; cin >> n;
	vector<int>a(n), p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		a[p[i] - 1] = i;
	}

	int res, cnt; res = cnt = 1;
	for (int i = 1; i < n; i++) {
		if (a[i - 1] < a[i])res++;
		else res = 1;		
		cnt = max(cnt, res);
	}
	cout << n - cnt << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
	int a, b;
	cin >> a >> b;
	if (a <= b)
	{
		rep(i, b)
		{
			cout << a;
		}
		cout << "\n";
	}
	else
	{
		rep(i, a)
		{
			cout << b;
		}
		cout << "\n";
	}

	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;

int main()
{
    string n;
    cin >> n;
    string last = n.substr(n.size() - 1, 1);
    if (last == "2" || last == "4" || last == "5" || last == "7" || last == "9")
    {
        cout << "hon" << endl;
    }
    else if (last == "0" || last == "1" || last == "6" || last == "8")
    {
        cout << "pon" << endl;
    }
    else if (last == "3")
    {
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3632
#include <cstdio>  
#include <cstring>  
#include <algorithm>  
#include <queue>  
#include <iostream>  
#include <string>  
#include <cmath>  
#include <vector>  
#include <set>  
#include <map>  
#include <bitset>  
#include <stack>  
using namespace std;  
  
#define REP(i,n) for ( int i=1; i<=int(n); i++ )    
#define MP make_pair  
#define PB push_back  
#define SZ(x) (int((x).size()))  
#define ALL(x) (x).begin(), (x).end()  
#define X first  
#define Y second  
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }  
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }  
  
typedef long long LL;  
typedef long double LD;  
const int INF = 0x3f3f3f3f;  
typedef pair<int, int> pii;

int main() {
	int n;
	cin >> n;
	string a, b;
	cin >> a >> b;
	int c = 0;
	for(int i = 0; i < n; i ++) {
		bool flag = 0;
		for(int j = 0; j + i < n; j ++)
			if(a[i + j] == b[j]) continue;
			else { flag = 1; break; }
		if(flag == 0) { c = n - i; break; }
	}
	cout << SZ(a) + SZ(b) - c << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int K = GetInt();
		var ok = new bool[N];
		for(int i = 0; i < K; i++)
		{
			int d = GetInt();
			for(int j = 0; j < d; j++)
				ok[GetInt() - 1] = true;
		}
		WriteLine(N - ok.Count(x => x));
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 28324
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

typedef long long ll;

const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e2 + 5;

int arr[MAXN];

int main() {
	int n, m, sum = 0;
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", arr + i);
		sum += arr[i];
	}
	scanf("%d", &m);
	for(int i = 0; i < m; ++i) {
		int p, x;
		scanf("%d%d", &p, &x);
		printf("%d\n", sum - arr[p] + x);
	}
	return 0;
}


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

signed main(void){
    int n; cin >> n;
    vector<int>ans(n,0);
    for(int i=0;i<n-1;i++){
        int c,s,f; cin >> c >> s >> f;
        for(int j=0;j<=i;j++){
            if(ans[j]<s) ans[j] = s+c;
            else ans[j] = ((ans[j]-s+f-1)/f)*f + s + c;
        }
    }
    for(int i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
using namespace std;
int main()
{
	string s;
	cin >> s;

	if (s[0] == s[1] && s[2] == s[3] && s[2] == s[1]) {
		cout << "No";
	}
	else if (s[0] == s[1] && s[2] == s[3]) {
		cout << "Yes";
	}
	else if (s[0] == s[2] && s[1] == s[3]) {
		cout << "Yes";
	}
	else if (s[0] == s[3] && s[1] == s[2]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}


	return 0;
}

Measured memory_bytes: 256
import heapq

h,w = map(int,input().split())
C = [list(map(int,input().split())) for _ in range(10)]
A = [list(map(int,input().split())) for _ in range(h)]

distance = [10**6 for i in range(10)]
visited = [False for i in range(10)]
heap = []
cost = 0

distance[1] = 0
visited[1] = True
for i in range(10):
    heapq.heappush(heap,[C[i][1],i])

while heap:
    minedge = heapq.heappop(heap)
    if visited[minedge[1]]:
        continue
    v = minedge[1]
    distance[v] = minedge[0]
    visited[v] = True
    for i in range(10):
        if not visited[i]:
            heapq.heappush(heap,[C[i][v]+distance[v],i])

for i in range(h):
    for j in range(w):
        if A[i][j] != -1:
            cost += distance[A[i][j]]

print(cost)

Measured memory_bytes: 3444
from bisect import bisect
n = int(input())
dp = [10**10]*(n+1)
dp[0] = -1
for i in range(n):
    a = int(input())
    idx = bisect(dp, a-1)
    dp[idx] = min(a, dp[idx])
print( bisect(dp, 10**10-1)-1)


Measured memory_bytes: 9472
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

map < char, int > mm;

int main() {
	fastio;
	int n, k; cin >> n >> k;
	int r,s,p; cin >> r >> s >> p;
	
	mm['r'] = p; mm['s'] = r; mm['p'] = s;

	int ans = 0;

	string str; cin >> str;
	

	vector < int > dp(n, 0);

	for(int i = 0; i < k; ++i) {
		ans += mm[str[i]];
		dp[i] = ans;
	}

	for(int i = k; i < n; ++i) {
		if(str[i] == str[i - k]) {
			dp[i] = dp[i - 1];
			str[i] = 'x';
		}
		else {
			dp[i] = dp[i - 1] + mm[str[i]];
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 848
import collections
s = input()
n = len(s)

l = len(list(str(bin(2**(n-1))))) - 2
ans = [int(s)]

for i in range(1,2**(n-1)):
    bit = bin(i)
    bit = str(bit)
    bit = list(bit)
    bit.pop(0)
    bit.pop(0)
    for k in range(l-len(bit)):
        bit.insert(0,"0")
    
    temp = 0
    start = 0
    for k in range(l):
        if bit[k] == '1':
            temp += int(s[start:k])
            start = k
    temp += int(s[start:n])
    ans.append(temp)

print(sum(ans))

Measured memory_bytes: 3444
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const int mod = 1e9;
using namespace std;

int main() {
	ll N;
	cin >> N;
	ll ans = 0;
	for (int i = 1; i < ((double)sqrt(4*N+1)-1)/2; ++i) {
		if ((N - i) % i == 0)ans += (N - i) / i;
		}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	char s[18];
	scanf("%s", s);
	int n=strlen(s);
	for(int i=1; i<n; i++){
		if(s[i]!='9'){
			printf("%d\n", s[0]-'0'-1+(n-1)*9);
			return 0;
		}
	}
	printf("%d\n", s[0]-'0'+(n-1)*9);
}


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

using namespace std;
using ll = unsigned long long;
ll mo=1e9+7;
int main() {
    int n,ma,mb;
    cin>>n>>ma>>mb;
    vector<tuple<int,int,int>> abc;
    for(int i=0;i<n;++i){
        int a,b,c;
        cin>>a>>b>>c;
        abc.emplace_back(a,b,c);
    }
    constexpr int inf = 1<<20;
    int ret = inf;
    vector<vector<int>> from(550,vector<int>(550,inf));
    auto to = from;
    from[0][0] = 0;
    for(int i=0;i<n;++i){
        int a = get<0>(abc[i]);
        int b = get<1>(abc[i]);
        int c = get<2>(abc[i]);
        for(int j=0;j<500;++j){
            for(int k=0;k<500;++k){
                to[j][k] = from[j][k];
                if(j-a >=0 &&  k-b >=0) to[j][k] = min(to[j][k],from[j-a][k-b] + c);
            }
        }
        swap(to,from);
    }
    
    for(int j=1;j<500;++j){
        for(int k=1;k<500;++k){
            if(j*mb == k*ma)ret = min(ret,from[j][k]);
        }
    }
    
    if(ret != inf)cout << ret << endl;
    else cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    string a;
    cin >> a;
    if(a == "SUN"){
        cout << 7 << endl;
    }else if(a == "MON"){
        cout << 6 << endl;
    }else if(a == "TUE"){
        cout << 5 << endl;
    }else if(a == "WED"){
        cout << 4 << endl;

    }else if(a == "THU"){
        cout << 3 << endl;
    }else if(a == "FRI"){
        cout << 2 << endl;
    }else if(a == "SAT"){
        cout << 1 << endl;
    }
  

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
 using namespace std ;
 int main()
{
short int a,b,c,d;

cin>>a;
cin>>b;
cin>>c;
cin>>d;
if((abs(c-a))<=d) cout<< "Yes";
else
 if((abs(c-b)<=d)&& ( abs(b-a)<=d) ) cout<< "Yes";
else
cout<< "No";




}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
int dp[3002][3002];
//main
signed main(){
  int N;cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  if(N==1){cout<<v[0]<<endl;return 0;}
  if(N%2==0){
    for(int i=0;i<=N-2;i++)dp[i][i+1]=abs(v[i]-v[i+1]);
    for(int j=3;j<=N;j++){
      for(int i=0;i<=N-j;i++){
        if(j%2)dp[i][i+j-1]=min(dp[i+1][i+j-1]-v[i],dp[i][i+j-1-1]-v[i+j-1]);
        else dp[i][i+j-1]=max(dp[i+1][i+j-1]+v[i],dp[i][i+j-1-1]+v[i+j-1]);
      }
    }
  }
  else{
    for(int i=0;i<=N-2;i++)dp[i][i+1]=(-1)*abs(v[i]-v[i+1]);
    for(int j=3;j<=N;j++){
      for(int i=0;i<=N-j;i++){
        if(j%2)dp[i][i+j-1]=max(dp[i+1][i+j-1]+v[i],dp[i][i+j-1-1]+v[i+j-1]);
        else dp[i][i+j-1]=min(dp[i+1][i+j-1]-v[i],dp[i][i+j-1-1]-v[i+j-1]);
      }
    }
  }
  /*
  for(int i=0;i<=4;i++){
    for(int j=0;j<=4;j++)cout<<dp[i][j]<<" ";cout<<endl;
  }
  */
  cout<<dp[0][N-1]<<endl;
}


Measured memory_bytes: 70016
#include <stdio.h>
int main() {
	int n;
	char s;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%c ", &s);
		if (s == 'Y') {
			printf("Four\n");
			return 0;
		}
	}
	printf("Three\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
	int a[100], size;
	cin >> size;
	for(int i = 0;i < size;i++)
		cin >> a[i];

	for (int i = size - 1; i > 0; i--)
		cout << a[i] << " ";
	cout << a[0] << endl;
	return 0;
}


Measured memory_bytes: 3092
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 100000000001
const long mod = INF+7;

int main(){
  int N,W;
  cin >> N >> W;
  vector<int> w(N), v(N);
  rep(i,N){
    cin >> w[i] >> v[i];
  }

  long **dp=(long **)malloc(sizeof(long *)*N);
  rep(i,N){
    dp[i]=(long *)malloc(sizeof(long)*100001);
    rep(j,100001){
      dp[i][j]=INF;
    }
  }
  dp[0][0]=0;
  dp[0][v[0]]=w[0];

  rep(i,N-1){
    rep(j,100001){
      if(dp[i][j]!=INF){
        dp[i+1][j]=min(dp[i+1][j], dp[i][j]);
        dp[i+1][j+v[i+1]]=min(dp[i+1][j+v[i+1]], dp[i][j]+w[i+1]);
      }
    }
  }

  int ans=100000;
  while(dp[N-1][ans]>W){
    ans--;
  }

  printf("%d\n", ans);


}


Measured memory_bytes: 78592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e3+2;
char res[N];
ll dp[N][N];
 
int main()
{
 	string s,t;   
    cin>>s>>t;
    ll ns=s.length();
    ll nt=t.length();
    for(int i=1;i<=ns;i++){
     for(int j=1;j<=nt;j++){
      if(s[i-1]==t[j-1])dp[i][j]=dp[i-1][j-1]+1;
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
     }
    }
  
    ll i=ns;
    ll j=nt;
  	ll rc = 0;
  
    while(i!=0 && j!=0)
    {
     if(s[i-1]==t[j-1])
     {
      rc++;
      res[rc]=s[i-1];
      i--;j--;
     }
     else
     {
      if(dp[i-1][j]>=dp[i][j-1])
        i--;
      else 
        j--;
     }
    }
  
    for(int i=rc;i>=1;i--)
      cout<<res[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 70656
n, k, q = map(int, input().split())
count = [k] * n
safe = [True] * n
for i in range(q):
    a = int(input())
    count[a-1] += 1
    if count[a-1] - (i-1) <= 0:
        safe[a-1] = False
for i in range(n):
    if count[i] <= q:
        safe[i] = False
for b in safe:
    if b: print('Yes')
    else: print('No')

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

int main() {
  int N;
  cin >> N;
  if (N < 1200) {
    cout << "ABC" << endl;
  }
  else if (N < 2800) {
    cout << "ARC" << endl;
  }
  else {
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
namespace CsProgramSpace
{
    class Program
    {
        static void Main(string[] args)
        {
            short[] u = (Console.ReadLine().Split(' ').Select(_ => short.Parse(_)).ToArray());
            if (u[0] < u[1] && u[1] < u[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 18416
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<iostream>
#include<set>
#include<queue>
#include<stack>
using namespace std;
int n;
int q;
int ite1,ite2;
char s[100010];
char t[200020];
char b[200020];
int st;
char c[5];
int main()
{
	st=1;
	scanf("%s",s+1);
	n=strlen(s+1);
	cin>>q;
	for(int o=1;o<=q;o++)
	{
		int f;
		scanf("%d",&f);
		if(f==1)
		{
			st=(st^1);
		}
		else
		{
			int y;
			scanf("%d",&y);
			y--;
			cin>>c[1];
			if(st!=1)
			{
				y=(y^1);
			}
			if(y==0)
			{
				t[++ite1]=c[1];
			}
			else
			{
				b[++ite2]=c[1];
			}
		}
	}
	if(st==1)
	{
		//printf("Yes\n");
	    for(int i=ite1;i>=1;i--)
	    {
	    	cout<<t[i];
		}
		for(int i=1;i<=n;i++)
		{
			cout<<s[i];
		}
		for(int i=1;i<=ite2;i++)
		{
			cout<<b[i];
		}
	}
	else
	{
		for(int i=ite2;i>=1;i--)
		{
			cout<<b[i];
		}
		for(int i=n;i>=1;i--)
		{
			cout<<s[i];
		}
		for(int i=1;i<=ite1;i++)
		{
			cout<<t[i];
		}
	}
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
int main() {
	int n, d,ans=0;
	double x, y;
	cin >> n >> d;
	while (n--) {
		cin >> x >> y;
		double c;
		c = sqrt(pow(x, 2) + pow(y, 2));
		if (c <= d)ans++;

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

Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int MAX_N = 30000;

vector<int> prime;
bool is_prime[MAX_N+1];

void sieve(int n){
  int p = 0;
  for(int i=0;i<=n;i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      prime.push_back(i);
      for(int j=2*i;j<=n;j+=i) is_prime[j] = false;
    }
  }
}

int solve(int n){
  int res = 0;
  for(int i=0;i<prime.size();i++){
    if(prime[i]>n) break;
    for(int j=i;j<prime.size();j++){
      if(prime[i]+prime[j]>n) break;
      int tmp = n-prime[i]-prime[j];
      if(tmp >= prime[j]){
        if(is_prime[tmp]){
          if(prime[i] + prime[j] > tmp && prime[i] + tmp > prime[j] && prime[j] + tmp > prime[i]) res++;
        }
      }
    }
  }
  return res;
}

main(){
  sieve(MAX_N);
  int in;
  while(cin >> in && in){
    cout << solve(in) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
use std::io::*;

fn main() {
  let stdin = stdin();
  let mut lines = stdin.lock().lines();

  for line in lines {
    let n: f64 = line.unwrap().parse().unwrap();
    if n < 0. { return; }

    let nf = n * 16.;
    let ni = nf as u64;
    
    if ni > 0xfff || nf.fract() != 0. {
      println!("NA");
    }
    else {
      println!("{:08b}.{:04b}", ni >> 4, ni & 0b1111);
    }
  }
}



Measured memory_bytes: 5124
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let c: char = iter.next().unwrap().chars().next().unwrap();

    let result = match c {
        'A' => 'T',
        'T' => 'A',
        'C' => 'G',
        'G' => 'C',
        _ => 'Z',
    };

    println!("{}", result);
}

Measured memory_bytes: 4352