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

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

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r=nxt(),c=nxt();
    for(int i=0;i<r;i++)
    {
        string s  ;
        cin>>s;
        cout<<s<<"\n"<<s<<"\n";
    }
    
    
    return 0;   
}




 
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int digit_sum(int n){
  int res;
  if(n == 0){
    return 0;
  }else{
    return n%10 + digit_sum(n/10);
  }
}

int main(){
  
  int n;
  cin>>n;
  int ans = 54;
  REPP(i,n-1){
    int temp = 0;
    temp += digit_sum(i);
    temp += digit_sum(n-i);
    ans = min(ans, temp);
  }
  cout<<ans<<endl;
  return 0; 
}


Measured memory_bytes: 256
#include<stdio.h>

void mergeSort(int[],int,int);
void merge(int[],int,int,int);

#define INFTY 1000000001

int cont=0;

int main(){
  int i,x;
  scanf("%d",&x);
  int a[x];
  for(i=0;i<x;i++)scanf("%d",&a[i]);

  mergeSort(a,0,x);
  for(i=0;i<x-1;i++)printf("%d ",a[i]);
  printf("%d\n",a[x-1]);
  printf("%d\n",cont);
  return 0;
}
void merge(int A[],int left,int mid,int right){
  int i,j;
  int n1,n2;
  n1 = mid - left;
  n2 = right - mid;
  int L[n1];
  int R[n2];
//[0...n1], R[0...n2] を生成
  for(i=0;i<=n1-1;i++)L[i] = A[left + i];
  for(i=0;i<=n2-1;i++)R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  int k=0;
			
  for(k=left;k<=right-1;k++){
    if(L[i]<=R[j]){
      A[k] = L[i];
      i = i + 1;
      cont++;
    }
    else{ 
      A[k] = R[j];
       j = j + 1;
      cont++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}



Measured memory_bytes: 5640
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

ll fac[MAX_N], inv[MAX_N], fiv[MAX_N]; //fiv:inv(fac(i))

ll mod_pow(ll a, ll n) {
	if(n == 0) return 1;
	ll res = mod_pow(a, n / 2);
	if(n % 2 == 0) return res * res % mod;
	else return a * res % mod * res % mod;
}

ll invf(ll a) {
	return mod_pow(a, mod - 2);
}


void C_init(int n) {
	fac[0] = fac[1] = 1; inv[1] = 1;
	fiv[0] = fiv[1] = 1;
	rep(i, 2, n + 1) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fiv[i] = fiv[i - 1] * inv[i] % mod;
	}
}

ll C(int a, int b) { //assume a >= b
	if(a < b || a < 0 || b < 0) return 0;
	return fac[a] * fiv[b] % mod * fiv[a - b] % mod;
}

int N, K;
ll dp[30][1010];
int A[MAX_N];

void solve() {
	cin >> N >> K;
	C_init(N);
	rep(i, 0, K) cin >> A[i];
	dp[0][0] = 1;
	rep(i, 0, K) {
		rep(j, 0, N + 1) {
			rep(k, 0, A[i] + 1) {
				if(j + k <= N)
					ADD(dp[i + 1][j + k], dp[i][j] * C(N - j, k) % mod * C(N - k, A[i] - k) % mod);
			}
		}
	}
	// rep(i, 0, K + 1) {
	// 	rep(j, 0, N + 1) {
	// 		debug(i, j, dp[i][j]);
	// 	}
	// }
	cout << dp[K][N] << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



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

int main() {
    double w;
    while (cin >> w) {
        if (w <= 48) {
            cout << "light fly" << endl;
        } else if (w <= 51) {
            cout << "fly" << endl;
        } else if (w <= 54) {
            cout << "bantam" << endl;
        } else if (w <= 57) {
            cout << "feather" << endl;
        } else if (w <= 60) {
            cout << "light" << endl;
        } else if (w <= 64) {
            cout << "light welter" << endl;
        } else if (w <= 69) {
            cout << "welter" << endl;
        } else if (w <= 75) {
            cout << "light middle" << endl;
        } else if (w <= 81) {
            cout << "middle" << endl;
        } else if (w <= 91) {
            cout << "light heavy" << endl;
        } else {
            cout << "heavy" << endl;
        }
    }
    return 0;
}

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

int main(){
  int n,r;
  cin >> n >> r;
  if(n >= 10) cout << r << endl;
  else cout << r + 100*(10 - n) << endl;
}


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

int main(){
	int N;
	int A[100] = {};
	int B[100] = {};
	int C[100] = {};
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N - 1; i++) {
		cin >> C[i];
	}

	int manzo = 0;
	for (int k = 0; k < N; k++) {
		manzo += B[A[k]-1];
		if (k > 0) {
			if ((A[k] - A[k - 1]) == 1) {
				manzo += C[A[k] - 2];
			}
		}
	}
	cout << manzo << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  int res1, res2;
  vector<vector<int>> grid(H, vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      string tmp;
      cin >> tmp;
      if (tmp == "snuke") {
        res1 = i;
        res2 = j;
        break;
      }
    }
  }
  cout << (char)('A' + res2) << res1+1 << endl;
}

Measured memory_bytes: 256
from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]

args = []
for i in range(n):
    x, y = engine[i]
    if x == 0:
        if y < 0:
            args.append((-pi/2, x, y))
        elif y > 0:
            args.append((pi/2, x, y))

    elif y == 0:
        if x > 0:
            args.append((0, x, y))
        elif x < 0:
            args.append((pi, x, y))

    else:
        args.append((atan2(y, x), x, y))

args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l+1):
    for j in range(l):
        x, y = 0, 0
        for k in range(j, j+i):
            x += args[k][1]
            y += args[k][2]
        ans = max(ans, hypot(x, y))

print(ans)


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

int main()
{
  ll d, n;
  cin >> d >> n;
  ll s = pow(100, d);
  if (n < 100)
  {
    cout << s * n << endl;
  }
  else
  {
    cout << s * 101 << endl;
  }
}


Measured memory_bytes: 3752
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;
 
long dp[8005][8005];
 
bool judge( vector<long>& mv, long val )
{
    long i, j;
    long size=(long)mv.size();
    long sum=0;
    for(i=0; i<size; i++) {
        sum+=mv[i];
    }
    if(sum<val || (sum-val)%2==1) {
        return false;
    }
    long val2=(sum-val)/2;
 
    vector<vector<bool> > dp(size+1, vector<bool>(val2+1, false));
    dp[0][0]=true;
    for(i=1; i<=size; i++) {
        for(j=0; j<=val2; j++) {
            dp[i][j] = dp[i-1][j];
            if(j>=mv[i-1]) {
                dp[i][j] = dp[i][j] || dp[i-1][j-mv[i-1]];
            }
        }
    }
    return dp[size][val2];
}
 
int main(int argc, char* argv[])
{
    char str[8005]={0};
    scanf("%s", str);
    long len=strlen(str);
 
    long x,y;
    scanf("%ld %ld", &x, &y);
 
    long mvx0=0;
    vector<long> mvx;
    vector<long> mvy;
 
    long tcount=0;
    long i;
    for(i=0; i<len; i++) {
        long count=0;
        long k=i;
        while(k<len && str[k]=='F') {
            count++;
            k++;
        }
        if(count>0) {
            if(tcount%2==0) {
                if(tcount==0) mvx0=count;
                else mvx.push_back(count);
            }
            else {
                mvy.push_back(count);
            }
            i+=(count-1);
        }
        else {
            tcount++;
        }        
    }
 
    if( judge( mvx, abs(x-mvx0) ) && judge( mvy, abs(y) ) ) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
 
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ans = 0;
    char str[100];
    while (cin >> str)
    {
        int len = strlen(str);
        for (int i = 0; i < len; i++)
        {
            int n = 0;
            while (str[i] != '\0' && isdigit(str[i]))
            {
                n = n*10 + str[i++] - '0';
            }
            ans += n;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1124
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>

using std::vector;
using std::printf;
using std::cout;
using std::endl;
using std::string;
using std::cin;
using std::pair;
using std::sort;

#define i64t long long int
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

template<typename T>
void dump(vector<T> vec) {
    for (auto x : vec) {
        std::cout << x << " ";
    }
    std::cout << std::endl;
}

// ---------------------------

const i64t MOD = 1000000007;

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

    int tmp;
    vector<int> A(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> tmp;
        A[i] = tmp;
    }

    int odd_len = N / 2;
    int even_len = N - odd_len;

    vector<int> even1(even_len, 0);
    for (int i = 0; i < even_len; ++i) {
        even1[i] = A[2*i];
    }
    sort(even1.begin(), even1.end());

    // vector<int> odd1(odd_len, 0);
    // for (int i = 0; i < odd_len; ++i) {
    //     odd1[i] = A[2*i+1];
    // }
    // sort(odd1.begin(), odd1.end());


    sort(A.begin(), A.end());
    vector<int> even2(even_len, 0);
    for (int i = 0; i < even_len; ++i) {
        even2[i] = A[2*i];
    }

    // vector<int> odd2(odd_len, 0);
    // for (int i = 0; i < odd_len; ++i) {
    //     odd2[i] = A[2*i+1];
    // }

    // count different items
    int cnt = 0;
    int pos1 = 0, pos2 = 0;
    while((pos1 < even_len) || (pos2 < even_len)) {
        if (pos1 == even_len) {
            cnt += (even_len - pos2);
            pos2 = even_len;
        }
        else if (pos2 == even_len) {
            cnt += (even_len - pos1);
            pos1 = even_len;
        }
        else if (even1[pos1] == even2[pos2]) {
            pos1++; pos2++;
        }
        else if (even1[pos1] < even2[pos2]) {
            cnt++; pos1++;
        }
        else { // (even1[pos1] > even2[pos2]) 
            cnt++; pos2++;
        }
    }

    printf("%d\n", cnt / 2);


    // printf("even1\n");
    // dump<int>(even1);
    // printf("even2\n");
    // dump<int>(even2);

    // // debug
    // int cnt_d = 0;
    // pos1 = 0, pos2 = 0;
    // while((pos1 < odd_len) || (pos2 < odd_len)) {
    //     if (pos1 == odd_len) {
    //         cnt_d += (odd_len - pos2);
    //         pos2 = odd_len;
    //     }
    //     else if (pos2 == odd_len) {
    //         cnt_d += (odd_len - pos1);
    //         pos1 = odd_len;
    //     }
    //     else if (odd1[pos1] == odd2[pos2]) {
    //         pos1++; pos2++;
    //     }
    //     else if (odd1[pos1] < odd2[pos2]) {
    //         cnt_d++; pos1++;
    //     }
    //     else { // (odd1[pos1] > odd2[pos2]) 
    //         cnt_d++; pos2++;
    //     }
    // }

    // printf("%d\n%d\n", cnt / 2, cnt_d / 2);
    
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>

ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x%hell*res%hell)%hell;
    x=(x%hell*x%hell)%hell;
    y=y/2;
  }
  return res;
}

ll modinv(ll x){
  return power(x,hell-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/

void solve(){
  int test;
  //cin>>test;
  test=1;
  
  while(test--){
      ll x;
      cin>>x;
      
      ll ans=0,cnt=1;
      
      while(x>0){
          if(x==1)
          {
              ans+=cnt;
              break;
          }
          ans+=cnt;
          cnt*=2;
          x/=2;   
      }
      cout<<ans;
  }    
}    

    




///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def main():
    s = input()
    t = input()

    ans = 0
    for i_s, i_t in zip(s,t):
        if i_s != i_t:
            ans += 1

    print(ans)
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

Measured memory_bytes: 68300
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        int[] input = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int H = input[0];
        int W = input[1];

        var list = new List<Char[]>();
        list.Add(new char[W + 2]);
        for (int i = 0; i < H; i++)
        {
            list.Add((" " + ReadLine() + " ").ToCharArray());
        }
        list.Add(new char[W + 2]);

        String result = "Yes";
        for (int i = 1; i <= H; i++)
        {
            for (int j = 1; j < W; j++)
            {
                if (list[i][j] == '.')
                {
                    continue;
                }

                if (list[i - 1][j] == '.' &&
                    list[i + 1][j] == '.' &&
                    list[i][j - 1] == '.' &&
                    list[i][j + 1] == '.')
                {
                    result = "No";
                    i = H + 1;
                    break;
                }
            }
        }

        WriteLine(result);

    }
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	bool ans = true;
	int x = ceil((double) c/b );
	int y = ceil((double) a/d );
	if (x == 1 || x <= y)ans = true;
	else ans = false;
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


ll h,w,k; 
ll dp[105][10];
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN

    string s;cin>>s;
    REP(i,s.size()){
        if (s[i]=='1') cout<<'9';
        else cout<<'1';
    }
    cout<<endl;
    return 0;

}

Measured memory_bytes: 256
n = int(input())
*l, = map(int,input().split())
minus = 0
for i in range(n):
  if l[i] < 0:
    minus += 1
    l[i] *= -1
ans = sum(l)
if minus%2==1:
  ans-=(2*min(l))
print(ans)
  

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

int main() {
  	int num, step, dist;
  	scanf("%d", &num);
  	int t, x, y, pt=0, px=0, py=0;
  	for(int i = 0; i < num; i++) {
    	scanf("%d %d %d", &t, &x, &y);
      	step = t - pt;
      	dist = abs(x - px) + abs(y - py);
      	if (dist > step) {
        	cout << "No" << endl;
          	return 0;
        }
      	if (((step - dist) % 2) != 0) {
          	cout << "No" << endl;
          	return 0;
        }
      	pt = t;
      	px = x;
      	py = y;
    }
  	cout << "Yes" << endl;
	return 0;  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 1000, MAXM = 10000, MAXR = 1000, MAXQ = 50, MAXT = 1260;

int mem[MAXM + 1][MAXT + 1];

const int LOGIN = 1, LOGOUT = 0;
int main()
{
    int n, m;
    while(cin >> n >> m && n)
    {
        memset(mem, 0, sizeof(mem));
        int r; cin >> r;
        int rt, rn, rm, rs;
        REP(r)
        { 
            cin >> rt >> rn >> rm >>  rs;
            if(rs == LOGIN)
                for(int j = rt; j <= MAXT; j++) mem[rm][j] += 1;
            else
                for(int j = rt; j <= MAXT; j++) mem[rm][j] -= 1;
        }
        int q; cin >> q;
        REP(q)
        {
            int ts, te , qm;
            cin >> ts >> te >> qm;
            int ans = 0;
            
            for(int j = ts; j < te; j++)
                if(mem[qm][j] > 0) ans++;

            cout << ans << endl;
        }
                
    }
    return 0;
}

Measured memory_bytes: 50428
# AGC011 A Airport Bus
import bisect
from collections import deque

n, c, k = map(int, input().split())
t_list = [int(input()) for _ in range(n)]

t_list.sort()
t_list = deque(t_list)
ans = 0

while len(t_list) > 0:
    _tmp = t_list.popleft() + k
    _idx = bisect.bisect_right(t_list, _tmp)
    if c-1 <= _idx:
        for _ in range(c-1):
            t_list.popleft()
    else:
        for _ in range(_idx):
            t_list.popleft()
    ans += 1

print(ans)

Measured memory_bytes: 8116
#include<string>
#include <iostream>
using namespace std;
int main()
{
    string a="AC", b="WA", c="TLE", d="RE" ,s ;
    int   c0 = 0, c1 = 0, c2 = 0, c3 = 0;
   
    
    int n;
    cin >> n;
   
    
        for (int i = 0; i < n; i++)
    {
            cin >> s;
            if (s == a)
            {
                c0++;
            }
             if (s == b)
            {
                c1++;
            }
             if (s == c)
            {
                c2++;
            }
             if (s == d)
            {
                c3++;
            }
          
    }
        cout << "AC" << " x " << c0<<endl;
        cout << "WA" << " x " << c1<<endl;
        cout << "TLE" << " x " << c2<<endl;
        cout << "RE" << " x " << c3<<endl;
}


Measured memory_bytes: 3620
#include <iostream>

void solve() {
    int n;
    std::cin >> n;
    while (n--) {
        int x;
        std::cin >> x;
        if (x % 2 != 0) continue;
        if (x % 3 != 0 && x % 5 != 0) {
            std::cout << "DENIED" << std::endl;
            return;
        }
    }
    std::cout << "APPROVED" << std::endl;
}

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

    solve();

    return 0;
}


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

int stack[100];
int sz;

void push(int x) {
  if(sz == 100) return;
  stack[sz++] = x;
}

int pop() {
  return stack[--sz];
}

int main() {
  char c = '\0';
  int a, b;
  while(c != '\n') {
    a = 0;
    while(1) {
      c = getchar();
      if(!isdigit(c)) break;
      a = a*10 + c-'0';
    }
    
    if(c == ' ') {
      push(a);
    } else {
      b = pop();
      a = pop();
      if(c == '+') push(a + b);
      else if(c == '-') push(a - b);
      else if(c == '*') push(a * b);
      c = getchar();
    }
  }
  printf("%d\n", pop());
  return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
ll n,m,indeg[N],idx[N];
vector<ll> topo;
vector<ll> adj[N],rev_adj[N];
void toposort(){
    priority_queue<ll , vector<ll> , greater<ll> > pq;
    for(ll i=1;i<=n;i++)indeg[i]=rev_adj[i].size();
    for(ll i=1;i<=n;i++)if(!indeg[i])pq.push(i);
    while(!pq.empty()){
        ll node=pq.top();
        pq.pop();
        topo.push_back(node);
        for(auto &v:adj[node]){
            indeg[v]--;
            if(!indeg[v])pq.push(v);
        }
    }
    ll cur=0;
    for(auto &u:topo)idx[u]=++cur;
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    cin>>n>>m;
    for(ll i=1;i<=n-1+m;i++){
        ll u,v;cin>>u>>v;
        adj[u].push_back(v);
        rev_adj[v].push_back(u);
    }
    toposort();
    for(ll i=1;i<=n;i++){
        ll par=0,cur=0;
        for(auto &v:rev_adj[i])if(idx[v]>cur)cur=idx[v],par=v;
        cout<<par<<"\n";
    }
}

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

const double pi = 3.1415926535;
/********************************************************************/
#define M1 1000000007
#define M2 998244353
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y % x, x);
}

ll powM(ll x, ll y, ll m) {
	ll ans = 1, r = 1;
	x %= m;
	while (r > 0 && r <= y)
	{
		if (r & y)
		{
			ans *= x;
			ans %= m;
		}
		r <<= 1;
		x *= x;
		x %= m;
	}
	return ans;
}

map<long long, long long> factorize(long long n) {
	map<long long, long long> ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n > 1) {
		ans[n]++;
		n = 1;
	}
	return ans;
}
/* **********END OF TEMPLATE*********** */

int main() {
	FAST();
	ll a;
	cin >> a;
	cout << a + a*a + a*a*a;
	return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL n,m;
	cin>>n>>m;
	LL mx=0;
	FOR(i,1,100000){
		if(m%i!=0)continue;
		LL s=i,b=m/i;
		if(s*n<=m){
			mx=max(mx,s);
		}
		if(b*n<=m){
			mx=max(mx,b);
		}

	}
	cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a,b;
    cin>>a>>b;
    ll ans=0;
    if(abs(a-b)>1) ans=0;
    else{
        if(a==b)ans=2;
        else ans=1;
        rep2(i,1,a+1){
            ans*=i;
            ans%=MOD;
        }
        rep2(i,1,b+1){
            ans*=i;
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(void)
{
    for(string s; cin>>s, s != "0";){
        int sum = 0;
        for(int i=0; i<(int)s.length();i++){
            sum += s[i]-'0';
        }
        cout << sum <<endl;
    }
}


Measured memory_bytes: 3140
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------

string rotate(string s) {
  return s[s.length()-1] + s.substr(0, s.length()-1);
}

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

  bool ans = false;
  rep(i, s.length()) {
    if(s == t) ans = true;
    s = rotate(s);
  }

  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#define int long long
using namespace std;

signed main() {
	int A,B;
	cin >> A >> B;
	int answer = 0;
	for(int i = A;i <= B;i++) {
		vector<int> vec(5);
		int N = i;
		for(int j = 0;j < 5;j++) {
			vec.at(j) = N % 10;
			N = N / 10;
		}
		if(vec.at(0) == vec.at(4) && vec.at(1) == vec.at(3)) {
			answer++;
		}
	}
	cout << answer << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define MOD 1000000007

using namespace std;

int pow_mod(int a, int b, int p) {
	if (b == 0)return 1;
	else if (b % 2 == 0)return (pow_mod(a*a, b / 2, p) % p);
	else return (pow_mod(a, b - 1, p)*a%p);
}

int factorial_mod(int a, int p) {
	if (!a)return 1;
	else return a * factorial_mod(a - 1, p) % p;
}

int sum_digit(int N) {
	int ans = 0;
	for (; N != 0;) {
		ans += N % 10;
		N /= 10;
	}
	return ans;
}

string s;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    lint res = 0;

    if (k == 0) {
        cout << n * n << endl;
        exit(0);
    }

    for (int b = k+1; b <= n; b++) {
        lint t = n / b;
        res += t * (b-k);
        lint t2 = n % b;
        res += max(0LL, t2 - k + 1);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
s=list(input())
K=int(input())
substring=set()
alphabet=list('abcdefghijklmnopqrstuvwxyz')
l=0
while len(substring)<K:
    x=alphabet[l]
    l+=1
    for i in range(len(s)):
        if s[i]==x:
            string=s[i]
            substring.add(string)
            for k in range(1,5):
                try:
                    string+=s[i+k]
                    substring.add(string)
                except:
                    pass
ans=sorted(list(substring))
print(ans[K-1])

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

const int MAX = 200;

// input
int H, W;
int c[10][10];
int A[MAX][MAX];


void input() {
    cin >> H >> W;
    rep(i, 10) rep(j, 10) cin >> c[i][j];
    rep(i, H) rep(j, W) cin >> A[i][j];
}


void warshall_floyd() {
    rep(k, 10) rep(i, 10) rep(j, 10) {
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
    }
}


int main() {
    input();
    warshall_floyd();
    int ans = 0;
    rep(i, H) rep(j, W) {
        if (A[i][j] !=  -1) ans += c[A[i][j]][1];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3780
#include <iostream>

using namespace std;

int main() {
	int price;
	int t = 0;
	while ( cin >> price, price ) {
		if (t++) cout << endl;

		int c10, c50, c100, c500; cin >> c10 >> c50 >> c100 >> c500;
		int from = c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500;

		int to = from - price;
		int C500 = to / 500; to -= C500 * 500;
		int C100 = to / 100; to -= C100 * 100;
		int C50 = to / 50; to -= C50 * 50;
		int C10 = to / 10; to -= C10 * 10;

		if (C10 < c10) cout << "10 " << c10-C10 << endl;
		if (C50 < c50) cout << "50 " << c50-C50 << endl;
		if (C100 < c100) cout << "100 " << c100-C100 << endl;
		if (C500 < c500) cout << "500 " << c500-C500 << endl;
	}
}

Measured memory_bytes: 1160
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(D)]
t=[int(input())-1 for i in range(D)]
last=[[0 for j in range(26)] for i in range(D)]
manzokudo=0
for d in range(D):
    for i in range(26):
        if d!=0:
            last[d][i]=last[d-1][i]
    last[d][t[d]]=d+1
    manzokudo+=s[d][t[d]]
    for i in range(26):
        manzokudo-=c[i]*(d+1-last[d][i])
    print(manzokudo)


Measured memory_bytes: 9512
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define PI          3.14159265358979323846
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ld          long double
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

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

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

const int N = 2e5 + 5;
ll n;
map<ll, ll> mp;
ll po(ll a, ll b){
    ll res = 1;
    while(b){
        if(b & 1) res = res * a;
        a = a * a;
        b >>= 1LL;
    }
    return res;
}
void pre(ll n){
    for(ll i = 2; i * i <= n; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n > 1){
        mp[n]++;
    }
}
vector<ll> help(){
    vector<ll> res;
    for(auto x : mp){
        int yo = 0;
        for(int i = 1; ; i++){
            if(x.S >= i){
                res.PB(po(x.F, i));
                x.S -= i;
            }else break;
        }
    }
    sort(ALL(res));
    return res;
}
void tc(){
    cin >> n;
    pre(n);
    vector<ll> get_fc = help();
    int ans = 0;
    for(int i = 0; i < SZ(get_fc); i++){
        if(n % get_fc[i] == 0){
            n /= get_fc[i];
            ans++;
        }
    }
    cout << ans;
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) tc();
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 3672
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

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

    vector<pair<int,int>> BA;

    for(int i = 0;i < N;i++) {
        int a,b;
        cin>>a>>b;
        BA.push_back({b,a});
    }

    sort(BA.begin(),BA.end());
    int cur = 0;
    for(int i = 0;i < N;i++) {
        if(cur+BA[i].second <= BA[i].first) {
            cur += BA[i].second;
        } else {
            cout<<"No"<<endl;

            return 0;
        }
    }

    cout<<"Yes"<<endl;

    return 0;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

LL GCD(LL a,LL b){
    LL t; LL r;
    if(a<b){t=a;a=b;b=t;}
    if(b==0){return a;}
    while(a%b!=0){r=a%b;a=b;b=r;}
    return b;
}

int main(){
    int n;
    cin>>n;
    Vll a(n);
    REP(i,n){
        cin>>a[i];
    }

    LL gcd = a[0];
    REP(i,n){
        gcd = GCD(gcd,a[i]);
    }

    cout<<gcd<<endl;
    return 0;
}

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

const int N=505;
ll a[N][N],b[N][N],c[N][N],f[N][N],bas,mx=-1e18,sum;
int n;

void cmax(ll &x,ll y){
	if(y>x)x=y;
}

int main(){
	scanf("%d",&n);
	rep(i,1,n)rep(j,1,n)	
		if(i!=j){
			scanf("%lld",&a[i][j]);
			if(i<j)b[i][j]=a[i][j],bas+=a[i][j];
			else c[j][i]=a[i][j];
			sum+=a[i][j];
		}
	per(i,n,1)rep(j,i+2,n){
		b[i][j]+=b[i][j-1]+b[i+1][j]-b[i+1][j-1];
		c[i][j]+=c[i][j-1]+c[i+1][j]-c[i+1][j-1];
	}
	memset(f,0xc0,sizeof f);
	rep(i,1,n)f[1][i]=c[1][i]-b[1][i];
	rep(i,1,n)rep(j,i,n)rep(k,j+1,n)
		cmax(f[j+1][k],f[i][j]+c[i][k]-c[i][j]-b[j+1][k]);
	rep(i,1,n)cmax(mx,f[i][n]);
	cout<<sum-(mx+bas)<<endl;
	return 0;
}

Measured memory_bytes: 8192
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s; i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n, k, ans = 1000000000; cin >> n >> k;
    vector<int> x(n);
    REP(i, n) cin >> x[i];
    for(int l = 0, r = k-1; r < n; ++l, ++r){
        ans = min(ans, min(abs(x[l]), abs(x[r])) + abs(x[r]-x[l]));
    }
    cout << ans << "\n";
    return 0;
}


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

typedef unsigned long long ll;

ll md = 1000000007;

int main(int, char**)
{
	string s; 
	cin >> s;

	cin >> s;
	bool isOK =(s[0]==s[1]&&s[2]==s[3])|| 
		(s[0]==s[2]&&s[1]==s[3])||
		(s[0]==s[3]&&s[1]==s[2])||
		(s[1]==s[2]&&s[0]==s[3])||
		(s[1]==s[3]&&s[0]==s[2])||
		(s[2]==s[3]&&s[0]==s[1]);

	if (s[0] == s[1]&&s[0]==s[2]&&s[0]==s[3])
			isOK = false;

	if (isOK)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int A, B, X;
    string result = "NO";
    cin >> A >> B >> X;
    if (A <= X && X - A <= B) result = "YES";
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
N,W = map(int,input().split(" "))
w = [0]*N
v = [0]*N
for i in range(N):
    w[i],v[i] = map(int,input().split(" "))

dp = [[0]*(W+1) for i in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j - w[i] >= 0:
            dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]]+v[i])
        dp[i+1][j] = max(dp[i+1][j],dp[i][j])
print(dp[-1][-1])

Measured memory_bytes: 120684
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>


const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

void solve() {
    ld d, t, s;
    cin >> d >> t >> s;
    if(d / s > t) cout << "No";
    else cout << "Yes";
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	char bord[60][60];

    int H,W;
    int dx[4]={1,-1,0,0};
    int dy[4]={0,0,-1,1};
    cin >> H >> W;
    for(int i=0;i<H;i++){
        cin >> bord[i];
    }
    bool ans = true;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            bool found = false;
            if(bord[i][j]=='#'){
                for(int k=0;k<4;k++){
                    int i2 = i + dx[k];
                    int j2 = j + dy[k];
                    if(i2>=0&&j2>=0&&i2<H&&j2<W&&bord[i2][j2]=='#'){
                        found = true;
                    }
                }
                if(!found){
                    ans = false;
                }
            }
        }
    }
    if(ans)cout << "Yes"<<endl;
    else cout << "No"<<endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
for i in range(n):
  if a[i]<b[i]:c+=((b[i]-a[i]+1)//2)
if c>sum(b)-sum(a):print('No')
else:print('Yes')

Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N,M,s=0;
  cin>>N;
  M=N;
  while(N) {
    s += N % 10;
    N /= 10;
  }
  if (M%s) cout << "No" << endl;
  else cout << "Yes" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int []k = new int [m];

		for(int i=0;i<n;i++) {
			int kn = Integer.parseInt(sc.next());
			for(int j=0;j<kn;j++) {
				int ryouri = Integer.parseInt(sc.next());
				k[ryouri-1]++;
			}
		}
		sc.close();
		int cnt = 0;
		for(int i=0;i<m;i++) {
			if(k[i]==n) {
				cnt++;
			}
		}

		System.out.println(cnt);
	}

}


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

int main() {
  int X, Y;
  cin >> X >> Y;
  if (Y % 2 == 1) {
    cout << "No" << endl;
  } else {
    if (Y % 4 == 0) {
      if (Y/4 <= X && X <= Y/2) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    } else {
      if ((Y-2)/4 + 1 <= X && X <= Y/2) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}

Measured memory_bytes: 3640
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;

int fa[MAXN];
inline void init(int n){ for(int i=1; i<=n; ++i) fa[i] = i;}
int find(int u){ return fa[u]==u? u: fa[u] = find(fa[u]);}
inline void connect(int u,int v){ fa[find(u)] = find(v);}

int main(void)
{
	int n,m;
	scanf("%d%d",&n,&m);
	
	init(n);
	for(int i=1; i<=m; ++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		connect(u,v);
	}
	
	static int size[MAXN];
	for(int i=1; i<=n; ++i)
		++size[find(i)];
	
	int ans = 0;
	for(int i=1; i<=n; ++i)
		ans = max(ans, size[i]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 10748
n = int(input())
l = [_ for _ in range(1,10)]

for i in range(10**5):
    if str(l[i])[-1] == '0':
        l.append(l[i]*10 + int(str(l[i])[-1]))
        l.append(l[i]*10 + int(str(l[i])[-1]) + 1)

    elif str(l[i])[-1] == '9':
        l.append(l[i]*10 + int(str(l[i])[-1]) - 1)
        l.append(l[i]*10 + int(str(l[i])[-1]))

    else:
        l.append(l[i]*10 + int(str(l[i])[-1]) - 1)
        l.append(l[i]*10 + int(str(l[i])[-1]))
        l.append(l[i]*10 + int(str(l[i])[-1]) + 1)

print(l[n-1])

Measured memory_bytes: 15824