akhauriyash/Code-Regression huggingface dataset:
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < (int)s.length(); ++i) {
		char c = s[i] - 'A';
		c = (c + n) % 26;
		s[i] = ('A' + c);
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
/*
      author : nishi5451
      created: 11.08.2020 22:36:41
*/

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


int main(){
    string s,t;
    cin >> s >> t;
    string ans = t+s;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int n;
  cin >> n;
  int now = 1;
  rep(i,0,n){
    int a;
    cin >> a;
    if(now == a) now++; 
  }
  if(now == 1) cout << -1 << endl;
  else cout << n - now + 1 << endl;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int n, a, b, c;
    cin >> n;
    int dp[n+1] = {0};
    if(n==1){
        cout << 0 << endl;
        return 0;
    }
    cin >> a >> b;
    dp[2] = abs(a-b);
    if(n==2){
        cout << dp[2] << endl;
        return 0;
    }
    for(int i=3; i<=n; i++){
        cin >> c;
        dp[i] = min((dp[i-2]+abs(a-c)), (dp[i-1]+abs(b-c)));
        a = b;
        b = c;
    }
    cout << dp[n];
}

Measured memory_bytes: 4028
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define int long long
#define inf 200000000000
const int maxnodes=1005;
#define ll long long
#define N 2501
#define EPS 0.01
#define ld long double



ll fastexpom(ll a,ll b,ll m)
{
  ll res=1;
      while(b>0)
      {
        if(b%2==1)
          res=(((res)%m)*((a)%m))%m;
        a=(((a)%m)*((a)%m))%m;
        b/=2;
      }
      return res;
}
ll modinv(ll a, ll m=1000000007)
{
  return fastexpom(a,m-2,m);
}


int32_t main()
{
    IOS;

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> low,mid,high,r,b,g;
    for(int i = 0;i < 3*n;i++)
    {
        if(s[i] == 'R')
        {
            r.push_back(i);
        }
        if(s[i] == 'G')
        {
            g.push_back(i);
        }
        if(s[i] == 'B')
        {
            b.push_back(i);
        }
    }
    for(int i = 0;i < n;i++)
    {
        vector<int> temp({r[i],b[i],g[i]});
        sort(temp.begin(),temp.end());
        low.push_back(temp[0]);
        mid.push_back(temp[1]);
        high.push_back(temp[2]);

    }
    int ans = 1;
    int j = 0;
    for(int i = 0;i < n;i++)
    {
        while(j < n and low[j] < mid[i])
            j++;
        ans = (ans * (j-i)) % mod;
    }
    j = n - 1;
    for(int i = n - 1;i >= 0;i--)
    {
        while(j >=0 and high[j] > mid[i])
        {
            j--;
        }
        ans = (ans * (i - j))%mod;
    }
    for(int i = 1;i <= n;i++)
        ans = (ans * i)%mod;
    cout << ans;
}

Measured memory_bytes: 6028
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int>graph[200005];
bool visited[200005];
bool f(int curr,int dist){
	visited[curr] = true;
	if(dist==2) return (curr==n);
	bool ret = 0;
	for(int i=0; i<graph[curr].size(); i++){
		int nx = graph[curr][i];
		if(!visited[nx]) ret|=f(nx,dist+1);
	}
	return ret;
}
int main(){
	int m;
	cin>>n>>m;
	while(m--){
		int a,b;
		cin>>a>>b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	if(f(1,0)) cout<<"POSSIBLE";
	else cout<<"IMPOSSIBLE";
}

Measured memory_bytes: 15100
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iomanip>

#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

using namespace std;

int main(){

  int i=0,n;
  int num[6]={0};
  int top,front;

  for(i=0;i<6;i++){
    cin >>num[i];
  }
  cin >>n;
  for(i=0;i<n;i++){
    cin >>top >>front;

    if(top==num[0]){
      if(front==num[1]) cout<<num[2] <<endl;
      if(front==num[2]) cout<<num[4] <<endl;
      if(front==num[3]) cout<<num[1] <<endl;
      if(front==num[4]) cout<<num[3] <<endl;
    }
    if(top==num[1]){
      if(front==num[0]) cout<<num[3] <<endl;
      if(front==num[2]) cout<<num[0] <<endl;
      if(front==num[3]) cout<<num[5] <<endl;
      if(front==num[5]) cout<<num[2] <<endl;
    }
    if(top==num[2]){
      if(front==num[0]) cout<<num[1] <<endl;
      if(front==num[1]) cout<<num[5] <<endl;
      if(front==num[4]) cout<<num[0] <<endl;
      if(front==num[5]) cout<<num[4] <<endl;
    }
    if(top==num[3]){
      if(front==num[0]) cout<<num[4] <<endl;
      if(front==num[1]) cout<<num[0] <<endl;
      if(front==num[4]) cout<<num[5] <<endl;
      if(front==num[5]) cout<<num[1] <<endl;
    }
    if(top==num[4]){
      if(front==num[0]) cout<<num[2] <<endl;
      if(front==num[2]) cout<<num[5] <<endl;
      if(front==num[3]) cout<<num[0] <<endl;
      if(front==num[5]) cout<<num[3] <<endl;
    }
    if(top==num[5]){
      if(front==num[1]) cout<<num[3] <<endl;
      if(front==num[2]) cout<<num[1] <<endl;
      if(front==num[3]) cout<<num[4] <<endl;
      if(front==num[4]) cout<<num[2] <<endl;
    }

  }

  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>>dp(n + 1, vector<long long>(n + 1, 1e15 + 1));
  vector<vector<int>>p(n + 1, vector<int>(n + 1, -1));
  for (int i = 1; i <= n; i++) {
    dp[i][i] = 0;
  }
  for (int len = 1; len <= n; ++len) {
    for (int i = 1; i < n - len + 1; ++i) {
      int j = i + len;
      if (j == i + 1) {
        dp[i][j] = a[j-1] + a[i-1];
        continue;
      }
      long long s = 0;
      for (int k = i; k <= j; k++) s += a[k-1];
      for (int k = i; k <= j - 1; k++) {
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + s);
      }
    }
  }
  cout << dp[1][n] << endl;  
  return 0;
}

Measured memory_bytes: 2176
#include "bits/stdc++.h"
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007LL;
int main()
{
	ll N,k;
	cin >> N >> k;
	ll number = 0;
	number = N / k;
	number = number * number*number;
	if (k%2 == 0 && N>=k/2){
		ll y = (N - k/ 2) / k+1;
		
		number = number + y*y*y;
	}
	cout << number << endl;
 
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include <stdlib.h>

int main(int argc, char const *argv[]) {

  int A[5];
  int res = 1000;

  std::cin >> A[0] >> A[1] >>A[2];

  A[3] = A[0];
  A[4] = A[1];


  for (size_t i = 0; i < 3; i++) {
    int B;
    B = abs(A[i+1] - A[i]) + abs(A[i+2] - A[i+1]);
    if(B < res) res = B;
    B =  abs(A[i+2] - A[i]) + abs(A[i+2] - A[i+1]);
    if(B < res) res = B;

  }

  std::cout << res << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n,d;
    cin >> n >> d;

    cout << (n-1) / (d * 2 + 1) +1 << endl; 

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (!isKaibun(s.substring(0, s.length() / 2))) {
            System.out.println("No");
            return;
        }
        if (!isKaibun(s)) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }

    private static boolean isKaibun(String s) {
        StringBuilder sb = new StringBuilder(s);
        sb.reverse();
        return s.equals(sb.toString());
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <map>
using namespace std;
int main()
{
    int n,m;
	char c;
	pair<char,char> data[10000];
	while(true){
		cin>>n;
		if(!n)break;
		for(int i=0;i<n;i++)cin>>data[i].first>>data[i].second;
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>c;
			for(int j=0;j<n;j++)if(data[j].first==c){c=data[j].second;break;}
			cout<<c;
		}
		cout<<endl;
	}
    return 0;
}

Measured memory_bytes: 1172
from collections import deque


class Dinic:
    def __init__(self, n):
        self.n = n
        self.links = [[] for _ in range(n)]
        self.depth = None
        self.progress = None

    def add_link(self, _from, to, cap):
        self.links[_from].append([cap, to, len(self.links[to])])
        self.links[to].append([0, _from, len(self.links[_from]) - 1])

    def bfs(self, s):
        depth = [-1] * self.n
        depth[s] = 0
        q = deque([s])
        while q:
            v = q.popleft()
            for cap, to, rev in self.links[v]:
                if cap > 0 and depth[to] < 0:
                    depth[to] = depth[v] + 1
                    q.append(to)
        self.depth = depth

    def dfs(self, v, t, flow):
        if v == t:
            return flow
        for i, link in enumerate(self.links[v]):
            if i < self.progress[v]:
                continue
            self.progress[v] = i
            cap, to, rev = link
            if cap == 0 or self.depth[v] >= self.depth[to]:
                continue
            d = self.dfs(to, t, min(flow, cap))
            if d == 0:
                continue
            link[0] -= d
            self.links[to][rev][0] += d
            return d
        return 0

    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            if self.depth[t] < 0:
                return flow
            self.progress = [0] * self.n
            current_flow = self.dfs(s, t, float('inf'))
            while current_flow > 0:
                flow += current_flow
                current_flow = self.dfs(s, t, float('inf'))


n = int(input())
an = list(map(int, input().split()))
mf = Dinic(n + 2)
max_value = 0
for i, a in enumerate(an):
    i += 1
    if a > 0:
        max_value += a
        mf.add_link(i, n + 1, a)
    else:
        mf.add_link(0, i, -a)
    for j in range(2 * i, n + 1, i):
        mf.add_link(i, j, float('inf'))
print(max_value - mf.max_flow(0, n + 1))


Measured memory_bytes: 3444
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int D;
int C[26];
int S[365][26];
int T[365];

int last[26];

int score(int day) {
    int cur = 0;
    REP (c, 26) last[c] = -1;

    REP (i, day) {
	int t = T[i];
	last[t] = i;

	cur += S[i][t];
	REP (c, 26) cur -= C[c] * (i - last[c]);
    }
    return cur;
}

void solve() {
    REP (day, D) {
	int best = 0, bestc = 0;
	REP (c, 26) {
	    T[day] = c;
	    int s = score(day+1);
	    if (best < s) {
		best = s;
		bestc = c;
	    }
	}
	T[day] = bestc;
	// eprintf("%d\n", best);
    }
}

void output() {
    REP (d, D) printf("%d\n", T[d]+1);
}

void MAIN() {
    scanf("%d", &D);
    REP (c, 26) scanf("%d", C+c);
    REP (i, D) REP (c, 26) scanf("%d", S[i]+c);

    solve();
    output();
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3864
# -*- coding:utf-8 -*-

import sys

array = []
for i in sys.stdin:
    array.append(i)

N = int(array[0])
for k in range(1,N+1):
    x = array[k].split()
    a, b, c = int(x[0]), int(x[1]), int(x[2])
    if a**2 + b**2 == c**2 or b**2 + c**2 == a**2 or c**2 + a**2 == b**2:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 7772
/*
    @Author: TieWay59
    @Date: 2019/11/22 13:38
    @Link: https://atcoder.jp/contests/agc040/tasks/agc040_b
    @Tags: idea
*/

#include <bits/stdc++.h>

#define  debug(x)  cerr <<#x << " = "<<x<<endl

#define endl '\n'
#define STOPSYNC ios::sync_with_stdio(false);cin.tie(nullptr)
#define MULTIKASE int Kase=0;cin>>Kase;for(int kase=1;kase<=Kase;kase++)
typedef long long ll;
const int MAXN = 2e5 + 59;
const int MOD = 1e9 + 7;
const int INF = 0x3F3F3F3F;
const ll llINF = 0x3F3F3F3F3F3F3F3F;
using namespace std;

int n, m;
struct node {
    ll l, r;
} a[MAXN];
ll maxL;
ll minR;
ll ans;
ll ansInLeft[MAXN];
ll ansInRight[MAXN];
node pairInLeft[MAXN];
node pairInRight[MAXN];

void solve(int kaseId = -1) {

    cin >> n;

    for (int i = 1; i <= n; ++i) {
        cin >> a[i].l >> a[i].r;
        ans = max(ans, a[i].r - a[i].l + 1);
    }

    sort(a + 1, a + 1 + n, [](node x, node y) {
        if (x.l == y.l)return x.r < y.r;
        return x.l < y.l;
//        return (x.r - x.l) < (y.r - y.l);
    });

    maxL = 0;
    minR = llINF;
    for (int i = 1; i <= n; ++i) {
        maxL = max(maxL, a[i].l);
        minR = min(minR, a[i].r);
        if (maxL <= minR) {
            ansInLeft[i] = minR - maxL + 1;
            pairInLeft[i] = {maxL, minR};
        } else {
            break;
        }
    }

    maxL = 0;
    minR = llINF;
    for (int i = n; i >= 1; --i) {
        maxL = max(maxL, a[i].l);
        minR = min(minR, a[i].r);
        if (maxL <= minR) {
            ansInRight[i] = minR - maxL + 1;
            pairInRight[i] = {maxL, minR};
        } else {
            break;
        }
    }

    for (int i = 1; i < n; ++i) {
        ans = max(ans, ansInLeft[i] + ansInRight[i + 1]);
    }

    for (int i = 2; i < n; ++i) {
        ll len = a[i].r - a[i].l + 1;
        if (ansInRight[i + 1] &&
            ansInLeft[i - 1] &&
            pairInRight[i + 1].l <= pairInLeft[i - 1].r) {
            ans = max(ans, len +
                           min(pairInLeft[i - 1].r, pairInRight[i + 1].r)
                           - pairInRight[i + 1].l + 1);
        }
    }

    cout << ans << endl;
}

/*void solves() {
    MULTIKASE {
        solve(kase);
    }
}*/

int main() {
    STOPSYNC;
//    solves();
    solve();
    return 0;
}
/*

 */

Measured memory_bytes: 12032
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint()
{
	int x=0,p=1;char c=getchar();
	while (c<=32)c=getchar();
	if(c==45)p=-p,c=getchar();
	while (c>32)x=x*10+c-48,c=getchar();
	return x*p;
}
using namespace std;
//
int n;
ll pre[4][1000];
vector<ll>cnt[4];
ll res=0,xx,yy,w;
//
int main()
{
	n=getint();w=1ll*getint();
	xx=getint();yy=getint();
	cnt[0].push_back(yy);
	rep(i,n-1)
	{
		int x=getint(),y=getint();
		cnt[x-xx].push_back(y);
	}
	rep(i,4)
	{
		sort(cnt[i].begin(),cnt[i].end());
		reverse(cnt[i].begin(),cnt[i].end());
		pre[i][0]=0;
		for(int j=1;j<=cnt[i].size();j++)
			pre[i][j]=pre[i][j-1]+1ll*cnt[i][j-1];
	}
	rep(i,cnt[0].size()+1)
		rep(j,cnt[1].size()+1)
			rep(k,cnt[2].size()+1)
			{
				ll l=(w-1ll*i*xx-1ll*j*(xx+1)-1ll*k*(xx+2));
				if(l<0)continue;
				l/=(xx+3);
				l=min(l,1ll*(ll)cnt[3].size());
				ll ans=pre[0][i]+pre[1][j]+pre[2][k]+pre[3][l];
				res=max(res,ans);
			}
	cout<<res<<endl;		
	return 0;
}


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

int main(){
	int n,m;
	int judge[100000];
	int h[100000];
	int a;
	int b;
	int ans=0;
	int i;
	cin>>n>>m;
	for(i=0;i<n;i++){
		cin>>h[i];
		judge[i]=1;
	}
	for(i=0;i<m;i++){
		cin>>a>>b;
		if(h[a-1]<=h[b-1]) judge[a-1]=0;
		if(h[a-1]>=h[b-1]) judge[b-1]=0;
	}
	for(i=0;i<n;i++){
		if(judge[i]==1) ans+=1;
	
	}
	cout<<ans;
}
	
	

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

int main(){
    int H, W;
    cin >> H >> W;
    string S[1000];
    for(int i=0; i<H; i++) cin >> S[i];

    vector<pair<int, int>> cand;
    for(int i=0; i<H; i++){
        int l = -1, r = -1;
        for(int j=0; j<W; j++) if(S[i][j] == 'B'){
            if(l == -1) l = j;
            r = j;
        }
        if(l >= 0){
            cand.emplace_back(i, l);
            cand.emplace_back(i, r);
        }
    }

    int ans = 0;
    for(auto& p : cand) for(auto& q : cand){
        int res = abs(p.first-q.first) + abs(p.second-q.second);
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}



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

int main() {
  string s;
  cin >> s;
  int red = 0;
  for (char c : s) {
    if (c == '0') ++red;
  }
  int blue = s.length() - red;
  cout << 2 * min(red, blue) << endl;
}


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

static const int N = 100;

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

	for (int i = 1; i <= n; i++) m[i][i] = 0;
	for (int l = 2; l <= n; l++) {
		for (int i = 1; i <= n - l + 1; i++) {
			int j = i + l - 1;
			m[i][j] = (1 << 21);
			for (int k = i; k <= j - 1; k++) {
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
				//cout << m[i][j] << endl;
			}
		}
	}

	cout << m[1][n] << endl;

	return 0;
}


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


using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;
bool isPrime[MAXN];



ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}

//__builtin_popcount ();
bool isPrim(int n)
{
    if (n == 1 || n == 0)
        return false;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}
int main()
{
    FAST
 ll n;
 cin>>n;
 ll ans=((n*(n+1))/2)-n;
 cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
 	int h,w,n;
  	cin >> h >> w >> n;
   	bool is_exist[1000001];
  
  	rep(i,0,h+1){
      is_exist[i*w] = true;
    }
  
  	rep(i,0,w+1){
      is_exist[i*h] = true;
    }
  
  	rep(i,0,h+1){
      rep(j,0,w+1){
        is_exist[(i*(w-j))+(j*(h-i))] = true;
      }
    }
   
  	if(is_exist[n]) cout << "Yes"<< endl;
  	else cout << "No" << endl;
  	
 	return 0; 
}

Measured memory_bytes: 1280
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
ll power(ll a ,ll b)
{
	ll res=1LL;
	while(b>0){
		if(b&1) res=(res*a) % mod;
		a=(a*a) % mod;
		b=b>>1;
	}
	return res % mod;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k; cin>>n>>k;
    ll arr[k+2]={0};
    for(int i=1;i<=k;i++){
        ll val=k/i;
        val=power(val,n);
        arr[i]=val;
    }
    
    for(int i=k;i>=1;i--)
    {
        ll sum=0;
        for(int j=2*i;j<=k;j+=i)
        {
            sum+=arr[j];
        }
        arr[i]-=sum;
        arr[i]%=mod; arr[i]+=mod; arr[i]%=mod;
    }
    ll ans=0;
    for(int i=1;i<=k;i++){
        ans=(ans+(arr[i]*i)%mod)%mod;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

#define MAX_DIST 1LL<<50
#define NMAX 3000
#define MMAX 5200

vector<ll> dist(NMAX,0);
bool negative[NMAX] = {false,};
ll a[MMAX];
ll b[MMAX];
ll c[MMAX];

void bellmanford(ll start, ll v, ll e, ll p){
    for(int i = 0; i < NMAX; i++){
        dist[i] = MAX_DIST;
    }
    dist[start] = 0;

    for(int i = 0; i < v-1; i++){
        for(int j = 0; j < e; j++){
            if(dist[a[j]] == MAX_DIST){continue;}
            if(dist[b[j]] > dist[a[j]] + c[j] + p){
                dist[b[j]] = dist[a[j]] + c[j] + p;
            }
        }
    }
    for(int i = 0; i < v; i++){
        for(int j = 0; j < e; j++){
            if(dist[a[j]] == MAX_DIST){continue;}
            if(dist[b[j]] > dist[a[j]] + c[j] + p){
                dist[b[j]] = dist[a[j]] + c[j] + p;
                negative[b[j]] = true;
            }
            if(negative[a[j]]){
                negative[b[j]] = true;
            }
        }
    }
}


int main(){
    ll n, m, p;
    cin >> n >> m >> p;


    for(int i = 0; i < m; i++){
        ll ta, tb, tc;
        cin >> ta >> tb >> tc;
        ta--; tb--;
        a[i] = ta;
        b[i] = tb;
        c[i] = -tc;
    }

    bellmanford(0, n, m, p);
    ll ans = -dist[n-1];
    if(negative[n-1]){cout << -1 << endl;}
    else{cout << max(ans, 0LL) << endl;}


    return 0;

}


Measured memory_bytes: 384
#include<cstdio>
#include<cmath>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

int main(void) {
	int N, D;
	scanf("%d %d", &N, &D);
	int X[10][10];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			scanf("%d", &X[i][j]);
		}
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			double d = 0;
			for (int k = 0; k < D; k++) {
				d += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
			d = sqrt(d);
			if (floor(d) == d) ans++;
		}
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 3780
//ITP 1_4_C
#include <iostream>
using namespace std;

int main(){
int a,b,ans;
char ch;

while(1){
    
    cin >> a >> ch >> b;
    
    if(ch == '?')
    break;
    
    if(ch == '+')
    ans = a+b;
    
    else if(ch == '-')
    ans = a-b;
    
    else if(ch == '*')
    ans = a*b;
    
    else if(ch == '/')
    ans = a/b;

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



Measured memory_bytes: 3116
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int n = Integer.parseInt(sc.nextLine());
            int[] ns = Stream.of(sc.nextLine().split(" "))
                    .map(Integer::parseInt)
                    .mapToInt(i -> i)
                    .toArray();
            if (n != ns.length) {
                return;
            }
            Integer cnt = 0;
            cnt = mergeSort(ns, 0, ns.length, cnt);
            System.out.println(Arrays.stream(ns)
                    .boxed()
                    .map(Object::toString)
                    .collect(Collectors.joining(" ")));
            System.out.println(cnt);
        } catch (NoSuchElementException | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static Integer mergeSort(
            int[] ns,
            int left,
            int right,
            Integer cnt
    ) {
        if ((left + 1) < right) {
            int mid = (left + right) / 2;
            cnt = mergeSort(ns, left, mid, cnt);
            cnt = mergeSort(ns, mid, right, cnt);
            cnt = merge(ns, left, mid, right, cnt);
        }
        return cnt;
    }

    private static Integer merge(
            int[] ns,
            int left,
            int mid,
            int right,
            Integer cnt
    ) {
        int n1 = mid - left;
        int n2 = right - mid;
        int[] ll = new int[n1];
        int[] rl = new int[n2];
        IntStream.rangeClosed(0, n1 - 1).forEach(i -> {
            ll[i] = ns[left + i];
        });
        IntStream.rangeClosed(0, n2 - 1).forEach(i -> {
            rl[i] = ns[mid + i];
        });
        int i = 0, j = 0;
        for (int k = left; k < right; k++) {
            cnt++;
            if (i < ll.length && (j >= rl.length ||
                    ll[i] <= rl[j])) {
                ns[k] = ll[i];
                i++;
            } else {
                ns[k] = rl[j];
                j++;
            }
        }
        return cnt;
    }
}




Measured memory_bytes: 208340
N = int(input())
H = list(map(int,input().split()))
count = 0
while True:
    f1 = False
    f2 = False
    for h in H:
        if not f1 and h > 0:
            f1 = True
            f2 = True
            count += 1
        elif f1 and h <= 0:
            f1 = False
    if not f2:
        break
    f1 = False
    f2 = False
    H = list(map(lambda x: x-1,H))
print(count)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#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 FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    int cost = 0;
    vector<int> a(n + 2);
    a[0] = 0, a[n + 1] = 0;
    rep(i, n) {
      cin >> a[i + 1];
    }
    FOR(i, 1, n + 2) {
      cost += abs(a[i] - a[i - 1]);
    }
    FOR(i, 1, n + 1) {
      int ans;
      ans = cost + abs(a[i + 1] - a[i - 1]) - (abs(a[i + 1] - a[i]) + abs(a[i] - a[i - 1]));
      cout << ans << '\n';
    }

    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int D;
int A[100001];
vector<int> dat[1<<20];

void init(int k, int l, int r) {
  if (r - l == 1) {
    dat[k].push_back(A[l]);
  } else {
    int lch = k * 2 + 1, rch = k * 2 + 2;
    init(lch, l, (l + r) / 2);
    init(rch, (l + r) / 2, r);
    dat[k].resize(r - l);
    merge(dat[lch].begin(), dat[lch].end(), dat[rch].begin(), dat[rch].end(), dat[k].begin());
  }
}

int query(int i, int j, int x, int k, int l, int r) {
  if (j <= l || r <= i) {
    return 0;
  } else if (i <= l && r <= j) {
    return upper_bound(dat[k].begin(), dat[k].end(), x) - dat[k].begin();
  } else {
    int lc = query(i, j, x, k * 2 + 1, l, (l + r) / 2);
    int rc = query(i, j, x, k * 2 + 2, (l + r) / 2, r);
    return lc + rc;
  }
}

int main() {

  cin >> D;
  rep(i, D) cin >> A[i];

  init(0, 0, D);

  int Q; cin >> Q;

  rep(_, Q) {
    int l, r, e; cin >> l >> r >> e;
    l --, r --;
    int a = min(A[l], A[r]) - e;
    int b = max(A[l], A[r]) + e;
    cout << (query(l, r + 1, a - 1, 0, 0, D) - query(l, r + 1, b, 0, 0, D) + (r - l + 1)) << endl;
  }

  
  return 0;
}

Measured memory_bytes: 39320
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  ll x = 0;
  rep(i, n) {
    cin >> a[i];
    x ^= a[i];
  }
  rep(i, n) cout << (x ^ a[i]) << (i == n - 1 ? '\n' : ' ');
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

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

int main()

{

    ll n, D, X;
    cin >> n >> D >> X;
    vector<ll> v;
    for(ll i = 0; i < n; i++)
    {

        ll x;
        cin >> x;
        v.pb(x);
    }
    ll ans = 0;
    for(ll i = 0; i < v.size(); i++)
    {

        ll a= v[i];
        ll cnt = 0;
        for(ll j = 0; j < D; j++)
        {

            ll xx = j*a+1;
            if(xx <= D) cnt++;
        }
        ans+=cnt;
    }
    cout << ans+X;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+10;
int h,v;
int main()
{
	scanf("%d%d",&h,&v);
	printf("%d\n",(h+v-1)/v);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(...) minn(__VA_ARGS__)
#define max(...) maxx(__VA_ARGS__)
#define stringio() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
char _;
typedef long long ll;
typedef pair<int,int> pii;
template<typename t>constexpr const t minn(const t x,const t y){return x<y?x:y;}
template<typename t,typename ...r>constexpr const t minn(const t x,const r ...xs){return minn(x,minn(xs...));}
template<typename t>constexpr const t maxx(const t x,const t y){return x>y?x:y;}
template<typename t,typename ...r>constexpr const t maxx(const t x,const r ...xs){return maxx(x,maxx(xs...));}
template <typename t> void scan (t& x) {do{while((x=getchar_unlocked())<'0'); for(x-='0'; '0'<=(_=getchar_unlocked()); x=(x<<3)+(x<<1)+_-'0');}while(0);}
template <typename t, typename ...r> void scan (t& x, r&... xs) {scan(x); scan(xs...);} 
const int MAXN = 100005;
int main() {
    int n,a,b;
  	scan(n,a,b);
  	printf ("%d\n",min(n*a,b));
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC085BKagamiMochi solver = new ABC085BKagamiMochi();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085BKagamiMochi {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            out.println(IntStream.range(0, in.nextInt()).map(x -> in.nextInt()).distinct().count());
        }

    }
}



Measured memory_bytes: 29140
#include<iostream>
#include<vector>
#include <string>

using namespace std;


int main() {
	int N;

	cin >> N;


	double sum=0;

	for (int i = 0; i < N; i++) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY")
			sum += x;
		else
			sum += x * 380000.0;
	}

	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 256
k, n = map(int, input().split())
A = list(map(int, input().split()))

D = [0] * n
for i in range(len(A)-1):
    D[i] += A[i+1]-A[i]
D[n-1] += A[0] + k - A[n-1]

D.remove(max(D))
print(sum(D))

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

int main()
{
        int M, N;
        cin >> N >> M;
        vector<int> A(N, 0);
        long long sum = 0;
        for (int i = 0; i < N; ++i) {
                cin >> A[i];
                sum += A[i];
        }
        double judge = (double)sum / (4.0 * M);

//      cout << judge << endl;
        sort(A.begin(), A.end(), greater<int>());
        int num = 0;
        for (int i = 0; i < M; ++i) {
                if (A[i] < judge) {
                        cout << "No" << endl;
                        exit(0);
                }
        }
        cout << "Yes" << endl;
}


Measured memory_bytes: 3628
import scala.io.StdIn.readLine
import scala.collection.mutable.Queue

object Main extends App {
  val l = readLine.split(" ").map(_.toInt)
  val q = new Queue[(String,Int)]
  var total = 0

  for(i<-0 until l(0)) {
    val m = readLine.split(" ")
    q += ((m(0), m(1).toInt))
  }

  while(!q.isEmpty) {
    val (p,t) = q.dequeue
    if(t>l(1)) {
      q += ((p,t-l(1)))
      total += l(1)
    } else {
      println(p + " " + (t+total))
      total += t
    }
  }
}

Measured memory_bytes: 107288
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
// using namespace atcoder;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define _GLIBCXX_DEBUG
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())       // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))    //最大値を求める
#define MIN(x) *min_element(ALL(x))    //最小値を求める
//定数
#define INF 1000000000000  // 10^12:極めて大きい値,∞
#define inf 2147483647     // int値の最大値
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back                             // vectorヘの挿入
#define MP make_pair                             // pairのコンストラクタ
#define F first                                  // pairの一つ目の要素
#define S second                                 // pairの二つ目の要素
#define CST(x) cout << fixed << setprecision(x)  //小数点以下の桁数指定
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;
}
int gcd(int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
//各桁の和
int sumDight(int x) {
    int sum = 0;
    while (x > 0) {
        sum += (x % 10);
        x /= 10;
    }
    return sum;
}
//回文数
int divideReverse(int x) {
    int reverse = 0;
    int r;
    while (x > 0) {
        r = x % 10;
        reverse = reverse * 10 + r;
        x /= 10;
    }
    return reverse;
}

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

    ll n, y;
    cin >> n >> y;
    bool b = false;
    int ma, a, c;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n;j++){
           
            if (n >=j+i  && n + 4 * j + 9 * i == y / 1000){
                b = true;
                ma = i;
                a = j; 
                c = n - j - i;
            }
        }
        if (b) break;
    }
    if(b)cout <<ma  << " " << a << " " << c << endl;
    else
        cout << -1 << " " << -1 << " " << -1 << endl;
}


Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
using namespace std;
	long long dp[1001][1001];
	long long  e[1001][1001];
	long long  ans[1001];
	long long n,m,d[1001],c[1001];
int main(){
		cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>d[i];
	}
	for(int i=0;i<m;i++){
		cin>>c[i];
	}
	for(int i=0;i<m-(n-1);i++){
		dp[0][i]=d[0]*c[i];
	}
	//cout<<" ++++++"<<endl;
	for(int i=1;i<n;i++){
		for(int j=i;j<m-(n-i)+1;j++){
			//cout<<"====="<<endl;
			for(int z=i-1;z<j;z++){
				//cout<<"QQQQQQQ"<<endl;
				ans[z-i+1]=dp[i-1][z];
			}
			sort(ans,ans+j-(i-1));
			dp[i][j]=ans[0]+d[i]*c[j];
		}
	}
	for(int i=n-1;i<m;i++){
		ans[i-(n-1)]=dp[n-1][i];
	}
	sort(ans,ans+(m-n)+1);
	cout<<ans[0]<<endl;
}

Measured memory_bytes: 7428
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  cin >> S;
  cout << (regex_match(S, regex("^(?:dream(?:er)?|eraser?)+$")) ? "YES" : "NO")
       << endl;
  return 0;
}


Measured memory_bytes: 23640
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int N, D, X;
    cin >> N >> D >> X;
    if (N + D < X) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int M,K;
  cin>>M>>K;
  int N=pow(2,M);
  if(N<=K ||(N==2 && K==1))
    cout<<-1<<endl;
  else if(N==2 && K==0)
    cout<<0<<" "<<1<<" "<<1<<" "<<0<<endl;
  else{
  vector<int>A;
    for(int i=0;i<N;i++){
    if(i!=K)
      A.push_back(i);
    }vector<int>B;
    B.push_back(K);
    for(int i=0;i<N-1;i++)
      B.push_back(A[i]);
    B.push_back(K);
    for(int i=0;i<N-1;i++)
      B.push_back(A[N-2-i]);
    for(int i=0;i<2*N-1;i++)
      cout<<B[i]<<" ";
    cout<<B[2*N-1]<<endl;
  }
  return 0;
}

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

using namespace std;
vector < int > v;

int main()
{
    int Ans = 0;
    string s;  cin >> s;
    for(int i = 0;i<s.size();i++){
        s[i] = s[i] - '0';
        if(v.size() && v.back() != s[i]){
            v.pop_back();
            Ans+=2;
        }
        else  v.push_back(s[i]);
    }
    cout << Ans;
    return 0;
}


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

struct Rest{
	int N;
	string S;
	int P;
};

bool sort_S(const Rest &r1,const Rest &r2){
	for(int i=0;i<r1.S.size();i++){
		if(r1.S[i]<r2.S[i])return true;
		if(r1.S[i]>r2.S[i])return false;
	}
	if(r1.S.size()==r2.S.size())return r1.P>r2.P;
	return true;
}

int main(){
	int N;
	cin >> N;
	vector<Rest> R(N);
	vector<int> ans(N);
	for(int i=0;i<N;i++){
		string s;
		int p;
		cin >> s >> p;
		R[i].N=i;
		R[i].S=s;
		R[i].P=p;
	}
	sort(R.begin(),R.end(),sort_S);
	for(int i=0;i<N;i++){
		ans[i]=R[i].N+1;
	}
	for(int i=0;i<N;i++)cout << ans[i] << endl;
	return 0;
}

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 r,d,x;
    cin>>r>>d>>x;
    for(int i=2000;i<2010;i++)
    {
        x=r*x-d;
        cout<<x<<endl;
        
    }
    
    return 0;

}


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

int V[10010][10010];
int N,W;
int v[110],w[110];
int max(int a,int b){
    return a>b?a:b;
}
void solve(){
    for(int i=0;i<=N;i++){
        for(int c=0;c<=W;c++){
            if(i<=0||c<=0){
                V[i][c]=0;
            }
            else if((c-w[i-1])<0){
                V[i][c]=V[i-1][c];
            }
            else if(c-w[i-1]>=0){
                V[i][c]=max(v[i-1]+V[i-1][c-w[i-1]],V[i-1][c]);
            }
        }
    }
}
int main(){
    cin>>N>>W;
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
    solve();
    cout<<V[N][W]<<endl;
    return 0;
}




Measured memory_bytes: 7072
import sys
sys.setrecursionlimit(10**9)

class ABC(object):

    def __init__(self):
        pass


    def main(self):
        s = input()
        
        if s[-1] == 's':
            s += 'es'
        else:
            s += 's'
        
        print(s)
        return


if __name__ == "__main__":
    obj = ABC()
    obj.main()
    sys.exit(0)

Measured memory_bytes: 61728
#!/usr/bin/env python3


def read_h(typ=int):
    return map(typ, input().split())


def read_v(n, typ=int):
    return [typ(input()) for _ in range(n)]


def digit_sum(i):
    return sum([int(d) for d in str(i)])


def main():
    n, = read_h()
    ans = 10000
    for a in range(1, n):
        b = n - a
        s = digit_sum(a) + digit_sum(b)
        if s < ans:
            ans = s

    print(ans)


if __name__ == '__main__':
    main()


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

int cnt = 0;

void insertionSort(int A[], int n, int g){
    int i,j,v;
    for(i=g; i<n; i++){
        v=A[i];
        j=i-g;
        while(j>=0 && A[j]>v){
            A[j+g] = A[j];
            j = j-g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[], int n){
    int m=0;
    int t=1;
    int G[110];
    int i;

    while(n/t>1){
        t*=2;
        G[m]=n/t;
        m++;
    }
    if(n==1){
        G[0]=1;
        m=1;
    }
    
    for(i=0; i<m; i++){
        insertionSort(A, n, G[i]);
    }

    cout << m << endl;
    if(m!=1){
        for(i=0; i<m-1; i++){
            cout << G[i] << ' ';
        }
        cout << G[m-1] << endl;
    }
    else cout << G[0] << endl;
    cout << cnt << endl;
    for(i=0; i<n; i++){
        cout << A[i] << endl;
    }
}

int main(){
    int n;
    cin >> n;
    int i,j,k;
    int A[n];
    for(i=0; i<n; i++){
        cin >> A[i];
    }

    shellSort(A, n);

    return 0;
}




Measured memory_bytes: 7028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define int long long
#define fill(x, v) memset(x, v, sizeof(x))
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define ios std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
/*
std::cout << std::setprecision(9) << f << '\n';//3.141590000;
map<char,int>::reverse_iterator rit;
for(rit = mp.rbegin(); rit!=mp.rend(); rit++)
*/
int n, m, x;
int c[13];
int kn[13];
int arr[13][13];
int ans = INT_MAX;
bool check()
{
    for (int i = 0; i < m; i++)
    {
        if (kn[i] < x)
            return 0;
    }
    return 1;
}

void fun(int in, int kk)
{
    if (in > n)
        return;
    // for (int i = 0; i < m; i++)
    //     cout << kn[i] << " ";
    if (check())
    {
        ans = min(ans, kk);
    }
    for (int i = in; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            kn[j] += arr[i][j];
        }
        fun(i + 1, kk + c[i]);
        for (int j = 0; j < m; j++)
        {
            kn[j] -= arr[i][j];
        }
        fun(i + 1, kk);
    }
}

int32_t main()
{
    ios;

    cin >> n >> m >> x;
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
        {
            cin >> arr[i][j];
        }
    }
    fun(0, 0);
    if (ans != INT_MAX)
        cout << ans << endl;
    else
        cout << -1 << endl;
}


Measured memory_bytes: 3688