akhauriyash/Code-Regression huggingface dataset:
/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)

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...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else

#define debug(x...)
#endif

int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int s[110000];
	int dp[110000] ;
	int n,k; cin>>n>>k;
	for(int i=0;i<n;i++) cin>>s[i];
	for(int i=0;i<=n;i++) dp[i] = MOD;
	dp[0] = 0;
	for(int i=0;i<n;i++) {
			for(int j=1;j<=k;j++) {
					if(i+j<n) {
							dp[i+j] = min(dp[i+j],dp[i] + abs(s[i] - s[i+j]));
					}	
			}

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





Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int q[100005];
long long ans=1;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		int k=0;
		cin>>q[i];
        int j;
		if(q[i]==c) ++k,j=3;
		if(q[i]==b) ++k,j=2;
		if(q[i]==a) ++k,j=1;
		if(j==1) a++;
		if(j==2) b++;
		if(j==3) c++;
		ans*=k;
		ans%=1000000007; 
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int sht[1000][1000];

int main(){
 string t;//原文
 string b;//呪文
 long long int i,j,k,ans=0;
 
 for(i=0;i<1000;i++){
 	for(j=0;j<1000;j++){
		sht[i][j]=0;
	}
 }
 
 cin>>t>>b;
 //1行目
 for(i=0;i<t.size();i++){
 	if(b[0]==t[i]){
		sht[i][0]=1;
	}else{
		sht[i][0]=0;
	}
 }
 //2行目以降
 for(i=1;i<b.size();i++){
 	for(j=0;j<t.size();j++){
		if(b[i]==t[j] && j>=i){
			for(k=0;k<j;k++){
				sht[j][i]=(sht[j][i]+sht[k][i-1])%1000000007;
			}
		}
	}
 }
 for(j=0;j<t.size();j++){
 	ans=(ans+sht[j][i-1])%1000000007;
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 7128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N;
  	cin >> N;
  	int sheet = 0;
  	for(int i =0;i<N;i++){
      int a,b;
      cin>>a>>b;
      sheet += b-a+1;
    }
  	cout<<sheet<<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 = sc.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = sc.nextInt();
        }
        int count = SelectionSort(A, N);
        for(int i = 0; i < N; i++){
            if(i != N - 1){
                System.out.print(A[i] + " ");
            }else{
                System.out.print(A[i]);
            }
        }
        System.out.println("");
        System.out.println(count);
    }

    public static int SelectionSort(int[] a, int n){
        int c = 0;
        for(int i = 0; i <= n - 1; i++){
            int minj = i;
            for(int j = i; j <= n - 1; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int x = a[i];
                a[i] = a[minj];
                a[minj] = x;
                c++;
            }
        }
        return c;
    }
}


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

const int Q = 7 + 1e9;

ll exp( ll n, ll m ){
    if( m == 0 ) return 1;
    if(m%2==0) return ( exp(n,m/2)*exp(n,m/2) )%Q;
    else return ( n*exp(n,m-1) )%Q;
}

int main(){
    int N;
    cin >> N;
    ll w_all = exp(10,N); // 0...9
    ll w_wo_0 = exp(9,N); // 1..9 ( = 0..8)
    ll w_wo_09 = exp(8,N); // 1...8
    cout << ( ( w_wo_09 - (2*w_wo_0)%Q + w_all )%Q + Q )%Q << endl;
    return 0;
}


Measured memory_bytes: 3612
import Foundation

// １行文字列
func readStr() -> String {
  readLine()!
}

// １行整数
func readInt() -> Int {
  Int(readLine()!)!
}

// 空白文字で分割された文字列
func readSpStrs() -> [String] {
  readLine()!.components(separatedBy: " ")
}

// 空白文字で分割された整数
func readSpInts() -> [Int] {
  readSpStrs().map { Int($0)! }
}

// N行分の整数
func readInt(_ n: Int) -> [Int] {
  (1...n).map { _ in readInt() }
}

let k = readInt()

print(
  (1...k).reduce("") { r, _ in r + "ACL" }
)



Measured memory_bytes: 13036
#include <iostream>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;

ll mod;

ll powmod(ll a, ll e) {
  ll sum = 1;
  ll cur = a;
  while (e > 0) {
    if (e % 2) {
      sum = sum * cur % mod;
    }
    cur = cur * cur % mod;
    e /= 2;
  }
  return sum;
}
ll powmod(ll a, ll e, ll mod) {
  ll sum = 1;
  ll cur = a;
  while (e > 0) {
    if (e % 2) {
      sum = sum * cur % mod;
    }
    cur = cur * cur % mod;
    e /= 2;
  }
  return sum;
}

void add(ll &x, ll y) {
  x = (x + y) % mod;
}

const int N = 3010;
ll comb[N][N];
ll dp[N][N];
ll invfac[N];

void init(void) {
  comb[0][0] = 1;
  REP(i, 1, N) {
    REP(j, 0, N) {
      if (j > 0) add(comb[i][j], comb[i - 1][j - 1]);
      add(comb[i][j], comb[i - 1][j]);
    }
  }
  dp[0][0] = 1;
  REP(i, 1, N) {
    REP(j, 0, N) {
      if (j > 0) add(dp[i][j], dp[i - 1][j - 1]);
      add(dp[i][j], dp[i - 1][j]);
      dp[i][j] = dp[i][j] * j % mod;
      add(dp[i][j], dp[i - 1][j]);
    }
  }
  invfac[0] = 1;
  REP(i, 1, N) {
    invfac[i] = invfac[i - 1] * powmod(i, mod - 2) % mod;
  }
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n >> mod;
  init();
  ll tot = 0;
  REP(i, 0, n + 1) {
    ll fac = powmod(2, powmod(2, n - i, mod - 1));
    ll tis = powmod(2, n - i);
    ll ani = 0;
    ll accfac = 1;
    REP(j, 0, i + 1) {
      ll tmp = dp[i][j] * accfac % mod;
      accfac = accfac * tis % mod;
      tmp = tmp * invfac[j] % mod;
      add(ani, tmp);
    }
    ani = ani * fac % mod;
    ani = ani * comb[n][i] % mod;
    if (i % 2 == 1) ani = (mod - ani) % mod;
    add(tot, ani);
  }
  cout << tot << endl;
}


Measured memory_bytes: 141952
#include <iostream>
#include <cfloat>
#include <cmath>
using namespace std;
 
 
//0075
int main(){
	int num;
    double w, h;
    char ch;

	while(cin >> num >> ch >> w >> ch >> h){
		double bmi = w/(h*h);
		if(bmi >= 25.0 - DBL_EPSILON){
			cout << num << endl;
		}
	}
	return 0; 
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define ii pair<int,int>
#define st first
#define nd second
#define N 205
#define inf 1000000000
#define MOD 998244353
#define sz(x) ((int)x.size())
#define umax(x,y) x=max(x,y)
using namespace std;

int n,m,tot,etot;
int sink,source;
int a[N][N],node[N],idn[N],vis[3*N];
vector<int> v[3*N];

struct edge {

	int go,cap;

} e[N*N];

int id(int val) {

	return (val+m-1)/m;

}

void print() {

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

		for(int j=1;j<=m;j++) {

			printf("%d ",a[i][j]);

		}

		printf("\n");

	}

}

void solve_p_col(int c) {

	vector<int> vals;

	for(int i=1;i<=n;i++) vals.pb(a[i][c]);

	sort(vals.begin(),vals.end());

	for(int i=0;i<n;i++) a[i+1][c]=vals[i];	

}

void solve_cols() {

	for(int i=1;i<=m;i++) {

		solve_p_col(i);

	}

	print();

}

void bring(int row,int col,int idd) {

	for(int j=col;j<=m;j++) {

		if(id(a[row][j])==idd) {

			swap(a[row][col],a[row][j]);

			return ;

		}

	}

	assert(0);

}

int dfs(int node) {

	if(node==sink) return 1;

	vis[node]=1;

	for(int i:v[node]) {

		if(!vis[e[i].go] && e[i].cap && dfs(e[i].go)) {

			e[i].cap=0;
			e[i^1].cap=1;

			return 1;

		}

	}

	return 0;

}

void add_edge(int x,int y) {

	v[x].pb(etot);
	e[etot++]={y,1};
	v[y].pb(etot);
	e[etot++]={x,0};

}

void clear_network() {

	for(int i=1;i<=tot;i++) {

		v[i].clear();

	}

	etot=tot=0;

}

int nn() {return ++tot;}

void solve_col(int c) {

	clear_network();

	source=nn();
	sink=nn();

	for(int i=1;i<=n;i++) node[i]=nn(),add_edge(source,node[i]);
	for(int i=1;i<=n;i++) idn[i]=nn(),add_edge(idn[i],sink);

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

		for(int j=c;j<=m;j++) {

			add_edge(node[i],idn[id(a[i][j])]);

		}

	}

	do {

		fill(vis+1,vis+tot+1,0);

	} while(dfs(source));

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

		for(int ednum:v[node[i]]) {

			if(e[ednum].cap==0 && e[ednum].go>=idn[1] && e[ednum].go<=idn[n]) {

				bring(i,c,e[ednum].go-idn[1]+1);

				break ;

			}

		}

	}

}

void solve_rows() {

	for(int i=1;i<=m;i++) {

		solve_col(i);

	}

	print();

}

int main(int arg,char* argv[]) {

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

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

		for(int j=1;j<=m;j++) {

			scanf("%d",&a[i][j]);

		}

	}

	solve_rows();
	solve_cols();

}

Measured memory_bytes: 768
#!/usr/bin/env python3
import sys
args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False
input = sys.stdin.readline
a, b, c = map(int, input().split())
if a+b+c >= 22:
  print("bust")
else:
  print("win")
if em: sys.stdin = open('/dev/tty')


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

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

Measured memory_bytes: 256
#define USE_MATH_DEFINES 1
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 998244353ll
#define INF 1000000000000000000ll
#define EPS 1e-9

#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock

typedef long long         ll;
typedef long double       ld;
typedef pair <ll,ll>      pl;
typedef tuple <ll,ll,ll>  tl;

int N, lower, upper, maxfr, el, er, rc, bc;
char fr, ans[205];
vector <int> q_para;

char q_range() {
	cout << "?";
	for (int x : q_para) cout << " " << x;
	cout << endl;
	string ret;
	cin >> ret;
	return (ret.compare("Red") == 0 ? 'R' : 'B');
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> N;
	
	q_para.clear();
	for (int i = 1; i <= N; i++) q_para.push_back(i);
	fr = q_range();
	
	lower = 1;
	upper = N+1;
	maxfr = 1;
	
	while (upper - lower > 1) {
		int test = (lower + upper) / 2;
		q_para.clear();
		for (int i = 0; i < N; i++) q_para.push_back(test + i);
		char re = q_range();
		if (fr == re) {
			maxfr = max(maxfr, test);
			lower = test;
		} else upper = test;
	}
	
	el = maxfr + 1;
	er = maxfr + N - 1;
	q_para.clear();
	for (int i = el; i <= er; i++) q_para.push_back(i);
	for (int i = 1; i <= 2 * N; i++) {
		if (el <= i && i <= er) continue;
		q_para.push_back(i);
		ans[i] = q_range();
		q_para.pop_back();
	}
	
	q_para.clear();
	rc = (N - 1) / 2;
	bc = (N - 1) / 2;
	for (int i = 1; i <= 2 * N; i++) {
		if (el <= i && i <= er) continue;
		if (ans[i] == 'R' && rc > 0) {
			q_para.push_back(i);
			rc--;
		} else if (ans[i] == 'B' && bc > 0) {
			q_para.push_back(i);
			bc--;
		}
	}
	
	for (int i = el; i <= er; i++) {
		q_para.push_back(i);
		ans[i] = q_range();
		q_para.pop_back();
	}
	
	cout << "! ";
	for (int i = 1; i <= 2 * N; i++) {
		cout << ans[i];
	}
	
    return 0;
}

Measured memory_bytes: 724
/*
                ____________    ______________       __
               / _________  /\ /_____   _____/\     / /\
              / /\       / /  \\    /  /\    \ \   / /  \
             / /  \_____/ /   / \__/  /  \____\/  / /   /
            / /   /    / /   /    /  /   /       / /   /
           / /   /    / /   /    /  /   /       / /   /
          / /   /    / /   /    /  /   /       / /   /
         / /___/____/ /   /    /  /   /       / /___/________
        /____________/   /    /__/   /       /______________/\
        \            \  /     \  \  /        \              \ \
         \____________\/       \__\/          \______________\/
           ___       ___               ___    __________
          /  /\     /  /\             /  /\  /_______  /\
         /  /__\___/  /  \           /  /  \ \      /  /  \
        /____    ____/   /          /  /   /  \____/  /   /
        \   /   /\   \  /          /  /   /       /  /   /
         \_/   /  \___\/ ___      /  /   /       /  /   /
          /   /   /     /  /\    /  /   /       /  /   /
         /   /   /     /  /__\__/  /   /       /  /___/____
        /___/   /     /___________/   /       /___________/\
        \   \  /      \           \  /        \           \ \
         \___\/        \___________\/          \___________\/
       
          A FAN OF FIZZYDAVID
           
*/

#include<bits/stdc++.h>

#define HEAP priority_queue
#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,n) for(int i=(n)-1;i>=0;i--)
#define forn(i,l,r) for(int i=(l);i<=(r);i++)
#define nrof(i,r,l) for(int i=(r);i>=(l);i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-20
#define pi 3.1415926535897932384626433832795
#define orz int
#define yjz main
#define fizzydavid return
#define ak 0
#define la ;
#define debug puts("OK");
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int iinf=1e9+7;
const LL linf=1ll<<60;
const flt dinf=1e10;

template <typename T>
inline void scf(T &x)
{
	bool f=0; x=0; char c=getchar();
	while((c<'0' || c>'9') && c!='-') c=getchar();
	if(c=='-') { f=1; c=getchar(); }
	while(c>='0' && c<='9') { x=x*10+c-'0'; c=getchar(); }
	if(f) x=-x; return;
}

template <typename T1,typename T2>
void scf(T1 &x,T2 &y) { scf(x); return scf(y); }

template <typename T1,typename T2,typename T3>
void scf(T1 &x,T2 &y,T3 &z) { scf(x); scf(y); return scf(z); }

#ifdef ONLINE_JUDGE
#else
#define DEBUG
#endif

//---------------------------head----------------------------

const int N=1e5+100;

int a[N];
int n,cnt1,cnt2;

orz yjz()
{
	scf(n,a[0]);
	forn(i,1,n) scf(a[i]);
	int mn=a[1],dlt=0;
	forn(i,2,n) dlt=max(a[i]-mn,dlt), mn=min(mn,a[i]);
	mn=a[1];
	forn(i,2,n)
	{
		if(a[i]-mn==dlt) cnt1++;
		mn=min(mn,a[i]);
	}
	int mx=a[n];
	nrof(i,n-1,1)
	{
		if(mx-a[i]==dlt) cnt2++;
		mx=max(mx,a[i]);
	}
	printf("%d\n",min(cnt1,cnt2));
	fizzydavid ak la
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m + 1];
        int[] y = new int[m + 1];
        for (int i = 1; i <= m; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        boolean[] red = new boolean[n + 1];
        int[] nums = new int[n + 1];
        red[1] = true;
        for (int i = 1; i <= n; i++) {
            nums[i] = 1;
        }
        for (int i = 1; i <= m; i++) {
            if (red[x[i]]) {
                if (nums[x[i]] <= 1) {
                    red[x[i]] = false;
                }
                red[y[i]] = true;
            }
            nums[x[i]]--;
            nums[y[i]]++;
        }
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            if (red[i]) {
                ans++;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 71016
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int a,b;
    cin>>a>>b;
    if(a>b) swap(a,b);
    cout<<string(b,a+'0')<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	string N;
	cin >> N;

	switch (N.back())
	{
	case '2':
	case '4':
	case '5':
	case '7':
	case '9':
		cout << "hon";
		break;
	case '0':
	case '1':
	case '6':
	case '8':
		cout << "pon";
		break;
	case '3':
		cout << "bon";
		break;
	default:
		break;
	}

	return 0;
}

Measured memory_bytes: 3612
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AtC_prac
{
    class Program
    {
        static void Main(string[] args)
        {
            string Sd = Console.ReadLine();
            string T = Console.ReadLine();
            int Sdlen = Sd.Length;
            int Tlen = T.Length;

            List<string> Slist = new List<string>();
            for(int i = 0; i <= Sdlen - Tlen; i++)
            {
                int tmp = 0;
                for (int j = 0; j < Tlen; j++)
                {
                    if (!(Sd[i + j] == T[j] || Sd[i + j] == '?'))
                    {
                        tmp = 1;
                        //Console.WriteLine($"{i} {j} ");
                    }
                }
                if (tmp == 1) continue;
                string S = Sd.Substring(0, i);
                S = S + T;
                S = S + Sd.Substring(i+Tlen,Sdlen-i-Tlen);
                S = func(S,'a','?');
                Slist.Add(S);
            }
            Slist.Sort();
            if (Slist.Count == 0) Console.WriteLine("UNRESTORABLE");
            else Console.WriteLine(Slist[0]);
        }

        static string func(string S, char a, char b)
        {
            string Sd = "";
            int Slen = S.Length;
            for(int i = 0; i < Slen; i++)
            {
                if (S[i] == b) Sd = Sd + a;
                else Sd = Sd +  S.Substring(i, 1);
            }
            return Sd;
        }
       

        static StringBuilder sb = new StringBuilder(1024);
        public static string ArraytoString<T>(T[][] arr, string sep = ", ", string rowSep = "\n",
    string start_bracket = "[", string end_bracket = "]")
        {
            sb.Length = 0;
            sb.Append(start_bracket);
            for (int i = 0; i < arr.Length; i++)
            {
                if (i > 0)
                {
                    sb.Append(sep);
                    sb.Append(rowSep);
                }

                sb.Append(start_bracket);

                for (int j = 0; j < arr[i].Length; j++)
                {
                    if (j > 0)
                    {
                        sb.Append(sep);
                    }
                    sb.Append(arr[i][j]);
                }
                sb.Append(end_bracket);
            }
            sb.Append(end_bracket);

            return sb.ToString();
        }
        
    }
}



/*
int N = int.Parse(Console.ReadLine());
string[] ABCD = Console.ReadLine().Split(' ');
int A = int.Parse(ABCD[0]); 
int B = int.Parse(ABCD[1]); 
int C = int.Parse(ABCD[2]); 
int D = int.Parse(ABCD[3]); 

string[][] Array = new string[x][];
for (int i = 0; i < x; i++) Array[i] = new string[y];

for(int i = 0; i < R; i++)
{
    for (int j = 0; j < C; j++) Console.Write($"{Visited[i,j]} ");
    Console.WriteLine();
}

*/


Measured memory_bytes: 11360
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define msg(a) cout << #a << " " << a << endl
#define eb emplace_back

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    int ans = (x - a) % b;
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from collections import deque

s = input()
q = int(input())
queries = [input().split() for _ in range(q)]

judge = True
S = deque()
for string in s:
    S.append(string)

for query in queries:
    if query[0] == '1':
        judge = not judge
    else:
        if judge:
            if query[1] == '1':
                S.appendleft(query[2])
            else:
                S.append(query[2])
        else:
            if query[1] == '1':
                S.append(query[2])
            else:
                S.appendleft(query[2])
ans = ''.join(S)
if not judge:
    print(ans[::-1])
else:
    print(ans)

Measured memory_bytes: 44660
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var A = sc.ReadInt();
        var B = sc.ReadInt();
        var C = sc.ReadInt();
        var ok = A + B == C || B + C == A || C + A == B;
        Console.WriteLine(ok ? "Yes" : "No");
    }

    static int MOD = (int)1e9 + 7;
    static int INF = (int)1e7 + 1;
    static long LINF = (long)1e13 + 1;
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
	int n,W;
    cin>>n>>W;
    int*dp = new int[W+1];
    for(int i=1; i<=n; i++)
    {
      int weight , value;
      cin>>weight>>value;
      for(int j=W; j>=0; j--)
      {
 		dp[j] = (weight > j) ? dp[j] : max(dp[j-weight] + value, dp[j]);
      }
    }
    cout<<dp[W];
}

Measured memory_bytes: 1024
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll r;
    cin>>r;
    double pi=acos(-1);
    cout<<fixed<<setprecision(15);
    cout<<2*pi*r;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15504
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream> 
using namespace std;
struct node{
	int y,next;
}road[200010];
int N,x,y,du[100010],cnt,head[100010],p;
bool vis[100010];
int read()
{
	static int x;
	static char ch;
	x = 0;
	for(ch=getchar();ch>'9'||ch<'0';ch=getchar());
	for(;ch>='0'&&ch<='9';ch=getchar()) x = x * 10 + ch - '0';
	return x;
}
void build(int x,int y)
{
	road[++p].y = y;
	road[p].next = head[x];
	head[x] = p;
}
int dfs(int x,int f)
{
	if (du[x] > 2) return x;
	for (int i = head[x];i;i=road[i].next) if (road[i].y!=f) return dfs(road[i].y,x);
	return x;
}
int main()
{
	N = read();
	for (int i = 1;i<N;++i)
	{
		x = read() + 1;
		y = read() + 1;
		build(x,y);
		build(y,x);
		du[x]++;du[y]++;
	}
	for (int i = 1;i<=N;++i) if (du[i]==1) cnt++,vis[dfs(i,0)] = true;
	for (int i = 1;i<=N;++i) if (vis[i]) cnt -- ;
	if (!cnt) cnt++;
	printf("%d\n",cnt);
	return 0;
}

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

int ans(int64_t x)
{
    int t=0;
    for(int64_t k = 2;k<=sqrt((double)x);k++)
    {
        if((x-1)%k == 0)
        {
            if(k == sqrt((double)x-1))
            {
                t++;
            }
            else
            {
                t += 2;
            }
        }
    }
    if(x == 2)
    {
        return 0;
    }
    else
    {
    return t + 1;

    }
}
vector<int64_t> ans2(int64_t x)
{
    vector<int64_t> y;
    for(int64_t k = 2;k<=sqrt((double)x);k++)
    {
        if(x%k == 0)
        {
            if(k == sqrt((double)x))
            {
                y.push_back(k);
            }
            else
            {
                y.push_back(k);
                y.push_back(x/k);
            }
        }
    }
    return y;
}

int main()
{
    int64_t temp;
    cin >> temp ;
    
    int64_t N = temp;
    int re = 0;
    
    re += ans(N);
    vector<int64_t> y = ans2(N);
    for(int i=0;i < y.size();i++)
    {
        while(temp % y[i] == 0)
        {
            temp /= y[i];
        }
        if(temp % y[i] == 1)
        {
            re++;
        }
        
        temp = N;
    }
    
    cout << re+1 <<endl;
    
    
    return 0;
}

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

Measured memory_bytes: 21972
a,b,c=gets.split.map &:to_i
j=0
99.times{
  break if [a,b,c].find(&:odd?)
  x=b/2+c/2,c/2+a/2,a/2+b/2
  j=-1 and break if x.min==x.max
  a,b,c=x
  j+=1 
}
p j

Measured memory_bytes: 3836
import java.io.*;
import java.util.Arrays;
   
public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] inputs = br.readLine().split(" ");
    Arrays.sort(inputs);
    System.out.println(String.join(" ", inputs));
  }
}

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

using namespace std;

bool actg(char c){
    return (c == 'A' || c == 'C' || c == 'T' || c == 'G');
}

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

    int sum = 0;
    int max = -1;
    for(int i = 0; i < s.size(); i++){
	if(actg(s.at(i))){
	    sum++;
	}else{
	    if(sum > max){
		max = sum;
	    }
	    sum = 0;
	}
    }
    if(sum>max){
	max = sum;
    }

    cout << max << endl;
}


Measured memory_bytes: 256
main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	var n = +lines, output = "";
	for(var i=1;i<=n;i++) if(i % 3 == 0 || i.toString().indexOf("3") >= 0){
		output += " " + i;
	}
	console.log(output);
}

Measured memory_bytes: 17672
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

int main() {
    IOS;
    string s;
    cin >> s;
    int n = (int)s.size();
    vector<int> a;
    vector<int> c(26,0);
    int cnt = 0;
    a.push_back(n);
    RREP(i,n){
        if(c[s[i]-'a']==0){
            cnt++;
            c[s[i]-'a'] = 1;
        }
        if(cnt==26){
            REP(j,26){
                c[j] = 0;
            }
            cnt = 0;
            a.push_back(i);
        }
    }
    string res;
    int pre;
    Rep(i,26){
        if(c[i]==0){
            res+=(char)'a'+i;
            pre = i;
            break;
        }
    }
    reverse(all(a));
    REP(i,(int)a.size()-1){
        int mi = INT_MAX;
        int fir = 0;
        FOR(j,a[i],a[i+1]+1){
            if(s[j]-'a'==pre){
                fir = j;
                break;
            }
        }
        vector<int> d(26,0);
        FOR(j,fir+1,a[i+1]){
            d[s[j]-'a'] = 1;
        }
        Rep(j,26){
            if(d[j]==0){
                res+=(char)'a'+j;
                pre = j;
                break;
            }
        }
    }
    put(res);
    return 0;
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

ll N, M, L;
ll cost[301][301];


void floyd(){
    REP(k, N){
        REP(i, N){
            REP(j, N){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
                cost[j][i] = cost[i][j];
            }
        }
    }
    REP(i, N) REP(j, N) cost[i][j] = ((cost[i][j] <= L) ? 1 : INT64_MAX / 2);
    REP(k, N){
        REP(i, N){
            REP(j, N){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
                cost[j][i] = cost[i][j];
            }
        }
    }
}

signed main(){
    cin >> N >> M >> L;
    ll A, B, C;
    REP(i, N) REP(j, N) cost[i][j] = INT64_MAX / 2;
    REP(i, M){
        cin >> A >> B >> C;
        A--; B--;
        cost[A][B] = cost[B][A] = C;
    }
    floyd();
    ll Q, s, t;
    cin >> Q;
    REP(i, Q){
        cin >> s >> t;
        s--; t--;
        if(cost[s][t] == INT64_MAX / 2) PRINT("-1");
        else PRINT(cost[s][t] - 1);
    }
    return 0;
}

Measured memory_bytes: 4300
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int a[10000],n,i,j,t,c=0;	cin>>n;
	for(i=0;i<n;i++)cin>>a[i];
	for(i=0;i<n;i++){
	for(j=n-1;j>i;j--){
	if(a[j]<a[j-1]){
	t=a[j];
	a[j]=a[j-1];
	a[j-1]=t;
	c++;
	}
	}
	}
	for(i=0;i<n;i++){if(i)cout<<" ";cout<<a[i];}
	cout<<'\n'<<c<<endl;
	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

int main(){
    ll a,b,c,d,p,q;
    cin>>a>>b>>c>>d;
    p=(a-1)/c+(a-1)/d-(a-1)/(c*d/__gcd(c,d));
    q=(b)/c+(b)/d-(b)/(c*d/__gcd(c,d));
    cout<<b-a+1-q+p;
}

Measured memory_bytes: 3632
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto abm = readln.split.to!(int[]);
    auto A = abm[0];
    auto B = abm[1];
    auto M = abm[2];
    auto as = readln.split.to!(int[]);
    auto bs = readln.split.to!(int[]);
    int[] xs, ys, cs;
    foreach (_; 0..M) {
        auto xyc = readln.split.to!(int[]);
        xs ~= xyc[0]-1;
        ys ~= xyc[1]-1;
        cs ~= xyc[2];
    }

    auto min_c = int.max;
    foreach (i; 0..M) {
        min_c = min(min_c, as[xs[i]] + bs[ys[i]] - cs[i]);
    }
    sort(as);
    sort(bs);
    min_c = min(min_c, as[0] + bs[0]);
    writeln(min_c);
}

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

using namespace std;

#define ll long long

const int N=1e6+5,MOD=1000000007;

int n,a[N],b[N],x,cnt[N];

ll ans;

char s[N];

ll dp[N][13];

ll solve(int idx,int mod){
    if (idx>=n){
        return mod==5; 
    }
    ll &r=dp[idx][mod];
    if (r!=-1)
        return r; 
    r=0;
    if (s[idx]=='?'){
        for(int i=0;i<=9;i++){
            r+=solve(idx+1,(10*mod+i)%13);
            r%=MOD;
        }
    }
    else{
        r+=solve(idx+1,((mod*10)+s[idx]-'0')%13)%MOD;
    }
    return r%MOD;

}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    memset(dp,-1,sizeof dp);
    scanf("%s",s);
    n=strlen(s);
    printf("%lld",solve(0,0));
}



Measured memory_bytes: 108928
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String[] S2 = S.split("");
		String[] S3 = new String[S.length()];
		for(int i=0; i<S3.length; i++) {
			S3[i]= "";
		}
		int n = 753;
		int sum = 0;
		int ans = 100000000;
		for(int i=0; i<S2.length-2; i++) {
			for(int j = i; j<i+3; j++) {
				S3[i] += S2[j];
			}
			sum = Integer.parseInt(S3[i]);
			if(ans>Math.abs(n-sum)) {
			  ans = Math.abs(n-sum);
			}
			sum = 0;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
using System;
using System.Linq;

class C
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var d = new int[n].Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).OrderBy(x => -x.Sum()).ToArray();
		Console.WriteLine(d.Where((x, i) => i % 2 == 0).Sum(x => x[0]) - d.Where((x, i) => i % 2 == 1).Sum(x => x[1]));
	}
}


Measured memory_bytes: 30516
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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

int main()
{
  ll N,K;
  cin >> N >> K;
  VEC(ll,A,N);

  vector<int> vec(50,0);
  REP(i,N){
    bitset<50> bs(A[i]);
    REP(j,50){
      if(bs[j]==1){
        vec[j]++;
      }
    }
  }

  ll ans=0;
  ll x=pow(2,49);
  REPR(i,49,0){
    if(vec[i]<=N/2&&ans+x<=K){
      ans+=x;
    }
    x/=2;
  }

  ll ans2=0;
  REP(i,N){
    ans2+=ans^A[i];
  }

  cout << ans2 << endl;
}

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

typedef long long int ll;

const double PI=3.14159265358979323846;

int main () {
    ll r; cin >> r;
    printf("%.6lf\n", (double)r * 2.0 * PI);
    return 0;
}

Measured memory_bytes: 3256
number = int(input())
Total = []

for i in range(1, number + 1):
    if number % 3 == 0 and i % 5 ==0:
        "FizzBuzz"
    elif i % 3 ==0:
        "Fizz"
    elif i % 5 == 0:
        "Buzz"
    else:
        Total.append(i)

print(sum(Total))


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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
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; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  string s; cin >> s;
  int cnt = 0;
  for(auto e: s) {
    if (e == 'x') {
      cnt++;
    }
  }
  if (cnt >= 8) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }

}

Measured memory_bytes: 768
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B; cin >> A >> B;

    int d = B - A;
    int base = 0; rep(i, d) base += i;
    int res = base - A;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";

int main(){
  ll n,m; cin >> n >> m;
  priority_queue<ll, vector<ll>, greater<ll>> q;
  rep(i,n){
    ll a; cin >> a; q.push(a);
  }
  vector<vector<ll>> v(m,vector<ll>(2,0));
  rep(j,m){
    ll b,c; cin >> b >> c;
    v[j][1]=b; v[j][0]=c;
  }
  sort(v.begin(),v.end(),greater<vector<ll>>());
  rep(k,m){
    rep(p,v[k][1]){
      ll t = q.top();
      if(t>=v[k][0]) break;
      q.pop();
      q.push(v[k][0]);
    }
  }
  ll ans=0;
  while(!q.empty()){
    ans+=q.top();
    q.pop();
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 6516
#include <stdio.h>

typedef struct
{
	int n, e, w, s, t, b;
} dice;

void dice_scan(dice *x)
{
	scanf("%d %d %d %d %d %d", &x->t, &x->s, &x->e, &x->w, &x->n, &x->b);
}

void dice_rorate_n(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->t;
	x->t = x->s;
	x->s = x->b;
	x->b = temp;
}

void dice_rorate_e(dice *x)
{
	int temp;
	temp = x->e;
	x->e = x->t;
	x->t = x->w;
	x->w = x->b;
	x->b = temp;
}

void dice_rorate_r(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->w;
	x->w = x->s;
	x->s = x->e;
	x->e = temp;
}

int dice_equal(const dice *d1, const dice *d2)
{
	if(d1->n != d2->n) { return 0; }
	if(d1->e != d2->e) { return 0; }
	if(d1->w != d2->w) { return 0; }
	if(d1->s != d2->s) { return 0; }
	if(d1->t != d2->t) { return 0; }
	if(d1->b != d2->b) { return 0; }
	return 1;
}

int dice_rorate_equal(dice *d1, dice *d2)
{
	int ok = 0;
	for(int i = 0; i < 4; ++i)
	{
		for(int j = 0; j < 4; ++j)
		{
			ok += dice_equal(d1, d2);
			dice_rorate_n(d1);
		}
		dice_rorate_e(d1);
	}
	for(int i = 0; i < 4; ++i)
	{
		for(int j = 0; j < 4; ++j)
		{
			ok += dice_equal(d1, d2);
			dice_rorate_n(d1);
		}
		dice_rorate_r(d1);
	}
	return ok;
}

int main()
{
	int n;
	dice d[100];

	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		dice_scan(&d[i]);
	}

	for(int i = 0; i < n; ++i)
	{
		for(int j = i + 1; j < n; ++j)
		{
			if(dice_rorate_equal(&d[i], &d[j]))
			{
				printf("No\n");
				return 0;
			}
		}
	}

	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 2112
import sys
import numpy as np
input = sys.stdin.buffer.readline
Q = int(input())


def is_prime(v):
    for i in range(2, v):
        if i * i > v:
            break
        if v % i == 0:
            return False
    return True


def make_prime(U):
    is_prime = np.zeros(U, np.bool)
    is_prime[2] = 1
    is_prime[3::2] = 1
    M = int(U**.5) + 1
    for p in range(3, M, 2):
        if is_prime[p]:
            is_prime[p * p::p + p] = 0
    return is_prime


is_primes = make_prime(10**5 + 2)
# print('is_primes', is_primes[:14])

V = [0] * (10**5 + 2)
for i in range(1, len(V)):
    if i % 2 == 0:
        V[i] = V[i - 1]
        continue
    if is_primes[i] and is_primes[(i + 1) // 2]:
        V[i] = V[i - 1] + 1
    else:
        V[i] = V[i - 1]
# print('V', V)

for _ in range(Q):
    l, r = map(int, input().split())
    # print('l - 1, r, V[l- 1], V[r]', l - 1, r, V[l - 1], V[r])
    print(V[r] - V[l - 1])


Measured memory_bytes: 14088
def change(N, A, B):
    ans = N
    dp = list(range(N+1))
    for i in range(3):
        w = A[i]
        v = B[i]
        for j in range(N+1):
            if w <= j:
                dp[j] = max(dp[j], dp[j-w] + v)
    return dp[N]

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    N1 = change(N, A, B)
    N2 = change(N1, B, A)
    print(N2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 228636
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  char b;
  scanf("%c", &b);
  if (b == 'A')
    puts("T");
  else if (b == 'T')
    puts("A");
  else if (b == 'G')
    puts("C");
  else
    puts("G");
  return 0;
}

Measured memory_bytes: 128
def solve():
  x, y = map(int, input().split())
  if y==0:
    return abs(x)+(x>0)
  if x==0:
    return abs(y)+(y<0)
  if y<x and x<0:
    return abs(abs(y)-abs(x))+2
  if x>y and y>0:
    return abs(abs(y)-abs(x))+2
  return abs(abs(y)-abs(x))+(x*y<0)
print(solve())

Measured memory_bytes: 9128
#!usr/bim/python
#! -*- coding: utf-8 -*-

n = raw_input()
n = int(n)

a = raw_input()
a = a.split()
a = map(int,a)

if min(a) >= 0:
    print n-1
    for i in range(n-1):
        print i+1,i+2
elif max(a) <= 0:
    print n-1
    for i in range(n-1):
        print (n-i),(n-i-1)
elif abs(min(a)) <= max(a):
    max_index = a.index(max(a))
    print 2*n-1
    for i in range(n):
        if i == max_index:
            pass
        else:
            print max_index+1,i+1
    print max_index+1,max_index+1
    for i in range(n-1):
        print i+1,i+2
else:
    min_index = a.index(min(a))
    print 2*n-1
    for i in range(n):
        if i == min_index:
            pass
        else:
            print min_index+1,i+1
    print min_index+1,min_index+1
    for i in range(n-1):
        print (n-i),(n-i-1)


Measured memory_bytes: 2696