akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define ll long long int
#define MOD (ll) (1e9+7)
#define in_arr(ar) for(int i=0;i<sizeof(ar)/sizeof(ar[0]);i++)cin>>ar[i];
#define val(x) cout<<"Value of "<<(#x)<<" is "<<x<<endl;




ll bigmod(ll a, ll e)
{
    ll ret = 1LL;
    while (e>0)
    {
        if (e%2==1) ret = ret * a % MOD;
        a = a*a % MOD;
        e/=2;
    }
    return ret;
}



int solve()
{

    int n;
    cin>>n;
    int ar[n];
    in_arr(ar);
    int Xor = 0;
    for(int x:ar)
        Xor^=x;
    for(int x:ar)
    {
        cout<<(x^Xor)<<" ";
    }
    cout<<endl;
    return 0;
}


int main()
{
    int t=1;
//    cin>>t;
    while(t--)
    {
        int x = solve();
    }
    return 0;
}


Measured memory_bytes: 4328
import java.util.*;
import static java.lang.System.*;

import java.io.IOException;
import java.io.InputStream;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int N = sc.nextInt();
	  long[]score = new long[N+1];
	  int[] k = new int[N+1];
	  long sum = 0;
	  
	  for(int i=0; i<N; i++) {
		  int n = sc.nextInt();
		  score[n]++;
		  k[i+1] = n;
	  }
	  for(int i=1; i<=N; i++) {
		  sum += score[i] * (score[i]-1) / 2;
	  }
	  //out.println(sum);
	  for(int i=1; i<=N; i++) {
		  long ans = sum - score[k[i]] + 1;
		  if (ans < 0 ) ans = 0;
		  out.println(ans);
	  }

  }
}



Measured memory_bytes: 103528
#include<bits/stdc++.h>
using namespace std;
const int N=3005;
int v[N];
long long dp[N];
const int MOD=998244353;
int main()
{
  int n,s;
  cin>>n>>s;
  for(int i=1;i<=n;i++){
    cin>>v[i];
  }
  long long  ans=0;
  for(int i=1;i<=n;i++){
    dp[0]=i%MOD;
    if(v[i]<=s){
      ans+=(1LL*dp[s-v[i]]*(n-i+1)%MOD)%MOD;
      ans%=MOD;
      for(int ss=s-v[i];ss>=0;ss--){
        dp[ss+v[i]]+=dp[ss];
        dp[ss+v[i]]%=MOD;
      }
    }
  }
  cout<<ans;
  return 0;
}


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

int main() {
    int N, K;
    string S;
    cin >> N >> K >> S;
    
    if(S[K-1] == 'A') S[K-1] = 'a';
    else if(S[K-1] == 'B') S[K-1] = 'b';
    else if(S[K-1] == 'C') S[K-1] = 'c';
    
    cout << S << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>


#define	ll_int	long long int


void Reverse(ll_int *box, int b, int e)
{
	ll_int tmp;
	int x;
	int i;

	x = b + e - 1;	// その区間における両端の添え字の合計

	// 半分の場所間まで交換処理を行えば、その区間内は全て交換したことになる
	for(i = b; i <= x / 2; i++){
		tmp = box[i];
		box[i] = box[x - i];
		box[x - i] = tmp;
	}
}


void Print_box(ll_int *box, int n)
{
	int i;

	for(i = 0; i < n; i++){
		printf("%lld", box[i]);
		if(i != n - 1)
			printf(" ");
	}
	printf("\n");
}


int main()
{
	int n, q;
	int b, e;
	ll_int *box;
	int i;


	scanf("%d", &n);

	box = (ll_int *)malloc(sizeof(ll_int) * n);

	for(i = 0; i < n; i++)
		scanf("%lld", &box[i]);

	scanf("%d", &q);

	for(i = 0; i < q; i++){
		scanf("%d %d", &b, &e);

		Reverse(box, b, e);
	}


	Print_box(box, n);

	return 0;
}


Measured memory_bytes: 2112
#include<stdio.h>

int main(){
  int n,q,S[100000],T[50000],i,j,c=0,left,right,mid;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
	c++;
	break;
      }
      else if(T[i]<S[mid]) right=mid;
      else left=mid+1;
    }
  }
  printf("%d\n",c);
  return 0;
}



Measured memory_bytes: 2364
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
    int n;
    cin >> n;
    long long a[n];
    rep(i,n) cin >> a[i];
    long long now = 1;
    long long ans = a[0]-1;
    for(int i = 1;i<n;i++){
        if(a[i]==now+1) now++;
        else ans+=(a[i]-1)/(now+1);
    }
    cout << ans << endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  for (int j = 0; j < W + 2; j ++ ){
    cout << '#';
  }
  cout << endl;
  
  for (int i = 0; i < H; i ++ ){
    string A;
    cin >> A;
    A = '#' + A + '#';
    cout << A << endl;
  }
  
  for (int j = 0; j < W + 2; j ++ ){
    cout << '#';
  }
  cout << endl;
    
}

Measured memory_bytes: 256
A,B,K=map(int,input().split())
if A+K-1>=B-K+1:
  for i in range(A,B+1):
    print(i)
else:
  for i in range(A,A+K):
    print(i)
  for j in range(B-K+1,B+1):
    print(j)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int, P>PP;
int a[86][86], b[86][86],c[86][86];
bool ok[81][81][25602];
signed main() {
	int h, w; cin >> h >> w;
	rep(i, h)rep(j, w)cin >> a[i][j];
	rep(i, h)rep(j, w)cin >> b[i][j];
	rep(i, h)rep(j, w)c[i][j] = abs(a[i][j]- b[i][j]);
	int T = 12800;
	ok[0][0][T - c[0][0]] = true;
	ok[0][0][T + c[0][0]] = true;

	rep(i, h) {
		rep(j, w) {
			for (int k = 0; k <= T << 1; k++) {
				if (ok[i][j][k]) {
					if (j != w - 1) {
						ok[i][j + 1][k + c[i][j+1]] = true;
						ok[i][j + 1][k - c[i][j+1]] = true;
					}
					if (i != h - 1) {
						ok[i + 1][j][k + c[i + 1][j]] = true;
						ok[i + 1][j][k - c[i + 1][j]] = true;
					}
				}
			}
		}
	}

	rep(i, T+1) {
		if (ok[h - 1][w - 1][i + T] || ok[h - 1][w - 1][T - i]) {
			cout << i << endl; return 0;
		}
	}
}

Measured memory_bytes: 163072
#!python3

# input
N = int(input())


def num_divisors_table(n):
    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    return table


def main():
    t = num_divisors_table(N)
    ans = sum([i * x for i, x in enumerate(t)])
    print(ans)
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 366116
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, T;
    cin >> n >> T;
    
    int t[200010];
    rep(i, n) cin >> t[i];
    int ans = 0;
    rep(i, n) {
        if(i + 1 < n)
        ans += min(T, t[i + 1] - t[i]);
        else ans += T;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A = sc.nextInt();

	if(A>=N%1000 ) System.out.println("Yes");
	else System.out.println("No");

    }
}


Measured memory_bytes: 22608
#include<iostream>

using namespace std;

int main(){

	int in;

	while(cin >> in && in){
		int score;
		int max = 0, min = 500;

		for(int i = 0; i < in; i++){
			int sum = 0;
			for(int j = 0; j < 5; j++){
				cin >> score;
				sum += score;
			}
			if(sum > max) max = sum;
			if(sum < min) min = sum;
		}

		cout << max << " " << min << endl;
	}
	return 0;
}

Measured memory_bytes: 0
def calc_digit(n):
    d = 0
    while n > 0:
        d += 1
        n //= 10
    return d


n = int(input())
temp = -1
ans = 12
i = 1
while i * i <= n:
    if n % i == 0:
        temp = max(calc_digit(i), calc_digit(n // i))
    ans = min(temp,ans)
    i += 1
print(ans)


Measured memory_bytes: 3060
import fractions
from functools import reduce
 
N, X = map(int, input().split())
 
L = []

def minus_X(n):
  return abs(n - X)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

L = list(map(int, input().split()))

L2 = map(minus_X, L)
 
print(gcd_list(L2))


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const ll MOD = 1000000007;

int N, C;
int A[410], B[410];
ll dp[410][410];
ll v[410][410];
ll pw[410][410];

int main() {
    cin >> N >> C;
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    for (int i = 1; i <= 400; ++i) {
	pw[i][0] = 1;
	for (int j = 1; j <= 400; ++j) pw[i][j] = pw[i][j-1] * i % MOD;
    }

    rep(i, N) {
	for (int k = 0; k <= C; ++k) for (int j = A[i]; j <= B[i]; ++j) v[i][k] = (v[i][k] + pw[j][k]) % MOD;
    }

    dp[0][0] = 1;

    rep(i, N) {
	for (int j = 0; j <= C; ++j) {
	    for (int k = 0; k <= C - j; ++k) {
		dp[i+1][j+k] = (dp[i+1][j+k] + dp[i][j] * v[i][k]) % MOD;
	    }
	}
    }

    cout << dp[N][C] << endl;
    
    return 0;
}

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

int main() {
  string N;
  cin >> N;
  if (N[0]!='A' && N[1]!='A' && N[2]!='A'){
    cout << "No" << endl;
  }
  else if (N[0]!='B' && N[1]!='B' && N[2]!='B'){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  } 
}


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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

void insert(vi& a, int k) {
    a.push_back(k);
    int i = a.size() - 1;
    while (i / 2 > 0 && a[i] > a[i / 2]) {
        swap(a[i], a[i / 2]);
        i = i / 2;
    }
}

int extract_max(vi& a) {
    int m = a[1];
    a[1] = a.back();
    a.pop_back();

    int h = a.size() - 1;
    int i = 1;
    while (2 * i <= h) {
        int max_i = i;
        if (a[max_i] < a[2 * i]) { max_i = 2 * i; }
        if (2 * i + 1 <= h && a[max_i] < a[2 * i + 1]) { max_i = 2 * i + 1; }

        if (i == max_i) { break; }
        swap(a[max_i], a[i]);
        i = max_i;
    }
    return m;
}

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

    vi a(1, 0);

    while (true) {
        string s;
        cin >> s;
        if (s[0] == 'i') {
            int x;
            cin >> x;
            insert(a, x);
        } else if (s[1] == 'x') {
            int m = extract_max(a);
            cout << m << endl;
        } else {
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 6844
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<string, int> S;
typedef vector<int> Node;
struct State{
  int u, c;
  State(int u, int c) : 
    u(u), c(c) {}
  bool operator < (const State& s) const{
    return c > s.c;
  }
};

int main(){
  int N; 
  while(cin >> N){
    cin.ignore();
    vector<string> s(N);
    REP(i, N){
      getline(cin, s[i]);
    }
    s.push_back("goto ###;"); N++;
    vector<S> prog;
    vector<int> node_idx(N); //S[i] is node of node_idx[i]
    int M = 0; // node
    REP(i, N){
      if(s[i].substr(0, 4) == "goto"){
        string t = s[i].substr(5, s[i].size() - 6);
        prog.push_back(S(t, 1));
        node_idx[i] = M++;
      }else{
        prog.push_back(S(s[i].substr(0, s[i].size() - 1), 0));
      }
    }
    queue<string> lq;
    map<string, int> goto_map;  // s goto Node i
    goto_map["###"] = M - 1;
    REP(i, N){
      if(prog[i].second == 0){
        lq.push(prog[i].first);
      }else{
        while(!lq.empty()){
          goto_map[lq.front()] = node_idx[i];
          lq.pop();
        }
      }
    }
    vector<int> graph(M, -1);
    REP(i, N){
      if(prog[i].second == 1){
        graph[node_idx[i]] = goto_map[prog[i].first];
      }
    }
    priority_queue<State> que;
    vector<int> dist(M, INF);
    que.push(State(0, 0));
    dist[0] = 0;
    while(!que.empty()){
      int u = que.top().u;
      que.pop();
      int v = graph[u];
      if(u == M - 1) break;
      if(dist[v] > dist[u]){
        dist[v] = dist[u];
        que.push(State(v, dist[v]));
      }
      if(dist[u + 1] > dist[u] + 1){
        dist[u + 1] = dist[u] + 1;
        que.push(State(u + 1, dist[u] + 1));
      }
    }
    cout << dist[M - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include<stdio.h>
#include<math.h>
#define MAX 100
#define WHILE 0
#define GRAY 1
#define BLACK 2
#define INFTY -1
//flooat inf=INFINITY;
int inf=(1<<21);
int n,a[MAX][MAX];

int prim(){
  int i,u,v,mincost,sum=0;
  int color[MAX],d[MAX],p[MAX];

  for(i=0;i<n;i++){
    d[i]=inf;
    p[i]=-1;
    color[i]=WHILE;
  }
  d[0]=0;
  while(1){
    mincost=inf;
    u=-1;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && a[u][v]!=inf){
	if(d[v]>a[u][v]){
	  d[v]=a[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i]!=-1) sum+=a[i][p[i]];
  }

  return sum;
}

int main(){
  int i,j,e;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      if(e==-1) e=inf;
      a[i][j]=e;
    }
  }
  printf("%d\n",prim());
  return 0;
}
    



Measured memory_bytes: 2032
import java.util.*;

// ABC 42-C
// http://abc042.contest.atcoder.jp/tasks/arc058_a

public class Main {
	
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in = new Scanner(System.in);
	    
	    int n = in.nextInt();
	    int k = in.nextInt();
	    HashMap<Integer, Integer> avoid = new HashMap<Integer, Integer>();
	    
	    for (int i = 0; i < k; i++) {
	    	avoid.put(in.nextInt(), 1);
	    }
	    
	    while (!isConditionMet(avoid, n)) {
	    	n++;
	    }
	    System.out.println(n);
	}
	
	public static boolean isConditionMet(HashMap<Integer, Integer> avoid, int n) {
		while (n > 0) {
			if (avoid.containsKey(n % 10)) {
				return false;
			}
			if (n == 0) {
				break;
			}
			n /= 10;
		}
		return true;
	}
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<min(a+b+1,c)+b<<endl;
}

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

const int N = 10;

char c[N][N];
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> c[i][j];
		} 
	}
	bool b = true;
	for (int i1 = 1; i1 <= n; i1++) {
		for (int j1 = 1; j1 <= m; j1++) {
			for (int i2 = 1; i2 <= n; i2++) {
				for (int j2 = 1; j2 <= m; j2++) {
					if ((c[i1][j1] == '#' && c[i2][j2] == '#') && ((i1 > i2 && j1 < j2) || (i1 < i2 && j1 > j2))) {
						b = false;
					//	cout << i1 << " " << j1 << " " << i2 << " " << j2 << endl;
					}
				}
			}
		}
	}
	if (b)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const ll MOD = 1e9 + 7;
const ll N = 5e5 + 5;

string s;
ll ans;
ll a[N];

void solve() {
    cin >> s;
    for(ll i = 0; i < s.size(); i++) {
        if(s[i] == '<') a[i + 1] = a[i] + 1; 
    }
    for(ll i = s.size() - 1; i >= 0; i--) {
        if(s[i] == '>') 
            a[i] = max(a[i], a[i + 1] + 1);
    }
    ans = 0;
    for(ll i = 0; i <= s.size(); i++) {
        ans += a[i];
    }
    cout << ans << "\n";
}

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    solve();
    
}

Measured memory_bytes: 7736
N=int(input())
S=[]
for i in range(N):
    S.append(input())
print('AC x {}'.format(S.count('AC')))
print('WA x {}'.format(S.count('WA')))
print('TLE x {}'.format(S.count('TLE')))
print('RE x {}'.format(S.count('RE')))

Measured memory_bytes: 16136
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,t;
	priority_queue<long long> q;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
	{
		cin >> t;
		q.push(t);
	}
	while(m)
	{
		if(!q.empty())
		{
			t = q.top()/2;
	    	q.pop();
	    	q.push(t);
	    	m--;
		}
	}
	long long sum = 0;
	while(!q.empty())
	{
		sum += q.top();
		q.pop();
	}
	cout << sum << endl;
}

Measured memory_bytes: 1528
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
		if a[i]%2 == 0 && (a[i]%3 != 0 && a[i]%5 != 0) {
			fmt.Println("DENIED")
			return
		}
	}

	fmt.Println("APPROVED")
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}
 
const double PI=3.14159265358979323846;

const ll X = 1000000000000001;



int main(void){
    ll n;
    cin>>n;
    map<int,char>m;
    for(char x='a';x<='z';x++){
        m[(x-'a')+1]=x;
    }
        string K ="";
        while(true){
            if(n<26){
                if(n!=0)K.push_back(m[n]);
                break;
            }
            else{
                ll r = n%26;
                ll J = n/26;
                if(r==0){
                    r = 26;
                    J--;
                }
                //cout<<r<<" "<<J<<endl;
                K.push_back(m[r]);
                n = J;
            }
        }
        reverse(K.begin(),K.end());
        cout<<K<<endl;
    return 0;
}

Measured memory_bytes: 3624
a, b, c = map(int, input().split())
k = int(input())

flg = False

for i in range(k+1):
  d = 2**i*b
  e = 2**(k-i)*c
  if a < d < e:
    flg = True
    break

if flg:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9176
#include <iostream>

int main()
{
    int X;
    std::cin >> X;
    constexpr int N = 7;
    const std::string d[N] = {
        "mon",
        "tue",
        "wed",
        "thu",
        "fri",
        "sat",
        "sun"
    };

    int p = 5;
    if (X <= 9) {
        for (int i = 9; i > X; i--) {
            p = (p - 1 + N) % N;
        }
    } else {
        for (int i = 9; i < X; i++) {
            p = (p + 1) % N;
        }
    }

    std::cout << d[p] << std::endl;
    return 0;
}

Measured memory_bytes: 3152
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n, k;
  scan(n, k);
  print(n - k + 1);
  return 0;
}


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

using namespace std;

int main()
{
	while(true)
	{
		string str;
		char tmp;
		while(true){
			cin.get(tmp);
			if(tmp == '\n') break;
			str += tmp;
		}
		if(str == "END OF INPUT") break;
		str += ' ';

		string output = "";
		int cnt = 0;
		int len = str.size();
		for(int i=0; i < len; i++) {
			if(str[i] == ' ') {
				output += (char)('0' + cnt);
				cnt = 0;
			}
			else
				cnt++;
		}
		cout << output << endl;
	}
	return 0;
}

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


int main(void){
	int n, k, sum = 0;
	cin >> n >> k;
	vector<int> p(n, 0);
	for(int i = 0; i < n; i++) cin >> p[i];

	sort(p.begin(), p.end());
	for(int i = 0; i < k; i++) sum += p[i];

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


Measured memory_bytes: 3628
n = gets.chomp.to_i
Node = Struct.new(:num, :parent, :left, :right)

class BinSearchTree
  attr_accessor :root
  def initialize
    @root = nil
  end

  def inorder(r, order)
    if r.nil?.!
      inorder(r.left, order)
      order << r.num
      inorder(r.right, order)
    end
  end
  
  def preorder(r, order)
    if r.nil?.!
      order << r.num
      preorder(r.left, order)
      preorder(r.right, order)
    end
  end

  def insert(k)
    x = @root
    y = nil
    z = Node.new
    z.num = k
    until x.nil?
      y = x
      if z.num < x.num
        x = x.left
      else
        x = x.right
      end
    end
    z.parent = y
    if y.nil?
      @root = z
    else
      if z.num < y.num
        y.left = z
      else
        y.right = z
      end
    end
  end
end

bst = BinSearchTree.new

n.times do
  cmd, i = gets.chomp.split.map{|t| t.match?(/\d/) ? t.to_i : t}
  case cmd
  when "insert"
    bst.insert(i)
  when "print"
    root = bst.root
    in_res, pre_res = [], []
    bst.inorder(root, in_res)
    puts " " + in_res.map(&:to_s).join(' ')
    bst.preorder(root, pre_res)
    puts " " + pre_res.map(&:to_s).join(' ')
  end
end


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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

#define ll   int
#define ld long double
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define pi 3.14159265358979
//#define goodset tree<pa, null_type, less<pa>, rb_tree_tag, tree_order_statistics_node_update>

const ll mod = 1000000007 ;
const ll N=1e6+5;

int main()
{
    FAST
    ll tc,i,j,k;
    //cin>>tc;
    tc=1;
    while(tc--)
    {
        ll n;
        cin>>n;
        ll val=n;
        val+=(n*n);
        val+=(n*n*n);
        cout<<val;
    }
    return 0;
}


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

int main(){
        int N,H,W;
        int A, B;
        int ans=0;
        cin >> N >> H >> W;
        for(int i = 0; i < N; i++){
          cin >> A >> B;
          if(A >= H && B >= W){
                  ans++;
          }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>

#define NMAX 50000
using namespace std;

int n;
int pos;
int a[300];
int v[300];

int ask(int st) {

    cout << "? ";
    for (int i = 0; i < n; ++i) {
        cout << st + i << " ";
    }
    cout << endl;
    string ans;
    cin >> ans;
    if (ans == "Red") return 0;
    return 1;

}

int ask_array(int *v) {

    cout << "? ";
    for (int i = 0; i < n; ++i) {
        cout << v[i] << " ";
    }
    cout << endl;
    string ans;
    cin >> ans;
    if (ans == "Red") return 0;
    return 1;

}

void bin_search(int st, int dr, int val) {

    if (st > dr) return;
    if (st == dr) {
        if (ask(st) == val) {
            pos = max(pos, st);
            return;
        }
    }
    int mij = (st + dr) / 2;
    if (ask(mij) == val) {
        pos = max(pos, mij);
        bin_search(mij + 1, dr, val);
    } else {
        bin_search(st, mij - 1, val);
    }

}

int main() {

    // 0 -> rosu
    // 1 -> albastru

    std::ios::sync_with_stdio(false);
    cin >> n;
    int x = ask(1);
    bin_search(1, n, x);

    a[pos] = x;

    for (int i = 1; i < pos; ++i) {
        for (int j = 0; j < n - 1; ++j) {
            v[j] = pos + j + 1;
        }
        v[n - 1] = i;
        a[i] = ask_array(v);
    }

    for (int j = 0; j < n - 1; ++j) {
        v[j] = pos + j + 1;
    }

    for (int i = pos + n; i <= 2 * n; ++i) {
        v[n - 1] = i;
        a[i] = ask_array(v);
    }
    int index = 0;
    for (int j = 1; j < pos; ++j) {
        v[index] = j;
        index ++;
    }
    for (int j = pos + n + 1; j <= 2 * n; ++j) {
        v[index] = j;
        index ++;
    }

    for (int i = pos + 1; i <= pos + n; ++i) {
        v[n - 1] = i;
        a[i] = ask_array(v);
    }

    cout << "! ";
    for (int i = 1; i <= 2 * n; ++i) {
        if (a[i] == 0) cout << "R";
        else cout << "B";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 724
res = [i for i in input().split()]

def swap(arr, a, b):
  tmp = arr[a]
  arr[a] = arr[b]
  arr[b] = tmp
  return arr

arr1 = swap(res, 0, 1)
arr2 = swap(arr1, 0, 2)
print(' '.join(arr2))

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

using namespace std;

int main(int argc, const char *argv[])
{
    int k, a,b;
    cin >>k>>a >>b;
    if((b/k)*k >= a){
cout << "OK" <<endl;
    }else{
        cout << "NG" <<endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int dp[3100][3100] = { 0 };
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	
	for (int i = 0; i <= n / 4; ++i) {
		for (int j = 0; j <= n / 7; ++j) {
			if (4 * i + 7 * j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n;
int main(){
	n=read();
	for(int i=1;i<n;++i){
		for(int j=i+1;j<=n;++j){
			printf("%d ",__builtin_ffs(i^j));
		}
		printf("\n");
	}
	return 0;
}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll x,y;
    cin>>x>>y;
    if(y%2==0 && (y/2)>=x && 2*x>=(y/2)) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 3648
#include<iostream>

using namespace std;

int main()
{
	int i,j;
	int map[20][20];
	int smap[20][20]={0};
	int mx,my;
	int next[3]={-1,0,1};
	
	for(;;)
	{
		int ans=0;
		
		cin >> mx >> my ;
		
		if(mx==0 && my==0)
			break;
		
		for(i=0;i<20;i++)
			for(j=0;j<20;j++)
			{
				smap[i][j]=0;
				map[i][j]=0;
			}
		
		for(i=0;i<my;i++)
		{
			for(j=0;j<mx;j++)
			{
				cin >> map[i][j] ;
			}
		}
		for(i=0;i<mx;i++)
		{
			if(map[0][i]!=1)
				smap[0][i]=1;
		}
		for(i=0;i<my-1;i++)
		{
			for(j=0;j<mx;j++)
			{
				if(map[i][j]==2)
				{
					if(map[i+2][j]!=1)
						smap[i+2][j]+=smap[i][j];
				}
				else
				{
					for(int k=0;k<3;k++)
					{
						if(j+next[k]>=0 && j+next[k]<mx)
						{
							if(map[i+1][j+next[k]]==1)
							{
								smap[i+1][j+next[k]]=0;
							}
							else if(map[i+1][j+next[k]]==0)
							{
								smap[i+1][j+next[k]]+=smap[i][j];
							}
							else if(map[i+1][j+next[k]]==2 && j==j+next[k])
							{
								smap[i+1][j+next[k]]+=smap[i][j];
							}
						}
					}
				}
			}
		}
		
		for(i=my-1;i<my+1;i++)
		{
			for(j=0;j<mx;j++)
				ans+=smap[i][j];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
<?php
    fscanf(STDIN, '%d', $d);
    $count=0;
    $countaa=0;
    
    for($j=1;$j<=$d;$j++){
        for($i=1;$i<=$j;$i++){
            if($j%$i==0 && $j%2==1){
                $count++;
            }
        }
        if($count==8){
            // echo $j."\n";
            $countaa++;
        }
        $count=0;
    }
    
    echo $countaa;

?>

Measured memory_bytes: 3700
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ k, t ] <- readInts
	a <- readInts
	let
		half = ( k + 1 ) `div` 2
		over = max 0 $ maximum a - half
		res = max 0 $ over * 2 - ( k + 1 ) `mod` 2
	print res

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e6 + 10;
const ll mod = 1e9 + 7;
int n, m, k;
ll a[3010][3010];
ll dp[3010][3010][4];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	//for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++)a[i][j] = -inf;
	for (int i = 1; i <= k; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		scanf("%lld", &a[x][y]);
	}
	//for (int i = 0; i <= n; i++)for (int j = 0; j <= m; j++)for (int x = 0; x <= 3; x++)dp[i][j][k] = -inf;
	for (int i = 0; i <= n; i++)for (int j = 0; j <= m; j++)dp[i][j][0] = 0;
	dp[1][1][0] = 0; if (a[1][1] >= 0)dp[1][1][1] = a[1][1];
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			for (int k = 1; k <= 3; k++) {
				dp[i][j][k] = max(dp[i - 1][j][3] + a[i][j], max(dp[i][j - 1][k - 1] + a[i][j], dp[i][j - 1][k]));
				ans = max(ans, dp[i][j][k]);
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 356372
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,j,k,l,sum,t,q,x,y;
    scanf("%lld",&n);
    long long a[n+1];
    map<long long,long long>m;
    sum=0;
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        m[a[i]]++;
        sum+=a[i];
    }
    scanf("%lld",&q);
    for(i=0;i<q;i++){
        scanf("%lld%lld",&x,&y);
        sum-=x*m[x];
        sum+=y*m[x];
        m[y]+=m[x];
        m[x]=0;
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 10416
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
const int N=1000000000;
int n,m;
long long s,a,b;
int main()
{
	cin>>s;
	a=N-s%N;
	if(s%N==0)
		a=0;
	b=(s+a)/N;
	cout<<0<<' '<<0<<' '<<N<<' '<<a<<' '<<1<<' '<<b;
}


Measured memory_bytes: 764
N,T = map(int,input().split())
t = list(map(int,input().split()))

#最後に押してからT秒は必ずお湯が出る
ans = T

for i in range(N-1):
    #お湯が出てるときに次の人がスイッチを押したとき
    if t[i+1]-t[i]<T:
        ans += t[i+1]-t[i]
    else:
        ans += T
    
print(ans)

Measured memory_bytes: 30828
using System;

class Program
{
    static void Main(string[] args)
    {
        var abc = Console.ReadLine().Split(' ');
        var n = 100 * int.Parse(abc[0]) + 10 * int.Parse(abc[1]) + int.Parse(abc[2]);

        if (n % 4 == 0)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9+7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
if n == 3:
    print(max(a))
    quit()
dp1 = [-inf]*(n+1) 
dp2 = [-inf]*(n+1)
dp3 = [-inf]*(n+1)
dp1[0] = 0
dp2[0] = 0
dp3[0] = 0
dp1[1] = a[0]
dp2[2] = a[1]
for i in range(3,n+1):
    dp1[i] = dp1[i-2] + a[i-1]
    dp2[i] = max(dp2[i-2],dp1[i-3]) + a[i-1]
    dp3[i] = max(dp3[i-2],dp2[i-3],dp1[i-4]) + a[i-1]
if n % 2:
    print(max(dp1[n-2], dp2[n], dp3[n]))
else:
    print(max(dp1[n-1], dp2[n]))



Measured memory_bytes: 120076
N = int(input())
A = [int(input()) for i in range(N)]
p = 1
count = 0
se = set([1])
while p!=2:
  count += 1
  p = A[p-1]
  if p == 2:
    print(count)
  elif p in se:
    print('-1')
    break
  se.add(p)


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll a,b,k;
    cin>>a>>b>>k;
    Vec v;

    rep(i,k){
        if(a+i<=b){
            v.pb(a+i);
        }
    }
    rep(i,k){
        if(b-i>=a){
            v.pb(b-i);

        }
    }
    sort(ALL(v));
    Uniq(v);
    rep(i,v.size()){
        cout<<v[i]<<endl;

    }
    ll ans=0;
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	int N, A;

	cin >> N >> A;

	cout << ((N%500)<=A ? "Yes" : "No")<< endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h> 
int main()
{
	int n,a,b,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a,&b);
		ans+=(b-a)+1;
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    int h,w; cin>>h>>w;
    vector<vector<char>>a(h+2,vector<char>(w+2));
    rep(i,w+2){
        a[0][i]='#';
        a[h+1][i]='#';
    }
    rep(i,h+2){
        a[i][0]='#';
        a[i][w+1]='#';
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>a[i][j];
        }
    }
    int cnt;
    int ii,jj;
    int mx=0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(a[i][j]=='#')continue;
            cnt=1;
            ii=i;
            while(a[ii+1][j]=='.'){
                cnt++;
                ii++;
            }
            ii=i;
            while(a[ii-1][j]=='.'){
                cnt++;
                ii--;
            }
            jj=j;
            while(a[i][jj+1]=='.'){
                cnt++;
                jj++;
            }
            jj=j;
            while(a[i][jj-1]=='.'){
                cnt++;
                jj--;
            }
            mx=max(mx,cnt);
            if(mx==h+w-1){
                cout<<mx<<endl;
                return 0;
            }
        }
    }
    cout<<mx<<endl;
}





Measured memory_bytes: 4224
package main

import (
    "fmt"
    "bufio"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main(){
    var a, b int
    fmt.Fscan(r, &a, &b)
    
    x1 := a*b
    x2 := (a+b)*2
    fmt.Printf("%v %v\n",x1,x2)
}



Measured memory_bytes: 1136
import math
A,B,H,N= map(int,input().split())
sa=((15-H)%12)*30-N/2
sb=((75-N)%60)*6
c1=math.sin(math.radians(sa))*A
c2=math.cos(math.radians(sa))*A
d1=math.sin(math.radians(sb))*B
d2=math.cos(math.radians(sb))*B
print(((c1-d1)**2+(c2-d2)**2)**(0.5))


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

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

	vector<vector<int>> arr(n,vector<int>(2));

	for(int i=0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1];
	}

	int count = 0;

	for(int i=0;i<n;i++){
		if(arr[i][0]==arr[i][1]){
			count++;
			if(count >= 3){
                                cout<<"Yes";
                                return 0;
                        }
		}
		else{
			if(count >= 3){
				cout<<"Yes";
				return 0;
			}

			count = 0;
		}
	}

	cout<<"No";

	return 0;

}


Measured memory_bytes: 3612
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n);
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){
  string s, t;
  cin >> s >> t;

  int s_n = s.size();
  int t_n = t.size();
  bool f = false;

  for(int i=s_n-t_n+1; i>=0; --i){
    if(s[i] == t[0] || s[i] == '?'){
      int count = 0;
      while(s[i+count] == t[count] || s[i+count] == '?'){
	count++;
	if(count == t_n) {
	  f = true;
	  break;
	}
      }
      if(f){
	REP(j, count){
	  //cout << "Change:" << i << " " << j << endl;
	  s[i+j] = t[j];
	}
	break;	
      }
    }
  }
  if(f){
    REP(i, s_n){
      if(s[i] == '?') cout << "a";
      else cout << s[i];
    }
    cout << endl;
  }else{
    cout << "UNRESTORABLE" << endl;
  }     
     
  
  /*
  bool f, f2=false, f3=false;

  REP(i, s_n - t_n + 1){
    f=false;
    int count = 0;
    REP(j, t_n){
      if(s[i+j] == t[j]){
	//cout << i << " " << j << endl;
	tmp1 = i+j; // s loc
	tmp2 = j;   // t loc
	f=true;
      }	
    }
    if(f){
      REP(j, t_n){
	cout << count << " " << j << endl;	
	if(s[tmp1+j] != '?' && s[tmp1+j] != t[tmp2+j]){
	  f2=false;
	  break;
	}	
	else{
	  count++;
	  if(count == t_n-1){
	    f2=true;
	  }
	}	
      }
    }
    if(f2){
      if(i == tmp1){
	REP(j, t_n){	
	  cout << i << " " << j << "tmp1+j:" << tmp1+j << " tmp2+j:" << tmp2+j << endl;
	  
	  s[tmp1+j] = t[tmp2+j];
	}
	f2 = false;
	f3 = true;
      }
    }
  }
  
  REP(i, s_n){
    if(s[i] == '?'){
      s[i] = 'a';
    }
  }  
  
  
  if(!f3) cout << "UNRESTORABLE" << endl;
  else cout << s << endl;
  */
    
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
vote = list(map(int, input().split()))
sum = sum(vote)
allowedList = []


for i in range(0,len(vote)):
    if sum / 4 / M <= vote[i]:
        allowedList.append(vote[i])


if len(allowedList) >= M:
    print("Yes")
else: print("No")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    ll x;
    cin >> x;
    ll a = 100;
    int i = 0;
    while(true) {
        i++;
        a *= 1.01;
        if(a >= x) break;
    }
    cout << i << endl;

    return 0;
}


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

int main() {
  string s,t;
  cin >> s >> t;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3856
#include <cstdio>
#include <cstring>

char S[100010];
bool v[100010];

int main(){
  scanf("%s", S); int L = strlen(S);

  v[0] = true;

  for(int i = 1; i <= L; i++){
    if(i >= 5 && v[i - 5] && S[i - 5] == 'd' && S[i - 4] == 'r' && S[i - 3] == 'e' && S[i - 2] == 'a' && S[i - 1] == 'm') v[i] = true;
    if(i >= 7 && v[i - 7] && S[i - 7] == 'd' && S[i - 6] == 'r' && S[i - 5] == 'e' && S[i - 4] == 'a' && S[i - 3] == 'm' && S[i - 2] == 'e' && S[i - 1] == 'r') v[i] = true;
    if(i >= 5 && v[i - 5] && S[i - 5] == 'e' && S[i - 4] == 'r' && S[i - 3] == 'a' && S[i - 2] == 's' && S[i - 1] == 'e') v[i] = true;
    if(i >= 6 && v[i - 6] && S[i - 6] == 'e' && S[i - 5] == 'r' && S[i - 4] == 'a' && S[i - 3] == 's' && S[i - 2] == 'e' && S[i - 1] == 'r') v[i] = true;
  }

  puts(v[L] ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 384
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
#define vint vector<int>

int main() {
    int N;
    cin >> N;
    ll ans_a = 0, ans_b = 1;
    rep(i, N) {
        ll q, x;
        cin >> q >> x;
        if (q == 1) {
            ans_b *= x;
            ans_a *= x;
        } else if (q == 2)
            ans_a -= x;
        else
            ans_a += x;
    }
    cout << ans_a << " " << ans_b << endl;
    return 0;
}


Measured memory_bytes: 3120