akhauriyash/Code-Regression huggingface dataset:
using System;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int a11 = int.Parse(input[0]);
		int a12 = int.Parse(input[1]);
		int a13 = int.Parse(input[2]);
		string[] input2 = Console.ReadLine().Split(' ');
		int a21 = int.Parse(input2[0]);
		int a22 = int.Parse(input2[1]);
		int a23 = int.Parse(input2[2]); 
		string[] input3 = Console.ReadLine().Split(' ');
		int a31 = int.Parse(input3[0]);
		int a32 = int.Parse(input3[1]);
		int a33 = int.Parse(input3[2]);
		// 整数の入力
		int n = int.Parse(Console.ReadLine());
		for (int i = 0; i < n; i++)
		{
			int b = int.Parse(Console.ReadLine());
			if (a11 == b)
			{
				a11 = 0;
			}
			if (a12 == b)
			{
				a12 = 0;
			}
			if (a13 == b)
			{
				a13 = 0;
			}
			if (a21 == b)
			{
				a21 = 0;
			}
			if (a22 == b)
			{
				a22 = 0;
			}
			if (a23 == b)
			{
				a23 = 0;
			}
			if (a31 == b)
			{
				a31 = 0;
			}
			if (a32 == b)
			{
				a32 = 0;
			}
			if (a33 == b)
			{
				a33 = 0;
			}
		}
		int ans = 0;
		if (a11 == 0 && a12 == 0 && a13 == 0)
		{
			ans = 1;
		}
		if (a21 == 0 && a22 == 0 && a23 == 0)
		{
			ans = 1;
		}
		if (a31 == 0 && a32 == 0 && a33 == 0)
		{
			ans = 1;
		}
		if (a11 == 0 && a21 == 0 && a31 == 0)
		{
			ans = 1;
		}
		if (a12 == 0 && a22 == 0 && a32 == 0)
		{
			ans = 1;
		}
		if (a13 == 0 && a23 == 0 && a33 == 0)
		{
			ans = 1;
		}
		if (a11 == 0 && a22 == 0 && a33 == 0)
		{
			ans = 1;
		}
		if (a31 == 0 && a22 == 0 && a13 == 0)
		{
			ans = 1;
		}
		if (ans==1)
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}
	}
}


Measured memory_bytes: 13140
//C
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>

using namespace std;

long long int h;
long long int w;
long long int solve(){
	long long int A = LLONG_MAX;
	if (h >= 3){
		if (h % 3 == 0){
			A = 0;
		}
		else{
			A = w;
		}
	}
	for (int i = 1; i <= h; i++){
		long long int S1 = (long long int)(i - 1)*(long long int)(w);
		int H = h - i + 1;
		long long int S2 = (long long int)(H)*(long long int)(w / 2);
		long long int S3 = h*w - S1 - S2;
		if (S1&&S2&&S3){
			long long int mx = max(S1, max(S2, S3));
			long long int mi = min(S1, min(S2, S3));
			mx -= mi;
			A = min(A, mx);
		}
	}
	return A;
}
int main(){
	cin >> h >> w;
	long long int ans = solve();
	swap(h, w);
	ans = min(ans, solve());
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}


Measured memory_bytes: 3624
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int num = sc.nextInt();
			sc.nextLine();
			Dice[] dices = new Dice[num];
			for(int i=0;i<num;i++) {
				dices[i] = new Dice(sc.nextLine().split(" "));
			}
			for(int i=0;i<num-1;i++) {
				for(int j=i+1;j<num;j++) {
					if(dices[i].equals(dices[j])) {
						System.out.println("No");
						return;
					}
				}
			}
			System.out.println("Yes");
		}
	}
	static class Dice{

		private int[] face;

		public Dice(String[] face) {
			this.face = new int[6];
			for(int i=0;i<this.face.length;i++) {
				this.face[i] = Integer.parseInt(face[i]);
			}
		}

		/**
		 * 東西南北EWSN+右左RLでさいころを回転させます
		 * @param to 回転向き?
		 */
		public void rotate(char to){
			int buf;
			switch(to) {
			case 'E':
				buf = this.face[0];
				this.face[0] = this.face[3];
				this.face[3] = this.face[5];
				this.face[5] = this.face[2];
				this.face[2] = buf;
				break;
			case 'W':
				buf = this.face[0];
				this.face[0] = this.face[2];
				this.face[2] = this.face[5];
				this.face[5] = this.face[3];
				this.face[3] = buf;
				break;
			case 'S':
				buf = this.face[0];
				this.face[0] = this.face[4];
				this.face[4] = this.face[5];
				this.face[5] = this.face[1];
				this.face[1] = buf;
				break;
			case 'N':
				buf = this.face[0];
				this.face[0] = this.face[1];
				this.face[1] = this.face[5];
				this.face[5] = this.face[4];
				this.face[4] = buf;
				break;
			case 'R':
				buf = this.face[1];
				this.face[1] = this.face[2];
				this.face[2] = this.face[4];
				this.face[4] = this.face[3];
				this.face[3] = buf;
				break;
			case 'L':
				buf = this.face[1];
				this.face[1] = this.face[3];
				this.face[3] = this.face[5];
				this.face[5] = this.face[2];
				this.face[2] = buf;
				break;
			}
		}

		/**
		 * 2つのさいころが同じ物か判定します
		 * 比較する側は回されます。
		 * @param dice
		 * @return 同じか否か
		 */
		public boolean equals(Dice dice) {
			for(int i=0;i<4;i++) {
				dice.rotate('N');
				for(int j=0;j<4;j++) {
					dice.rotate('R');
					int k;
					for(k=0;k<6;k++) {
						if(this.get(k) != dice.get(k)) break;
					}
					if(k==6) return true;
				}
			}
			for(int i=0;i<2;i++) {
				dice.rotate('E');
				for(int j=0;j<4;j++) {
					dice.rotate('R');
					int k;
					for(k=0;k<6;k++) {
						if(this.get(k) != dice.get(k)) break;
					}
					if(k==6) return true;
				}
				dice.rotate('E');
			}
			return false;
		}
		public int get(int n) {
			return this.face[n];
		}
	}
}


Measured memory_bytes: 27524
//Serene
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
#define ll long long
#define db double
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define lc son[pos][0]
#define rc son[pos][1]
const int W=60;
ll n,m,ans;

char cc;ll ff;
template<typename T>void read(T& aa) {
	aa=0;ff=1; cc=getchar();
	while(cc!='-'&&(cc<'0'||cc>'9')) cc=getchar();
	if(cc=='-') ff=-1,cc=getchar();
	while(cc>='0'&&cc<='9') aa=aa*10+cc-'0',cc=getchar();
	aa*=ff;
}

int lb(ll x) {int rs=0;while(x) rs++,x>>=1;return rs;}

int main() {
	read(n); read(m);
	ll p=W,x;
	while(p>=0&&((n>>p)&1)==((m>>p)&1)) p--;
	if(p>=0) {
		n&=(1LL<<p+1)-1;
		m&=(1LL<<p)-1;
		ans+=(1LL<<p)-n;
		x=lb(m);
		ans+=(1LL<<x);
		n=max(n,1LL<<x);
		ans+=(1LL<<p)-n;
	}
	else ans=1;
	printf("%lld\n",ans);
	return 0;
}


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

int main() {
    int X; cin >> X;
    while(true){
        int Y = pow(X,0.5);
        int flag = 0;
        for (int i = 2;i < Y;i++){
            if (X % i == 0) flag = 1;
        }
        if (flag == 0) break;
        else X++;
    }
    cout << X << endl;
}

Measured memory_bytes: 512
#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 <math.h> // sqrt
using namespace std;

int main() {
    string s;
    cin >> s;
    int N = s.size();
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            if (s.at(i) == s.at(j)) {
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	string s;
	cin>>s;
	int n = s.size();

	vector<vector<ll>> dp(n+1,vector<ll>(13,0));

	dp[0][0]=1;
	for (int i = 0; i < n; i++){
		int now = 0;
		if(s[i]=='?') now=-1;
		else now=s[i]-'0';

		for (int digit = 0; digit < 10; digit++){
			if(now!=-1 && now!=digit) continue;
			for (int m = 0; m < 13; m++){
				dp[i+1][(m*10+digit)%13] += dp[i][m];
				dp[i+1][(m*10+digit)%13] %= mod;
			}
		}
	}
	cout<<dp[n][5]<<endl;
	return 0;
}

Measured memory_bytes: 13696
def solve(n,k,A):
    if A[0]==0:
        return 0
    visited=set()
    visited.add(0)
    C=[0]
    p=A[0]
    while p not in visited:
        visited.add(p)
        C.append(p)
        p=A[p]
    l=len(C)
    s=C.index(p)
    if k<=s:
        return C[k]
    cycle=l-s
    k-=s
    r=k%cycle
    return C[s+r]

def main():
    n,k=map(int,input().split())
    A=tuple(map(lambda x: int(x)-1,input().split()))
    ans=solve(n,k,A)+1
    print(ans)
    
if __name__=='__main__':
    main()

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

using namespace std;

int gcd(const int x, const int y)
{
    if (x < y)
        return gcd(y, x);
    else if (x % y == 0)
        return y;
    else
        return gcd(y, x - y);
}

int main()
{
    int a, b, k;
    scanf("%d %d %d", &a, &b, &k);

    int g = gcd(a, b);

    double sg = sqrt(g);
    int cnt = 0, ans;
    for (int i = 1; i <= g; i++)
    {
        if (g % i == 0)
        {
            cnt++;
        }
        if (cnt == k)
        {
            ans = g / i;
            break;
        }
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=2e5+5;
vector<int> g[N],d[2],a[3];
int n,ans[N];

void dfs(int x,int fa,int p){
	d[p].push_back(x);
	for(int y:g[x]) if(y^fa) dfs(y,x,p^1);
}

signed main(){
	read(n);
	for(int i=1;i<=n;i++) a[i%3].push_back(i);
	for(int i=1,x,y;i<n;i++){
		read(x,y);
		g[x].push_back(y);
		g[y].push_back(x);
	}
	dfs(1,0,0);
	if(d[0].size()>d[1].size()) swap(d[0],d[1]);
	if(a[1].size()>d[0].size()) for(int x:d[0]) ans[x]=a[0].back(),a[0].pop_back();
	else for(int x:d[0])
		if(a[1].size()) ans[x]=a[1].back(),a[1].pop_back();
		else ans[x]=a[0].back(),a[0].pop_back();
	for(int x:d[1])
		if(a[0].size()) ans[x]=a[0].back(),a[0].pop_back();
		else if(a[1].size()) ans[x]=a[1].back(),a[1].pop_back();
		else ans[x]=a[2].back(),a[2].pop_back();
	for(int i=1;i<=n;i++) write(ans[i]),putchar(' ');
}

Measured memory_bytes: 24192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll n,y;cin>>n>>y;
  //caricurate
  for(ll i=0;i<((y/10000)+1);i++){
    for(ll j=0;j<n-i+1;j++){
        if(10000*i+5000*j+1000*(n-i-j)==y){cout<<i<<" "<<j<<" "<<n-i-j<<endl;return 0;}
    }
  }
  //output
  cout<<"-1 -1 -1"<<endl;
}

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 int ll;
ll INF = 1LL<<60;

int main(){
    string S; cin >> S;
    vector<ll> ans(S.size());
    ll x = 0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='R')x++;
        if(S[i]=='L' && x!=0){
            ans[i-1] += x/2; ans[i] += x/2;
            if(x%2==1) ans[i-1] += 1;
            x = 0;
        }
    }
    x = 0;
    for(int i=S.size()-1;i>=0;i--){
        if(S[i]=='L')x++;
        if(S[i]=='R' && x!=0){
            ans[i+1] += x/2; ans[i] += x/2;
            if(x%2==1) ans[i+1] += 1;
            x = 0;
        }
    }
    rep(i,S.size()) cout << ans[i] << " ";
}

Measured memory_bytes: 1408
N,K = map(int, input().split())
*P, = map(int, input().split())
S   = [0]*(N+1)


for i in range(N):
    S[i+1] = S[i] + P[i]

right = 0
left  = 0
ans   = 0
for i in range(N-K+1):

    if ans <= (S[i+K]-S[i]):
        ans = (S[i+K]-S[i])
        right = i+K
        left  = i

ans = 0
for j in range(left, right, 1):
    ans = ans + (1+P[j])
print(ans/2)

Measured memory_bytes: 25060
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        int sum = 0;
        for(int i = 0; i < s.length(); i++){
            sum += Integer.parseInt(Character.toString(s.charAt(i)));
        }
        System.out.println(sum % 9 == 0 ? "Yes" : "No");
        scan.close();
    }

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

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

int main(){
    long long int n, k;
    cin >> n >> k;
    vector<long long int> a(n+1);
    vector<bool> isvisit(n+1, false);
    for(int i = 1; i <= n; i++) cin >> a[i];
    vector<long long int> loop1(1, 1);
    long long int beforeloop = 0;
    isvisit[1] = true;
    for(int i = 0; !isvisit[a[loop1[i]]]; i++){
        isvisit[a[loop1[i]]] = true;
        loop1.push_back(a[loop1[i]]);
        beforeloop++;
    }

    long long int loopin = 0;
    int len = loop1.size();
    for(; loop1[loopin] != a[loop1[len-1]]; loopin++);
    vector<long long int> loop2;
    for(int i = loopin; i < len; i++) loop2.push_back(loop1[i]);

    long long int ans;
    if(k < loopin){
        ans = loop1[k];
    }else{
        k -= loopin;
        k %= (len - loopin);
        ans = loop1[k+loopin];
    }
    cout << ans << endl;

    return 0; 
}

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

int main(){
  
  int a,b;
  cin >> a >> b;
  
  if( a <= b ){
    
    cout << "unsafe" << endl;
    
  }
  
  else{
    
    cout << "safe" << endl;
    
  }
  
}
    
    

Measured memory_bytes: 3624
K, Q = map(int, input().split())
*D, = map(int, input().split())
for q in range(Q):
    n, x, m = map(int, input().split())
    r = (n - 1) % K
    D1r_count0 = 0
    D1_count0 = 0
    D1_sum = 0
    D1r_sum = 0
    for k in range(K):
        if k < r:
            if D[k] % m == 0:
                D1r_count0 += 1
            D1r_sum += D[k] % m
        if D[k] % m == 0:
            D1_count0 += 1
        D1_sum += D[k] % m
    cnt_0 = D1_count0 * ((n - 1) // K) + D1r_count0
    a = x
    # 第n-1項を求める
    b = a + D1_sum * ((n - 1) // K) + D1r_sum
    # 繰り上がりの回数
    cnt_p = b // m - a // m
    cnt_n = (n - 1) - cnt_0 - cnt_p
    print(cnt_n)


Measured memory_bytes: 51164
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define mm map<ii>
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

    
    ll n,a,b;
    cin>>n>>a>>b;

    cout<<min(n*a,b);

    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int K;
  cin >> K;
  vi a;
  auto rec = [&](auto &self, int i, int x, int prev_digit) -> void {
    if (i == 10) {
      return;
    }
    a.push_back(x);
    rep(d, max(0LL, prev_digit - 1), min(10LL, prev_digit + 2)) {
      self(self, i + 1, x * 10 + d, d);
    }
  };
  rep(d, 1, 10) rec(rec, 0, d, d);
  sort(all(a));
  cout << a[K - 1] << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 2420
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int itemCount = int.Parse(Reader.ReadLine());

        int current = 0;
        int[] items = new int[itemCount];
        for (int i = 0; i < itemCount; i++) {
            items[i] = int.Parse(Reader.ReadLine()) - 1;
        }
        int ans = -1;
        for (int i = 0; i <= itemCount; i++) {
            int next = items[current];
            if(current == 1) {
                ans = i;
                break;
            }
            current = next;
        }
        Console.WriteLine(ans);
    }



    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



3
3
1
2


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 15300
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <stack>
#include <algorithm>
using namespace std;
const int Max = 2e5;

int a, b, c;

int main()
{
	scanf ("%d %d %d", &a, &b, &c);
	if (c <= b && c >= a)	printf ("Yes\n");
	else printf ("No\n");
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main (){
	char n[3];
  	for(int i = 0;i<3;i++){
    	cin >> n[i];
      	if(n[i] == '1'){
        	n[i] = '9';
        }
      	else{
        	n[i] = '1';
        }
      	cout << n[i];
    }
}

Measured memory_bytes: 256
#include<stdio.h>

#include<string.h>


#include<stdlib.h>


int main(void)


{


 int i, a, gokei;


 char b, suti[1000];


 while(1){


  gokei=0;


  scanf("%s",suti);


  if(suti[0] == '0'){


   break;


  }


  a=strlen(suti);


  for(i=0; i<a; i++){


   b=suti[i];


   gokei+=atoi(&b);


  }


  printf("%d\n",gokei);


 }


return 0;


}


  

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

int main() {

ll x,k,d; cin>>x>>k>>d;
  if(x<0)x=-x;
   ll ans=x%d;
  
  if(x/d<k){
 
    if((k-x/d)%2==0){ }
    else {ans=(x%d)-d;}}
  else{ans=x-k*d;}
if(ans>=0)cout<<ans<<endl;
  else{cout<<-ans<<endl;}
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
int main() {
	ll n,m;
	cin>>n>>m;
	if(n<10) cout<<(10-n)*100+m<<endl;
	else cout<<m<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    inline int calc(int x){
    int ret=0;
    while(x) ret+=x%10,x/=10;
    return ret;
    }
    int main() {
    int n,ans=1<<30;
    cin>> n;
    for(int i=1;i+i<=n;i++)
    ans=min(ans,calc(i)+calc(n-i));
    cout<<ans;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn = 20;
int a[maxn];
int x[maxn][maxn],y[maxn][maxn];
int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		for(int j = 1;j <= a[i];j++){
			scanf("%d %d",&x[i][j],&y[i][j]);
		}
	}
	int maxn = 0;
	for(int i = 1;i < (1 << n);i++){
		int f = 1;
		for(int j = 1;j <= n;j++){
			if(i & (1 << (j-1))){
				for(int k = 1;k <= a[j];k++){
					if(y[j][k] && !(i & (1 << x[j][k]-1)) ) f = 0;
					if(!y[j][k] && (i & (1 << x[j][k]-1)) ) f = 0;
					if(f == 0) break;
				}
				if(f == 0) break;
			}			
		}
		if(f){
			int sum = 0;
			int t = i;
			while(t){
				t = t - (t&(-t));
				sum++;
			}
			maxn = max(maxn,sum);
		}
	}
	cout << maxn << endl; 
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<deque>
#include<queue>
using namespace std;
int zx[210];
int zy[210];
int px[210];
int py[210];
int qx[210];
int qy[210];
int wall[210][210];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int bfs[210][210];
int v[210][210];
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<c;i++){
		scanf("%d%d%d%d",px+i,py+i,qx+i,qy+i);
		zx[i*2]=px[i];
		zx[i*2+1]=qx[i];
		zy[i*2]=py[i];
		zy[i*2+1]=qy[i];
	}
	zx[c*2]=0;
	zx[c*2+1]=a;
	zy[c*2]=0;
	zy[c*2+1]=b;
	std::sort(zx,zx+c*2+2);
	std::sort(zy,zy+c*2+2);
	int xs=0;
	int ys=0;
	for(int i=0;i<c*2+2;i++){
		if(i==0||zx[i]!=zx[i-1])zx[xs++]=zx[i];
		if(i==0||zy[i]!=zy[i-1])zy[ys++]=zy[i];
	}
	
	for(int i=0;i<c;i++){
		if(px[i]==qx[i]){
			int at=lower_bound(zx,zx+xs,px[i])-zx;
			int L=lower_bound(zy,zy+ys,py[i])-zy;
			int R=lower_bound(zy,zy+ys,qy[i])-zy;
			if(L>R)swap(L,R);
			for(int j=L;j<R;j++){
				wall[at][j]|=4;
				if(at)wall[at-1][j]|=1;
			}
		}else{
			int at=lower_bound(zy,zy+ys,py[i])-zy;
			int L=lower_bound(zx,zx+xs,px[i])-zx;
			int R=lower_bound(zx,zx+xs,qx[i])-zx;
			if(L>R)swap(L,R);
			for(int j=L;j<R;j++){
				wall[j][at]|=8;
				if(at)wall[j][at-1]|=2;
			}
		}
	}
/*	for(int i=0;i<xs;i++){
		for(int j=0;j<ys;j++)printf("%d ",wall[i][j]);
		printf("\n");
	}*/
	int d;scanf("%d",&d);
	while(d--){
		int p,q,r,s;
		scanf("%d%d%d%d",&p,&q,&r,&s);
		int P=lower_bound(zx,zx+xs,p)-zx-1;
		int Q=lower_bound(zy,zy+ys,q)-zy-1;
		int R=lower_bound(zx,zx+xs,r)-zx-1;
		int S=lower_bound(zy,zy+ys,s)-zy-1;
		deque<pair<int,int> > D;
		for(int i=0;i<210;i++)for(int j=0;j<210;j++)
			v[i][j]=0;
		for(int i=0;i<210;i++)for(int j=0;j<210;j++)
			bfs[i][j]=999999999;
		bfs[P][Q]=0;
		D.push_back(make_pair(P,Q));
		while(D.size()){
			int row=D.front().first;
			int col=D.front().second;
			D.pop_front();
			if(v[row][col])continue;
			for(int i=0;i<4;i++){
				if(row+dx[i]<0||col+dy[i]<0||
					row+dx[i]>=xs-1||col+dy[i]>=ys-1)continue;
				if(wall[row][col]&(1<<i)){
					if(!v[row+dx[i]][col+dy[i]]&&bfs[row+dx[i]][col+dy[i]]>bfs[row][col]+1){
						bfs[row+dx[i]][col+dy[i]]=bfs[row][col]+1;
						D.push_back(make_pair(row+dx[i],col+dy[i]));
					}
				}else{
					if(!v[row+dx[i]][col+dy[i]]&&bfs[row+dx[i]][col+dy[i]]>bfs[row][col]){
						bfs[row+dx[i]][col+dy[i]]=bfs[row][col];
						D.push_front(make_pair(row+dx[i],col+dy[i]));
					}
				}
			}
		}
	/*	for(int i=0;i<xs;i++){
			for(int j=0;j<ys;j++)printf("%d ",bfs[i][j]);
			printf("\n");
		}*/
		printf("%d\n",bfs[R][S]);
	}
}

Measured memory_bytes: 1532
n=int(input())
a=list(map(int,input().split()))
flg = 0
ans=1
for i in range(1,n):
  tmp = a[i-1]
  if a[i] == tmp:
    pass
  elif a[i] > tmp:
    if flg == 1:
      pass
    elif flg == -1:
      ans += 1
      flg = 0
    else:
      flg = 1
  else:
    if flg == -1:
      pass
    elif flg == 1:
      ans += 1
      flg = 0
    else:
      flg = -1
print(ans)

Measured memory_bytes: 14252
#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 watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n; cin>>n;
	int K; cin>>K;
	ll ans=0;
	forn(i,0,n){
		int x; cin>>x;
		if(x>=K) ans++;
	}
	cout<<ans<<'\n';
	
	return 0;
}


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

void fnInput(string& sTarget)
{
  cin >> sTarget;
}

int fnParse(string sTarget)
{
  const vector<string> cnvsWord{"dream", "dreamer", "erase", "eraser"};
  int ixBgn, ixEnd;
  ixBgn = sTarget.size();

  while (ixBgn)
  {
    bool bRslt = false;
    ixEnd = ixBgn;
    for (int i = 0; i < cnvsWord.size(); i++)
    {
      string sWord = "";
      ixBgn = ixEnd - cnvsWord[i].size();
      if (ixBgn < 0)  ixBgn = 0;

      for (int j = ixBgn; j < ixEnd; j++)
        sWord += sTarget[j];

      if (sWord == cnvsWord[i])
      {
        bRslt = true;
        break;
      }
    }
    if (!bRslt)  return 0;
  }
  return 1;
}

int main()
{
  string sTarget;
  
  fnInput(sTarget);
  if (fnParse(sTarget)) cout << "YES" << endl;
  else                  cout << "NO"  << endl;

  return 0;
}
 

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> pr;
typedef vector<ll> vll;
typedef vector<vector<int>> vv;
typedef vector<vector<ll>> vvll;
const ll inf = 1e16;
const ll md = 1000000007;
ll x[100005];
ll v[100005];
ll r[100005];
ll revr[100005];
ll l[100005];
ll revl[100005];

int main() {
  int n;
  ll c, sr = 0, sl = 0;
  cin >> n >> c;
  rep(i, n) cin >> x[i] >> v[i];
  rep(i, n) {
    sr += v[i];
    if (i > 1)
      r[i] = max(r[i - 1], sr - x[i]);
    else
      r[i] = sr - x[i];
    revr[i] = sr - x[i] * 2;
  }
  sr = 0;
  for (int i = n - 1; i >= 0; i--) {
    sr += v[i];
    if (i < n - 1)
      l[i] = max(l[i + 1], sr - (c - x[i]));
    else
      l[i] = sr - (c - x[i]);
    revl[i] = sr - (c - x[i]) * 2;
  }
  ll ans = max(r[n - 1], 0LL);
  ans = max(ans, l[0]);
  rep(i, n - 1) ans = max(ans, revr[i] + l[i + 1]);
  for (int i = n - 1; i > 0; i--) ans = max(ans, revl[i] + r[i - 1]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> x(n),y(n);
	rep(i,n){
		cin>>x[i]>>y[i];
	}
	int xin,xax,yin,yax;
	int c=0;
	ll ans=9000000000000000000;
	//cout<<ans<<endl;
	ll xx,yy;
	FOR(a1,0,n){
		FOR(a2,a1,n){
			FOR(a3,a2,n){
				FOR(a4,a3,n){
					xin=min(x[a1],min(x[a2],min(x[a3],x[a4])));
					xax=max(x[a1],max(x[a2],max(x[a3],x[a4])));
					yin=min(y[a1],min(y[a2],min(y[a3],y[a4])));
					yax=max(y[a1],max(y[a2],max(y[a3],y[a4])));
					c=0;
					rep(i,n){
						if(x[i]>=xin && x[i]<=xax && y[i]>=yin && y[i]<=yax){
							c++;
						}
					}
					xx=(xax-xin);
					yy=(yax-yin);
					//cout<<xx<<endl<<yy<<endl;
					if(c>=k ){
						ans=min(ans,xx*yy);
					}
					
				}
			}
		}
	}
	

	printf("%lld\n",ans);
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

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

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if(a < b) {a = b; return true;}
    return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if(a > b) {a = b; return true;}
    return false;
}

template<class T>
struct edge {
    int src, to;
    T cost;
};

template<typename T>
using Graph = vector<vector<edge<T>>>;


template<typename T>
void quick_sort(vector<T>& a, int l, int r) {
    if (l >= r) return;
    int i = l, j = r - 1;
    T pivot = a[(l + r) / 2];
    while (true) {
        while (a[i] < pivot) ++i;
        while (pivot < a[j]) --j;
        if (i >= j) break;
        swap(a[i], a[j]);
        ++i, --j;
    }
    quick_sort(a, l, i);
    quick_sort(a, j + 1, r);
}


int main() {

    int n; cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    quick_sort(a, 0, n);

    int alice = 0, bob = 0;
    REP(i, n) {
        (i & 1 ? bob : alice) += a[n-1-i];
    }

    cout << alice - bob << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    k--;
    s[k] -= 'A' - 'a';
    cout << s << endl;
}


Measured memory_bytes: 3584
<?php
// Your code here!
    $line = trim(fgets(STDIN));
    $new_string = "";
    while($string = trim(fgets(STDIN))){
        if($string=="END_OF_TEXT")break;
        $new_string .= $string." ";
        // echo $string;
    }
    $array = explode(" ",$new_string);
    // var_dump($array);
    $count=0;
    foreach($array as $value){
        if(stristr($value,$line) !==FALSE && strlen($value)==strlen($line)){
            $count++;
        }
    }
    echo $count;
    echo "\n";
?>


Measured memory_bytes: 9304
s = input()
if int(s[0])+int(s[1])+int(s[2])+int(s[3]) == 7:
    op1, op2, op3 = "+", "+", "+"
if int(s[0])+int(s[1])+int(s[2])-int(s[3]) == 7:
    op1, op2, op3 = "+", "+", "-"
if int(s[0])+int(s[1])-int(s[2])+int(s[3]) == 7:
    op1, op2, op3 = "+", "-", "+"
if int(s[0])+int(s[1])-int(s[2])-int(s[3]) == 7:
    op1, op2, op3 = "+", "-", "-"
if int(s[0])-int(s[1])+int(s[2])+int(s[3]) == 7:
    op1, op2, op3 = "-", "+", "+"
if int(s[0])-int(s[1])+int(s[2])-int(s[3]) == 7:
    op1, op2, op3 = "-", "+", "-"
if int(s[0])-int(s[1])-int(s[2])+int(s[3]) == 7:
    op1, op2, op3 = "-", "-", "+"
if int(s[0])-int(s[1])-int(s[2])-int(s[3]) == 7:
    op1, op2, op3 = "-", "-", "-"
print(s[0]+op1+s[1]+op2+s[2]+op3+s[3]+"=7")

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


struct edge { int u, v, cost; };

bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost;
}


const int MAX_N = 101;
const int MAX_E = 10000;
int par[MAX_N];
int r[MAX_N];

void init(int n) {
  for ( int i = 0; i < n; i++ ) {
    par[i] = i;
    r[i] = 0;
  }
}

int find(int x) {
  if ( par[x] == x ) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

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

  if ( r[x] < r[y] ) {
    par[x] = y;
  } else {
    par[y] = x;
    if ( r[x] == r[y] ) r[x]++;
  }
}

bool same(int x, int y) {
  return find(x) == find(y);
}



edge es[MAX_E];
int V, E;

int kruskal() {
  sort(es, es + E, comp);
  init(V);
  int res = 0;
  for ( int i = 0; i < E; i++ ) {
    edge e = es[i];
    if ( !same(e.u, e.v) ) {
      unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}

int main() {
  while( cin >> V >> E, V ) {

    for ( int i = 0; i < E; i++ ) {
      char ch;
      cin >> es[i].u >> ch >> es[i].v >> ch >> es[i].cost;
    }
  
    int ans = kruskal();
       cout << ((ans/100)-(V-1)) << endl;
  }
  return 0;
}

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

list = [-1]*n
for i in range(n):
    list[a[i] - 1] = i+1
# print(list)
print(list[0], end="")
for i in range(1, n):
    print(" ", end="")
    print(list[i], end="")

Measured memory_bytes: 13880
#include <stdio.h>
 
int main(){
    int j,s_length = 0;
    char s[101],p[101];
    scanf("%s",s);
    scanf("%s",p);
 
    for(int i = 0; s[i] != '\0';i++) s_length++;
 
    for(int left = 0;s[left] != '\0';left++){
        for(j = 0;p[j] != '\0' && p[j] == s[(left+j)%s_length];j++);
        if(p[j] == '\0'){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 2112
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, A, B;
int S[300011];
int ans[300011];

bool ok() {
    if (N < A || N < B) return false;
    if (A+B > N+1) return false;

    int cnt = 0;
    S[0] = A;
    cnt += A;
    for (int i=1; i<B; i++) {
	S[i] = 1;
	cnt += 1;
    }
    for (int i=1; i<B; i++) {
	int m = min(A - S[i], N - cnt);
	S[i] += m;
	cnt += m;
    }
    if (cnt != N) return false;

    int val = N;
    int pos = 0;
    REP (i, B) {
	for (int k=pos+S[i]-1; k>=pos; k--) {
	    ans[k] = val;
	    val--;
	}
	pos += S[i];
    }
    return true;
}

void MAIN() {
    scanf("%d%d%d", &N, &A, &B);

    if (ok()) {
	rprintf("%d", ans, ans+N);
    } else {
	puts("-1");
    }

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3968
#include "bits/stdc++.h"
#include <unordered_set>

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979323846

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;

//==============================================

#define MAX 300;

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

	int h;
	cin >> h;

	vi A(h + 1);

	REP3(i, 1, h) {
		cin >> A[i];
	}

	REP3(i, 1, h) {
		cout << "node " << i << ": key = " << A[i] << ", ";
		if (i / 2 >= 1) cout << "parent key = " << A[i / 2] << ", ";
		if (i * 2 <= h) cout << "left key = " << A[i * 2] << ", ";
		if (i * 2 + 1 <= h) cout << "right key = " << A[i * 2 + 1] << ", ";
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll a[3];
int main() {
  rep(i, 3)
    cin >> a[i];
  sort(a,a+3);
  int ans =0;
  rep(i,2)
    ans += a[i+1]-a[i];
  cout << ans << endl;
  
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        string s = sc.next();

        bool flag = true;
        for (int i = 0; i < s.Length; i++)
        {
            if ((i + 1) % 2 == 1)
            {
                if (s[i] == 'L')
                {
                    flag = false;
                    break;
                }
            }
            else
            {
                if (s[i] == 'R')
                {
                    flag = false;
                    break;
                }
            }
        }
        if (flag) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int main()
{
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    ans += min(k,a);
    k -= (a+b);
    if(k > 0)
    {
        ans -= k;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  }
  else {
    return gcd(b, a%b);
  }
}
int main() {
  ll N, X;
  cin >> N >> X;
  ll ans = 0; 
  for (int i = 0; i < N; i++) {
    ll x;
    cin >> x;
    ans = gcd(abs(X-x), ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
lst = list(input())
n = len(lst)

for i in range(2 ** (n - 1)):
    l = [lst[0]]
    for j in range(n - 1):
        if i >> j & 1:
            l.append("+")
        else:
            l.append("-")
        l.append(lst[j + 1])

    s = "".join(l)
    if eval(s) == 7:
        print(s + "=7")
        exit()

Measured memory_bytes: 3060
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x %= p;
  while (y > 0)
  {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
ll po(ll base, ll powerRaised)
{
  if (powerRaised != 0)
    return (base * po(base, powerRaised - 1));
  else
    return 1;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  set<ll> s;
  ll n;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    ll x;
    cin >> x;
    s.insert(x);
  }
  if (n == s.size())
    cout << "YES";
  else
    cout << "NO";

  return 0;
}


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

typedef long long int ll;
typedef long double ld;
const ll mx=1e9+7;
#define pb push_back

#define all(n) n.begin(),n.end()

void solve()
{
		string s;
		cin>>s;
		if(s[s.size()-1]=='s')cout<<s<<"es";
		else
		cout<<s<<"s";		

	
}

int main()
{
	
solve();
		
	
	
}

Measured memory_bytes: 3616
N,A,B = gets.split(" ").map(&:to_i)

sums = 0

def positons_sum(num)
  sum = 0
  until num == 0
    sum += num%10
    num = num/10
  end
  return sum
end

(0..N).each do |n|
  sum = positons_sum(n)
  sums += n if A <= sum && sum <= B
end

puts sums

Measured memory_bytes: 1788
//verma_ankit484

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

#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const int mod = (int) 1e9+7;

using namespace std;
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

vector<int> arr, seg;


int query(int v, int l, int r, int s, int e)
{
  if(l>r||s>e||r<s||l>e)
    return 0;      //if not in range we returned 0 so that it doesn't make any change
  if (s >= l && e <= r)
    return seg[v];
  int mid = (s+e)/2;
  return query(2*v, l, r, s, mid)+query(2*v+1, l ,r, mid+1, e);
}

void update(int v, int l, int r, int s, int e, int val)
{
  if(l>r||s>e||r<s||l>e)
    return;
  if (s >= l && e <= r)
  {
    seg[v] = val;
    return;
  }
  int mid = (s+e)/2;
  update(2*v, l , r, s, mid, val);
  update(2*v+1, l ,r, mid+1, e, val);
  seg[v] = seg[2*v]+seg[2*v+1];
}

bool srt(const pair<pair<int, int>, int> &p1, const pair<pair<int, int>, int> &p2) {
  return p1.first.second < p2.first.second;
}

int32_t main() {
  IOS
  #ifdef AV
  freopen("input.txt", "r", stdin);
  #endif
  int N = 500005;
  arr.resize(N, 0);
  seg.resize(4 * N + 1, 0);
  int n, q;
  cin >> n >> q;
  vector<int> vc(n);
  for (int i = 0; i < n; i++) cin >> vc[i];
  vector<pair<pair<int, int>, int>> qu(q);
  for (int i = 0; i < q; i++) {
    cin >> qu[i].first.first >> qu[i].first.second;
    qu[i].first.first--, qu[i].first.second--;
    qu[i].second = i;
  }
  sort(qu.begin(), qu.end(), srt);
  vector<int> last(500005, -1);
  vector<int> ans(q, 0);
  int lidx = 0;
  for (int i = 0; i < q; i++) {
    while (lidx <= qu[i].first.second) {
      int v = vc[lidx];
      if (last[v] != -1) {
        update(1, last[v], last[v], 0, N - 1, 0);
      }
      update(1, lidx, lidx, 0, N - 1, 1);
      last[v] = lidx;
      lidx++;
    }
    int val = query(1, qu[i].first.first, qu[i].first.second, 0, N - 1);
    ans[qu[i].second] = val;
  }
  for (auto i: ans) cout << i << endl;
  return 0;
}


Measured memory_bytes: 46744
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long

#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

int main() {
	const ul M = 1e9;
	ul n;
	cin >> n;
	vector<ul> a = vector<ul>(n, 0);
	rup(i, 0, n)cin >> a[i];
	sort(a.begin(), a.end());
	ul res = 0;
	for (int i = 0; i < n; i++) {
		ul seq = 1;
		ul j;
		for (j = i + 1; j < n; j++) {
			if (a[j] == a[i]) seq++;
			else break;
		}
		if (seq % 2 == 1)res++;
		i = j-1;
	}

	cout << res;


	return 0;
}





Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()



int main() {

	ll N, K;
	cin >> N >> K;
	vll A(N);
	rep(i, N) cin >> A[i];

	ll val = 0;
	rep(i, 60) {
		ll tmp = 1ull << i;
		map<ll, ll> count;
		rep(j, N) count[A[j] & tmp] += 1;
		if (count[0] > count[tmp]) val += tmp;
	}

	ford(i, 0, 60) {
		ll tmp = 1ull << i;
		ll a = K & tmp;
		ll b = val & tmp;
		if (a < b) val -= tmp;
		else if (a > b) break;
	}

	ll ans = 0;
	rep(i, N) {
		ans += val ^ A[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024