akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

vector<int> G[5050];
ll A[5050];
ll dp1[5050][5050]; //コンピュータあり
ll dp2[5050][5050]; //コンピュータなし
int sub[5050];

void dfs(int v, int pv) {
    vector<ll> arr1(5050,1e18),arr2(5050,1e18);
    sub[v] = 1;
    if (A[v] < 0) arr1[0] = A[v];
    else arr2[0] = A[v];
    for (auto nv : G[v]) {
        if (nv == pv) continue;
        dfs(nv,v);
        vector<ll> ch1(5050,1e18),ch2(5050,1e18);
        rep(i,sub[v]) {
            rep(j,sub[nv]) {
                chmin(ch1[i+j],arr1[i]+dp1[nv][j]);
                if (dp1[nv][j] < 0) chmin(ch1[i+j+1],arr1[i]);
                chmin(ch1[i+j],arr1[i]+dp2[nv][j]);
                if (dp2[nv][j] != 1e18) chmin(ch1[i+j+1],arr1[i]);

                if (arr2[i] != 1e18) chmin(ch1[i+j],arr2[i]+dp1[nv][j]);
                if (dp1[nv][j] < 0) chmin(ch2[i+j+1],arr2[i]);
                chmin(ch2[i+j],arr2[i]+dp2[nv][j]);
                if (dp2[nv][j] != 1e18) chmin(ch2[i+j+1],arr2[i]);
            }
        }
        swap(arr1,ch1); swap(arr2,ch2);
        sub[v] += sub[nv];
    }

    rep(i,sub[v]) {
        dp1[v][i] = arr1[i];
        dp2[v][i] = arr2[i];
    }
    return;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    rep(i,N) cin >> A[i];
    rep(i,N-1) {
        int u,v; cin >> u >> v;
        --u; --v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    rep(i,N) rep(j,N) dp1[i][j] = dp2[i][j] = 1e18; 
    dfs(0,-1);
    int ans = 5000;
    rep(i,N) {
        if (dp1[0][i] < 0) chmin(ans,i);
        if (dp2[0][i] != 1e18) chmin(ans,i);
    }

    cout << ans << ln;
}

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

using namespace std;

class UnionFindTreeWithDistance {
	public:
		UnionFindTreeWithDistance(int N) : N_(N){
			distance_ = vector<long long>(N, 0);
			rank_ = vector<int>(N, 0);
			for(int i = 0; i < N; ++i) {
				parent_.push_back(i);
			}
		}
		void unite(int x, int y, long long d) {
			int rx = find(x);
			int ry = find(y);
			if(rank_[rx] < rank_[ry]) {
				distance_[rx] = d + distRoot(y) - distRoot(x);
				parent_[rx] = ry;
			} else {
				distance_[ry] = -d + distRoot(x) - distRoot(y);
				parent_[ry] = rx;
				if(rank_[rx] == rank_[ry]) ++rank_[rx];
			}
		}
		bool same(int x, int y) {
			return find(x) == find(y);
		}
		long long getDist(int x, int y) const {
			return distRoot(x) - distRoot(y);
		}
	private:
		vector<long long> distance_;
		vector<int> parent_;
		vector<int> rank_;
		const int N_;
		int find(int x) {
			if(parent_[x] == x) {
				return x;
			} else {
				distance_[x] = distRoot(x);
				return parent_[x] = find(parent_[x]);
			}
		}
		long long distRoot(int x) const {
			if(parent_[x] == x) {
				return 0;
			} else {
				return distance_[x] + distRoot(parent_[x]);
			}
		}
};

int main(void) {
	int N, M;
	cin >> N >> M;
	UnionFindTreeWithDistance tree(N);
	for(int i = 0; i < M; ++i) {
		int L, R;
		long long D;
		cin >> L >> R >> D;
		--L;
		--R;
		if(tree.same(L, R)) {
			if(tree.getDist(L, R) != D) {
				cout << "No\n";
				return 0;
			}
		} else {
			tree.unite(L, R, D);
		}
	}
	cout << "Yes\n";
	return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef  long long ll;
int gcd(int f , int s){if(s==0)return f;else return gcd(s,f%s);}
int const N = 1000006;
ll const M = 998244353;
long double const ep = .000000000000000001;
map<ll , char> m ;
int main() {
	
	ll a , b;
	cin >> a >> b;
	string s , s1;
	cin >> s >> s1;
	ll lcm = a * b / gcd(a,b);
	for(int i = 0 , j = 0; i < a ; i++, j += lcm/a){
		m[j] = s[i];
	}
	for(int i = 0 , j = 0 ; i < b ; i++ , j+=lcm/b){
		if(m.find(j) != m.end()){
			if(m[j] != s1[i]){cout << "-1";return 0;}
		}
	}
	printf("%lld\n", lcm);
	return 0;
}

Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
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 unsigned uint;
const int INF=1e8;
const int oo=0x3f3f3f3f;
const double eps=1e-10;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n,m;
const int Maxn=1e5+5;
vector<int>G[Maxn];
int deg[Maxn];
vector<int>seq;
void tp(){
	queue<int>q;
	rep(i,n)if(!deg[i])q.push(i);
	while(!q.empty()){
		int now=q.front();q.pop();
		seq.push_back(now);
		rep(i,SZ(G[now])){
			int to=G[now][i];
			deg[to]--;
			if(!deg[to]){
				q.push(to);
			}
		}
	}
}
int dp[Maxn];
int main(){
	n=in();m=in();
	rep(i,m){
		int x,y;
		x=in();y=in();
		x--;y--;
		G[x].push_back(y);
		deg[y]++;
	}
	tp();
//	rep(i,SZ(seq))cout<<seq[i]<<' ';cout<<endl;
	rep(i,SZ(seq)){
		int now=seq[i];
		rep(j,SZ(G[now])){
			int to=G[now][j];
			chkmax(dp[to],dp[now]+1);
		}
	}
	int LP=0;
	rep(i,n)chkmax(LP,dp[i]);
	cout<<LP<<endl;
	return 0;
}

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


int main() {
    string s,t;
    cin >> s >> t;
    s += s;
    rep(i,s.length()-t.length()){
        bool a = true;
        rep(j,t.length()){
            if(s[i+j] != t[j]){
                a = false;
                continue;
            }
        }
        if(a){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


Measured memory_bytes: 3216
class _Node {
  constructor(key, left = null, right = null) {
    this.key = key;
    this.left = left;
    this.right = right;
  }
}

class BinaryTree {
  constructor() {
    this.root = null;
  }

  static get Node() { return _Node; }

  insert(key) {
    this.root = new BinaryTree.Node(key, null, null);
    this.insert = (key) => {
      let x = this.root, y;
      let newNode = new BinaryTree.Node(key, null, null);
      while (x !== null) {
        y = x;
        x = x[key < x.key ? 'left' : 'right'];
      }
      y[key < y.key ? 'left' : 'right'] = newNode;
    }
  }

  find(key, n = this.root) {
    if (n === null) return false;
    if (n.key === key) return true;
    return this.find(key, n[key < n.key ? 'left' : 'right']);
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.forEach(function(cmd) {
    switch(cmd.charAt(0)) {
    case 'i': tree.insert(Number(cmd.split(' ')[1])); break;
    case 'f': console.log(tree.find(Number(cmd.split(' ')[1])) ? 'yes' : 'no'); break;
    default: tree.print();
    }
  });
})();



Measured memory_bytes: 195184
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, w = list(map(int, input().rstrip('\n').split()))
    dp = [0] * (w + 1)
    for _ in range(n):
        wv, vv = list(map(int, input().rstrip('\n').split()))
        for i in range(w - wv, -1, -1):
            dp[i+wv] = max(dp[i+wv], dp[i] + vv)
    print(dp[-1])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 39664
N = int(input())
zahyou = input().split(" ")
tairyoku = []
temptairyoku = int(0)
for i in range(1, 101):
    for s in range(N):
        temptairyoku = temptairyoku + (int(zahyou[s]) - int(i)) ** 2
    tairyoku.append(int(temptairyoku))
    temptairyoku = 0
tairyoku.sort()
print(tairyoku[0])

Measured memory_bytes: 3064
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
int Q;long long x,y,z;
int main()
{
	scanf("%d",&Q);
	while(Q--)
	{
		scanf("%lld%lld",&x,&y);
		z=int(sqrt(x*y));
		if(x>y)swap(x,y);
		if(z*(z+1)<x*y)
			printf("%lld\n",2*z-1);
		else
		{
			if(z*z==x*y)
			{
				if(x==y)
					printf("%lld\n",2*z-2);
				else
					printf("%lld\n",2*z-3);
			}
			else
				printf("%lld\n",2*z-2);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,k;
    cin >> n >> k;
    // サイコロで勝つ確率 * コインで勝つ確率
    double dice = 0.0;
    double not_dice = 1.0;
    if(n>k-1){
        dice = (n-k+1.0)/n;
        not_dice = (k-1.0)/n;
    }
    int64_t div = 1;
    double prob = 0;
    // i: サイコロの出目
    for(int64_t i=1; i<=min(k-1,n); i++){
        // i * 2^j が k を超えた最小の j に対して、 2^j で割る
        int64_t div = 1;
        for(int64_t j=1; j<k; j++){
            div *= 2;
            if(i * div>=k) break;
        }
        prob += (1.0/div);
        // cout << prob << endl;
    }
    int64_t one = 1;
    cout << setprecision(20) << dice + not_dice*prob/min(max(one,k-1),n) << endl;
}


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

#define ll long long
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define viit vector<int>::iterator
#define MOD 1000000007
#define endl "\n"
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define repe(i, a, b) for (int i = (a); i <= (b); i++)
#define repd(i, a, b) for (int i = (a); i >= (b); i--)
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vi h(n), a(n);
    rep(i, 0, n) cin >> h[i];
    a[0] = 0;
    a[1] = abs(h[1] - h[0]);
    rep(i, 2, n)
        a[i] = min(abs(h[i] - h[i - 1]) + a[i - 1], abs(h[i] - h[i - 2]) + a[i - 2]);

    cout<<a[n-1];
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 27732
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#define ll long long
#define mp(a,b) make_pair(a,b)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
using namespace std;

ll power(ll a){
  ll ans = 0;
  while(a%2==0){
    ans++;
    a/=2;
  }
  return ans;
}

int main(){
  ll n; cin >> n;
  ll arr[n];
  bool f = 0;
  ll both=1;
  ll maxipow=0;
  for(ll i=0;i<n;i++){
    cin >> arr[i];
    if(arr[i]%2==0){
      f=1;
      both*=2;
      maxipow += power(arr[i]);
    }
  }
  if(!f){
    cout << "0" << endl;
    return 0;
  }
  else{
    cout << maxipow << endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
const ll INF = 9223372036854775807;

int main() {
  int a,b,c,d,e;cin >> a >> b >> c >> d >> e;
  int Ans = (60*c+d)-(60*a+b) - e;
  cout << Ans << endl;
}

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

using namespace std;

typedef long long ll;

const ll MAXN = 1000;

ll d[2] = {1, -1};
ll N, M;
ll x[MAXN+1], y[MAXN+1], z[MAXN+1];

ll solve(ll a, ll b, ll c){
  ll v[N];
  for(int i=0;i<N;i++){
    v[i] = x[i+1] * d[a] + y[i+1] * d[b] + z[i+1] * d[c];
  }
  sort(v, v+N, greater<ll>());
  ll sum = 0;
  for(int i=0;i<M;i++) sum += v[i];
  return sum;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> N >> M;
  for(int i=1;i<=N;i++){
    cin >> x[i] >> y[i] >> z[i];
  }
  ll ans = 0;
  for(ll i=0;i<2;i++){
    for(ll j=0;j<2;j++){
      for(ll k=0;k<2;k++){
        ll res = solve(i, j, k);
        ans = max(res, ans);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
D, G = map(int, input().split())
pc = [tuple(map(int, input().split())) for _ in range(D)]

ans = 10000
for i in range(2**D):
    s = 0
    cnt = 0
    b = [0] * D
    
    #各問題についてボーナスまで解くか手を付けないかでbit全探索
    for j in range(D):
        if (i >> j) & 1:
            s += 100 * (j + 1) * pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            b[j] = 1

    #足りない点数分を解く
    flag1 = False
    flag2 = True
    if s < G:
        for k in range(D)[::-1]:
            if b[k] == 0:
                for x in range(pc[k][0]):
                    s += 100 * (k + 1)
                    cnt += 1
                    if s >= G:
                        flag1 = True
                        break
                else:
                    flag2 = False
                    break
            if flag1:
                break

    if flag2:
        ans = min(ans, cnt)


print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main() {

   int x, y;
   
   scanf("%d %d", &x, &y);
   while(1) {
       if (x >= y){
            x = x % y;
            if (x == 0){
                 printf("%d\n", y);
                 break;
            }
       }
       else {
            y=  y % x;
            if (y == 0){
                 printf("%d\n", x);
                 break;
            }
       }
   }
   return 0;
}

Measured memory_bytes: 1808
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

signed main() {
    INIT;
    cin >> K;
    REP(i, K)
    S += "ACL";
    cout << S << endl;
}

Measured memory_bytes: 3648
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int ctr = 0;
		for(int i=0;i<n;i++)
		{
			int c = s.nextInt();
			if((i+1)%2!=0 && c%2!=0) {
				ctr++;
			}
		
		}
		System.out.println(ctr);
		
	}

}

Measured memory_bytes: 35768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

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


  rep(i,n + 1) {
    ll black = i * m;
    rep(j,m + 1) {
      
      if(j != 0) {
        black += ( n - i ) - i;
      }
      
      //cout << i << ' ' << j << ' ' << black << endl;

      if(black == k) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
}


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

if __name__ == '__main__':

    stack = []
    line = input().split(" ")
    for s in line:
        if s.isdigit():
            stack.append(s)
        else:
            v2 = stack.pop()
            v1 = stack.pop()
            stack.append(str(eval(v1 + s + v2)))

    print(stack.pop())




Measured memory_bytes: 5572
#include <stdio.h>
#define PI 3.141592653589793
int main(void){
    int a,b,c;
    double s,l,h;
    scanf("%d%d%d",&a,&b,&c);
    s = sin(c * PI / 180.0)*a*b/2;
    l = a + b + sqrt(a*a + b*b - 2*a*b * cos(c * PI / 180.0));
    h = s/a*2;
    printf("%lf %lf %lf\n" ,s,l,h);
    return 0;
}


Measured memory_bytes: 2056
#include <iostream>
using namespace std;
int main(){
	int a,b,n;
	int A=0;
	int B=0;
	while(1){
		A=0;
		B=0;
		cin>>n;
		if(n==0) break;
		for(int i=0; i<n; i++){
			cin>>a>>b;
			if(a>b){
				A+=a;
				A+=b;
			}else if(a<b){
				B+=a;
				B+=b;
			}else if(a==b){
				A+=a;
				B+=b;
			}

			
		}
		cout<<A<<" "<<B<<endl;
	}
}

Measured memory_bytes: 1160
N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
maxn = max(max(X), A)

dp = [[0 for _ in range(2 * N * maxn + 1)] for _ in range(N + 1)]
dp[0][N * maxn] = 1

for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] <= 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]]

print(dp[N][N * maxn] - 1)


Measured memory_bytes: 5232
N, M = map(int,input().split())

Lmax = 1
Rmin = N

for i in range(M):
    L, R = map(int, input().split())
    Lmax = max(L, Lmax)
    Rmin = min(R, Rmin)

print(max(0, Rmin - Lmax + 1))

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>


int merge(long int a1[], long int a2[], long int a1_size, long int a2_size, long int a[]);
int mergeSort(long int a[], long int number);

int main(void)
{
	long int n, k;
	long int count = 0;
	long int i, j;
	long int h[200000];
	
	scanf("%ld%ld", &n, &k);
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &h[i]);
	}
	
	mergeSort(h, n);
	
	for(i = 0; i < n; i++) {
		//printf("%ld ", h[i]);
	}
	
	if(n <= k) {
		printf("0\n");
		return 0;
	} else {
		for(i = n - k - 1; i >= 0; i--) {
			count += h[i];
		}
	}
	
	printf("%ld\n", count);
	
	return 0;
}

int merge(long int a1[], long int a2[], long int a1_size, long int a2_size, long int a[])
{
	long int i = 0, j = 0;
	
	while( (i < a1_size ) || (j < a2_size) ) {
		if( (j >= a2_size ) || ( (i < a1_size) && (a1[i] < a2[j]) ) ) {
			a[i + j] = a1[i];
			i++;
		} else {
			a[i + j] = a2[j];
			j++;
		}
	}
	
	return 0;
}


int mergeSort(long int a[], long int number)
{
	long int m = number / 2, n = number - m;
	long int a1[m];
	long int a2[n];
	int i, j;
	
	if(number > 1) {
		for(i = 0; i < m; i++) {
			a1[i] = a[i];
		}
		for(i = 0; i < n; i++) {
			a2[i] = a[m + i];
		}
		mergeSort(a1, m);
		mergeSort(a2, n);
		merge(a1, a2, m, n, a);
	}
	
	return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>
#include<stdio.h>
#include<string>
using namespace std;

int main() {
	int n,m;
	int a[10000],jikan=0;
	cin >> n >> m;
	for (int i = 0;i < m;i++) {
		cin >> a[i];
		jikan += a[i];
	}
	if (n - jikan >= 0) {
		cout << n - jikan << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 1000 + 8;
#define inf 0x3f3f3f3f

struct node
{
    int x,y;
    node(int x = 0,int y = 0):x(x),y(y){}
}s,current,st,nd;

int h,w,n;
int step[maxn][maxn];
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};
string Map[maxn];
int sum = 0;

int bfs()
{
    for(int i = 0 ; i < h ; ++i){
        for(int j = 0 ; j < w; ++j){
            step[i][j] = inf;
        }
    }
    queue<node> q;
    step[st.x][st.y] = 0;
    q.push(st);
    while(!q.empty())
    {
        current = q.front();
        q.pop();
        if(current.x == nd.x && current.y == nd.y) break;
        for(int i = 0; i < 4; ++i)
        {
            s.x = current.x + dx[i];
            s.y = current.y + dy[i];
            if(s.x >= 0 && s.x < h && s.y >= 0 && s.y < w && Map[s.x][s.y] != 'X' && step[s.x][s.y] == inf)
            {
                step[s.x][s.y] = step[current.x][current.y] + 1;
                q.push(s);
            }
        }
    }
    return step[nd.x][nd.y];
}
int main()
{
    while(cin >> h >> w >> n)
    {
        sum = 0;
        for(int i = 0 ; i < h; ++i) cin >> Map[i];
        for(int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                if (Map[i][j] == 'S') {
                    st.x = i;
                    st.y = j;
                }
            }
        }

        for(int i = 0; i < n; ++i)
        {
            for(int j = 0; j < h; ++j)
            {
                for(int k = 0; k < w; ++k)
                {
                    if(Map[j][k] == '1' + i)
                    {
                        nd.x = j; nd.y = k;
                        sum += bfs();
                        st.x = j; st.y = k;
                    }
                }
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

/*
3 3 1
S..
...
..1
4 5 2
.X..1
....X
.XX.S
.2.X.
10 10 9
.X...X.S.X
6..5X..X1X
...XXXX..X
X..9X...X.
8.X2X..X3X
...XX.X4..
XX....7X..
X..X..XX..
X...X.XX..
..X.......
*/

Measured memory_bytes: 8100
fun main(){
    val (a,b, c, k) = readLine()!!.split(" ").map(String::toInt)

    if(a >= k){
        print("$k")
    }
    else if(a < k && a+b >= k){
        print("$a")
    }
    else{
        val max = a+(k-a-b)*(-1)
        print(max.toString())
    }

}

Measured memory_bytes: 36296
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  ll sum = 0;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    sum += a[i];
    a[i] *= n;
  }
  int ans = 0;
  ll tmp = INF;
  for(int i = 0; i < n; ++i){
    if(tmp > abs(sum - a[i])){
      tmp = abs(sum - a[i]);
      ans = i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
def swap(array,x,y)
  tmp=array[x]
  array[x]=array[y]
  array[y]=tmp
end
def sort(array)
  ary=array.dup
  pos_max=ary.length-1
  (0...pos_max).each do |n|
    (0...pos_max-n).each do |num|
      if ary[num]<ary[num+1] then
        swap(ary,num,num+1)
      end
    end
  end
  return ary
end

N=gets.chomp.to_i
cards=gets.chomp.split(" ").map{|str|str.to_i}
sorted=sort(cards)
alice,bob=0,0
(0...N).each do |n|
  if n%2==0 then
    alice+=sorted[n]
  else
    bob+=sorted[n]
  end
end
puts alice-bob

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  bool ok = true;

  ll N;
  scanf("%lld", &N);

  string s;
  cin >> s;

  map<string, ll> m;
  m[s] = 1;

  for (ll i = 1; i < N; i++) {
    string ss;
    cin >> ss;

    if (s[s.size() - 1] == ss[0] && m[ss] == 0) {
      // ok
    } else {
      ok = false;
      break;
    }
    m[ss] = 1;
    s = ss;
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

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

const ll MAX_N = 1e9 + 21;
ll q, A, B;

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

	while (q--) {
		cin >> A >> B;
		if (A == B) {
			cout << (A - 1) * 2 << "\n";
			continue;
		}

		if (B < A)
			swap(A, B);

		ll s = 0, e = B;
		while (e - s > 1) {
			ll mid = e + s >> 1;
			ll mx = 0;
			if (mid <= A + 1)
				mx = (A + 1) * mid;
			else {
				if ((mid - (A + 1)) % 2 == 0)
					mx = (mid + A + 1) / 2 * (mid + A + 1) / 2;
				else
					mx = (mid + A + 1) / 2 * (mid + A + 2) / 2;
			}

			if (mx < A * B)
				s = mid;
			else
				e = mid;
		}

		ll mid = s, mx = 0;
		if (mid <= A + 1)
			mx = (A + 1) * mid;
		else {
			if ((mid - (A + 1)) % 2 == 0)
				mx = (mid + A + 1) / 2 * (mid + A + 1) / 2;
			else
				mx = (mid + A + 1) / 2 * (mid + A + 2) / 2;
		}

		cout << A - 1 + s << "\n";
	}
	return 0;
}

Measured memory_bytes: 504
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc107_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int i = int.Parse(input[1]);

            Console.WriteLine(N - i + 1);
            Console.Read();
            
        }
    }
}


Measured memory_bytes: 27468
#include <iostream>

int main(int argc, char *argv[]){
    unsigned int N;
    std::cin >> N;
    unsigned int A[N];
    for(auto &a : A){
        std::cin >> a;
    }

    int i;
    for(i=0; i<N-1; ++i){
        A[N-1] += (2*(i&1)-1)*A[i];
    }

    A[N-1] /= 2;

    for(i=N-2; i>=0; --i){
        A[i] -= A[i+1];
    }
    
    for(auto &a : A){
        std::cout << 2*a << " ";
    }
    std::cout << std::endl;
    return 0;
}

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

using namespace std;


int main()
{
  int N;
  string S;
  cin >> N;
  cin >> S;
  int sum = 0, ret = 0;
  for(auto &c : S) {
    if(c == 'I') ++sum;
    else --sum;
    ret = max(ret, sum);
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int a,b,c;
    cin >>a;
    
    for(int i = 0; i < a; i++){
        
        cin >>b>>c;
        if(b % c == 0){
            cout <<c<<endl;
        }else{
            cout <<b % c<<endl;
        }
        
    }
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}


ll n, k;
vector<ll> a;
bool check(ll x){
    ll res = 0;
    rep(i, n){
        int ng = -1, ok = n;
        while(abs(ok-ng) > 1){
            int m = ng+ok>>1;
            if(a[i] < 0){
                (a[m]*a[i] < x ? ok : ng) = m;
            }else{
                (a[m]*a[i] >= x ? ok : ng) = m;
            }
        }
        if(a[i] < 0){
            res += n-ok;
        }else{
            res += ok;
        }
        if(a[i]*a[i] < x) --res;
    }
    res /= 2;
    return res < k;
}


int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    cin >> n >> k;
    a.resize(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    ll ok = -LINF, ng = LINF;
    while(abs(ok-ng) > 1){
        ll mid = ng+ok>>1;
        (check(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;
    return 0;
}



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

int main(){
    int N,M;
    const int T_MAX = 1260;
    const int T_MIN = 540;
    while(cin >> N >> M, N != 0){
        int r;
        cin >> r;
        vector<vector<int>> timeTable(M+1, vector<int>(T_MAX+2, 0));
        rep(i,r){
            int t, n, m, s;
            cin >> t >> n >> m >> s;
            int stamp = (s == 1 ? 1 : -1);
            timeTable[m][t] += stamp;
        }

        for(int m = 1;m <= M; m++){
            for(int t = T_MIN + 1; t <= T_MAX; t++){
                timeTable[m][t] += timeTable[m][t - 1];
            }
        } 

        int q;
        cin >> q;
        rep(i,q){
            int ts, te, m;
            cin >> ts >> te >> m;
            int res = 0;
            int seg = 0;

            for(int t = ts; t <= te; t++){
                res += !!(timeTable[m][t]);
            }
            seg += !!(timeTable[m][te]);
            res -= seg;

            cout << res << endl;
        }
    }
}



Measured memory_bytes: 50988
n, k = map(int, input().split())

d = []
A = []
for i in range(k):
    d.append(int(input()))
    x = list(map(int, input().split()))
    A.append(x)

B = set()
for i in range(k):
    for a in A[i]:
        B.add(a)

print(n-len(B))

Measured memory_bytes: 9224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  string s;
  cin>>s;
  int a=s.size()-2;
  cout<<s[0]+to_string(a)+s[s.size()-1]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;
int main(){
	int c;
	long long x,y,d,n;
	c = 0;
	cin >> n >> d;
	while(n--){
		cin >> x >> y;
		if(sqrt(x*x + y*y) <= d){
			c++;
		}
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 3664
N = int(input())
src = list(map(int,input().split()))

a1 = now = 0
for i in range(N):
    now += src[i]
    if i%2:
        if now < 1:
            a1 += 1 - now
            now = 1
    else:
        if now > -1:
            a1 += now + 1
            now = -1
a2 = now = 0
for i in range(N):
    now += src[i]
    if i%2==0:
        if now < 1:
            a2 += 1 - now
            now = 1
    else:
        if now > -1:
            a2 += now + 1
            now = -1

print(min(a1,a2))

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;

typedef long long LL;
typedef long double ldouble;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL n, k;
    cin >> n >> k;
    LL res = 0;
    for(LL i = k + 1; i <= n; ++i) {
        res += (n / i) * (i - k);
        res += max(0ll, (n % i) - k + 1);

    }
    if(k == 0) res -= n;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
S = input()
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for s in S:
  if s in alpha:
    alpha.remove(s)
if len(alpha) == 0:
  print('None')
else:
  print(alpha[0])

Measured memory_bytes: 3188
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n = ni()
if n == 1:
    print("Hello World")
else:
    a, b = nin(2)
    print(a + b)

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>

int main(void)
{
	double q, x, judge;
	
	while (1){
		scanf("%lf", &q);
		
		if (q == -1){
			break;
		}
		
		x = q * 0.5;
		judge = x * x * x - q >= 0 ? x * x * x - q : -1 * x * x * x - q;
		while (judge >= 0.00001 * q){
			x = x - ((x * x * x - q) / (3 * x * x));
			judge = x * x * x - q >= 0 ? x * x * x - q : -1 * x * x * x - q;
		}
		
		printf("%f\n", x);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <bits/stdc++.h>
#include <cstdlib>
#include <math.h> 
using namespace std;
#define ll long long int
int main()
{
int n;
cin>>n;
ll a[n];
ll ans=1e18,f=1,y=0;
for(int i=0;i<n;i++)
{cin>>a[i];
if(a[i]==0)y=1;}
if(y==1)cout<<0;
else 
{
	for(int i=0;i<n;i++)
	{
		if(ans/f<a[i])
		{cout<<-1;
		return 0;
		}
		f=f*a[i];
	}
	cout<<f;
}
return 0;
}

Measured memory_bytes: 4372
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		char[] str = sc.next().toCharArray();
		ArrayList<ArrayList<Boolean>> statements = new ArrayList<ArrayList<Boolean>>();
		ArrayList<Boolean> statement = new ArrayList<Boolean>();
		int maxLen = 0;
		for (int i = 0; i < str.length;) {
			boolean next = str[i] == 'c';
			if (!statement.isEmpty() && statement.get(statement.size() - 1) == next) {
				statements.add(statement);
				maxLen = Math.max(maxLen, statement.size());
				statement = new ArrayList<Boolean>();
			}
			statement.add(next);
			i += next ? 7 : 3;
		}
		statements.add(statement);
		maxLen = Math.max(maxLen, statement.size());
		for (ArrayList<Boolean> st : statements) {
			if (st.size() == maxLen) {
				System.out.println(st.get(maxLen - 1) ? "chicken" : "egg");
				break;
			}
		}
	}
}

Measured memory_bytes: 20412
#include <bits/stdc++.h>
#define lld long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define nmax
#define mod
using namespace std;

int main()
{
    string s;
    cin>>s;
    if (s == "SAT"){
        cout<<"1\n";
    }
    else if (s == "FRI"){
        cout<<"2\n";
    }
    else if (s == "THU"){
        cout<<"3\n";
    }
    else if (s == "WED"){
        cout<<"4\n";
    }
    else if (s == "TUE"){
        cout<<"5\n";
    }
    else if (s == "MON"){
        cout<<"6\n";
    }
    else {
        cout<<"7\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF (1 << 21)
typedef long long ll;

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

  vector<int> V[n];
  // int E[n][n];
  map<pair<int, int>, int> E;
  int d[n];
  int visited[n];

  REP(x, n) {
    REP(y, n) {
      // E[x][y] = INF;
      // E[make_pair(x, y)] = INF;
    }
    d[x] = INF;
    visited[x] = 0;
  }

  REP(_, n) {
    int u, k;
    cin >> u >> k;
    REP(__, k) {
      int v, c;
      cin >> v >> c;
      V[u].push_back(v);
      // E[u][v] = c;
      E[make_pair(u, v)] = c;
      // E[v][u] = c;
    }
  }

  d[0] = 0;
  REP(_, n) {
    int minv = -1;
    int mincost = INF;
    REP(v, n) {
      if (!visited[v] && d[v] < mincost) {
        minv = v;
        mincost = d[v];
      }
    }
    visited[minv] = 1;
    for (vector<int>::iterator it = V[minv].begin(); it != V[minv].end(); it++) {
      if (E[make_pair(minv, *it)] < INF && d[minv] + E[make_pair(minv, *it)] < d[*it]) {
        d[*it] = d[minv] + E[make_pair(minv, *it)];
      }
    }
  }

  REP(i, n) {
    cout << i << " " << d[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 36820
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    int sx, sy, tx, ty;
    cin >> sx;
    cin >> sy;
    cin >> tx;
    cin >> ty;
    
    string ans = "";
    
    for ( int i = 0; i < ty -sy; i++ ) {
        ans += "U";
    }
    for ( int i = 0; i < tx -sx; i++ ) {
        ans += "R";
    }
    
    for ( int i = 0; i < ty -sy; i++ ) {
        ans += "D";
    }
    for ( int i = 0; i < tx -sx; i++ ) {
        ans += "L";
    }
    
    ans += "L";
    for ( int i = 0; i < ty -sy+1; i++ ) {
        ans += "U";
    }
    for ( int i = 0; i < tx -sx+1; i++ ) {
        ans += "R";
    }
    ans += "D";
    
    ans += "R";
    for ( int i = 0; i < ty -sy+1; i++ ) {
        ans += "D";
    }
    for ( int i = 0; i < tx -sx+1; i++ ) {
        ans += "L";
    }
    ans += "U";
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
const    ld   PI=3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}

int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{











string s;
cin>>s;
if(s=="ARC")
cout<<"ABC";
else
cout<<"ARC";





}return 0;}


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

int main() {
	// your code goes here
	int n;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n; i++){
	    arr[i] = i + 1;
	}
	int a[n], b[n];
	for(int i = 0; i < n; i++){
	    cin >> a[i];
	}
	for(int i = 0; i < n; i++){
	    cin >> b[i];
	}
	int ac, bc;
    int count = 0;
	do{
	    bool same = true;
	    for(int i = 0; i < n; i++){
	        if(arr[i] != a[i]){
	            same = false;
	            break;
	        }
	    }
	    if(same){
	        ac = count;
	    }
	    same = true;
	    for(int i = 0; i < n; i++){
	        if(arr[i] != b[i]){
	            same = false;
	            break;
	        }
	    }
	    if(same){
	        bc = count;
	    }
	    count++;
	}while(next_permutation(arr, arr + n));
	int ans = abs(ac - bc);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
int main(){
    cin>>N;
    for(ll i=0;i<N;i++){
        ll a;
        cin>>a;
        if(a%2==0 && a%3!=0 && a%5!=0){
            cout<<"DENIED"<<endl;
            return 0;
        }
    }
    cout<<"APPROVED"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
using ll = long long;
using namespace std;
 
int main(){
	int N, temp;
	cin >> N;
	vector<int> A(N);
	for(int i=0; i<N; ++i){
		cin >> temp;
		A[i] = temp - i - 1;
	}
	sort(A.begin(), A.end());
	int b = A[N/2];
	ll sum = 0;
	for( int a : A ){
		sum += abs( a - b );
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()
B = LI()


A, B = zip(*sorted(zip(A, B), key=lambda x:x[1]))

A_c = copy.deepcopy(A)

A = sorted(A)
B = sorted(B)

for i in range(N):
    if A[i] > B[i]:
        print("No")
        sys.exit(0)

for i in range(1,N):
    if A[i] < B[i-1]:
        print("Yes")
        sys.exit(0)

# ans = "Yes"
# for i in range(N):
#     if A[i] <= B[i]:
#         pass
#     else:
#         ans = "No"
#         break

si2i = sorted(range(len(A_c)), key=lambda x:A_c[x])
a = 0
count = 0
while True:
    a = si2i[a]
    if a == 0:
        break
    count += 1

if count <= N - 2:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 29524
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


[n, d] = inpl()

print(n//(2*d+1)+(n%(2*d+1)>0))

Measured memory_bytes: 12556