akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>
#include<cmath>
#include<utility>
#include<cstdlib>
#include<bitset>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;                       

#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define sc second


#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const ll M = 1e9 + 7;

ll add(ll a, ll b){
    (a += b)%=M;
    (a += M)%=M;
    return a;
}

ll mul(ll a, ll b){
    (a *= b)%=M;
    (a += M)%=M;
    return a;
}

ll fastpo(ll a, ll x){
    if(x == 0) return 1ll;
    if(x == 1) return a;
    ll y = fastpo(a, x/2);
    if(x%2 == 0){
        return y*y;
    }
    return y*y*a;
}

ll inv(ll a, ll M){
    return fastpo(a, M-2);
}

ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}

ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1) 
        return -1; 
    else
    { 
        ll res = (x%m + m) % m; 
        return res;
    } 
}


ll gcd(ll a, ll b){
    if(a == 0){
        return b;
    }
    return gcd(b%a, a);
}

ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}

void print(vector<int> &a){
    int n = a.size();
    for(int i=0; i<n; i++){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}


int main(){
//    clock_t time_req;
//     time_req = clock();
    fastio;
    string s;
    cin>>s;
    int r = 0;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R'){
        cout<<3<<endl;
        return 0;
    }
    if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')){
        cout<<2<<endl;
        return 0;
    }
    if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R'){
        cout<<1<<endl;
        return 0;
    }
    cout<<0<<endl;
    // time_req = clock()-time_req;
    // cout<<"Time taken: "<<(float)time_req/CLOCKS_PER_SEC<<"s"<<endl;
    return 0;
}

Measured memory_bytes: 3640
import collections
from math import *
s=input()
a=collections.Counter(s)
o=0
for x in a:
    if a[x]&1:
        o+=1
        if o>1:print(0);break
        a[x]-=1
else:
    b=factorial(len(s)//2)
    for x in a.values():
        b//=factorial(x//2)
    print(b)

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


int main() {
    int H,N,sum=0;
    
    cin >> H >> N;
    
    vector<int> A(N);
    
    for(int i=0;i < N;i++){
        cin >> A[i];
        sum += A[i];
    }
    
    if(H - sum <= 0)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}





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

int main(void) {
    vector<int> hill(10, 0);
    for (int i = 0; i < 10; i++) {
        cin >> hill[i];
    }
    sort(hill.begin(), hill.end(),greater<int>());
    for (int i = 0; i < 3; i++) 
        cout << hill[i] << endl;
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];
  sort(as.begin(),as.end());

  if(as[0]>0){
    Int sum=-as[0];
    for(Int i=1;i<n;i++) sum+=as[i];
    cout<<sum<<endl;
    Int t=as[0];
    for(Int i=1;i+1<n;i++){
      cout<<t<<" "<<as[i]<<endl;
      t-=as[i];
    }
    cout<<as[n-1]<<" "<<t<<endl;
    return 0;
  }

  if(as[n-1]<0){
    Int sum=as[n-1];
    for(Int i=0;i+1<n;i++) sum-=as[i];
    cout<<sum<<endl;
    Int t=as[n-1];
    for(Int i=0;i+1<n;i++){
      cout<<t<<" "<<as[i]<<endl;
      t-=as[i];
    }
    return 0;
  }

  Int sum=0;
  for(Int i=0;i<n;i++) sum+=abs(as[i]);
  cout<<sum<<endl;

  Int p=as[n-1],q=as[0];
  for(Int i=1;i+1<n;i++){
    if(as[i]<=0){
      cout<<p<<" "<<as[i]<<endl;
      p-=as[i];
    }else{
      cout<<q<<" "<<as[i]<<endl;
      q-=as[i];
    }
  }
  cout<<p<<" "<<q<<endl;
  return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//
//using namespace __gnu_pbds;
using namespace std;

#define pb                     push_back
#define ll                     long long
#define forn(i,n)              for(int i=0; i<(int)n; i++)
#define forn1(i,n)              for(int i=1; i<=(int)n; i++)

#define sfd(a)                 scanf("%d", &a)
#define sffd(a,b)              scanf("%d%d", &a, &b)
#define sffl(a,b)              scanf("%lld%lld", &a,&b)
#define sfl(a)                 scanf("%lld", &a)

#define pii                    pair<int , int>
#define pll                    pair<ll , ll>
#define ff                     first
#define ss                     second
#define mem(a, val)            memset(a, val, sizeof(a))
#define all(x)                 (x).begin(), (x).end()

//#define mx                     200005
#define INF_mx                 1e18
#define gcd(a,b)               __gcd(a, b)
#define lcm(a,b)               (a*b)/__gcd(a,b)
#define PRINT                  cout<<"hi"<<endl
#define PI acos(-1)
#define fast_in_out          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Q    int q; cin>>q; while(q--)
/*
tree<
       int,
     null_type,
     less<int>,
     rb_tree_tag,
     tree_order_statistics_node_update>t;
*/

int main()
{
    fast_in_out;

     int n,m;
     cin>>n>>m;
     ll x, sum=0;
     for(int i=0; i<m; i++){
        cin>>x;
        sum+=x;
     }

   if(sum>n) cout<<-1<<endl;
   else cout<<n-sum<<endl;
    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
#include<stdlib.h>
#define MAX 100005

typedef struct {
  char name[100];
  int time;
}P;

P Q[MAX];
int head=0, tail=0, n;

void enqueue(P x){

  if(head == (tail + 1) % MAX){
    printf("over flow\n");
    exit(1);
  }

  Q[tail] = x;
  if(tail + 1 == MAX) tail = 0;
  else tail++;
  
}

P dequeue(){

  P x;

  if(head == tail){
    printf("over flow\n");
    exit(1);
  }

  x = Q[head];
  if(head + 1 == MAX) head = 0;
  else head++;

  return x;
  
}

int main(){
  
  int i,q,data;
  int alltime=0;
  P u;
 

  scanf("%d %d", &n, &q);

  for(i = 1; i <= n; i++){
    scanf("%s", u.name);
    scanf("%d", &u.time);
    enqueue(u);
  }
  
  data=n;
  
  while(data>0){

    u=dequeue();

    if(u.time<=q){
      alltime+=u.time;
      printf("%s %d\n",u.name,alltime);
      data--;
    }else{
      u.time=u.time-q;
      alltime+=q;
      enqueue(u);
    }
    
  }

  return 0;
  
}




Measured memory_bytes: 11852
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <math.h>
#include <stdbool.h>


//using ll = long long;
int ASC( void *a,  void *b) {
	return strcmp(*(const char **)a, *(const char **)b);//降順
}
int GCD(int a, int b) {	//最大公約数
	if (b == 0) return a;
	else return GCD(b, a % b);
}
int min(int a, int b ) {
	if (a < b) {
		return a;
	}
	else
		return b;
}
int max(int a, int b) {
	if (a < b)
		return b;
	else
		return a;
}
int main(void)
{
	int a;
	scanf("%d",&a);
	while (a >= 10 ) {
		a = a % 10;
		//printf("%d", a);
	}
	int ans = a;
	if (ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9)
		printf("hon");
	else if (ans == 0 || ans == 1 || ans == 6 || ans == 8)
		printf("pon");
	else
		printf("bon");
	return 0;
}

Measured memory_bytes: 1728
use proconio::input;
fn main() {
    input!(n: usize);
    let mut n = n;
    let a = 'a' as u8;
    let mut ans = Vec::new();
    while n > 0 {
      	n -= 1;
        let now = (n % 26) as u8;
        ans.push((now + a) as char);
        n /= 26;
    }
    ans.reverse();
    let ans: String = ans.iter().collect();
    println!("{}", ans);
}

Measured memory_bytes: 2156
import java.util.*;

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

        String T = sc.next();
        char[] charArray = T.toCharArray();

        for(int i=0; i<charArray.length; i++) {
            if(charArray[i] == '?') {
                charArray[i] = 'D';
            }
        }


        for(char output: charArray) {
            System.out.print(output);
        }
        System.out.println();
    }
}

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

int a,b,x;

int mySet(int d){
  for(int i=0;i<10;i++){
    if(d<3){
      mySet(d+1);
    }else if(d==3){
      if(a==x){
      b++;
      }
    }
    a++;
  }
  return a=a-10;
}

int main(void){
  while(scanf("%d",&x)!=EOF){
  mySet(0);
  cout<<b<<endl;
  b=0;
  }
  return 0;
}

Measured memory_bytes: 3136
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frn(i,a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define test int t;cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define pu push
#define fi first
#define se second
#define mod 1000000007
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> seti;
void fast() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
vi p;
int prims[1005];
void sieve() {
    fr(i, 0, 1001) prims[i] = 1;
    prims[0] = prims[1] = 0;
    fr(i, 2, 1001) {
        if (prims[i]) {
            for (int j = i * i; j < 1001; j = j + i) {
                prims[j] = 0;
            }
        }
    }
    fr(i, 2, 1001) if (prims[i]) p.pb(i);
}

int n;
int a[1000005];
int dp[1000005];



int32_t main() {
    //fast();
    cin >> n;
    sieve();
    fr(i, 0, n) cin >> a[i];
    int gc = __gcd(a[0], a[1]);
    fr(i, 2, n) gc = __gcd(gc, a[i]);
    if (gc == 1) {
        memset(dp, 0, sizeof dp);
        fr(i, 0, n) {
            for (auto x : p) {
                if (x * x > a[i]) break;
                if (a[i] % x == 0) {
                    if (dp[x] == 1) {
                        cout << "setwise coprime";
                        return 0;
                    }
                    dp[x] = 1;
                    while (a[i] % x == 0) {
                        a[i] = a[i] / x;
                    }
                }
            }
            if (a[i] > 1) {
                if (dp[a[i]] == 1) {
                    cout << "setwise coprime";
                    return 0;
                }
                dp[a[i]] = 1;
            }
        }
        cout<<"pairwise coprime";
    }
    else cout << "not coprime";

    return 0;
}

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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int x, y, z;
  x = a + b;
  y = a * 2 - 1;
  z = b * 2 - 1;
  cout << max({x, y, z}) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int n;
    cin >> n;
    int d = n/100;
    for (int i = 111; i <= 999; i+=111){
        if (n <= i && d == i/100){
            cout << i << '\n';
            return;
        }
    }
    cout << (d+1)*100 + (d+1)*10 + d+1 << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3620
//
// Created on 2020/04/17.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    ll ans = 0;
    ll n;
    cin>>n;
    vector<int>a(n+1);
    for (ll i = 0; i < n+1; ++i) {
        cin>>a[i];
    }

    for (ll j = 0; j < n; ++j) {
        int b;
        cin>>b;

        ans += min(b,a[j]+a[j+1]);
        a[j+1] -= (max(min(b-a[j],a[j+1]),0));
        a[j] = max(a[j] - b,0);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a = max(a, c);
    b = min(b, d);
    cout << max(0, b-a) << endl;
}


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

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

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

#define ff first
#define endl "\n"
#define ss second
#define maxn 2000006
#define pb push_back
#define ll long long
#define lll __int128
#define vll vector<ll>
#define mll map<ll,ll>
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fr(i,x,n) for(ll i=x;i>=n;i--)
inline ll min(ll a, ll b, ll c) { return min(min(a, b), c);}
inline ll max(ll a, ll b, ll c) { return max(max(a, b), c);}
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

int dx[] = { -1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};



int main() {
	fastio();

	ll n; cin >> n;
	vector<ll> a(n + 1, 0); f(i, 1, n) cin >> a[i];
	vector<ll> pref(n + 1, 0); f(i, 1, n) pref[i] = (a[i] + pref[i - 1]);
	vector<vector<ll> > dp(n + 1, vector<ll>(n + 1, 0));
	f(dist, 0, n - 1) {
		f(l, 1, n - dist) {
			ll r = l + dist;

			if (l != r) {
				dp[l][r] = LLONG_MAX;
				f(k, l, r - 1) {
					dp[l][r] = min(dp[l][r], dp[l][k] + dp[k + 1][r] + ((pref[k] - pref[l - 1]) + (pref[r] - pref[k])));
				}
			}
		}
	}

	cout << dp[1][n];
	return 0;
}

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

using namespace std;
using ll = long long int;

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n, a, b;
    cin >> n >> a >> b;
    ll mi = a*(n-1) + b;
    ll ma = b*(n-1) + a;
    cout << max(0ll,ma-mi+1) << endl;
}


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

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

n = I()
d = defaultdict(lambda : False)
flag = True
for i in range(n):
    w = input()
    if i == 0:
        tmp = w
        d[w] = True
        continue
    if tmp[-1] != w[0]:
        flag = False
    if d[w]:
        flag = False
    d[w] = True
    tmp = w
if flag:
    print('Yes')
else:
    print('No')


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

int main(){
	int n,h,w,ans=0;
	cin >> n >> h >> w;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++){
		cin >> a.at(i) >> b.at(i);
		if(a.at(i)>=h && b.at(i)>=w){
			ans++;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#define int long long

int O357[4] = {0, 3, 5, 7};

int convert(int n){
	int ans, i;
	for(ans = 0, i = 1; n > 0; n /= 4, i *= 10){
		ans += i * O357[n % 4];
	}
	return ans;
}

int is_753(int n){
	int f3, f5, f7;
	for(f3 = 0, f5 = 0, f7 = 0; n > 0; n /= 10){
		if(n % 10 == 3){
			f3 = 1;
		}
		else if(n % 10 == 5){
			f5 = 1;
		}
		else if(n % 10 == 7){
			f7 = 1;
		}
		else{
			return 0;
		}
	}
	if(f3 == 1 && f5 == 1 && f7 == 1){
		return 1;
	}
	else{
		return 0;
	}
}

signed main(){
	int N, i, ans = 0;
	scanf("%lld", &N);
	for(i = 1; convert(i) <= N; i++){
		if(is_753(convert(i)) == 1){
//			printf("convert(%d) = %d\n", i, convert(i));
			ans++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int INF=1001001001001001001ll;

int N,M;
vpint G[15];

int sum[1<<15];

int dp[1<<15][15];

signed main(){

    cin>>N>>M;

    int allcost=0;
    rep(i,M){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        G[a].pb({b,c});
        G[b].pb({a,c});
        allcost+=c;
    }

    rep(i,1<<N){
        rep(j,N){
            if(!(i>>j&1))continue;
            for(auto &e:G[j]){
                if(i>>e.fi&1)sum[i]+=e.se;
            }
        }
        sum[i]/=2;
    }

    fill_n(*dp,(1<<15)*15,-INF);
    dp[1][0]=0;

    rep(i,1<<N){
        rep(j,N){
            if(!(i>>j&1))continue;

            int sup=((1<<N)-1)^i;
            int sub=sup;
            do{
                chmax(dp[i|sub][j],dp[i][j]+sum[sub|(1<<j)]);
                sub=(sub-1)&sup;
            }while(sub!=sup);

            for(auto &e:G[j]){
                if(i>>e.fi&1)continue;
                chmax(dp[i|(1<<e.fi)][e.fi],dp[i][j]+e.se);
            }
        }
    }

    cout<<allcost-dp[(1<<N)-1][N-1]<<endl;
    return 0;
}


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

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
/*Learning is endless*/
#include <bits/stdc++.h>
#define endl "\n";
#define pii pair<int,int>;
using namespace std;
typedef long long ll;
const ll BIG=1000000007;
const double PI=3.141592653589793238;
template <typename T,typename Q>
T max(T a,Q b)
{
    if(a<b)
        return b;
    return a;
}
template <typename T,typename Q>
T min(T a,Q b)
{
    if(a>b)
        return b;
    return a;
}
long gcd(long a,long b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b,a%b);
}
void solve()
{
    int x;cin>>x;
    if(x)
    {
        cout<<"0";
    }
    else
    {
        cout<<"1";
    }
}
int main() {
    int t;
    t=1;
    while(t--)
        solve();
	return 0;
}


Measured memory_bytes: 3580
N = int(input())
C = [0] * N
S = [0] * N
F = [0] * N

for i in range(N-1):
	C[i], S[i], F[i] = map(int, input().split())

def Time_spent(i,t):
	global C,S,F

	res = C[i]
	if t < S[i]:
		res += S[i]
	else: # if t >= S[i]
		for tt in range(t,t + F[i] + 1):
			if tt % F[i] == 0:
				res += tt
				break
	return res

ans = [[0 for i in range(N)] for _ in range(N)]
time = 0
for i in range(N-1):
	for j in range(i,N-1):
		if j == 0:
			ans[i][j] = Time_spent(j, 0)
		else:
			ans[i][j] = Time_spent(j, ans[i][j-1])

for i in range(N):
	print(ans[i][N-2])

Measured memory_bytes: 9256
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) (i64)(a / (f64)__gcd(a, b) * b) /* 最小公倍数 */

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

void Main() {
    i32 N;
    cin >> N;
    Vec<i64> X(N);
    for (i32 i = 0; i < N; i++) cin >> X[i];
    Vec<i64> S(X);
    sort(ALL(S));
    i64 left, right;
    left = S[S.size() / 2 - 1];
    right = S[S.size() / 2];
    for (i32 i = 0; i < N; i++) {
        i32 index = distance(S.begin(), lower_bound(ALL(S), X[i]));
        cout << YN(left, right, index >= S.size() / 2) << endl;
    }

}


Measured memory_bytes: 6356
#include<stdio.h>
int main()
{
	int A, B, C, D;
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	scanf("%d", &D);
	if (B < C || D < A)
		printf("%d",0);
	else
	{
		if (A < C)
		{
			if (B < D)
			{
				printf("%d", B - C);
			}
			else
			{
				printf("%d", D - C);
			}
		}
		else 
		{
			if (B < D)
			{
				printf("%d", B - A);
			}
			else
			{
				printf("%d", D - A);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 128
def findProductSum(A, n):
    tmp = (10**9)+7

    array_sum = 0
    for i in range(0, n, 1):
        array_sum = array_sum + A[i]

    array_sum_square = array_sum * array_sum

    individual_square_sum = 0
    for i in range(0, n, 1):
        individual_square_sum += A[i] * A[i]
        individual_square_sum = individual_square_sum

    return ((array_sum_square - individual_square_sum) // 2) % tmp

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

print(findProductSum(a,n))


Measured memory_bytes: 31584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define numrep(i,n) for(int i=1;i<=n;i++)
#define bitrep(n) for(int bit=0;bit<(1<<n);bit++)
#define ll int64_t
#define all(v) v.begin(), v.end()
 
const int MOD = 1000000007;
 
int main() {
 
int N; cin >> N ;
 
vector<int> A(N);
 
rep(i,N) cin>>A[i];
 
map<ll,int> L,R;
 
rep(i,N){
  int x=i+A[i]+1,y=i-A[i]+1;//i+A(i),j-A(j)
  if(L[x]==0) L[x]=1;
  else L[x]++;
 
  if(R[y]==0) R[y]=1;
  else R[y]++;
}
 
ll ans=0;
 
for(auto p : R){
  ll key=p.first; int value=p.second;
 
  ans+=(ll)value*L[key];
 
}
 
cout << ans << endl;
 
return 0;
}

Measured memory_bytes: 38292
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int a,sum = 0;
  for(int i = 0; i < 3; i++){
	cin >> a;
    sum += a;
  }
  if(sum > 21) cout << "bust" << endl;
  else cout << "win" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    int a,b;
    cin>>s>>t;
    cin>>a>>b;
    string u;
    cin>>u;
    if(s==u){
        cout<<a-1<<' '<<b<<'\n';
    }
    else{
        cout<<a<<' '<<b-1<<'\n';
    }
    return(0);
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

    int N; cin >> N;
    ll A[N], B[N+1];
    F0R(i, N+1) cin >> B[i];
    F0R(i, N) cin >> A[i];

    ll ans = 0;
    F0R(i, N) {
        ll V = min(A[i], B[i]); A[i] -= V; B[i] -= V; ans += V;

        V = min(A[i], B[i+1]); A[i] -= V; B[i+1] -= V; ans += V;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.io.*;

public class Main {
    public static String rotate(String s, int r){
        return (s.substring(r,s.length()) + s.substring(0,r));
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        boolean ans = false;
        
        for(int i=0;i<s.length();i++){
        	if(rotate(s,i).equals(t)) ans=true;
        }
        System.out.println(ans ? "Yes" : "No");
    }
}

Measured memory_bytes: 22996
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;


int main(){

	int N;

	cin >> N;

	int A[N+1];

	map<long long, vector<tuple<long long, long long>>> m;

	for(int i=0; i<N-1; i++){
		long long u, v, w;
		cin >> u >> v >> w;
		m[min(u,v)].push_back(make_tuple(max(u, v), w));
		m[max(u,v)].push_back(make_tuple(min(u, v), w));
	}

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

	A[1] = 1;

	queue<int> n;
	n.push(1);
	while(n.size()>0){
		int x = n.front();
		n.pop();
		for(int j=0; j<m[x].size(); j++){
			if(A[get<0>(m[x][j])] != 0) continue;
			if(get<1>(m[x][j]) % 2 == 0){
				A[get<0>(m[x][j])] = A[x];
			} else {
				A[get<0>(m[x][j])] = -A[x];
			}
			n.push(get<0>(m[x][j]));
		}
	}

	for(int i =1; i<=N; i++){
		if(A[i] ==  -1) A[i] = 0;
		cout << A[i] << endl;
	}

	return 0;
}


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

# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"

using namespace std;

# 1 "../Algo/NumberTheory/modulo.h" 1
class ModuloOps {
public:
    ModuloOps(long long mod): MOD(mod) {
    }

    long long binPow(long long a, long long b) {
        if (b == 0) {
            return 1;
        }
        auto prev = binPow(a, b/2);
        return mul(mul(prev, prev), b % 2 == 1 ? a : 1);
    }

    long long inv(long long a) {
        return binPow(a, MOD - 2);
    }

    inline long long add(long long a, long long b) {
        return (a + b) % MOD;
    }

    inline long long sub(long long a, long long b) {
        return (a - b + MOD) % MOD;
    }

    inline void inc(long long &a, long long b) {
        a = add(a, b);
    }

    inline long long mul(long long a, long long b) {
        return (a * b) % MOD;
    }

    inline long long div(long long a, long long b) {
        return mul(a, inv(b));
    }

private:
    long long MOD;
};
# 5 "<stdin>" 2


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, p;
    cin >> n >> p;
    ModuloOps mod(p);
    string s;
    cin >> s;
    long long ans = 0;
    if (p == 2 || p == 5) {
        for (int i = 0; i < n; i++) {
            if ((s[i] - '0') % p == 0) {
                ans += i+1;
            }
        }
    } else {
        vector<int> cnt(p);
        cnt[0] = 1;
        auto inv10 = mod.inv(10);
        long long mul = 1;
        long long cur = 0;
        for (int i = 0; i < n; i++) {
            cur = mod.add(10*cur, s[i] - '0');
            auto need = mod.mul(mul, cur);
            ans += cnt[need];
            cnt[need]++;
            mul = mod.mul(mul, inv10);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

int main(){
    int q;
    scanf("%d", &q);
    priority_queue<lint> que1;
    priority_queue<lint, vector<lint>, greater<lint>> que2;
    lint bsum = 0;
    lint sum1 = 0;
    lint sum2 = 0;
    rep(i, q){
        int c;
        scanf("%d", &c);
        if(c == 1){
            lint a, b;
            scanf("%lld%lld", &a, &b);
            bsum += b;
            if(que1.empty()) que1.push(a), sum1 += a;
            else{
                lint q1 = que1.top();
                if(que1.size() == que2.size()){
                    lint q2 = que2.top();
                    if(a <= q2) que1.push(a), sum1 += a;
                    else{
                        que2.pop(); sum2 -= q2;
                        que1.push(q2); sum1 += q2;
                        que2.push(a); sum2 += a;
                    }
                }
                else{
                    if(q1 <= a) que2.push(a), sum2 += a;
                    else{
                        que1.pop(); sum1 -= q1;
                        que2.push(q1); sum2 += q1;
                        que1.push(a); sum1 += a;
                    }
                }
            }
        }
        else{
            lint m = que1.top();
            printf("%lld %lld\n", m, m*(que1.size() - que2.size()) - sum1 + sum2 + bsum);
        }
    }
}

Measured memory_bytes: 3952
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#include <stack>
#include <climits>
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;

int main(){
  ll x;
  cin >> x;
  ll ans = (x/11)*2;
  if(x % 11 > 0 && x % 11 < 7){
    ans++;
  }
  else if(x % 11 >= 7){
    ans += 2;
  }
  cout << ans << endl;
}

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

using namespace std;

#define MODULO 1000000007

int main()
{
	string s;
	cin >> s;
	int b = 0;
	int e = s.size() - 1;
	while (b < s.size() && s[b] != 'A') b++;
	while (e >= 0 && s[e] != 'Z') e--;
	cout << e-b+1 << endl;
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    for(int i=0;i<a;i++){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    for(int i=0;i<a;i++){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

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

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	    for(int i=0;i<t;i++){ fact[i+1]=fact[i]*(i+1)%MOD;}
	fact_inv[t]=power(fact[t], MOD-2);
	for(int i=0;i<t;i++){ fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;}
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
  
int main()
{
	cin.tie(0);	ios::sync_with_stdio(false);

  int i,j;
  int D; cin >> D;
  int C[26]; rep(i,26){cin >> C[i];}
  int S[D][26]; 
  rep(i,D){rep(j,26){cin >> S[i][j];}}
  int T[D]; rep(i,D){cin >> T[i];T[i]--;}
  int last[26]; rep(i,26){last[i]=0;}
  ll ans = 0;
  for(i=0;i<D;i++){
      ans += S[i][T[i]]; last[T[i]]=i+1;
      rep(j,26){
          ans -= C[j] * (i+1 - last[j]);
      }
      cout << ans << endl;
  }

  return 0;

}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
     
    using namespace std;
     
    int main(){
    	int n , k;
      	cin >> n >> k;
      	vector<long> v(n);
      	for(int i =0; i < n; i++) cin >> v[i];
      	
      	sort(v.rbegin(), v.rend());
      	
      	long long moves = 0;
      	
        for(int i = k; i < n; i++) moves +=v[i]; 
      	cout <<moves << endl;
    	
      return 0;
    }

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-


if __name__ == '__main__':

    n, m = [int(s) for s in input().split()]
    A = [[float("inf") for j in range(n)] for i in range(n)]

    for i in range(n):
        A[i][i] = 0

    for _ in range(m):
        s, t, d = map(int, input().split())
        A[s][t] = d

    for k in range(n):
        for i in range(n):
            for j in range(n):
                A[i][j] = min(A[i][j], A[i][k] + A[k][j])

    negative = False
    for i in range(n):
        if A[i][i] < 0:
            negative = True

    if negative:
        print("NEGATIVE CYCLE")
    else:
        for i in range(n):
            print(" ".join(map(lambda x: str(x).upper(), A[i])))



Measured memory_bytes: 6264
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
template<class T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}

#define MOD 1000000007
typedef long long ll;

int main(){
  ll h,w;
  cin >> h >> w;
  ll ans;
  if(h%3==0 || w%3==0){
    ans=0;
  }else{
    ans=min(h,w);
  }
  ll a,b,c;
  FOR(i,h-1){
    a=(i+1)*w;
    if(w%2==0){
      b=(h-i-1)*(w/2);
      c=b;
    }else{
      b=(h-i-1)*(w/2);
      c=b+(h-i-1);
    }
    chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
  }
  FOR(i,w-1){
    a=(i+1)*h;
    if(h%2==0){
      b=(w-i-1)*(h/2);
      c=b;
    }else{
      b=(w-i-1)*(h/2);
      c=b+(w-i-1);
    }
    chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
  }

  cout << ans << endl;
  

  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int k,x;
  cin>>k>>x;
  int end=x+k-1,start=x-k+1;
  if(end>1000000)
    end=1000000;
  if(start<-1000000)
    start=-1000000;
  for(;start<=end;start++){
    cout<<start<<" ";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define MAX 1000003
#define pii pair<ll,ll>
#define VP vector< pii >
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define all(v) (v).begin(),(v).end()
#define S(x) scanf("%d",&(x))
#define S2(x,y) scanf("%d%d",&(x),&(y))
#define SL(x) scanf("%lld",&(x))
#define SL2(x) scanf("%lld%lld",&(x),&(y))
#define P(x) printf("%d\n",(x))
#define FF first
#define SS second
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,k;
cin>>n>>k;
ll ans=n;
n=n%k;
map<ll,ll>m;
while(m[n]==0)
{
	ll prev=n;
	n=abs(n-k);
	m[prev]++;
	ans=min(ans,n);
}
cout<<ans;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define int               long long
#define M                 1000000007
#define MM                998244353
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount

template<typename T1,typename T2>
std::istream& operator>>(std::istream& in,pair<T1,T2> &a)
{
	in>>a.fr>>a.sc;
	return in;
}
template<typename T1,typename T2>
std::ostream& operator<<(std::ostream& out,pair<T1,T2> &a)
{
	out<<a.fr<<" "<<a.sc;
	return out;
}

int n;
int a[10005];
int d;
int dp[10005][105][2];

int calc(int p,int s,int f){
	if(p==n)return s==0;
	int &ans=dp[p][s][f];
	if(ans!=-1)return ans;
	ans=0;
	if(!f){
		rep(i,0,a[p]){
			ans+=calc(p+1,(s+i)%d,1);
			ans%=M;
		}
		ans+=calc(p+1,(s+a[p])%d,0);
		ans%=M;
	}
	else{
		rep(i,0,10){
			ans+=calc(p+1,(s+i)%d,1);
			ans%=M;
		}
	}
	// cout<<p<<" "<<s<<" "<<f<<" "<<ans<<"\n";
	return ans;
}
void solve(){
	mem1(dp);
	string s;
	cin>>s>>d;
	n=sz(s);
	rep(i,0,n){
		a[i]=s[i]-'0';
	}
	cout<<(calc(0,0,0)+M-1)%M;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	#ifdef DSU
		cleardsu(MAXDSUSIZE);
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


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

int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<char>>grid;
  vector<bool> delete_line_flag(120, true);
  vector<bool> delete_col_flag(120, true);

  for(int i = 0; i < h; i++){
    vector<char>temp_grid(w);
    for(int j = 0; j < w; j++){
      cin >> temp_grid[j];
      if(temp_grid[j] == '#'){
        delete_line_flag[i] = false;
        delete_col_flag[j] = false;
      }
    }
    grid.push_back(temp_grid);
  }

  for(int i = 0; i < h; i++){
    if(delete_line_flag[i] == false){
      for(int j = 0; j < w; j++){
        if(delete_col_flag[j] == false){
          cout << grid[i][j];
        }
      }
      cout << endl;
    }
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int64_t INF=1e18+1;
const int mod = 1000000007;

int main() {
  string s;
  cin>>s;
  if(s[0]==s[2]){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pll pair<ll, ll>
#pragma GCC optimize ("O3")
using namespace std;
int main () {
    #ifdef LOCAL
        freopen ("input.txt", "r", stdin);
        freopen ("output.txt", "w", stdout);
        freopen ("error.txt", "w", stderr);
    #else
        ios::sync_with_stdio(false);
        cin.tie (NULL);
    #endif
    string s; cin>>s;
    ll n=s.size();
    vector <ll> cnt (n, 0), l (n, 0), r (n, n-1);
    for (ll i=1;i<n;++i) {
        if (s[i]=='R') l[i]=i;
        else l[i]=l[i-1];
    }
    for (ll i=n-2;i>=0;--i) {
        if (s[i]=='L') r[i]=i;
        else r[i]=r[i+1];
    }
    for (ll i=0;i<n;++i) {
        if (s[i]=='L') {
            if ((i-l[i])%2) cnt[l[i]+1]++;
            else cnt[l[i]]++;
        }
        else {
            if ((r[i]-i)%2) cnt[r[i]-1]++;
            else cnt[r[i]]++;
        }
    }
    for (auto &i : cnt) cout<<i<<' ';
    return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int n;
    cin >> n;
    VI av(n);
    REP(i, n) cin >> av[i];
    int ans = 0;
    REP(i, n) {
        if (av[i] % 2 == 1 && i % 2 == 0) {
            ans++;
        }
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed solve(){
  Int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;

  map<Int, __int128_t> dp;
  MFP([&](auto dfs,Int x)->Int{
    if(dp.count(x)) return dp[x];
    auto &res=dp[x];
    res=x*(__int128_t)d;
    for(Int k=-4;k<5;k++){
      Int nx=x+k;
      if(nx<=0) continue;
      if(nx%2==0 and nx/2<x) chmin(res,dfs(nx/2)+d*abs(k)+a);
      if(nx%3==0 and nx/3<x) chmin(res,dfs(nx/3)+d*abs(k)+b);
      if(nx%5==0 and nx/5<x) chmin(res,dfs(nx/5)+d*abs(k)+c);
    }
    return (Int)res;
  })(n);

  cout<<(Int)dp[n]<<endl;
  return 0;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int T;
  cin>>T;
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 7152
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
const long double EPS = 1e-9;
 
#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c)
#define rsort(a,n) sort(a,a+n,greater<>())
 
const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 100;
 
int main(void){
    ll a,b;
    str s;

    in3(a,b,s);
    rep(i,a) if (s[i] == '-') {prl("No"); return 0;}
    if (s[a] != '-') {prl("No"); return 0;}
    For(i,a+1,a+b+1) if (s[i] == '-') {prl("No"); return 0;}

    prl("Yes");

    return 0;
}

Measured memory_bytes: 256
function initOfficialHouse(bMax, fMax, rMax) {
    var o = Array(bMax);
    for(var b = 0; b < bMax; b++) {
        o[b] = Array(fMax);
        for(var f = 0; f < fMax; f++) {
            o[b][f] = Array(rMax);
            for(var r = 0; r < rMax; r++) {
                o[b][f][r] = 0;
            }
        }
    }
    return o;
}
function toString(o){
    return o.map(function(b){
        return b.map(function(f){
            return ' ' + f.join(' ');
        }).join('\n');
    }).join('\n####################\n');
}

const chunk = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = chunk.trim().split('\n');
lines.shift(); // n
var o = initOfficialHouse(4, 3, 10);
lines.forEach(function (line) {
    var bfrv = line.split(' ').map(Number);
    var b = bfrv[0], f = bfrv[1], r = bfrv[2], v = bfrv[3];
    o[b - 1][f - 1][r - 1] += v;
});

console.log(toString(o));

Measured memory_bytes: 15836