akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x=nxt();
    for(;;x++)
    {
        bool t=1;
        for(int i=2;i<=sqrt(x);i++)
            if(x%i==0)
            {
                t=0;
                break;
            }
        if(t)
            break;
    }
    cout<<x<<endl;
    

    return 0;   
}


 
 


Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))


n = inp()
aa = inpl()
g = 1
for a in aa:
    g = a*g//fractions.gcd(a,g)
g %= mod
res = 0
for a in aa:
    res += g*pow(a,mod-2,mod)
    res %= mod
print(res)

Measured memory_bytes: 6184
#include<limits.h>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;

int knapsack(int *w,int *v,int n,int we,int va)
  { 
  	  ll res[n+1][va+1];
  	  for(int i=0;i<=n;i++)
          res[i][0]=0;
      for(int i=0;i<=n;i++)
         for(int j=1;j<=va;j++)
              res[i][j]=INT_MAX;
      int rv=-1;          
      for(int i=1;i<=n;i++)
       {
       	for(int j=1;j<=va;j++)
       		 {
       		 	if((j-v[i-1])>=0)
       		 	  {
       		 	      if(res[i][j-v[i-1]]==INT_MAX)
       		 	          res[i][j]=res[i-1][j];
       		 	      else
       		 	          res[i][j]=min(res[i-1][j-v[i-1]]+w[i-1],res[i-1][j]);
       		 	  }
       		 	else
       		 	      res[i][j]=res[i-1][j];
       		 	if(res[i][j]!=INT_MAX && j>rv && res[i][j]<=we)
       		 	    rv=j;
       		 	 //cout<<res[i][j]<<" ";   
       		 }
       		//cout<<"\n"; 
       } 
      return rv;       	

  }

int main()
 {
    int n,we;
    cin>>n>>we;
    int v[n],w[n],va=0;
    for(int i=0;i<n;i++)
    	 {
    	 	cin>>w[i];
    	 	cin>>v[i];
    	 	va+=v[i];
    	 }
    cout<<knapsack(w,v,n,we,va)<<"\n";	 
 }

Measured memory_bytes: 79104
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<long long int> A(N + 1);
	vector<long long int> B(N);
	for (int i = 0; i < N + 1; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	long long int ans = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] >= B[i]) {
			ans += B[i];
		}
		else if (A[i] < B[i] && A[i] + A[i + 1] > B[i]) {
			ans += B[i];
			A[i + 1] -= B[i] - A[i];
		}
		else {
			ans += A[i] + A[i + 1];
			A[i + 1] = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	string s;
	int k;
	cin>>s>>k;
	REP(i,s.size()){
		if(i%k==0){
			cout<<s[i];
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int m,n;
	int x[201],y[201];
	int x1[1001],y1[1001];
	int sa1[201],sa2[201];
	int i,j,k;
	while(1){
		cin>>m;
		if(m==0)	break;
		for(i=0;i<m;i++){
			cin>>x[i]>>y[i];
		}
		cin>>n;
		for(i=0;i<n;i++){
			cin>>x1[i]>>y1[i];
		}
		for(i=1;i<m;i++){
			sa1[i]=x[i]-x[0];
			sa2[i]=y[i]-y[0];
		}
		
		
		
		int a,b;
		bool flg,flg2;

		int o,p;
		for(i=0;i<n;i++){
			flg=true;
			for(j=1;j<m;j++){
				int snx=x1[i]+sa1[j];
				int sny=y1[i]+sa2[j];
				flg2=false;
				for(k=0;k<n;k++){
					if(snx==x1[k]&&sny==y1[k]){
						a=x1[i];
						b=y1[i];
						flg2=true;
						break;
					}
				}
				if(!flg2){
					flg=false;
					break;
				}
			}
			if(flg){
				a=a-x[0];
				b=b-y[0];
				break;
			}
		}
		cout<<a<<" "<<b<<endl;
	}
	return 0;
}
						
				


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int k;

ll res = 0;
void solve(int pos, int last){
    if(pos == 0){
        k--;
        if(k == 0){
            cout << res << endl;
            exit(0);
        }
        return;
    }
    if(last == -1){
        for(int i = 1; i <= 9; i++){
            res = i;
            solve(pos-1, i);
            res /= 10;
        }
        return;
    }
    for(int i = 0; i <= 9; i++)
        if(abs(i-last) <= 1){
            res *= 10;
            res += i;
            solve(pos-1, i);
            res /= 10;
        }
}

int main(){
    cin >> k;
    for(int i = 1; ; i++)
        solve(i, -1);
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!


n, m, l = map(int, input().split())
A = [[0 for j in range(m)] for i in range(n)]
B = [[0 for k in range(l)] for j in range(m)]

for i in range(n):
   A[i] = list(map(int, input().split()))
   
for i in range(m):
   B[i] = list(map(int, input().split()))

#print(A)
#print(B)

C = [[0 for k in range(l)] for i in range(n)]

sum = 0
for i in range(n):
   for k in range(l):
      for j in range(m):
         sum += A[i][j] * B[j][k]
      C[i][k] = sum
      sum = 0

for i in range(n):
   for k in range(l):
      print(C[i][k], end = "")
      if k < l - 1:
         print(" ", end = "")
   #if i < n - 1:
   print("")



Measured memory_bytes: 7148
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll x,y;
ll fac[1000050],inv[1000050];
ll mi(ll a,ll b)
{
    ll ret=1;
    while(b)
    {
        if(b&1)ret=ret*a,ret%=mod;
        b>>=1;
        a=a*a,a%=mod;
    }
    return ret;
}

ll C(ll n,ll m)
{
    if(n==m||m==0)return 1LL;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}

int main()
{
    fac[0]=1;
    for(int i=1;i<=1000000;++i)fac[i]=fac[i-1]*i%mod;
    for(int i=1;i<=1000000;++i)inv[i]=mi(fac[i],mod-2);
    cin>>x>>y;
    ll s=x+y;
    if(s%3>0||abs(x-y)>s/3)return puts("0"),0;
    int cnt=0;
    ll ans=0;
    ll n=s/3;
    ll m=abs(x-n*2);
    ans=C(n,m);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 15872
#include <map>
#include <string>
#include <queue>
#include <utility>
#include <iostream>

using namespace std;

typedef pair<int,string> P;

int main(){
  
  int d[4] = {-1,1,-4,4};
  
  map<string,int> ans;
  
  ans["01234567"] = 0;
  
  queue<P> que;
  
  que.push(P(0,"01234567"));
  
  while(que.size()){
    P p = que.front(); que.pop();
    int k = ans[p.second];
    for(int i = 0;i < 4;i++){
      
      int n = p.first + d[i];
      if(i == 0 && n == 3)continue;
      if(i == 1 && n == 4)continue;
      if(n >= 0 && n < 8){
	string tmp;
	tmp = p.second;
	
	tmp[p.first] = tmp[n];
	tmp[n] = '0';
	
	if(ans.find(tmp) == ans.end()){
	  ans[tmp] = k + 1;
	  que.push(P(n,tmp));
	}
	
      }
    }
    
  }
  string s;
  char t;
  while(cin >> t){
    s += t;
    for(int i = 0;i < 7;i++){
      cin >> t;
      s += t;
    }

    cout << ans[s] << endl;
    
    s.clear();
  }

  return 0;
  
}

Measured memory_bytes: 5352
#include <stdio.h>
int main(void){
    int H, W;
    int i, j;
    
    while(scanf("%d %d\n", &H, &W) != "EOF"){
        if(H == 0 && W == 0) break;
        
        for(i = 0; i < H; i++) {
            for(j = 0; j < W; j++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2104
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
s = " " + ns()
q = ni()
k = list(li())

def find_ans(k:int):
    cnt = [0,0,0]
    ans = 0
    
    for i in range(1, n+1):
        
        if s[i] == 'C':
            ans += cnt[2]

        if i-k+1 > 0:
            if s[i-k+1] == 'D':
                cnt[0] -= 1
                cnt[2] -= cnt[1]
                
            elif s[i-k+1] == 'M':
                cnt[1] -= 1
                
        if s[i] == 'D':
            cnt[0] += 1    
        
        elif s[i] == 'M':
            cnt[2] += cnt[0]
            cnt[1] += 1

            
    return ans
        
for ki in k:
    print(find_ans(ki))

Measured memory_bytes: 57188
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
ll inf = 1e10;
ll w[105], v[105];
ll dp[300005] = {};
ll d[200005];
vector<int> g[100005];
int main() {
	string s, t;
	cin >> s >> t;
	cout << t << s << endl;


	return 0;
}


Measured memory_bytes: 4352
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

queue<pair<int, int>> q;

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

    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    int ans = 0;
    rep(y, H) {
        rep(x, W) { cin >> S[y][x]; }
    }
    rep(y_s, H) {
        rep(x_s, W) {
            if (S[y_s][x_s] == '#') continue;
            vector<vector<ll>> d(H, vector<ll>(W, -1));
            pair<int, int> start = {y_s, x_s};
            queue<pair<int, int>> que;
            que.push(start);
            d[start.first][start.second] = 0;
            while (que.size()) {
                pair<int, int> p = que.front();
                que.pop();
                for (int i = 0; i < 4; i++) {
                    int ny = p.first + dy[i], nx = p.second + dx[i];
                    if (0 <= nx && nx < W && 0 <= ny && ny < H &&
                        S[ny][nx] != '#' && d[ny][nx] == -1) {
                        que.push({ny, nx});
                        d[ny][nx] = d[p.first][p.second] + 1;
                    }
                }
            }
            int max_d = -1;
            rep(y, H){
                rep(x, W){
                    if(d[y][x]>max_d){
                        max_d = d[y][x];
                    }
                }
            }
            if (max_d > ans) {
                ans = max_d;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

ll dp[202020];
ll cum[202020];

vector<pair<int, int>> runLengthEncoding(vector<int> s) {
    int n = s.size();

    vector<pair<int, int>> res;
    int pre = s[0];
    int cnt = 1;
    for(int i=1;i<n;i++) {
        if (pre != s[i]) {
            res.push_back({ pre, cnt });
            pre = s[i];
            cnt = 1;
        }
        else cnt++;
    }

    res.push_back({ pre, cnt });
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> C(N);
    REP(i,N) cin >> C[i];
    auto CC = runLengthEncoding(C);
    int n = CC.size();
    dp[0] = 1;
    REP(i,n){
        int c = CC[i].first;
        dp[i + 1] = dp[i] + cum[c];
        dp[i + 1] %= MOD;
        cum[c] += dp[i];
        cum[c] %= MOD;
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 5856
#include<iostream>

using namespace std;

int main(void)
{
  int a,b; cin>>a>>b;
  int max=a+b;
  
  if(max<(a-b)){max=a-b;}
  if(max<(a*b)){max=a*b;}
  
  cout<<max<<endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import string


def solve(C: str):
    print(chr(ord(C) + 1))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    C = next(tokens)  # type: str
    solve(C)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;

int main() {
    string s; cin >> s;reverse(s.begin(),s.end());
    string ans = "YES";
    while(s.length() != 0){
        if(s.substr(0,5) == "maerd" || s.substr(0,5) == "esare"){
            s.erase(0,5);
        }else if(s.substr(0,6) == "resare"){
            s.erase(0,6);
        }else if(s.substr(0,7) == "remaerd"){
            s.erase(0,7);
        }else{
            ans = "NO";
            break;
        }
    }
    cout << ans;
    
}



Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        int H = 0;  //??????????????°
        int W = 0;  //??????????????°

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder output = new StringBuilder();

//      ?????°????????????????????????????§????????????????????????????????????????1????????????????????????????????????
        while(true){
            String input = br.readLine();
            String[] strArray = input.split(" ");

            H = Integer.parseInt(strArray[0]);
            W = Integer.parseInt(strArray[1]);

//          H??¨W?????±???0?????¨??????????????????
            if(H == 0 && W == 0){
                break;
            }

//          ??????????????°?????°?????????
            for(int i = 0; i < H; i++){

//              ????????¨????????????????????¨??????
                if(i == 0 || i == H-1){
                    for(int j = 0; j < W; j++){
                        output.append("#");
                    }
                }else{
                    for(int j = 0; j < W; j++){

//                      ????????¨????????????????????¨??????
                        if(j == 0 || j == W-1){
                            output.append("#");
                        }else{
                            output.append(".");
                        }
                    }
                }output.append("\n");
            }
            output.append("\n");
        }
        System.out.print(output);
    }
}

Measured memory_bytes: 25764
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

typedef long long ll;
const int INF = 100000000;
int dist[201][201];

int main(){
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R), A(M), B(M), C(M);
    for(int i = 0; i < R; ++i){
        cin >> r[i];
    }
    for(int i = 0; i < M; ++i){
        cin >> A[i] >> B[i] >> C[i];
    }
    
    for(int i = 1; i <= N; ++i){
        for(int j = 1; j <= N; ++j){
            if(i == j){
                dist[i][j] = 0;
            }
            else{
                dist[i][j] = INF;
            }
        }
    }
    for(int i = 0; i < M; ++i){
        dist[A[i]][B[i]] = dist[B[i]][A[i]] = C[i];
    }
    
    for(int k = 1; k <= N; ++k){
        for(int i = 1; i <= N; ++i){
            for(int j = 1; j <= N; ++j){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    
    sort(r.begin(), r.end());
    int ans = INT_MAX;
    do{
        int sum = 0;
        for(int i = 0; i < R - 1; ++i){
            sum += dist[r[i]][r[i + 1]];
        }
        ans = min(ans, sum);
    }while(next_permutation(r.begin(), r.end()));
    
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;

int X, Y;
int field[15 + 2][15 + 2];
int dp[15 + 2][15 + 2];

void solve() {
	for (int i = 1; i <= X; i++) {
		if (field[0][i] == 0) {
			dp[0][i] = 1;
		}
	}
	for (int y = 0; y < Y - 1; y++) {
		for (int x = 1; x <= X; x++) {
			if (field[y][x] == 2) {
				if (field[y + 2][x] != 1) {
					dp[y + 2][x] += dp[y][x];
				}
			} else if (field[y][x] == 0) {
				if (field[y + 1][x - 1] == 0) {
					dp[y + 1][x - 1] += dp[y][x];
				}
				if (field[y + 1][x] != 1) {
					dp[y + 1][x] += dp[y][x];
				}
				if (field[y + 1][x + 1] == 0) {
					dp[y + 1][x + 1] += dp[y][x];
				}
			}
		}
	}
	int sum = 0;
	for (int y = Y - 1; y <= Y; y++) {
		for (int x = 1; x <= X; x++) {
			sum += dp[y][x];
		}
	}
	printf("%d\n", sum);
}

int main() {
	while (scanf("%d %d ", &X, &Y) == 2) {
		if (X == 0 && Y == 0) {return 0;}

		fill(dp[0], &dp[15 + 2 - 1][15 + 2], 0);
		fill(field[0], &field[15 + 2 - 1][15 + 2], 1);
		for (int y = Y; y <= Y + 1; y++) {
			for (int x = 1; x <= X; x++) {
				field[y][x] = 2;
			}
		}
		for (int i = 0; i < Y; i++) {
			for (int j = 1; j <= X; j++) {
				scanf("%d ", &field[i][j]);
			}
		}
		/*
		for (int i = 0; i < Y + 2; i++) {
			for (int j = 0; j < X + 2; j++) {
				printf("%d ", field[i][j]);
			}
			printf("\n");
		}
		*/
		solve();
		/*
		for (int i = 0; i < Y + 2; i++) {
			for (int j = 0; j < X + 2; j++) {
				printf("%2d ", dp[i][j]);
			}
			printf("\n");
		}
		*/
	}
}

Measured memory_bytes: 0
using System;

namespace ABC061A_BetweenTwoIntegers
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int min = int.Parse(input[0]);
            int max = int.Parse(input[1]);
            int target = int.Parse(input[2]);

            bool result = false;

            if (min <= target &&
                max >= target)
            {
                result = true;
            }


            string output = "No";
            if (result)
            {
                output = "Yes";
            }

            Console.Write(output);

        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
using namespace std;
int main()
{
 int n;
 cin >>n;
 int p[n];
  for(int i=0;i<n;i++)
    cin >> p[i];
  int count = 0;
  for(int i=1;i<n-1;i++)
  {
    if(((p[i-1]<p[i]) && (p[i]<p[i+1]))||((p[i-1]>p[i])&&(p[i]>p[i+1])))
      count++;
  }
  cout << count <<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

int main()
{
	string S;
	cin >> S;

	if (S == "SUN")
	{
		cout << 7 << endl;
	}
	else if (S == "MON")
	{
		cout << 6 << endl;
	}
	else if (S == "TUE")
	{
		cout << 5 << endl;
	}
	else if (S == "WED")
	{
		cout << 4 << endl;
	}
	else if (S == "THU")
	{
		cout << 3 << endl;
	}
	else if (S == "FRI")
	{
		cout << 2 << endl;
	}
	else if (S == "SAT")
	{
		cout << 1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

string S;
long long K;
cin >>S>>K;
long long count=1;
vector<int>vec(101,0);

for(int i=0;i<S.size();i++){
    if(S.at(i)=='1'){
        vec.at(i)++;
    }
    else{
        count=S.at(i)-'0';
        break;
    }
}
 if(K<=101){
    if(vec.at(K-1)==1){
        cout<<1<<endl;
    }
    else{
        cout<<count<<endl;
    }
 } 
 else{
         cout<<count<<endl; 
 } 
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
// #define int long long
#define ll long long
#define EPS 0.00000000000001
#define ld long double
#define PI 3.14159265358979323846
#define inf 200000000
#define N 81
// #define double long double

int32_t main()
{
    IOS;
  
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0;i < n;i++)
        cin >> v[i];
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        int j = i + 1;  
        for(;j < n;j++)
        {
            if(v[j-1] < v[j])
                break;
        }
        // cerr << i << " " << j << endl;
        ans = max(ans,j-i - 1);
        i = j - 1;
    }
    cout << ans;
}   
 
 


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, a, b, seas = 0, cnt = 0;
    string s;

    cin >> n >> a >> b >> s;

    for (int i = 0; i < n; i++) {

        if (s[i] == 'c') cout << "No\n";
        else if (s[i] == 'a') {

            if (cnt >= a+b) {
                cout << "No\n";
            } else {
                cout << "Yes\n";
                cnt++;
            }
        } else {

            if (seas >= b || cnt >= a+b) {
                cout << "No\n";
            } else {
                cout << "Yes\n";
                seas++;
                cnt++;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 848
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let a: usize = sc.cin();
    let xs: Vec<usize> = sc.vec(n);

    let mut dp = vec![vec![0u64; 2800]; 52];
    dp[0][0] = 1;
    for &x in xs.iter() {
        for k in (0..50).rev() {
            for i in 0..2700 {
                dp[k + 1][i + x] += dp[k][i];
            }
        }
    }

    let mut ans = 0;
    for k in 1..n+1 {
        ans += dp[k][a * k]
    }
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


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

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;

	int x = 1;
	while(x * 2 <= n) x *= 2;
	cout << x << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>

std::pair<int, int>
search_farthest(std::vector<std::vector<int>> const& tree,
                int start) {
  size_t const N = tree.size();

  std::vector<bool> visited(N, false);
  std::vector<int> dist(N, N*2);
  std::queue<int> que;

  que.push(start);
  dist[start] = 0;

  int farthest = start;

  while (! que.empty()) {
    int curr = que.front();
    // std::cerr << curr << std::endl;
    visited[curr] = true;

    if (dist[curr] > dist[farthest]) {
      farthest = curr;
    }

    for (auto n: tree[curr]) {
      if (visited[n]) continue;
      dist[n] = dist[curr] + 1;
      que.push(n);
    }

    que.pop();
  }

  // std::cerr << farthest << "," << dist[farthest] << std::endl;
  return std::make_pair(farthest, dist[farthest]);
}

int main() {
  int N;
  std::cin >> N;

  std::vector<std::vector<int>> tree(N, std::vector<int>());

  for (int i=0; i<N-1; i++) {
    int a, b;
    std::cin >> a >> b;
    a--;
    b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }

  int farthest = search_farthest(tree, 0).first;
  int longest = search_farthest(tree, farthest).second;

  bool judge = longest % 3 == 1;

  // std::cerr << "Path: " << longest << std::endl;

  std::cout << (judge ? "Second" : "First") << std::endl;

  return 0;
}


Measured memory_bytes: 13556
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		if(a%2!=0)
		{
		System.out.println(a*2);
		}
		else
		{
		    System.out.println(a);
		}
	}
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(a) push_back(a)
int main()
{
	int n,k,i,j;
	cin>>n>>k;
	int cn=0;
	for(i=0;i<n;i++)
	{
		cin>>j;
		cn+=(j>=k);
	}
	cout<<cn<<endl;
	return 0;
}

Measured memory_bytes: 256
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
//#include <cstdio>
//#include <cstdlib>
//#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <set>
using namespace std;

int main(void){

	int W, H, x, y, r;
	// char ;

	cin >> W >> H >> x >> y >> r;
	
	if(x >= r && y >= r && W >= x + r && H >= y + r) cout<<"Yes"<<endl;
	else cout <<"No"<<endl;

	return 0;
}

/*
for(i=0;i<N;i++){
	cin >> X[i];
}


for(i=0;i<N;i++){
	for(j=0;j<N;j++){
		cin >> X[i][j];
	}
}
*/

Measured memory_bytes: 1156
#include <iostream>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;
int main() {
	int q;cin>>q;
	vector<ll> a(q),b(q);
	for(int i=0;i<q;i++){
		cin>>a[i]>>b[i];
		ll max=a[i];
		ll min=b[i];
		if(max<min){
			max=b[i];
			min=a[i];
		}
		if(max==min){
			cout<<2*(max-1)<<endl;
			continue;
		}else if(max==min+1){
			cout<<2*(min-1)<<endl;
			continue;
		}
		ll ans=2*(min-1);
		ll sq=sqrt(max*min);
		while(sq*sq<max*min)sq++;
		if(sq*sq==min*max){
			ans=2*(sq-1)-1;
			cout<<ans<<endl;
		}else{
			if(sq*(sq-1)<max*min){
			ans=2*(sq-1)-1;
			cout<<ans<<endl;
			}else{
				ans=2*(sq-2);
				cout<<ans<<endl;
			}

		}
	}
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
from itertools import repeat
def main():
    n = int(stdin.readline())
    a = [int(stdin.readline()) for _ in xrange(n)]
    while a and not a[-1]:
        a.pop()
    a.reverse()
    while a and not a[-1]:
        a.pop()
    n = len(a)
    p = [0] * n
    q = [0] * n
    for i in xrange(n):
        if not a[i]:
            p[i] = 1
            q[i] = 2
        else:
            p[i] = 1 - a[i] % 2
            q[i] = a[i] % 2
    l = [(0, 0, 0)] * (n + 1)
    r = [(0, 0, 0)] * (n + 1)
    for i in xrange(n):
        l[i+1] = (l[i][0] + a[i], min(l[i][0], l[i][1]) + q[i], min(l[i]) + p[i])
    for i in xrange(n - 1, -1, -1):
        r[i] = (r[i+1][0] + a[i], min(r[i+1][0], r[i+1][1]) + q[i], min(r[i+1]) + p[i])
    ans = min(min(l[i]) + min(r[i]) for i in xrange(n + 1))
    print ans
main()


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

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n) cin >> a[i] >> b[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ll MIN;
  ll MAX;
  if(n%2==1){//Nが奇数の場合
    MIN = a[n/2];
    MAX = b[n/2];
  }
  else{//Nが偶数の場合
    MIN = a[n/2] + a[n/2-1];
    MAX = b[n/2] + b[n/2-1];
  }
  int ans = MAX - MIN + 1;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6356
n, k = map(int, input().split())
A = list(map(int, input().split()))
s = []
order = [-1] * (n+1)
l = 1
while order[l] == -1:
    order[l] = len(s)
    s.append(l)
    l = A[l-1]
new = s[order[l]:]
t = len(new)
first = len(s) - t
if k > first:
    print(new[(k-first)%t])
else:
    print(s[k])

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

ifstream in("test.in");
ofstream out("test.out");

const int DIM = 100005;

int nr[2], ok = 1;

int lev[DIM];
vector<int> edg[DIM];

void dfs(int x, int f)
{
    lev[x] = lev[f] + 1;
    nr[lev[x] & 1]++;
    
    for (int y : edg[x]) {
        if (y == f)
            continue;
        
        if (!lev[y])
            dfs(y, x);
        else
        if ((lev[x] & 1) == (lev[y] & 1))
            ok = 0;
    }
}

int main(void)
{
    ios :: sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    int n, m;
    cin >> n >> m;
    
    for (int i = 1; i <= m; ++i) {
        int x, y;
        cin >> x >> y;
        
        edg[x].push_back(y);
        edg[y].push_back(x);
    }
    
    dfs(1, 0);
    if (!ok)
        cout << 1LL * n * (n - 1) / 2 - m;
    else
        cout << 1LL * nr[0] * nr[1] - m;
    
    return 0;
}


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

const int MX = 2005;
bool d[3][3][MX];

int main() {
  vector<string> s(3);
  rep(i,3) cin >> s[i];
  sort(s.begin(),s.end());
  int ans = MX*3;
  do {
    memset(d, false, sizeof(d));
    rep(i,3)rep(j,3)rep(k,s[i].size()) {
      if (i >= j) continue;
      bool ok = true;
      for (int ni = k; ni < s[i].size(); ni++) {
        int nj = ni-k;
        if (nj >= s[j].size()) break;
        if (s[i][ni] == '?' || s[j][nj] == '?') continue;
        if (s[i][ni] != s[j][nj]) ok = false;
      }
      d[i][j][k] = ok;
    }

    auto f = [&](int i, int j, int k) {
      if (k >= s[i].size()) return true;
      return d[i][j][k];
    };

    rep(x,MX)rep(y,MX) {
      if (!f(0,1,x)) continue;
      if (!f(1,2,y)) continue;
      if (!f(0,2,x+y)) continue;
      int now = 0;
      now = max<int>(now, s[0].size());
      now = max<int>(now, x+s[1].size());
      now = max<int>(now, x+y+s[2].size());
      ans = min(ans, now);
    }
  } while (next_permutation(s.begin(), s.end()));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc073/tasks/abc073_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    cout << (s[0] == '9' || s[1] == '9' ? "Yes" : "No") << "\n";

    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
#A = list(map(int,input().split()))
ps = []
ans = [False for i in range(N)]
count = [0 for i in range(N)]
for i in range(M):
    p,s = list(input().split())
    p = int(p)
    if s == 'AC':
        ans[p-1] = True
    else:
        if not ans[p-1]:
            count[p-1] += 1
cans = 0
cac = ans.count(True)
for i in range(N):
    if ans[i]:
        cans += count[i]
print(cac,cans)

Measured memory_bytes: 4760
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<long long,bool> Pair;

int main(){

double R;

cin >> R;

cout << 2.0*R*M_PI << endl;

return 0;

}


Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;


//#define zero(a) memset(a,0,sizeof(a))
#define inff(a,n) fill(a,a+n+1,inf)
#define all(a) a.begin(),a.end()
#define sz(a) int((a).size())
#define read(x) scanf("%d",&x)
#define read2(x,y) scanf("%d%d",&x,&y)
#define write(x) printf("%d\n",x)



int n, m, cnt, ans, flag = 1, a[100001];
vector<int>v[100001];

void dfs(int u, int fa)
{
	for (auto i : v[u])
	{
		if (i == fa)continue;
		if (a[i] == -1)
		{
			a[i] = (a[u] ^ 1);
			dfs(i, u);
		}
		else
		{
			if (a[i] == a[u])flag = 0;
		}
	}
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i<m; i++)
	{
		int x, y;
		cin >> x >> y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	memset(a, -1, sizeof(a));
	a[1] = 0;
	dfs(1, 0);
	if (flag)
	{
		for (int i = 1; i <= n; i++)if (a[i])cnt++;
		cout << 1ll * cnt*(n - cnt) - m;
	}
	else
	{
		cout << 1ll * n*(n - 1) / 2 - m;
	}
	return 0;
}

Measured memory_bytes: 6912
s = str(input())
ans = 0
for i in range(1 << (len(s)-1)):
    si = s[0]
    for j in range(len(s)-1):
        if i & (1 << j):
            si += "+"+s[j+1]
        else:
            si += "-"+s[j+1]
    if eval(si) == 7:
        break

print(si+"=7")

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

const int INF = 1e9 + 5;
const pair<int, int> FULL = {0, INF};

int N;
vector<pair<int, int>> intervals;
vector<pair<int, int>> prefix, suffix;

pair<int, int> intersect(pair<int, int> a, pair<int, int> b) {
    return {max(a.first, b.first), min(a.second, b.second)};
}

int length(pair<int, int> p) {
    return max(p.second - p.first + 1, 0);
}

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

    cin >> N;
    intervals.resize(N);

    for (pair<int, int> &inter : intervals)
        cin >> inter.first >> inter.second;

    sort(intervals.begin(), intervals.end());
    prefix.resize(N + 1);
    suffix.resize(N + 1);
    prefix[0] = suffix[N] = FULL;

    for (int i = 0; i < N; i++)
        prefix[i + 1] = intersect(prefix[i], intervals[i]);

    for (int i = N - 1; i >= 0; i--)
        suffix[i] = intersect(suffix[i + 1], intervals[i]);

    int best = 0;

    for (int i = 0; i < N; i++)
        best = max(best, length(intervals[i]) + length(intersect(prefix[i], suffix[i + 1])));

    for (int i = 1; i < N; i++)
        best = max(best, length(prefix[i]) + length(suffix[i]));

    cout << best << '\n';
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    string N;
    cin>>N;
    int K;
    cin>>K;

    int s = N.size();
    vector<vector<vector<ll>>> dp(s + 1, vector<vector<ll>>(K + 2, vector<ll>(2)));
    dp[0][0][0] = 1;    // ケタ、0以外の回数、=N or !N
    rep(i, s) {
        rep(j, K + 1) {
            if (N[i] == '0') {
                dp[i + 1][j][0] += dp[i][j][0];
                dp[i + 1][j][1] += dp[i][j][1];
                dp[i + 1][j + 1][1] += 9 * dp[i][j][1];
            }
            else {
                dp[i + 1][j + 1][0] += dp[i][j][0];
                dp[i + 1][j][1] += dp[i][j][0];
                dp[i + 1][j + 1][1] += (N[i] - '0' - 1) * dp[i][j][0];
                dp[i + 1][j][1] += dp[i][j][1];
                dp[i + 1][j + 1][1] += 9 * dp[i][j][1];
            }
        }
    }

    cout<<dp[s][K][0] + dp[s][K][1]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
string s; cin >> s; int n = s.length();
	int a = 1000;
	for(int i=0;i<n-3+1;i++) {
		int u = stoi(s.substr(i, 3));
		a = min(a, abs(u - 753));
	}
	cout << a << endl;





    return 0;
}

Measured memory_bytes: 256
N = int(input())

a = list(map(int,input().split()))
maxi = max(a)

dic = {}

for i in range(N):

    if a[i] not in dic:
        dic[a[i]] = 1
    else:
        dic[a[i]] += 1

flag = True

if maxi % 2 == 0:

    for i in range(maxi + 1):

        if i < maxi // 2 and i in dic:
            flag = False

        if i == maxi // 2 and (i not in dic or dic[i] != 1):
            flag = False

        if i > maxi // 2 and (i not in dic or dic[i] < 2):
            flag = False

else:

    for i in range(maxi + 1):

        if i <= maxi // 2 and i in dic:
            flag = False

        if i == maxi // 2 + 1 and (i not in dic or dic[i] != 2):
            flag = False

        if i > maxi // 2 + 1 and (i not in dic or dic[i] < 2):
            flag = False

if flag:
    print ("Possible")
else:
    print ("Impossible")


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include<map>
using namespace std;

int main(){
  int n,i,j,result=0;

  std::cin >> n;

  for(j=0;7*j<=n;j++){
    for(i=0;4*i<=n;i++){
      if(n==4*i+7*j){
        result=1;
      break;}
    }
  }

if(result)
  std::cout << "Yes" << '\n';
else std::cout << "No" << '\n';

return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N ;
  cin >> N ;
  if ( N/1000 == N/100 % 10 && N/1000 == N/10 % 10){
    cout <<"Yes" << endl;
  }else if( N/100 % 10 ==N/10 % 10 && N/100 % 10 == N % 10){
	cout <<"Yes" << endl;
  }else {
    cout <<"No" << endl ;
  }
}

Measured memory_bytes: 3584
N = int(input())
t = N / 1.08
k = int(abs(t))
if k * 1.08 - N < 1 and k * 1.08 - N >= 0:
  print(k)
elif (k+1) * 1.08 - N < 1 and (k+1) * 1.08 - N >= 0:
  print(k+1)
else:
  print(":(")

Measured memory_bytes: 3060
#include<stdio.h>
#define true 1
#define false 0
int A[20], n;
int main() {
  int i, q, j=0, hantei;
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d", &q);
  int B[q];
  for(i = 0; i < q; i++) {
    scanf("%d", &B[i]);
  }
  for(i = 0; i < q; i++) {
    hantei = solve(j, B[i]);
    if(hantei == true) printf("yes\n");
    if(hantei == false) printf("no\n");
  }
  return 0;
}

int solve(int i, int m) {
  int res;
  if(m == 0) {
    return true;
  }
  if(i >= n) {
    return false;
  }
  res = solve(i+1, m) || solve(i+1, m-A[i]);
  return res;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int main(){
	ull n;
	cin>>n;
	int c[26];
	for(int i=0;i<26;i++) c[i]=50;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int d[26];
		for(int j=0;j<26;j++) d[j]=0;
		for(int j=0;j<s.size();j++){
			d[s[j]-'a']++;
		}
		for(int j=0;j<26;j++){
			c[j]=min(c[j],d[j]);
		}
	}
	for(int i=0;i<26;i++){
		for(int j=0;j<c[i];j++){
			cout<<(char)('a'+i);
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(){
	int i,j,point[20];
	for(i = 0;i < 20;i++){
		scanf("%d",&point[i]);
	}
	sort(point,point + 10);
	sort(point + 10,point + 20);
	printf("%d %d\n",point[7] + point[8] + point[9],point[17] + point[18] + point[19]);
	return 0;
}

Measured memory_bytes: 1040
from copy import deepcopy
while True:
    w, h = map(int, input().split())
    if w == 0:
        break
    wwal = []  # ｜
    hwal = []  # ー
    a = [0] * w
    b = []
    for i in range(2 * h - 1):
        if i % 2 == 0:
            wwal.append(list(map(int, input().split())))
            c = deepcopy(a)
            b.append(c)
        else:
            hwal.append(list(map(int, input().split())))
    b[0][0] = 1
    start = [[0, 0]]
    flag = 0
    while flag == 0:
        flag = 1
        stamemo = []
        for i in range(len(start)):
            t = start.pop()
            # Left
            if t[1] != 0:
                if wwal[t[0]][t[1] - 1] == 0 and b[t[0]][t[1]-1] == 0:
                    b[t[0]][t[1] - 1] = b[t[0]][t[1]] + 1
                    stamemo.append([t[0], t[1] - 1])
                    flag = 0
            # righT
            if t[1] != w-1:
                if wwal[t[0]][t[1]] == 0 and b[t[0]][t[1]+1] == 0:
                    b[t[0]][t[1] + 1] = b[t[0]][t[1]] + 1
                    if t[0] == h - 1 and t[1] + 1 == w - 1:
                        print(b[t[0]][t[1] + 1])
                        flag = 2
                        break
                    stamemo.append([t[0], t[1]+1])
                    flag = 0
            # Up
            if t[0] != 0:
                if hwal[t[0] - 1][t[1]] == 0 and b[t[0] - 1][t[1]] == 0:
                    b[t[0] - 1][t[1]] = b[t[0]][t[1]] + 1
                    stamemo.append([t[0] - 1, t[1]])
                    flag = 0
            # dowN
            if t[0] != h-1:
                if hwal[t[0]][t[1]] == 0 and b[t[0] + 1][t[1]] == 0:
                    b[t[0] + 1][t[1]] = b[t[0]][t[1]] + 1
                    if t[0]+1 == h - 1 and t[1] == w - 1:
                        print(b[t[0]+1][t[1]])
                        flag = 2
                        break
                    stamemo.append([t[0] + 1, t[1]])
                    flag = 0
        start = stamemo
    if flag == 1:
        print(0)


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, a, b, c;
  while (cin >> n >> a >> b >> c) {
    vector<int> v(n);
    cin >> v;

    const int inf = 1 << 29;
    int mn = inf;

    for (int bit = 0; bit < (1 << (n + n)); ++bit) {
      int y = bit;
      int sum = 0;
      int len[4] = {0, 0, 0, 0};
      for (int i = 0; i < v.size(); ++i) {
        const int x = y % 4;
        y /= 4;
        if (x != 3 && len[x]) sum += 10;
        len[x] += v[i];
      }
      unless (len[0] && len[1] && len[2]) continue;
      sum += abs(len[0] - a) + abs(len[1] - b) + abs(len[2] - c);
      setmin(mn, sum);
    }
    cout << mn << endl;
  }  
  return 0;
}


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

int main()
{
    long long a,b;
    cin>>a>>b;
    long long c=a+b;
    c/=2;

    if(a+b==c*2){
        cout<<c<<endl;
    }
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int p,q,r;
  cin >> p >> q >> r;

  if (p >= q && p >= r) cout << q + r;
  else if (q >= p && q >= r) cout << p + r;
  else if (r >= q && r >= p) cout << q + p;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
	int a[5],i,j,n;
	for(i=0;i<5;i++){
		std::cin>>a[i];
	}
	for(i=0;i<4;i++){
		for(j=i+1;j<5;j++){
			if(a[i]<a[j]){
				n=a[i];
				a[i]=a[j];
				a[j]=n;
			}
		}
	}
	std::cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<std::endl;
return 0;
}

Measured memory_bytes: 1164