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

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

ll H,W,K;
ll S[13][1005];

ll id[12];

ll cnt[12];

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

    cin >> H >> W >> K;

    for (int i = 0;i < H;i++){
        for (int j = 0;j < W;j++){
            char c; cin >> c;
            S[i][j] = c-'0';
        }
    }

    ll ans = H+W-2;

    for (int div = 0;div < (1<<(H-1));div++){
        ll tmp = 0;
        id[0] = 0;
        for (int i = 0;i < H-1;i++){
            if(div&(1<<i)) tmp++;
            id[i+1] = tmp;
        }
        /*for (int i = 0;i < H;i++){
            cout << id[i] << " ";
        }
        cout << endl;*/
        for (int i = 0;i < H;i++){
            cnt[i] = 0;
        }

        ll op = tmp;
        

        for (int w = 0;w < W;w++){
            if(op > ans) break;
            for (int h = 0;h < H;h++){
                if(S[h][w] == 1){
                    cnt[id[h]]++;
                    if(cnt[id[h]] > K){
                        op++;
                        //cout << op << endl;
                        for (int i = 0;i < H;i++){
                            cnt[i] = 0;
                        }
                        w--;
                        break;
                    }
                }
            }
        }
        //cout << op << endl;
        ans = min(ans,op);

    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 384
#include <stdio.h>

int count = 0;

void dfs(int ver, int v[][10], int seen[], int n, int m){
	int end = 1;
	for(int i=0; i < n; i++) {
		if(!seen[i] && i != ver)
			end = 0;
	}
	if(end) {
		count++;
		return;
	}

	seen[ver] = 1;
	for(int i=0; v[ver][i]; i++) {
		if(seen[v[ver][i]-1])
			continue;
		dfs(v[ver][i]-1, v, seen, n, m);
	}
	seen[ver] = 0;
}

int main(void){
	int n, m, a, b, idx[8] = {0};
	int v[8][10] = {{0}};
	int seen[8] = {0};

	scanf("%d%d", &n, &m);
	for(int i=0; i < m; i++) {
		scanf("%d%d", &a, &b);
		a--; b--;
		v[a][idx[a]++] = b+1;
		v[b][idx[b]++] = a+1;
	}

	dfs(0, v, seen, n, m);
	printf("%d", count);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MAXN 1000
#define vi vector<int>
#define F first
#define S second

using namespace std;

int main(){
    map<string,int> m;
    m["SUN"] = 7;
    m["MON"] = 6;
    m["TUE"] = 5;
    m["WED"] = 4;
    m["THU"] = 3;
    m["FRI"] = 2;
    m["SAT"] = 1;
    string ent;
    cin >> ent;
    cout << m[ent] << endl;
    return 0;
}

Measured memory_bytes: 256
import sys, math
input = sys.stdin.readline

def main():
    n,a,b = map(int,input().split())
    h = [int(input()) for _ in range(n)]
    ok = max(h)
    ng = 0
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        cnt = 0
        for i in range(n):
            cnt += max(0, math.ceil((h[i]-mid*b)/(a-b)))
        if cnt <= mid:
            ok = mid
        else:
            ng = mid
    print(ok)

if __name__ == "__main__":
    main()

Measured memory_bytes: 44252
"use strict"
 
function Main(s) {
  s = s.trim().split(' ');
  const a = s[0];
  const b = s[1];
  const aa = a.repeat(Number(b));
  const bb = b.repeat(Number(a));
  console.log(aa < bb ? aa:bb);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r){
    int x, i, j, t;
    x = A[r];
    i = p -1;
    for(j = p; j < r; j++){
        if(A[j] <= x){
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    t = A[i + 1];
    A[i + 1] = A[r];
    A[r] = t;
    return i + 1;
}

int main(){
    int i, q;

    scanf("%d", &n);

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

    }

    q = partition(0, n-1);

    for(i = 0; i < n; i++){
        if(i != 0){
            printf(" ");
        }
        if(i == q){
            printf("[");
        }
        printf("%d", A[i]);
        if(i == q){
            printf("]");
        }
       

       
    }
     printf("\n");
    return 0;
}


Measured memory_bytes: 2960
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr ll MOD = (ll)1e9 + 7;
constexpr ll MOD2 = 998244353;
constexpr ll HIGHINF = (ll)1e18;
constexpr ll LOWINF = (ll)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template<typename T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template<typename... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
    int N; cin >> N;
    V<int> p(N);

    for(int i = 0; i < N; ++i) cin >> p[i];
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j){
            auto q = p;
            swap(q[i],q[j]);
            int flg = 1;
            for(int k = 0; k + 1 < N; ++k) if(q[k]>q[k+1]) flg = 0;
            corner(flg,"YES");
        }
    }
    cout << "NO" << endl;
  

    return 0;
}


Measured memory_bytes: 256
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;



struct UnionFind {
  std::vector<int> par, rank;

  UnionFind(int n) : par(n , -1), rank(n, 0) {}

  void init(int n) {
    par.assign(n, -1); rank.assign(n, 0);
  }

  int root(int x) {
    if (par[x] == -1) return x;
    else return par[x] = root(par[x]);
  }

  bool issame(int x, int y) {return root(x) == root(y);}

  void unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return;
    if (rank[x] < rank[y]) std::swap(x, y);
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    return;
  }
};


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

  int n, m; cin >> n >> m;
  UnionFind uf(n);

  for (int i = 0; i < m; ++i) {
    int x, y; cin >> x >> y;
    if (!uf.issame(x, y)){
      uf.unite(x, y);
    }
  }

  int query; cin >> query;

  for (int i = 0; i < query; ++i) {
    int z, w; cin >> z >> w;
    if (uf.issame(z, w)) {
      cout << "yes" << '\n';
    } else {
      cout << "no" << '\n';
    }
  }

  return 0;
}


Measured memory_bytes: 3536
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 110000
using namespace std;
struct node{int y,nex;}a[2*N];
int n,fir[N],len;
bool bo;
void ins(int x,int y)
{
	a[++len].y=y;a[len].nex=fir[x];fir[x]=len;
}
bool dfs(int x,int fa)
{
	int cnt=0;
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		if(dfs(y,x)==0) cnt++;
		if(bo==0) return 0;
	}
	if(cnt>1) {bo=0;return 0;}
	return cnt;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		ins(x,y);ins(y,x);
	}
	bo=1;
	if(dfs(1,0)==0 || bo==0) printf("First\n");
	else printf("Second\n");
	return 0;
}

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

int main() {
  long long N, K; cin >> N >> K;
  long long mod = pow(10, 9) +7;
  N++;
  
  long long ans = 1;
  
  for(int i=K; i<N; i++) {
    long long a=2*N-i+1, b=i+1;
    long long c=(a-b)*i;
    ans += c/2 +1;
    ans %= mod;
  }
  
  cout << ans << endl;
  
}


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

int main(){
	int n;
	cin >> n;
	map<string, int> memo;
	rep(i, n){
		string s;
		cin >> s;
		memo[s] += 1;
	}

	int maxv = 0;
	for(const auto& x : memo){
		int v = x.second;
		if(v > maxv) maxv = v;
	}
	for(auto it = memo.begin(); it != memo.end(); it++){
		if(it->second == maxv){
			cout << it->first << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 19148
# -*- coding: utf-8 -*-
N, A, B, C, D = map(int, input().split())
S = input()
A, B, C, D = A-1, B-1, C-1, D-1

if A < B < C < D:
    for i in range(A + 1, D):
        # check "##"
        if S[i : i + 2] == "##":
            print("No")
            exit(0)
    print("Yes")
elif A < B < D < C:
    cnt3dot = 0
    for i in range(A + 1, C):
        # check "##"
        if S[i : i + 2] == "##":
            print("No")
            exit(0)
        if (B - 1 <= i) and (i <= D - 1):
            # check "..."
            if S[i : i + 3] == "...":
                cnt3dot += 1
    if cnt3dot > 0:
        print("Yes")
    else:
        print("No")
elif A < C < B < D:
    for i in range(A + 1, C):
        # check "##"
        if S[i : i + 2] == "##":
            print("No")
            exit(0)
    for i in range(B + 1, D):
        # check "##"
        if S[i : i + 2] == "##":
            print("No")
            exit(0)
    print("Yes")


Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <unordered_map>

using namespace std;

int main() {
  int N;
  cin >> N;
  unordered_map<int, int> S;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    ++S[a];
  }
  int cnt = 0;
  for (auto s : S) {
    if (s.second % 2 == 1) {
      ++cnt;
    }
  }
  printf("%d\n", cnt);
}

Measured memory_bytes: 6644
import sys

N, K = map(int, sys.stdin.readline().strip().split(" "))
X = map(int, sys.stdin.readline().strip().split(" "))

isZero = False
zeroInd = 0
for x in X:
    if x == 0:
        isZero=True
    if x < 0:
        zeroInd+=1
    else:
        break

zeroInd-=1

if isZero:
    X.remove(0)
    K -= 1

if K == 0:
    print(0)
    sys.exit(0)

ans = []

for k in range(K+1):
    a = -1
    if zeroInd + k < len(X):
        a = X[zeroInd+k]

    b = -1
    if len(X) > zeroInd+k-K+1 >= 0:
        b = X[zeroInd+k-K+1] * -1

    if b != -1 and k == 0:
        ans.append(b)
    elif a != -1 and k == K:
        ans.append(a)
    elif a != -1 and b != -1:
        ans.append(a*2+b)
        ans.append(b*2+a)

print(min(ans))


Measured memory_bytes: 11348
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		
		while(true)
		{
			int h = stdIn.nextInt();
			int w = stdIn.nextInt();
			
			if(h==0 && w==0)
			{
				break;
			}
			
			int diagonal = h*h+w*w;
			int i = 1;
			boolean flag = false;
			int diagonal_min = 100000;
			int h_min = 151;
			int w_min = 151;
			while(true)
			{
				for(int j = i+1;j<150;j++)
				{
					if((i!=h || j!=w) && diagonal == (i*i+j*j) && i>h)
					{
						System.out.println(i+" "+j);
						flag = true;
						break;
					}
					if(diagonal<(i*i+j*j) && (i*i+j*j)==diagonal && h_min>i && i>h)
					{
						h_min = i;
						w_min = j;
					}
					if(diagonal<(i*i+j*j) && (i*i+j*j)<diagonal_min )
					{
						diagonal_min = i*i+j*j;
						h_min = i;
						w_min = j;
						
					}
					
					if(j==i+1 && diagonal<(i*i+j*j))
					{
						System.out.println(h_min+" "+w_min);
						flag = true;
						break;
					}
					
				}
				if(flag)
				{
					break;
				}
				if(i==149)
				{
					System.out.println(h_min+" "+w_min);
					break;
				}
				i++;
			}
			
		}
	}

}

Measured memory_bytes: 20568
import java.util.*;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int flg = 0;

        for(int i=1;; i++) {
            int num = k * i;
            if(num < a) continue;
            if(a <= num && b >= num) {
                System.out.println("OK");
                flg = 1;
                break;
            }
            if(num > b) break;
        }
        if(flg == 0) {
            System.out.println("NG");
        }
	}
}

Measured memory_bytes: 35772
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N;
    cin >> N;

    multiset<ll > st;
    st.insert(-INF);

    for(ll i = 0; i < N; i++){
        ll A; cin >> A;
        auto it = st.lower_bound(A);
        it--;
        if(*it != -INF) st.erase(it);
        st.insert(A);
        //cout << "size:" << st.size() << endl;
    }

    cout << st.size()-1 << endl;

}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll k;
  cin >> k;
  ll a[k],l,r;
  for(int i=k-1;i>=0;i--){
    cin >> a[i];
  }
  l =  r = 2;
  for(int i=0;i<k;i++){
    if((l/a[i])*a[i]<l){
      l = (l/a[i])*a[i]+a[i];
    }
    r = (r/a[i])*a[i]+a[i]-1;
    if(r<a[i]||l>r){
      cout <<"-1\n";
      return 0;
    }
  }
  cout << l <<" "<<r<<endl;
}


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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main() {
	long long int n,maxa=-10000000,mina=10000000,sum=0;
	cin >> n;

	for (int i = 0; i < n; ++i) {
		long long int buf;
		cin >> buf;
		maxa = max(buf,maxa);
		mina = min(buf,mina);
		sum += buf;
	}

	printf("%lld %lld %lld\n",mina,maxa,sum);

	return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,k,q;
    cin >> n >> k >> q;
    vector<ll> point(n,0);
    for(int i = 0;i < q;i++){
        ll a;
        cin >> a;
        a--;
        point[a]++;
    }
    for(int i = 0;i < n;i++){
        if(q-point[i] >= k){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    //cin >> n;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int p[1005];
int main()
{
    int n;
    int k;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
    }
    sort(p,p+n);
    long long int s=0;
    for(int i=0;i<k;i++)
    {
        s+=p[i];
    }
    printf("%lld\n",s);
    return 0;
}


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

int main(){
    int n,k;
    cin>>n>>k;
    map<int,int>mp;
    rep(i,n){
        int a; cin>>a;
        mp[a]++;
    }
    vector<int>x;
    for(auto&p:mp){
        x.push_back(p.second);
    }
    sort(x.begin(),x.end());
    int go=mp.size()-k;
    if(go<0)go=0;
    int ans=0;
    rep(i,go){
        ans+=x[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 10748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
using P = pair<int, int>;
const ll inf =1e9;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    str s; cin >> s;
    for(int i=0; i<s.size(); i++){
        cout << 'x';
    }
    cout << endl;
}

Measured memory_bytes: 256
use proconio::input;
use std::cmp::{max, min};

const MAX_L: usize = 100_000;
const BASE_SIZE: usize = 1 << 10;

fn main() {
    input! {
        n: usize,
        vw: [(u32, usize); n],
        q: usize,
        vl: [(usize, usize); q],
    }
    let dp = make_dp(&vw);
    for vlq in vl {
        println!("{}", calc(&vw, vlq.0 - 1, vlq.1, &dp));
    }
}

fn make_dp(vw: &Vec<(u32, usize)>) -> Vec<Vec<u32>> {
    let mut dp = Vec::<Vec<u32>>::new();

    dp.push(
        (0..=MAX_L)
        .map(|i| if i < vw[0].1 { 0 } else { vw[0].0 as u32 })
        .collect()
    );

    let n = min(vw.len(), BASE_SIZE - 1);
    for c in 1..n {
        let p = (c - 1) / 2;
        dp.push(
            (0..=MAX_L)
            .map(|i| {
                let w = vw[c].1;
                let v = if i < w { 0 } else { dp[p][i - w] + vw[c].0 as u32 };
                max(dp[p][i], v)
            })
            .collect()
        );
    }

    dp
}

fn calc(
    vw: &Vec<(u32, usize)>,
    u: usize, 
    l: usize,
    dp: &Vec<Vec<u32>>
) -> u32 {
    if u < dp.len() {
        dp[u][l]
    } else {
        let p = (u - 1) / 2;
        let w = vw[u].1;
        let pv1 = calc(vw, p, l, dp);
        let pv2 = if l < w { 0 } else { calc(vw, p, l - w, dp) + vw[u].0 };
        max(pv1, pv2)
    }
}


Measured memory_bytes: 413140
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <map>
 
using namespace std;
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
 
typedef pair<int, int> P;
 
int d[201][201];
 
const int INF = 1<<29;
int main(){
    int n;
    while(cin >> n, n){
        rep(i, 201) rep(j, 201) d[i][j] = INF;
        map<string, int> num;
        int idx = 0;
        bool ans = true;
        rep(i, n){
            string a, b;
            string c;
            cin >> c >> a >> c >> c >> b;
            if(!num[a]) num[a] = ++idx;
            if(!num[b]) num[b] = ++idx;
            int x = atoi(c.substr(3).c_str());
            // a = b+x
            int l = num[a], r = num[b];
			d[l][l] = d[r][r] = 0;
            rep(k, 2){
                d[l][r] = x;
                swap(l, r);
                x = -x;
            }
            for(int j = 1; j <= idx; j++){
                for(int k = 1; k <= idx; k++){
                    if(d[k][j] == INF) continue;
                    for(int l = 1; l <= idx; l++){
                        if(d[j][l] == INF) continue;
                        d[k][l] = min(d[k][l], d[k][j]+d[j][l]);
                    }
                }
            }
            for(int j = 1; j <= idx; j++){
				if(d[j][j] != 0) ans = false;
			}
        }
 
        cout << (ans?"Yes":"No") << endl;
    }
 
    return 0;
}

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

namespace Atc_0021
{
    class Program
    {
        static void Main(string[] args)
        {
            string rStr = Console.ReadLine();

            int N = int.Parse(rStr.Split(' ')[0]);
            int M = int.Parse(rStr.Split(' ')[1]);

            int result = 0;

            if (2 <= N)
            {
                int r = Calc(N, N - 1) / 2;

                result += r;
            }

            if (2 <= M)
            {
                int r = Calc(M, M - 1) / 2;
                result += r;
            }

            Console.WriteLine(result);

        }

        static int Calc(int i, int s)
        {
            if (i == s)
            {
                return s;
            }

            return (i * Calc(i - 1, s));
        }
    }
}


Measured memory_bytes: 27268
#include <stdio.h>
int main(void)
{
    int N;
    int A, B;
    
    scanf("%d%*c", &N);
    if(N == 1){
        printf("Hello World\n");
    }else if(N == 2){
        scanf("%d%*c", &A);
        scanf("%d%*c", &B);
        printf("%d\n", A + B);
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int)x.size())
typedef long long LL;
typedef pair<int,int> PII;
int read(){
	char c=getchar();int d=0,f=1;
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';d=d*10+c-48,c=getchar());
	return d*f;
}
const int N=3010;
const int mod=998244353;
int n,x,ans,mi2[N],c[N][N],f[N][N*2];
void inc(int&a,int b){ a+=b;if(a>=mod)a-=mod; }
int mul(int a,int b){return (LL)a*b%mod;}
int main(){
	cin>>n>>x;
	f[0][0]=1;
	ref(i,0,n-1)ref(j,0,n*2)if(f[i][j]){
		inc(f[i+1][j+1],f[i][j]);
		inc(f[i+1][j+2],f[i][j]);
	}
	ref(i,0,n)c[i][0]=1;
	ref(i,1,n)ref(j,1,i)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	ans=1;
	ref(i,1,n){
		int s=c[n][i];
		int r=0;
		ref(j,1,x-1)inc(r,f[i][j]);
		ref(j,1,i)if(j<=x+1&&x+1<=j*2){
			int a=min(j-2,i-j)+2,b=x+1-a*2;
			if(a<=j&&b>=0)inc(r,f[j-a][b]);
		}
		inc(ans,mul(s,r));
		//cout<<i<<" "<<r<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 104576
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <=b; i++)
    {
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3636
import java.io.*;
import java.util.Scanner;

public class Main {
	
	
	public static void solution(String s1, String s2) {
		int s[][] = new int[s1.length()+1][s2.length()+1];
		for (int i = 0; i <= s1.length(); i++) {
			for (int j = 0; j <= s2.length(); j++) {
				if (i == 0 || j == 0) {
					s[i][j] = 0;
				}
				else if (s1.charAt(i-1) != s2.charAt(j-1)) {
					s[i][j] = Math.max(s[i-1][j], s[i][j-1]);
				}
				else {
					s[i][j] = s[i-1][j-1] + 1;
				}
			}
		}
		System.out.println(s[s1.length()][s2.length()]);
	}
	
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int sets = in.nextInt();
		for (int i = 0; i < sets; i++) {
			String s1 = in.next();
			String s2 = in.next();
			solution(s1,s2);
		}
	}
}


Measured memory_bytes: 66100
#include <stdio.h>
int main(){
	int a,b;
	int i,j;
	for(;;){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0) break;
		for(i=0;i<a;i++){
			for(j=0;j<b;j++){
				if(i==0||i==a-1||j==0||j==b-1) printf("#");
				else printf(".");
			}
			puts("");
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll INF64 = 1e18;

template <typename T>
string to_string(const vector<T> &v) {
  string ret = "<";
  for (auto it : v)
    ret += to_string(it) + ", ";
  ret.pop_back(); ret.pop_back();
  ret += ">";
  return ret;
}

string to_string(const string &s) {
  return '"' + s + '"';
}

string to_string(bool b) {
  return b ? "true" : "false";
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

void debug_print() { cerr << endl; }

template <typename T, typename ...U>
void debug_print(T t, U... u) {
  cerr << " " << to_string(t);
  debug_print(u...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_print(__VA_ARGS__)
const int N = 1e6 + 5;

vector<int> v;
int cnt[N];
bool not_prime[N];

bool sieve() {
  SET(cnt, 0);
  for (int i = 0; i < v.size(); i++) {
    cnt[v[i]]++;
  }
  for (ll i = 2; i < N; i++) {
    if (!not_prime[i]) {
      int c = 0;
      for (int j = i; j < N; j+= i) {
        not_prime[j] = true;
        if (cnt[j])
          c += cnt[j];
      }
      if (c > 1)
        return false;
    }
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  v.resize(n);
  for (auto &it : v)
    cin >> it;
  if (sieve())
    cout << "pairwise coprime" << '\n';
  else {
    int g = 0;
    for (auto it : v)
      g = __gcd(g, it);
    if (g == 1)
      cout << "setwise coprime" << '\n';
    else cout << "not coprime" << '\n';
  }
  //If you dont need Flush Stream, dont use endl
  return 0;
}


Measured memory_bytes: 11968
#include<iostream>
#include<string>

using namespace std;

int main() {

	string str[3];

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

	if (str[0][str[0].size() - 1] == str[1][0] && str[1][str[1].size() - 1] == str[2][0]) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 166, task B, 2020/05/03
//ms,
/*
*/

int main(void){
  int N, K;
  int d, a;

  cin >>N >>K;
  vector<int> sunuke(N);

  for(int i=0;i<N;i++) sunuke[i]=0;
  for(int i=0;i<K;i++){
    cin >>d;
    for(int j=0;j<d;j++){
      cin >>a;
      sunuke.at(a-1)=1;
    }
  }

  cout <<count(sunuke.begin(), sunuke.end(), 0) <<endl;

  
  return 0;
}
/*
*/


Measured memory_bytes: 3632
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define        u64             uint64_t
#define        ll              long long
#define        endl            "\n"
#define        PI              acos(-1)
#define        fi              first
#define        si              second
#define        mkp             make_pair
#define        pb              push_back
#define        set0(arr)       memset(arr, 0, sizeof(arr))
#define        setinf(arr)     memset(arr, 126, sizeof(arr))
#define        all(x)          (x).begin(),(x).end()
#define        sz(v)           ((int)(v).size())
#define        IOS             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
using          pll        =      pair<ll, ll> ;
using          vl         =      vector<ll> ;
using          vpll       =      vector<pll> ;
using          mll        =      map<ll, ll> ;
using          mcl        =      map<char, ll> ;
using          msl        =      map<string,ll> ;
using          sl         =      set<ll> ;
using          sc         =      set<char> ;
using          dl         =      deque<ll> ;
const int N = 1e6+5 ;

ll      mod = 1e9+7 ;
vl      adj[N] ;
vpll    adjc[N] ;
ll      vis[N] ;
ll      arr[N] ;



int main()
{
    IOS;
    ll a, b, c, d, n, m, p, x, y, z, i, j, k, f = 0, tc, cnt = 0, sum = 0, mul = 1, mi = 1e18, ma = -1e18;
    string   str ;
    char     ch ;
    double   db ;
    ll       l, r ;
    //code

        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>arr[i];
        }
        sum=0;
        arr[0]=0;
        for(i=1;i<=n;i++)
        {
              if(arr[i-1]>arr[i])
              {
                    x=arr[i-1]-arr[i];
                    sum+=x;
                    arr[i]=arr[i-1];
              }
        }
        cout<<sum<<endl;


    //code
    return 0;
}




Measured memory_bytes: 52040
import std.stdio, std.string, std.algorithm;

void main()
{
  char[] input = chomp(readln()).dup;
  char[] input2 = chomp(readln()).dup;

  swap(input[0], input[2]);
  if(input == input2) {
    writeln("YES");
    return;
  } else {
    writeln("NO");
    return;
  }
}


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

int main(){
  int K, A, B;
  cin >> K >> A >> B;
  
  string ans = "NG";
  int count = 1;
  while(K*count <= B){
    if(K*count >= A){
      ans = "OK";
      break;
    }
    count++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define LL long long
#define Set(s,v) memset(s,v,sizeof(s))
using namespace std;
inline LL read(){
    LL ans=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-'){f=-1;}ch=getchar();}
    while(ch>='0'&&ch<='9'){ans=(ans<<3)+(ans<<1)+(ch^48);ch=getchar();}
    return ans*f;
}
void write(LL x){
    if(x<0){putchar('-');x=-x;}
    if(x>9){write(x/10);}
    putchar(x%10|48);
}
int n,sum;
int main(){
    n=read();
    for (int i=1;i<=n;i++) sum^=read();
    if(!sum) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 888
# Indertion Sort

n = int(input())
A = list(map(int, input().split()))

def insertSort(A):
	print(*A)
	n = len(A)
	for i in range(1, n):
		v = A[i]
		j = i - 1
		while j >= 0 and A[j] > v:
			A[j + 1] = A[j]
			j -= 1
		A[j + 1] = v
		print(*A)
	return 0

insertSort(A)


Measured memory_bytes: 5976
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <stdio.h>
#define   FOR(i,n) for(int i=0;i<n;i++)

using namespace std;
int int_sort(const void*a,const void *b) {
    return *(  int *) b - *(int *) a;
    //qsort(b, a, sizeof(long long int), int_sort);
}

int main() {
  int a,b,x;

   cin>>x>>a>>b;

   cout<<(x-a)%b;
return 0;
}


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

int main(void){

    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    vector<int> vec;
    int max;
    int in;
    cin >> max;
    //cout << max <<endl;
    int ans = n;
    //cout << ans <<endl;
    for(int i=0;i<n-1;i++){
        cin >> in;
        //cout << in << max;
        if(max>in){
            ans--;
        }
        else{
            max = in;
        }
       // cout << ans << endl;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
while(1){
int m,f,r;
cin>>m>>f>>r;
if(m == -1 && f == -1 && r == -1) break;
string ans;
if(m == -1 || f ==-1) ans = "F";
else if(m + f >= 80 ) ans ="A";
else if (m + f >= 65)ans="B";
else if(m +f >=50)ans ="C";
else if(m +f >=30){
if(r >=50) ans ="C";
else ans ="D";
}
else ans ="F";
cout<<ans<<endl;
}
return 0;
}


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

int main(){
  double r,p=3.141592653589;
  cin >> r;
  cout << fixed << setprecision(6) << r*r*p << " ";
  cout << fixed << setprecision(6) << 2*r*p << endl;
  return 0;
}

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

int main(){
  int a,b,c,d,e;
  int k;
  std::cin >> a >> b >> c >> d >> e >> k;
  if(fabs(a-e)>k) std::cout << ":(" << std::endl;
  else std::cout << "Yay!" << std::endl;
  return 0;
}


Measured memory_bytes: 256
# number of elements 
n = int(input()) 
  
# Below line read inputs from user using map() function  
a = list(map(int,input().strip().split()))[:n] 
  
mask = 1;
flag = 0;
for num in a:
    if(num == 0):
            flag = 1
mask = 1;
flagex  = 0;
if(flag == 1):
    print(0)
else:
    for num in a:
        mask *= num;
        if(mask > 1000000000000000000):
            flagex = -1;
            break;
    if(flagex == -1):
        print(-1);
    else:
        print(mask);
            

Measured memory_bytes: 21780
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

int main(){
  int t = 700;
  string s;
  cin >> s;
  REP(i,3){
    if (s[i]=='o') {
      t+=100;
    }
  }
  cout << t;
  return 0;
}

Measured memory_bytes: 256
#define N 12
double M[N][1<<N],r,t;
D[N],n;
double dfs(p,f){if(M[p][f]<0){
	int i=0;
	M[p][f]=0;
	for(;i<n;i++){
		if(f&1<<i)continue;
		if(t=dfs(i,f|1<<i)+D[p]+D[i]-2*sqrt(D[p]*D[i]),M[p][f]<t)M[p][f]=t;
	}
}return M[p][f];}
main(l,i,j,d){for(;~scanf("%d",&l);){
	for(d=n=0;getchar()!='\n';d+=D[n++]*2)scanf("%d",D+n);
	for(i=0;i<n;i++)for(j=0;j<1<<n;j++)M[i][j]=-1;
	for(r=i=0;i<n;i++)if(t=dfs(i,1<<i),r<t)r=t;
	puts(d-r<=l?"OK":"NA");
}exit(0);}

Measured memory_bytes: 968
while True:
    ls=input().split()
    if ls[1]=='+':
        print(int(ls[0])+int(ls[2]))
    elif ls[1]=='-':
        print(int(ls[0])-int(ls[2]))
    elif ls[1]=='/':
        print(int(ls[0])//int(ls[2]))
    elif ls[1]=='*':
        print(int(ls[0])*int(ls[2]))
    else:break
        


Measured memory_bytes: 5600
/*
        |___Arshit Mangukiya___|
        |___DA-IICT____|
        |___201801173____|
*/
        //__WRITE  YOUR  CODE  HERE___//
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;            
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef vector<pll> vpl;
#define ff first
#define ss second
#define pi acos(-1)
#define mr_ad_0501 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(a)      a.begin(),a.end()
#define f(i,a,n) for(ll i=a;i<n;i++)
#define MOD 1000000007
#define MAX 200007
#define LM LLONG_MAX
#define sz size()
#define p(x)        cout<< x << " ";
#define pe(x)       cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
const int N=1e5+5;

/*  bool fun(pair<int,int>a , pair<int,int>b)
            {
                if(a.ff == b.ff)    return a.ss < b.ss;
                else            return a.ff < b.ff;
            }*/
           
 /*void bfs(ll x)
 {
    queue<ll> q;
    q.push(x);
    while(!q.empty())
    {
        ll k=q.front();
        q.pop();
        for(auto X:v[k])
        {
            if(!vis[X])
            {
                l[X]=l[k]+1;
                vis[X]=1;
                q.push(X);
            }
        }
    }
 }*/
//ll i,j;
/*void dfs(ll v) {
    visited[v] = true;
    for (auto u : adj[v]) {
        if (!visited[u])
            dfs(u);
    }
}*/

ll getSetBitsFromOneToN(ll N)
{
    ll two = 2, ans = 0;
    ll n = N;
 
    while (n) {
        ans += (N / two) * (two >> 1);
 
        if ((N & (two - 1)) > (two >> 1) - 1)
            ans += (N & (two - 1)) - (two >> 1) + 1;
 
        two <<= 1;
        n >>= 1;
    }
    return ans;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
        res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}
 
ll mod_inverse(ll a)
{
	return mod_pow(a , MOD-2 , MOD);
}

void solve()
{
	ll n;
	cin>>n;
	ll arr[n],c=0;
	f(i,0,n)cin>>arr[i];
	//sort(a,a+n);
	int count = 0; 
  
    // The three loops select three 
    // different values from array 
    for (ll i = 0; i < n; i++) { 
        for (ll j = i + 1; j < n; j++) { 
  
            // The innermost loop checks for 
            // the triangle property 
            for (ll k = j + 1; k < n; k++) 
  
                // Sum of two sides is greater 
                // than the third 
                if ( arr[i] + arr[j] > arr[k] && arr[i] + arr[k] > arr[j] && arr[k] + arr[j] > arr[i] && arr[i]!=arr[j] && arr[i]!=arr[k] && arr[k]!=arr[j]) 
                    count++; 
        } 
    } 
    cout<<count; 
}
   
int32_t main(){
    mr_ad_0501;
    ll t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

void solve() {
    i64 n, k;
    cin >> n >> k;
    vector<i64> h(n);
    for (auto& e : h) cin >> e;

    vector<i64> dp(n, INF);
    dp[0] = 0;
    for (i64 i = 0; i < n; i++) {
        for (i64 j = 1; j <= k && i + j < n; j++) {
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }
    cout << dp[n - 1] << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 4788
#include<stdio.h>

int main(){
  int n,k;
  scanf("%d%d",&n,&k);
  int p[n];
  double q[n];
  for(int i=0;i<n;i++){
    scanf("%d",&p[i]);
    q[i]=(p[i]+1.0)/2;}

  double max=0;
  double sum=0;
  for(int i=0;i<k;i++){
    sum+=p[i];}
  max=sum;
  for(int left=0;left+k<n;left++){
    sum-=p[left];
    sum+=p[left+k];
    if(sum > max){ max=sum;}}

  max=(max*1.0+k)/2;
  //printf("%d %d %f %f\n",n,k,sum,max);
  printf("%f\n",max);

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int jewel[21][21];
  int robot[21][21];
  int n;
  while(cin >>n,n){
    for(int i=0;i<=20;i++){
      for(int j=0;j<=20;j++){
        jewel[i][j]=0;
        robot[i][j]=0;
      }
    }
    bool ans=true;
    int pos_x=10,pos_y=10;
    for(int i=0;i<n;i++){
      int x,y;
      cin >> x >> y;
      jewel[x][y]=1;
    }
    int m;
    cin >> m;
    for(int i=0;i<m;i++){
    char d;
    cin >> d;
    int l;
    cin >> l;
    if(d=='N'){
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_y++;
        robot[pos_x][pos_y]=1;
      }
    }
    else if(d=='E'){
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_x++;
        robot[pos_x][pos_y]=1;
      }
    }
    else if(d=='S'){
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_y--;
        robot[pos_x][pos_y]=1;
      }
    }
    else{
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_x--;
        robot[pos_x][pos_y]=1;
      }
    }
  }
  for(int i=0;i<=20;i++){
    for(int j=0;j<=20;j++){
      if(jewel[i][j]==1){
        if(robot[i][j]==0) ans=false;
      }
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  }
}

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

int main(){
    string keys;
    cin>>keys;
    int arr[100];
    int pos=0;
    for(int i=0; i<keys.length(); i++){
        if(keys[i]=='1'){
            arr[pos]=1;
            pos++;
        }
        else if(keys[i]=='0'){
            arr[pos]=0;
            pos++;
        }
        else if(pos>0)
            pos--;
    }
    for(int i=0; i<pos; i++){
        printf("%d", arr[i]);
    }
return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int N;
	int i, j;
	cin >> N;

	int ans = 0, count;

	for (i = 1; i <= N; i+=2) {
		count = 0;
		for (j = 1; j*j < i; j++) {
			if (i % j == 0) {
				count+= 2;
			}
		}
		if (i == j*j && i%j == 0) count++;

		if (i%2 == 1 && count == 8) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
data = gets.split(" ").map{|nn|nn.to_i}
a = data[1]
b = data[0]
ans = 0

if a < b
  ans += b
  b -= 1
else
  ans += a
  a -= 1
end
if a < b
  ans += b
  b -= 1
else
  ans += a
  a -= 1
end

puts ans.to_s

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

int main(){
    int n; cin >> n;
    int a[n];
    int x[n][n], y[n][n];

    for(int i = 0; i < n; i++){
        cin >> a[i];
        for(int j = 0; j < a[i]; j++){
            cin >> x[i][j] >> y[i][j];
        }
    }

    int ans = 0;
    for(int i = 0; i < (1 << n); i++){
        bool f = true;
        bitset<20> bt(i);
        for(int j = 0; j < n; j++){
            if(!(i & (1 << (j)))) continue;
            for(int k = 0; k < a[j]; k++){
                if(((i >> (x[j][k]-1)) & 1) ^ y[j][k]) f = false;
            }
        }
        
        if(f) ans = max(ans, (int)bt.count());
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(abs(a-x)<abs(b-x)){
        cout << "A"<<endl;
    }
    else{
        cout << "B" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def examA():
    S, T = LSI()
    ans = T+S
    print(ans)
    return

def examB():
    A, B, K = LI()
    if A>K:
        A -=K
        print(A,B)
        return
    if A+B>K:
        B -=(K-A)
        A = 0
        print(A,B)
        return
    A = 0; B = 0
    print(A,B)
    return

def examC():
    def is_prime(n):
        if n == 1: return False
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True
    X = I()
    while(True):
        if is_prime(X):
            ans = X
            break
        X +=1
    print(ans)
    return

def examD():
    return

def examE():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()


Measured memory_bytes: 3676
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> cnt(404040);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnt[a]++;
    sum += a;
  }
  for (int i = 1; i < (int) cnt.size(); i++) {
    cnt[i] += cnt[i - 1];
  }
  vector<int> b(m);
  vector<long long> memo(202020, -1);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  long long ans = sum * m;
  for (int i = 0; i < m; i++) {
    if (memo[b[i]] != -1) {
      ans -= memo[b[i]];
      continue;
    }
    memo[b[i]] = 0;
    for (int x = 1; (x + 1) * b[i] - 1 < 404040; x++) {
      memo[b[i]] += 1LL * b[i] * x * (cnt[(x + 1) * b[i] - 1] - cnt[x * b[i] - 1]);
    }
    ans -= memo[b[i]];
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 6796
#include<iostream>
#include<vector>
#include<set>
using namespace std;

int main()
{
  int n;
  vector<int> num(50000);
  set<int> a;
  set<int>::iterator it, itr;
  int i, t;

  while (cin>>n, n) {
    a.clear();
    for (i = 0; i < n; i++) num[i] = 0;
    for (i = 1; i < n; i++) a.insert((i*i)%n);
    for (it = a.begin(); it != a.end(); it++) {
      for (itr = it; itr != a.end(); itr++) {
	t = *it - *itr;
	if (t == 0) continue;
	if (t < 0) t += n;
	if ((n-1)/2 < t) t = n-t;
	num[t] += 2;
      }
    }
    for (i = 1; i <= (n-1)/2; i++)
      cout<<num[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1224
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
  -- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative
import           Debug.Trace
import Text.Printf


readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons

main = do
  l <- readLn :: IO Double
  let maxVolume = (l / 3)**3
  printf "%.10f\n" maxVolume


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

using namespace std;

int main(void){
    int N;
    cin >> N;
    string s;
    cin >> s;
    deque<char> ans;

    int cnt=0;
    for(char c : s){
        ans.push_back(c);
        if(c == '('){
            if(cnt > 0){
                for(int i=0;i<cnt;i++) ans.push_front('(');
                cnt = 0;
            }
            
            cnt--;
        }
        if(c == ')') cnt++;
    }
    if(cnt > 0){
        for(int i=0;i<cnt;i++) ans.push_front('(');
    }
    if(cnt < 0){
        for(int i=0;i<-cnt;i++) ans.push_back(')');
    }

    for(char c : ans){
        cout << c;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256