akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
static int[] row,col,deg,ndeg;
static int[][]bor;
static int N=8;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sca=new Scanner(System.in);
		int i,j,y,x,n;
		n=sca.nextInt();
		bor=new int[N][N];//1=Located,-1=Not located,2=fix;
        row=new int[N];//1=Located,-1=Not located;
        col=new int[N];//1=Located,-1=Not located;
        deg=new int[2*N-1];//1=Located,-1=Not located;
        ndeg=new int[2*N-1];//1=Located,-1=Not located;
        for(i=0;i<N;i++){
        	row[i]=col[i]=-1;
        	for(j=0;j<N;j++){
        		bor[i][j]=-1;
        	}
        }
        for(i=0;i<2*N-1;i++){
        	deg[i]=ndeg[i]=-1;
        }
        for(i=0;i<n;i++){
        	y=sca.nextInt();
        	x=sca.nextInt();
          bor[y][x]=2;
        }
        play(0);
	}
	public static void  play(int a){
	int i;
	if(a==N){
		printboard();
		return;
	}
	for(i=0;i<N;i++){
		if(col[i]==1||deg[a+i]==1||ndeg[a-i+N-1]==1)continue;
		putremo(a,i,1);
		row[a]=i;
		if(bor[a][i]!=2)bor[a][i]=1;
		play(a+1);
	    putremo(a,i,-1);
	    if(bor[a][i]!=2)bor[a][i]=-1;
	    row[a]=-1;
	}
	}
	public static void putremo(int y,int x,int o){
    	col[x]=o;
    	deg[x+y]=o;
    	ndeg[y-x+(N-1)]=o;
	}
	public static void printboard(){
		int i,j;
		for(i=0;i<N;i++){
			for(j=0;j<N;j++){
				if(bor[i][j]==1||bor[i][j]==2){
					if(row[i]!=j)return;
				}
			}
		}
		for(i=0;i<N;i++){
			for(j=0;j<N;j++){
			if(row[i]==j){
				System.out.print("Q");
			}else{
			   System.out.print(".");
			}
		}
			System.out.println("");
	}
	}
}


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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	ll ans = 0;
	string s;
	ll n,k;	cin>>n>>k;
	ans = (n*3+k)/2;
	cout<<ans<<endl;
	return 0;
}

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

int main() {

  int r, g, b; cin >> r >> g >> b;
  if ((2 * g + b) % 4 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
    
}


Measured memory_bytes: 256
inf = 10**20
n, k = map(int, input().split())
hs = [int(s) for s in input().split()]
 
dp = [inf] * n
dp[0] = 0
 
for i in range(1, n):
    for j in range(i-1, max(0, i-k)-1, -1):
        dp[i] = min(dp[j] + abs(hs[i] - hs[j]), dp[i])
print(dp[-1])

Measured memory_bytes: 53600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  // 標準入力高速化のおまじない
  // scanfとの同期を切る。以降紛らわしいのでscanf使用不可。
  ios::sync_with_stdio(false);
  // // cin前の自動flashをやめる
  cin.tie(nullptr);

  ll A;
  double B;
  cin >> A >> B;
  // double誤差対策
  int _B = round(100*B);
  ll result = A*_B/100;
  cout << result << endl;
  return 0;
}


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

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

	if(N % 1000 == 0) {
		cout << 0 << endl;
		return 0;
	}

	cout << 1000 - N % 1000 << endl;

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    rep(i, 0, s.size()){
        if(i % 2 == 0) cout << s[i];
    }cout << endl;
}

Measured memory_bytes: 592
/**
 *    author:  tourist
 *    created: 12.01.2020 10:05:34       
**/
#include <bits/stdc++.h>

using namespace std;

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


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans(n+1);
    FOR(i,1,n+1) cin>>a[i];
    for(int i=n;i>=1;i--){
      int sum=0;
      for(int j=i+i;j<=n;j+=i){
        sum+=ans[j];
      }
      if(a[i]==0){
        if(sum%2==0) ans[i]=0;
        else ans[i]=1;
      }else{
        if(sum%2==0) ans[i]=1;
        else ans[i]=0;
      }
    }
    int cnt=0;
    FOR(i,1,n+1) if(ans[i]) cnt++;
    cout<<cnt<<endl;
    FOR(i,1,n+1) if(ans[i]) cout<<i<<endl;
}

Measured memory_bytes: 2560
int main(void) {
  int r; char *string;
  string = (char *) malloc(sizeof(char) * r + 1);
  scanf("%d%s", &r, string);
  if (r % 2 != 0) {
    printf("No\n");
    return 0;
  }
  for (int i = 0; i < r/2; i++) {
    if (string[i] != string[i + r/2]) {
      printf("No\n");
      return 0;
    } 
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdio.h>

int main()
{
int a,b,c,e;
while(~scanf("%d %d %d %d",&a,&b,&c,&e))
{
if(a*b>=c*e)
printf("%d\n",a*b); else printf("%d\n",c*e);
}

}

Measured memory_bytes: 128
s = str(input())
n = len(s)
hand = 0
point = 0
for i in range(n):
    if i==0:
        hand +=1
        continue
    if s[i]=="p" and hand>0:
        hand -=1
    elif s[i]=="p" and hand ==0:
        hand +=1
        point-=1
    elif s[i]=="g" and hand>0:
        hand -=1
        point +=1
    elif s[i]=="g" and hand==0:
        hand +=1
print(point)


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

typedef long long int ll;
#define INF 10000000000000
using namespace std;


int main()
{
	int N;
	int A[2][100];
	int sum_u, sum_l, max;
	sum_u = sum_l = max = 0;

	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[0][i];
	for (int i = 0; i < N; i++)
		cin >> A[1][i];

	for (int i = 0; i < N; i++)
	{
		sum_u = sum_l = 0;
		for(int j = 0; j <= i; j++)
			sum_u += A[0][j];
		for (int j = N - 1; j >= i; j--)
			sum_l += A[1][j];

		if (max < sum_u + sum_l)
			max = sum_u + sum_l;
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int size_A, size_B;
    cin >> size_A >> size_B;
    int total = 0;
    for (int i = 0; i < 2; i++)
    {
        if (size_A > size_B)
        {
            total += size_A;
            size_A--;
        }
        else
        {
            total += size_B;
            size_B--;
        }
    }
    cout << total;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(char &c){
  int i;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = my_getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
char S[15];
char T[15];
int N;
int main(){
  int i;
  N = rd(S);
  rd(T);
  for(i=(0);i<(N);i++){
    if(S[i]!=T[i]){
      wt_L("No");
      wt_L('\n');
      return 0;
    }
  }
  wt_L("Yes");
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// char S[15], T[15];
// int N;
// {
//   rd(S@N,T);
//   rep(i,N) if(S[i]!=T[i]) wt("No"), return 0;
//   wt("Yes");
// }


Measured memory_bytes: 3632
N = int(input())
S = input()

l = list(S)
MOD = 10**9 + 7

ans = 1
for c in range(ord('a'), ord('z') + 1):
    c = chr(c)
    ans *= (l.count(c) + 1)
    ans %= MOD
ans = (ans + MOD - 1) % MOD
print(ans)


Measured memory_bytes: 3956
#include <stdio.h>

int main(){
  double we;
  while(scanf("%lf", &we) != EOF){
    if(we<=48.0){
      printf("light fly\n");
    }else if(we<= 51.0){
      printf("fly\n");
    }else if(we<=54.0){
      printf("bantam\n");
    }else if(we<=57.0){
      printf("feather\n");
    }else if(we<=60.0){
      printf("light\n");
    }else if(we<=64.0){
      printf("light welter\n");
    }else if(we<=69.0){
      printf("welter\n");
    }else if(we<=75.0){
      printf("light middle\n");
    }else if(we<=81.0){
      printf("middle\n");
    }else if(we<=91.0){
      printf("light heavy\n");
    }else{
      printf("heavy\n");
    }
  }
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
bool initialized = false;

void combination_init() {
    initialized = true;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long combination(int n, int k) {
    assert(initialized);
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long permutation(int n) {
    assert(initialized);
    if (n < 0) return 0;
    return fac[n] % MOD;
}

long long combination2(int n, int k) {
    assert(initialized);
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll res = 1;
    k = min(k, n - k);
    for (long long x = 1; x <= k; x++) {
        res *= (n - x + 1);
        res %= MOD;
        res *= inv[x];
        res %= MOD;
    }
    return res;
}

ll pow(ll x, ll y, ll mod) {
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return pow(x * x % mod, y / 2, mod) % mod;
    } else {
        return x * pow(x, y - 1, mod) % mod;
    }
}

void Main() {
    ll n, a, b;
    cin >> n >> a >> b;
    combination_init();
    ll ans = pow(2, n, MOD) - 1;
    ans %= MOD;
    if (ans < 0) ans += MOD;
    ans -= combination2(n, a);
    ans %= MOD;
    if (ans < 0) ans += MOD;
    ans -= combination2(n, b);
    ans %= MOD;
    if (ans < 0) ans += MOD;
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <numeric>

using namespace std;

int main(){
   int m;
   cin>>m;
   cout<<24-m+24<<endl;
   

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

void InsertionSort(int a[],int n){
    for(int i=0;i<n;i++){
        int temp = a[i];
        int j = i-1;
        while(j>=0 && a[j] > temp){
            a[j+1] =a[j];
            j--;
            a[j+1] = temp;
        }
        for(int b=0;b<n-1;b++){
            cout << a[b] << " ";
        }
        cout << a[n-1] << endl;
    }
}


int main(){
    int n;
    int array[1000];

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

    InsertionSort(array,n);
    return 0;
}


Measured memory_bytes: 3136
num=int(input())
S=[]
H=[]
C=[]
D=[]
for i in range(num):
    a,b=input().split()
    b=int(b)
    if a=='S':
        S.append(b)
    elif a=='H':
        H.append(b)
    elif a=='C':
        C.append(b)
    elif a=='D':
        D.append(b)
for n in range(1,14):
    if n not in S:
        print('S {}'.format(n))
for n in range(1,14):
    if n not in H:
        print('H {}'.format(n))
for n in range(1,14):
    if n not in C:
        print('C {}'.format(n))
for n in range(1,14):
    if n not in D:
        print('D {}'.format(n))


Measured memory_bytes: 5600
n, a, b = list(map(int, input().split()))
mod = pow(10, 9) + 7

x = 1
y = 1
for i in range(1, a+1):
  x = x * (n-i+1) % mod
  y = (y * i) % mod
da = ((x % mod) * (pow(y, mod-2, mod) % mod)) % mod

x = 1
y = 1
for i in range(1, b+1):
  x = x * (n-i+1) % mod
  y = (y * i) % mod
db = ((x % mod) * (pow(y, mod-2, mod) % mod)) % mod

ans = pow(2,n,mod) - 1 - da - db
print(ans % mod)

Measured memory_bytes: 3064
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Queue;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	FastScanner sc;

	void run() {
		sc = new FastScanner();
		int N = sc.nextInt();
		int L = sc.nextInt();
		
		String[] ws = new String[N];
		for (int i = 0; i < N; i++) {
			ws[i] = sc.next();
		}
		
		Arrays.sort(ws);
		String ans = "";
		for (int i = 0; i < N; i++) {
			ans = ans + ws[i];
		}
		System.out.println(ans);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 12244
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <queue>
#include <set>

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

const LL inf = 1000000000000000;
const LL mod = 1000000007;

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

	LL n, m;
	n = s.size();
	m = t.size();

	vector<vector<pair<LL, pair<LL, LL>>>> lcs(n+1, vector<pair<LL, pair<LL, LL>>> (m+1, make_pair(0, make_pair(0, 0))));

	// lcs[i][j] = lcs[i+1][j]

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (s[i] == t[j]) {
				if (lcs[i][j].first +1> lcs[i+1][j+1].first) {
					lcs[i+1][j+1] = make_pair(lcs[i][j].first+1, make_pair(i, j));
				}
			}
			if (lcs[i+1][j].first < lcs[i][j].first) {
				lcs[i+1][j] = make_pair(lcs[i][j].first, make_pair(i, j));
			}
			if (lcs[i][j+1].first < lcs[i][j].first) {
				lcs[i][j+1] = make_pair(lcs[i][j].first, make_pair(i, j));
			}
		}
	}

	vector<char> common;
	pair<LL, LL> cur;
	pair<LL, pair<LL, LL>> ans;

	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= m; ++j) {
			if (ans < lcs[i][j]) {
				ans = lcs[i][j];
				cur = make_pair(i, j);
			}
		}
	}


	while (cur.first != 0 && cur.second != 0) {
		LL i = cur.first, j = cur.second;
		pair<LL, LL> prev = lcs[i][j].second;

		if (prev.first+1 == i && prev.second +1 == j) {
			common.push_back(s[i-1]);
		}
		cur = prev;

	}

	reverse(common.begin(), common.end());
	for (auto e : common) {
		cout << e;
	}
	cout << endl;
	 
}

Measured memory_bytes: 211456
class in{struct my_iterator{int it;const bool rev;explicit constexpr my_iterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(my_iterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const my_iterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const my_iterator& begin(){return i;}const my_iterator& end(){return n;}};

#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(n * 2, 0);
    iota(a.begin(), a.end(), 1);
    for(int _ : in(m)) {
        int k; cin >> k;
        auto tmp = a;
        if(k == 0) {
            for(int i : in(n)) {
                tmp[i * 2] = a[i];
                tmp[i * 2 + 1] = a[i + n];
            }
        }
        else {
            for(int i : in(2 * n)) {
                if(i >= k)
                  tmp[i - k] = a[i];
                else
                  tmp[2 * n - k + i] = a[i];
            }
        }
        a = tmp;
//        for(int x : a) cout << x << endl;
    }
    for(int x : a) cout << x << endl;
    return 0;
}

Measured memory_bytes: 3132
#from functools import lru_cache
import sys
import math
def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))
def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())
sys.setrecursionlimit(100000)
ls = rvfunc(int)(reader())
n,k=ls[0]
a=ls[1]

def reqk(l):
    return sum(vfunc(lambda aa:math.ceil(aa/float(l))-1)(a))
def binary_search(imin=None,imax=None):
    if [imin,imax]==[None]*2: imin,imax=1,10**9+1
    if (imax < imin):
        return imin
    else:
        imid = int(imin + (imax - imin) / 2)
        if (reqk(imid)<=k):return binary_search(imin, imid - 1)
        elif (reqk(imid)>k):return binary_search(imid + 1, imax)
print(binary_search() if k!=0 else max(a))


Measured memory_bytes: 219264
#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

const int MAX = 100002;
int PARENT[MAX] = {0};
int RANK[MAX] = {0};
int CHLDS[MAX] = {0}; //自分と同じグループのメンバ数。親の値のみ信用できる。

void init(int L){
	if(L<1) return;
	for(int i=0; i<L; i++){
		PARENT[i]=i;
		RANK[i]=0;
		CHLDS[i] = 1;
	}
}

int root(int x){
	if(x<0) return -1;
	if(PARENT[x]==x){
		return x;
	}
	else{
		int p = root(PARENT[x]);
		if(p != PARENT[x]){
			if(CHLDS[x] != 0){
				CHLDS[p] += CHLDS[x];
				CHLDS[x] = 0;
			}
			PARENT[x] = p;
		}
		return PARENT[x];
	}
}

int same(int x, int y){
	if(x==y) return 1;
	if(root(x)==root(y)){
		return 1;
	}
	else{
		return 0;
	}
}

void combine(int x, int y){
	if(x==y) return;

	int a = root(x);
	int b = root(y);
	if(a==b) return;

	if(RANK[x]<RANK[y]){
		PARENT[b] = a;
		CHLDS[a] += CHLDS[b];
		CHLDS[b] = 0;
	}
	else{
		PARENT[a] = b;
		if(RANK[x]==RANK[y]) RANK[x] += RANK[y];
		CHLDS[b] += CHLDS[a];
		CHLDS[a] = 0;
	}
}

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

	int N, M; cin >> N >> M;
	init(N);
	for(int i=0; i<M; i++){
		int a, b; cin >> a >> b;
		a--; b--;
		combine(a, b);
	}
	map<int, int> m;
	for(int i=0; i<N; i++){
		m[root(i)] = 1;
	}
	printf("%d\n", (int)m.size()-1);
	return 0;
}

Measured memory_bytes: 8560
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;

int main() {
    char ch;

	while((ch = getchar()) != EOF){
        if(islower(ch)) {
            printf("%c", toupper(ch));
        } else if(isupper(ch)) {
            printf("%c", tolower(ch));
        } else {
            printf("%c", ch);
        }
    }

    return 0;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
#define ld long double
using namespace std;

int main()
{ 
fast;
ll n,k;
cin>>n>>k;

ll a[n];
for(ll i=0;i<n;i++)
    cin>>a[i],a[i]--;

ll up [n][61];
memset(up,0,sizeof(up));

for(ll i=0;i<n;i++)
up[i][0]=a[i];

 for(ll j=1;j<=60;j++)
for(ll i=0;i<n;i++)
    up[i][j]=up[up[i][j-1]][j-1];

ll pow[64];
pow[0]=1;
for(ll i=1;i<64;i++)pow[i]=pow[i-1]*2;

ll st=0;
for(ll i=60;i>-1;i--)
    if(pow[i]<=k)
        k-=pow[i],st=up[st][i];
    
    cout<<st+1<<endl;
}

Measured memory_bytes: 100496
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

 

int main() {
	string s[3]; cin >> s[0] >> s[1] >> s[2];
	int turn = 0; // 0:A,1:B,2:C
	int net;
	while (true) {
		if (s[turn].length() > 0) {
			net = s[turn].front() - 97;
			s[turn].erase(s[turn].begin());
			turn = net;

		}
		else {
			char out;
			if (turn == 0)out = 'A'; else if (turn == 1)out = 'B'; else out = 'C';
			print(out);
			break;
		}
	}








	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define NO() cout<<"NO"<<endl
#define YES() cout<<"YES"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

ll powe(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

void solve()
{
    ll i,j,k=0,n,l;
    cin>>n>>k;
    vll v(n);
    take(v,n);
    sot(v);
    ll sum =0;
    for(i=0;i<k;i++)
        sum+=v[i];
    cout<<sum<<ee;

}

int main() {
    fast;
    ll i,j,l,k,t,n;
    t=1;
    while(t--)
    solve();
}


Measured memory_bytes: 3624
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
    string t = Console.ReadLine();
		int answer = 0;
    for(int i = 0; i < 3; i++)
    {
      if(s[i] == t[i]) answer++;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 11092
N = int(input())
a = list(map(int, input().split()))

i=j=0
g, h = a[0], a[0]
r = 0
while i<=N-1:
    if g == h:
        r += j-i+1
        if j==N-1:
            break
        j += 1
        g = a[j]^g
        h = a[j]+h
    else:
        g = a[i]^g
        h = h-a[i]
        i += 1
print(r)


Measured memory_bytes: 77772
n = int(input())
a= list(map(int, input().split()))

c = 0
r = []
num = 1

for i in range(n):
    if a[i] == num:
        r.append(a[i])
        num += 1
    else:
        c +=1

if r == []:
    print(-1)
else:
    print(c)

Measured memory_bytes: 24744
#include<stdio.h>


int main()
{

    int a,b,c;

    scanf("%d%d",&a,&b);

    int A[b],sum=0;


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

    }


    if(sum<a) printf("No\n");
    else printf("Yes\n");


    return 0;

}


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

#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define REP(i,a,b) for (int i = a; i <= b; i++)
using namespace std;
long long maxv = 1e9;

int main()
{
    fast_cin();
    // typedef vector<int> vi;
    string s,t;

    // int N,M,p;
    cin>>s;
    cin>>t;
    int counter;
    counter=0;
    // vi arr(M);
    REP(i,0,s.size()-t.size()){
        int tmp;
        tmp=0;
        REP(j,0,t.size()-1){
            if(s[i+j]==t[j]){
                tmp++;
            }
        }
        counter=max(counter,tmp);
    }
    cout<<t.size()-counter;
    return 0;
}

Measured memory_bytes: 3656
import sys
input=sys.stdin.readline
h,w=map(int,input().split())
C=[]
for i in range(h):
    sub_list=input().rstrip()
    C.append(sub_list)
dp=[[0]*w for i in range(h)]
if C[0][0]=='.':
    dp[0][0]=0
else:
    dp[0][0]=1
for i in range(h):
    for j in range(w):
        if i==0 and j==0:
            pass
        else:
            if i==0:
                if C[i][j]=='.':
                    dp[i][j]=dp[i][j-1]
                else:
                    if C[i][j-1]=='.':
                        dp[i][j]=dp[i][j-1]+1
                    else:
                        dp[i][j] = dp[i][j - 1]
            elif j==0:
                if C[i][j]=='.':
                    dp[i][j]=dp[i-1][j]
                else:
                    if C[i-1][j]=='.':
                        dp[i][j]=dp[i-1][j]+1
                    else:
                        dp[i][j] = dp[i-1][j]
            else:
                if C[i][j]=='.':
                    dp[i][j]=min(dp[i][j-1],dp[i-1][j])
                else:
                    if C[i][j-1]=='.':
                        dp[i][j]=dp[i][j-1]+1
                    else:
                        dp[i][j] = dp[i][j - 1]
                    if C[i-1][j]=='.':
                        dp[i][j]=min(dp[i][j],dp[i-1][j]+1)
                    else:
                        dp[i][j] =min(dp[i][j],dp[i-1][j])
print(dp[h-1][w-1])


Measured memory_bytes: 41968
from collections import deque
k = int(input())
x = [50 for i in range(k)]
x[1],q = 0,deque()
q.append(1)
while q:
	n = q.pop()
	m = n	
	while 1:
		m2 = (m*10)%k
		if x[m2]>x[m]:
			x[m2],m = x[m],m2
			q.append(m)
		else: break
	if x[(n+1)%k]==50:
		x[(n+1)%k] = x[n]+1
		q.appendleft((n+1)%k)
print(x[0]+1)

Measured memory_bytes: 6772
S=input()
if len(S)!=26:
    l=[0]*26
    for i in S:
        l[ord(i)-97]=1
    print(S,end="")
    for i in range(26):
        if l[i]==0:
            print(chr(i+97))
            break
else:
    l=[]
    for i in S:
        l.append(i)
    t=l[-1]
    for i in range(25,-1,-1):
        if t>l[i]:
            print(S[:i],end="")
            for j in S[::-1]:
                if j>l[i]:
                    print(j)
                    break
            break
        else:
            t=l[i]
    else:
        print(-1)

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


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

  string s1, s2;
  do {
    s.resize(s.length() - 2);
    s1 = s.substr(0, s.length() / 2);
    s2 = s.substr(s.length() / 2, s.length() / 2);
  } while (s1 != s2);

  cout << s.length() << endl;
  
  return 0;
}

Measured memory_bytes: 3604
#include <cstdio>

using namespace std;

#define rep(i, N) for (ll i = 0; i < N; ++i)
typedef long long int ll;

static const ll MAX = 100000;
ll T[MAX];
ll n, k;

int check(ll p) {
    int i = 0;
    rep(j, k) {
        ll s = 0;
        while (s + T[i] <= p) {
            s += T[i];
            i++;
            if (i == n) return n;
        }
    }
    return i;
}

int calc() {
    ll l = 0, m;
    ll r = MAX * 10000;
    while (r - l > 1) {
        m = (l + r) / 2;
        if (check(m) >= n) r = m;
        else l = m;
    }
    return r;
}

// Allocation
int main() {
    scanf("%d %d", &n, &k);
    rep(i, n) scanf("%d", &T[i]);

    int ans = calc();

    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;  // 1e9+7
const int INF = 100100100;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl

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

  FOR(i, X - K + 1, X + K) cout << i << ' ';
  cout << '\n';
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    if(b < 0) {
        return power(power(a, -b), mod-2);
    }
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 3e5+9;
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    int n, k, q; cin >> n >> k >> q;
    vector<int> a(n+1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int ans = 2e9;
    for(int i = 1; i <= n; i++) {
        vector<vector<int>> splits;
        vector<int> split;
        for(int j = 1; j <= n; j++) {
            if(a[j] < a[i]) {
                splits.push_back(split);
                split.clear();
            } else {
                split.push_back(a[j]);
            }
        }
        if(split.empty() == false) {
            splits.push_back(split);
        }
        vector<int> cands;
        for(auto split: splits) {
            sort(split.begin(), split.end());
            int m = split.size(); 
            for(int j = 0; j < m-k+1; j++) {
                cands.push_back(split[j]);
            }
        }
        sort(cands.begin(), cands.end());
        int m = cands.size();
        if(m >= q) {
            ans = min(ans, cands[q-1]-cands[0]);
        }
    }
    cout << ans << "\n";









    return 0;
    
}

Measured memory_bytes: 512
n,m = map(int, input().split())
s = []
for _ in range(m):
  ks = list(map(int, input().split()))
  s.append(ks[1:])
p = list(map(int, input().split()))

ans = 0
for i in range(2**n):
  for x,y in zip(s, p):
    flag = False
    for a in x:
      if i & 1 << (a-1):
        flag = not flag
    if int(flag) != y:
      break
  else:
    ans += 1
print(ans)


Measured memory_bytes: 3188
from math import gcd
from collections import Counter
k=int(input())
t=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    t.append(gcd(a,b))      
t=Counter(t)
ans=0
for d,e in t.items():
  for c in range(1,k+1):
    g=gcd(c,d)
    ans+=g*e
print(ans)


Measured memory_bytes: 71936
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int num[N];
    for(int i=0;i<N;i++){
        cin>>num[i];
       }
    for(int i=0;i<N;i++){
       cout<<num[N-1-i] ;
       if(i!=N-1){
           cout<<" ";
           
       }else{
           cout<<endl;
       }
     
    }
    
    return(0);
}


Measured memory_bytes: 3080
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,state;
	cin>>a>>b>>c;
	if(a==b)
	{
		if(a==c)
			state=0;
		else
			state=1;
		
	}
	else if(a==c||b==c)
		state=1;
	else
		state=0;
	if(state==1)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

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

int main(){
    string n; cin >> n;
    int res = 0;
    bool flg_1 = true;
    bool flg = true;
    if(n.at(0)!='9') flg_1 = false; 
    for(int i=1; i<n.length(); i++){
        if(n.at(i) != '9'){
            flg = false; break;
        }    
    }
    if(n.length() == 1){
        res = n.at(0) - '0';
    }else{
        if(flg && flg_1){
            res = 9*n.length();
        }else if(flg && !flg_1){
            res = (n.at(0) - '0') + 9*(n.length()-1);
        }else{
            res = (n.at(0) - '0')-1 + 9*(n.length()-1);
        }
    }
    
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3616
#include<iostream>  
#include<cstdio>
#include<stdio.h>
#include<cstring>  
#include<cstdio>  
#include<climits>  
#include<cmath> 
#include<vector>
#include <bitset>
#include<algorithm>  
#include <queue>
#include<map>
using namespace std;
int n;
int main()
{
	cin >> n;
	cout << n * 800 - n / 15 * 200 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin >> d;
  switch(d){
    case 22:
      cout<<"Christmas Eve Eve Eve"<<endl;
      break;
    case 23:
      cout<<"Christmas Eve Eve"<<endl;
      break;
    case 24:
      cout<<"Christmas Eve"<<endl;
      break;
    case 25:
      cout<<"Christmas"<<endl;
    default:
    break;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int f(int n){
	return (n % 2 == 0 ? n / 2 : 3 * n + 1);
}
int32_t main(){
	int s; cin>>s;
	vector<int> a(1, s);
	set<int> set;
	set.insert(s);
	while(true){
		s=f(s);
		a.push_back(s);
		if(set.count(s)){
			cout<<a.size()<<endl;
			return 0;
		}
		set.insert(s);
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int w,h,x,y,r;
	int flag=0;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	if(x<r)flag++;
	if(y<r)flag++;
	if((w-x)<r)flag++;
	if((h-y)<r)flag++;
	if(flag==0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

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

using namespace std;

int max(int a, int b) {
    return a > b ? a : b;
}
int min(int a, int b) {
    return a < b ? a : b;
}

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    
    int r1 = max(x, y);
    r1 = max(r1, z);
    
    int r3 = min(x, y);
    r3 = min(r3, z);
    
    int r2 = x + y + z - r1 - r3;
    
    cout << r3 << " " << r2 << " " << r1 << endl;
}


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

using namespace std;

int main(){
    string s;
    cin >> s;
    bool b = true;
    for (int i=0;i<s.length();i++){
        if (i%2==0){
            b &= (s.substr(i,1)!="L");
        }else{
            b &= (s.substr(i,1)!="R");
        }
    }
    cout << (b ? "Yes" : "No") << endl;

}


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

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

    static class BStringPalindrome {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            String t = s.substring(0, s.length() / 2);
            String u = s.substring(s.length() / 2 + 1);

            if (isKaibun(s) && isKaibun(t) && isKaibun(u)) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

        boolean isKaibun(String s) {
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) != s.charAt(s.length() - 1 - i)) {
                    return false;
                }
            }
            return true;
        }

    }
}



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

int main(){
    long double n, m, d;
    cin >> n >> m >> d;
    long double ans;
    if (d == 0){
        ans = double(m - 1) * double(1) / n;
    }
    else {
        ans = double(m - 1) * double(2 * (n - d)) / (n * n);
    }

    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });

            var X= Sarray()[0];
            for(var i=X; ;++i)
                if (isPrime(i))
                {
                    WriteLine(i);
                    return;
                }


            //Out.Flush();
        }
        static bool isPrime(long x)
        {
            if (x <= 1) return false;
            if (x == 2) return true;
            if (x % 2 == 0) return false;
            for (long i = 3; i * i <= x; i += 2)
                if (x % i == 0)
                    return false;
            return true;
        }
    }
}

Measured memory_bytes: 13268
a = int(input())
lis = list(map(int, input().split()))
lis2 = []
d = {}
cnt=1
for i in lis:
    if(lis[cnt-1]-cnt in d):
        d[lis[cnt-1]-cnt]=d[lis[cnt-1]-cnt]+1
    else:
        d[lis[cnt - 1] - cnt] = 1
    cnt+=1
cnt=1
result=0
for i in lis:
    if(-cnt-i in d):
        result+=d[-cnt-i]
    cnt += 1
print(result)

Measured memory_bytes: 40188
<?php
# 整数の入力
fscanf(STDIN, "%d", $a);

if (400 <= $a && $a <= 599) {
    echo 8;
} else if (600 <= $a && $a <= 799) {
    echo 7;
} else if (800 <= $a && $a <= 999) {
    echo 6;
} else if (1000 <= $a && $a <= 1199) {
    echo 5;
} else if (1200 <= $a && $a <= 1399) {
    echo 4;
} else if (1400 <= $a && $a <= 1599) {
    echo 3;
} else if (1600 <= $a && $a <= 1799) {
    echo 2;
} else if (1800 <= $a && $a <= 1999) {
    echo 1;
}

?>

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

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x+r <= W && x-r >= 0 && y+r <= H && y-r >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define INF 2139062143
#define ll long long
using namespace std;
const int maxn = 1005;
ll a[305][305];
ll tempa[305][305];
struct Edge {
    ll from, to, dist;
    Edge(ll u, ll v, ll d) : from(u), to(v), dist(d) {}
};
struct HeapNode {
    ll d, u;

    bool operator<(const HeapNode &rhs) const {
        return d > rhs.d;
    }
};
struct Dijkstra {
    ll n, m;
    vector <Edge> edges;
    vector<ll> G[maxn];
    bool done[maxn];
    ll d[maxn];
    ll roadcount[maxn];
    ll p[maxn];
    vector<ll> path;

    void init(ll n) {
        this->n = n;
        for (ll i = 0; i < n; i++) G[i].clear();
        edges.clear();
        path.clear();
    }

    void addEdge(ll from, ll to, ll dist) {
        edges.push_back(Edge(from, to, dist));
        m = edges.size();
        G[from].push_back(m - 1);
    }

    void dijkstra(ll s) {
        priority_queue <HeapNode> Q;
        for (ll i = 0; i <= n; i++) d[i] = INF;
        for (ll i = 0; i <= n; i++) roadcount[i] = 0;
        d[s] = 0;
        memset(done, 0, sizeof(done));
        Q.push((HeapNode) {
                0, s
        });
        while (!Q.empty()) {
            HeapNode x = Q.top();
            Q.pop();
            ll u = x.u;
            if (done[u]) continue;
            done[u] = true;
            for (ll i = 0; i < G[u].size(); i++) {
                Edge &e = edges[G[u][i]];
                if (d[e.to] > d[u] + e.dist) {
                    d[e.to] = d[u] + e.dist;
                    roadcount[e.to] = roadcount[u] + 1;
                    p[e.to] = G[u][i];
                    Q.push((HeapNode) {
                            d[e.to], e.to
                    });
                } else {
                    if(d[e.to] == d[u] + e.dist) {
                        roadcount[e.to] = max(roadcount[e.to],roadcount[u] + 1);
                    }
                }
            }
        }
    }
    void findpath(ll x, ll end) {
        path.clear();
        path.push_back(x);
        findd(x, end);
    }
    void findd(ll x, ll end) {
        if (x == end)
            return;
        else {
            path.push_back(this->edges[this->p[x]].from);
            findd(this->edges[this->p[x]].from, end);
        }
    }
};

int main() {
    ll n;
    scanf("%lld",&n);
    Dijkstra dj;
    dj.init(n);
    for(ll i=0; i<n; i++) {
        for(ll j=0; j<n; j++) {
            scanf("%lld",&a[i][j]);
            tempa[i][j] = a[i][j];
            if(i != j)
                dj.addEdge(i,j,a[i][j]);
        }
    }
    for(ll i=0; i<n; i++) {
        dj.dijkstra(i);
        for(ll j=0; j<n; j++) {
            if(a[i][j] > dj.d[j]){
                printf("-1\n");
                return 0;
            }
            if(dj.roadcount[j] > 1) {
                tempa[i][j] = 0;
                tempa[j][i] = 0;
            }
        }

    }
    ll ans = 0;
    for(ll i=0; i<n; i++) {
        for(ll j=0; j<n; j++) {
            ans += tempa[i][j];
        }
    }
    printf("%lld\n",ans / 2);
    return 0;
}


Measured memory_bytes: 6572
N, M = map(int, input().split())
s, t = set(), set()
for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s.add(b)
    elif b == N:
        t.add(a)

if len(s & t) >= 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 18892
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = scanInt()
	}

	ans := 0
	for i := 0; i < N; i++ {
		for {
			if A[i]%2 == 0 {
				A[i] /= 2
				ans++
			} else {
				break
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2000
#import<atcoder/all>
void f(int i){std::cout<<i<<' ';}int n,m,a;int main(){std::cin>>n>>m;atcoder::scc_graph g(n);for(;std::cin>>a>>n;)g.add_edge(a,n);auto v=g.scc();f(size(v));for(auto i:v){f(size(i));for(auto j:i)f(j);}}

Measured memory_bytes: 40068
a, b, c, x = [int(input()) for _ in range(4)]

count = 0

for i in range(a+1):
  total = i*500
  if total == x:
    count += 1
  else:
    for j in range(b+1):
      if total + j * 100 == x:
        count += 1
      else:
        k_total = total + j * 100
        for k in range(c+1):
          if k_total + k * 50 == x:
            count += 1
print(count)

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

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src_, int dst_, Weight weight_) :
        src(src_), dst(dst_), weight(weight_) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int const MAX_V = 100000;
void stronglyConnectedComponents(Graph const & g, int cmp[MAX_V]){
    int n = g.size();
    Graph rg(n);
    rep(i,n) for(auto & e : g[i]) rg[e.dst].eb(e.dst, e.src, e.weight);
    int cnt = 0;
    static int lavel[MAX_V], used[MAX_V], ord[MAX_V], inS[MAX_V], S[MAX_V];
    rep(i,n) lavel[i] = used[i] = inS[i] = cmp[i] = 0;
    int sz = 0;
    rep(i,n){
        if(used[i]) continue;
        int s = 0;
        S[s++] = i;
        while(s){
            int v = S[s-1];
            used[v] = true;
            bool flg = true;
            for(auto & e : g[v]){
                int dst = e.dst;
                if(!used[dst] && !inS[e.dst]){
                    S[s++] = dst;
                    flg = false;
                }
            }
            if(flg){
                int t = S[s-1];
                if(!lavel[t]){
                    lavel[t] = cnt++;
                    ord[sz++] = t;
                }
                s--;
            }
        }
    }
    rep(i,n) used[i] = 0;
    int k = 0;
    rep(i,n){
        int u = ord[n-i-1];
        if(used[u]) continue;
        int s = 0;
        S[s++] = u;
        while(s){
            int v = S[--s];
            used[v] = true;
            cmp[v] = k;
            for(auto & e : rg[v]){
                int d = e.dst;
                if(!used[d]) S[s++] = d;
            }
        }
        k++;
    }
}

int main(){
    int n,m;
    scanf("%d%d", &n,&m);
    Graph g(n);
    rep(i,m){
        int a,b;
        scanf("%d%d", &a,&b);
        g[a].eb(a,b,0);
    }
    static int c[MAX_V];
    stronglyConnectedComponents(g,c);
    int q;
    scanf("%d", &q);
    rep(i,q){
        int a,b;
        scanf("%d%d", &a,&b);
        printf("%d\n", c[a]==c[b]);
    }
}

Measured memory_bytes: 2408
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int l[]=new int[n];
		for(int i=0;i<n;i++) {
			l[i]=scan.nextInt();
		}
		scan.close();
		Arrays.sort(l);
		int ans=0;
		for(int i=n-k;i<n;i++) {
			ans+=l[i];
		}

		System.out.println(ans);
	}
}


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

int main(){
    string s;
    cin >> s;
    int calc;
    int memo;
    for(int i=0;i < (1<<3);i++){
        calc = s.at(0) - '0';
        rep(j,3){
            if(i & (1<<j)){
                calc += s.at(j + 1) - '0';
            }else{
                calc -= s.at(j + 1) - '0';
            }
        }
        if(calc == 7){
            memo = i;
            break;
        }
    }
    cout << s.at(0);
    rep(j,3){
        if(memo & (1<<j)){
            cout << '+';
        }else{
            cout << '-';
        }
        cout << s.at(j+1);
    }
    cout << "=7" << endl;
}

Measured memory_bytes: 256