akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

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

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	ll H, W, D, A[305][305], Q, L[100005], R[100005], cost[100005];
	pair<int, int> P[100005];
	cin >> H >> W >> D;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {

			cin >> A[i][j];
			P[A[i][j]] = make_pair(i, j);

		}
	}
	cin >> Q;
	for (int i = 1; i <= Q; i++) {

		cin >> L[i] >> R[i];

	}
	for (int i = 1; i <= D; i++) {

		cost[i] = 0;

	}
	for (int i = D + 1; i <= H*W; i++) {

		cost[i] = cost[i - D] + abs(P[i].first - P[i - D].first) + abs(P[i].second - P[i - D].second);

	}

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

		cout << cost[R[i]] - cost[L[i]] << endl;

	}

	return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int getDigit(int n) {
    int ret = 0;
    while(n != 0) {
        n /= 10;
        ret++;
    }
    return ret;
}

signed main() {
    int n; cin >> n;

    int ans = INF;
    for(int i=1; i*i <= n; i++) {
        if(n % i == 0) {
            int a = i, b = n / i;
            int d = max(getDigit(a), getDigit(b));
            ans = min(ans, d);
        }
    }
    cout << ans << endl;
    return 0;
}

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

struct P{
  int to;
  int index;
};

vector<vector<P>> G;
vector<int> ans;
int K = 0;

void dfs(int point,int parent,int col){
  int nowcolor = 1;
  for(auto e:G[point]){
    if(e.to != parent){
      if(nowcolor == col) nowcolor++;
      ans[e.index] = nowcolor;
      K            = max(K, nowcolor);
      dfs(e.to,point,nowcolor);
      nowcolor++;
    }
  }
}

int main() {
    int N;
    cin >> N;
    G.resize(N);
    ans.resize(N - 1);

    rep(i,N-1){
      int a,b;
      cin >> a >> b;
      a--;b--;
      G[a].push_back({b,i});
      G[b].push_back({a,i});
    }

    dfs(0,-1,0);

    cout << K << endl;
    rep(i,N-1) cout << ans[i] << endl;
}

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

using namespace std ;

#define IOS ios::sync_with_stdio(0); cin.tie(0), cout.tie(0)
#define ll long long int 

#define fr first
#define se second

#define all(v) v.begin(),v.end() 
#define rall(v) v.rbegin(),v.rend()
#define sz(v) v.size() 

#define pb push_back
#define mp make_pair 

#define PI 3.141592653589793238



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


//bool valid(int x, int y){return x > 0 && x < 9 && y > 0 && y < 9;}

int cntr,n, m, c;

int main(){
  cin >> n >> m >> c;
  for(int i = min(n,m) ; i > 0 ; i--){
    if(n%i == 0 && m%i == 0)
      c--;
    if(!c){
      cout << i;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int maxn=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	string a,b;
	cin>>a>>b;
	rep(i,0,n-1) cout<<a[i]<<b[i];
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,ans,k;char a; 
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	in(n);
	for(int i=1;i<=n;i++){
		scanf("%c",&a);
		if(a=='I')k++;
		else k--;
		ans=max(ans,k);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a,b;
long long ans;
int main(){
	cin>>a>>b;
	int l=b-a+1;
	if(l==1){
		ans=a ;
	}else{
		if(a%2==0){
			if(b%2==0){
				if(((l-1)/2)%2==0){
					ans=0^b ;
				}else{
					ans=1^b ;
				}
			}else{
				if((l/2)%2==0){
					ans=0 ;
				}else{
					ans=1 ;
				}
			}
		}else{
			if(b%2==0){
				if((l/2)%2==0){
					ans=a^1^b ;
				}else{
					ans=a^b ;
				}
			}else{
				if(((l-1)/2)%2==0){
					ans=a ;
				}else{
					ans=a^1 ;
				}
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 50
using namespace std;
int n,setfa[MAXN+5],x[MAXN+5],y[MAXN+5];
int Findfa(int x)
{
	if(setfa[x]==x)
		return x;
	return setfa[x]=Findfa(setfa[x]);
}
bool Union(int x,int y)
{
	x=Findfa(x),y=Findfa(y);
	if(x==y)	return false;
	setfa[x]=setfa[y];
	return true;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d %d",&x[i],&y[i]);
	int ans=n;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
		{
			int p=x[j]-x[i],q=y[j]-y[i];
			for(int k=1;k<=n;k++)
				setfa[k]=k;
			int blo=n;
			for(int k=1;k<=n;k++)
				for(int z=1;z<=n;z++)
					if(x[z]-x[k]==p&&y[z]-y[k]==q)
						blo-=Union(z,k);
			ans=min(ans,blo);
		}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  string n;
  cin>>n;
  for(int i=0;i<3;++i){
    if(n[i]=='1')n[i]='9';
    else n[i]='1';
  }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(a) cout << #a << ": " << a << endl
using ll = long long;
#define int long long
int trailing_zeros(int n) {
    if (n == 0) {
        return -1;
    }
    int count = 0;
    while (n % 2 == 0) {
        count++;
        n >>= 1;
    }
    return count;
}

int32_t main(){
	int n; cin>>n;
	vector<int> a(n);
	rep(i,n) {
		cin>>a[i];
	}
	int ans = 30;
	rep(i, n){
		//debug(trailing_zeros(a[i]));
		ans = min(ans, trailing_zeros(a[i]));
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

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

    static class TaskC {
        int RED = 0;
        int BLUE = 1;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();

            TaskC.Point[] points = new TaskC.Point[2 * N];

            for (int i = 0; i < N; i++) {
                points[i] = new TaskC.Point(in.nextInt(), in.nextInt(), RED);
            }
            for (int i = 0; i < N; i++) {
                points[N + i] = new TaskC.Point(in.nextInt(), in.nextInt(), BLUE);
            }

            Arrays.sort(points, (p1, p2) -> p1.x - p2.x);

            int ans = 0;

            TreeSet<TaskC.Point> reds = new TreeSet<>((p1, p2) -> p1.y - p2.y);

            for (TaskC.Point p : points) {
                if (p.color == RED) {
                    reds.add(p);
                } else {
                    TaskC.Point redPair = reds.floor(p);
                    if (redPair != null) {
                        ans++;
                        reds.remove(redPair);
                    }
                }
            }

            out.println(ans);
        }

        static class Point {
            int x;
            int y;
            int color;

            public Point(int x, int y, int color) {
                this.x = x;
                this.y = y;
                this.color = color;
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 27604
//file_name:ABC49_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("vowel");}else{puts("consonant");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


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

    if(s[0]=='a'||s[0]=='i'||s[0]=='u'||s[0]=='e'||s[0]=='o')yn;

    return 0;
}



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

N = int(input())
AN = list(map(int, input().split()))

BN = [0] * (N//2+1)

# 偶奇で分けて集計
for i in range(N):
    if N % 2 != 0:
        BN[N//2 - AN[i]//2] += 1
    else:
        BN[N//2 - (AN[i]//2+1)] += 1

# 偶数の場合は真ん中を考慮
ans = 0
for i in range(len(BN)):
    if BN[i] > 2 or N % 2 != 0 and BN[-1] > 1:
        print(0)
        exit()

# 結果出力
print(2 ** (N//2) % (10 ** 9 +7))

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

signed main() {
  int a, b, c, k; cin >> a >> b >> c >> k;
  int mx = max({a, b, c});
  int ans = mx;
  for(int i = 0; i < k; i++) ans *= 2;
  cout << (a+b+c) - mx + ans << endl;
  return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
//const int INF = INT_MAX  ;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;


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

    int zero = 0;
    int one = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') {
            zero++;
        } else {
            one++;
        }
    }


    cout << min(zero, one) * 2 << endl;
}



Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(n: usize,a: [i64;n]);
    let result = solve(n,a);
    println!("{:?}",result);
}

fn solve(n: usize,nums: Vec<i64>) -> i64 {
    let mut diffs: Vec<i64> = vec![0;n]; 
    for (i,num) in nums.iter().enumerate() {
        diffs[i] = *num - (i as i64 + 1);
    }
    diffs.sort();
    let center = if n % 2 == 0  { (diffs[n / 2 - 1] + diffs[n / 2]) / 2} else { diffs[n / 2] };
    diffs.iter().fold(0,|sum,cur| 
        sum + (cur - center).abs()
    )
}

Measured memory_bytes: 10492
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int OO = (int) 2e9;
const double eps = 1e-9;

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	while (a >= b) {
		b *= 2, k--;
	}
	while (b >= c) {
		c *= 2;
		k--;
	}
	if (k >= 0)
		puts("Yes");
	else
		puts("No");
	return 0;
}


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

public class Main{
    public static void main(String[] args)throws Exception{
        int[] s={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
        Scanner sc=new Scanner(System.in);
        int k=sc.nextInt();
        System.out.println(s[k-1]);
    }
}

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

int H,W;int dp[10][10];

int main() {
  cin >> H >> W;
  for (int i=0;i<10;i++) {
    for (int j=0;j<10;j++) {
      cin >> dp[i][j];
    }
  }
  for (int k=0;k<10;k++) {
    for (int i=0;i<10;i++) {
      for (int j=0;j<10;j++) {
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }
  int cost=0;
  for (int i=0;i<H;i++) {
    for (int j=0;j<W;j++) {
      int x;cin >> x;
      if (x==-1) continue;
      cost+=dp[x][1];
    }
  }
  cout << cost << endl;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  vector<int> z;
  for(int i=0;i<n;i++){
    cin>>a[i];
    z.push_back(a[i]);
  }
  sort(begin(z),end(z));
  for(int i=0;i<n;i++){
    if(a[i]<=z[n/2-1]){
      cout<<z[(n/2)]<<endl;
    }else{
      cout<<z[(n/2)-1]<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <cassert>
#include <deque>
using namespace std;
#define int64_t long long
constexpr int64_t MOD=1e9+7;
int cnt[100010];
int main() {
    int k,n;
    scanf("%d%d",&n,&k);
    vector<pair<int,int>> p;
    for(int i=0;i<n;++i){
        int t,d;
        scanf("%d%d",&t,&d);
        p.push_back({d,t});
    }
    sort(p.begin(),p.end());
    reverse(p.begin(),p.end());
    int64_t sum=0,ans=0;
    int64_t T=0;
    for(int i=0;i<k;++i){
        int d=p[i].first;
        int t=p[i].second;
        sum+=d;
        if(cnt[t]==0)++T;
        cnt[t]++;
    }
    ans=sum+T*T;
    int i=k-1;
    int j=k;
    while(i>=0){
        int d=p[i].first;
        int t=p[i].second;
        if(cnt[t]>1){
            while(j<n){
                if(cnt[p[j].second]==0){
                    break;
                }
                ++j;
            }
            if(j<n){
                int dj=p[j].first;
                int tj=p[j].second;
                cnt[t]--;
                T++;
                cnt[tj]++;
                sum+=-d+dj;
                ans=max(ans,sum+T*T);
            } else break;
        }
        --i;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1524
import std.stdio,std.conv,std.string;

void main(){
	int sum;
	auto N = readln().chomp().to!int();
	auto list = readArray!int();

	foreach( elm ; list ){
		while( elm%2 == 0 ){
			elm /= 2;
			sum++;
		}
	}
	
	writeln(sum);
}

T[] readArray(T)(){
	T[] ret;
	foreach( elm ; readln().split() ){
		ret ~= elm.to!T();
	}
	return ret;
}

Measured memory_bytes: 2684
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

void speed_solve(){
    string s;
    cin >> s;
    if(s[s.length() - 1] == 's') cout << s << "es" << endl;
    else cout << s << "s" << endl;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

template<typename T>inline void check_min(T a,T &b){if(a<b)b=a;}
template<typename T>inline void check_max(T a,T &b){if(a>b)b=a;}

namespace xiangbudaoxiangbudao
{
	typedef long long ll;
	const int N=52,M=N*N*N;
	const ll INF=4223372036854775807ll;

	struct NIDAGE
	{
		ll f[M];
		void reset()
		{
			f[0]=0;
			for(int i=1;i<M;i++)
				f[i]=INF;
		}
		void put(ll cost,int val)
		{
			for(int i=M-1;i>=val;i--)
				check_min(f[i-val]+cost,f[i]);
		}
		void insert(ll cost,int val,int num)
		{
			for(int k=1;k<=num;k<<=1)
				put(cost*k,val*k),num-=k;
			if(num)put(cost*num,val*num);
		}
	}d;

	struct item
	{
		ll cost;
		int val,num;
	}s[N];

	bool operator < (item A,item B)
	{
		return A.val*B.cost>B.val*A.cost;
	}

	int fa[N];

	int n,m,cnt;

	void initialize()
	{
		scanf("%d%d%d",&n,&m,&cnt);
		scanf("%lld",&s[1].cost);
		for(int i=2;i<=n;i++)
			scanf("%lld%d",&s[i].cost,fa+i);
		for(int i=1;i<=n;i++)s[i].val=1;
		for(int i=n;i;i--)s[fa[i]].val+=s[i].val,s[fa[i]].cost+=s[i].cost;

		s[1].num=m/s[1].cost+2333;
		for(int i=2;i<=n;i++)s[i].num=cnt;
		std::sort(s+1,s+n+1);

		d.reset();
		for(int i=1;i<=n;i++)
		{
			int tmp=std::min(50,s[i].num);
			s[i].num-=tmp;
			d.insert(s[i].cost,s[i].val,tmp);
		}
	}
	ll calc(ll lim)
	{
		ll ret=0;
		for(int i=1;i<=n;i++)
		{
			if(s[i].num==0 || s[i].cost<=lim/s[i].num)
			{
				ret+=s[i].num*s[i].val;
				lim-=s[i].cost*s[i].num;
			}
			else 
			{
				ret+=(lim/s[i].cost)*s[i].val;
				break;
			}
		}
		return ret;
	}
	void solve()
	{
		initialize();
		ll ans=0;

		for(int i=0;i<M;i++)
		{
			if(d.f[i]>m)break;
			check_max(i+calc(m-d.f[i]),ans);
		}
		printf("%lld\n",ans);
	}
}

int main()
{
	xiangbudaoxiangbudao::solve();
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i , n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int d[256];
int main (){
    string s;
    cin >> s;
    for(auto i : s){
        d[i]++;
    }
    for(auto i : d){
        if(i & 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3576
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<max({a+b,2*a-1,2*b-1})<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void){
	long N,K;
	long a,b,c;
	long an,bn,cn;
	scanf("%ld %ld",&N,&K);
	long p = N/K;
	long ans = 0;

	//a%K = 0
	ans += p*p*p;

	//a%K = 1,2,...,N-pK
	for(a=1;a<=N-p*K;a++) {
		//b%K = K-i
		b = K-a;
		c = K-a;
		if (((b+c)%K)==0) {
			ans += ((a<=N-p*K)?(p+1):p)*((b<=N-p*K)?(p+1):p)*((c<=N-p*K)?(p+1):p);
		}
	}
	if (N-p*K+2<=K) {
		for (a=N-p*K+1;a<=K-1;a++) {
			b = K-a;
			c = K-a;
			if (((b+c)%K)==0) {
				ans += ((a<=N-p*K)?(p+1):p)*((b<=N-p*K)?(p+1):p)*((c<=N-p*K)?(p+1):p);
			}
		}
	}
	printf("%ld\n",ans);
	
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
#define N 4
int main(){
    int n,in,tmp;
    cin >> n;
    vector<int> data;
    int t;
    for(int i = 0; i < n; ++i) {
        cout << "Case " << i+1 << ":" << endl;
        cin >> in;
        for(int k = 0; k < 10; ++k) {
            data.clear();
            tmp = pow(in,2);
            for(int j = 0; j < 2*N; ++j) {
                t = pow(10,2*N-j-1);
                if (2*N-N/2 >= j && j >= N/2) {
                    data.push_back(tmp/t);
                }
                tmp = tmp%t;
            }
            int next(0),l(4);
            for(vector<int>::iterator it = data.begin(); it != data.end(); ++it) {
                next += *it * pow(10,--l);
            }
            cout << next << endl;
            in = next;
        }
    }
}

Measured memory_bytes: 1260
n = int(input())
dct_id = {}
dct_city = {}
cities = []
for i in range(n):
  tmp = input()
  city = tmp.split()[0]
  score = int(tmp.split()[1])
  dct_id[score] = i+1
  #print(city, score)
  if city not in dct_city.keys():
    dct_city[city] = [score]
  else:
    dct_city[city].append(score)
  cities.append(city)
cities = list(set(cities))
cities.sort()
#print(cities)
for city in cities:
  #print(city)
  score_list = dct_city[city]
  score_list.sort(reverse=True)
  #print(score_list)
  for score in score_list:
    print(dct_id[score])
    #print(city,score,dct_id[score])
    

Measured memory_bytes: 3064
#include<stdio.h>
int J[1002][1002],O[1002][1002],I[1002][1002];
int a[100001],b[100001],c[100001],d[100001];
char joi[1001][1001];
int main(void)
{
	int M,N,K,i,j,sumJ,sumO,sumI;
	scanf("%d%d%d",&M,&N,&K);
	for(i=1;i<=M;i++){
		for(j=1;j<=N;j++){
			scanf(" %c",&joi[i][j]);
		}
	}
	for(i=1;i<=M;i++){
		for(j=1;j<=N;j++){
			J[i][j]=0;
			O[i][j]=0;
			I[i][j]=0;
		}
	}
	for(i=1;i<=M;i++){
		for(j=1;j<=N;j++){
			if(joi[i][j]=='J'){
				J[i][j]++;
			}
			if(joi[i][j]=='O'){
				O[i][j]++;
			}
			if(joi[i][j]=='I'){
				I[i][j]++;
			}
			J[i][j+1]+=J[i][j];
			O[i][j+1]+=O[i][j];
			I[i][j+1]+=I[i][j];
		}
	}
	for(i=1;i<=N;i++){
		for(j=1;j<M;j++){
			J[j+1][i]+=J[j][i];
			O[j+1][i]+=O[j][i];
			I[j+1][i]+=I[j][i];
		}
	}
	for(i=1;i<=K;i++){
		scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]);
	}
	for(i=1;i<=K;i++){
		sumJ=0;
			sumJ+=J[c[i]][d[i]];
			sumJ-=J[a[i]-1][d[i]];
			sumJ-=J[c[i]][b[i]-1];
			sumJ+=J[a[i]-1][b[i]-1];
		sumO=0;
			sumO+=O[c[i]][d[i]];
			sumO-=O[a[i]-1][d[i]];
			sumO-=O[c[i]][b[i]-1];
			sumO+=O[a[i]-1][b[i]-1];
		sumI=0;
			sumI+=I[c[i]][d[i]];
			sumI-=I[a[i]-1][d[i]];
			sumI-=I[c[i]][b[i]-1];
			sumI+=I[a[i]-1][b[i]-1];
		printf("%d %d %d\n",sumJ,sumO,sumI);
	}
	return 0;
}

Measured memory_bytes: 16844
import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		int[] Y = new int[N];
		long[] P = new long[N];
		for(int i = 0; i < N; ++i) {
			X[i] = sc.nextInt();
			Y[i] = sc.nextInt();
			P[i] = sc.nextInt();
		}
		long inf = (1L << 62);
		long[] cost = new long[1 << N];
		long[][] dp = new long[1 << N][N + 1];
		for(int i = 0; i < 1 << N; ++i) {
			cost[i] = inf;
			for(int j = 0; j < N; ++j) {
				if(((i >> j) & 1) == 0) continue;
				long sumx = 0, sumy = 0;
				for(int k = 0; k < N; ++k) {
					if(((i >> k) & 1) == 0) continue;
					sumx += Math.abs(X[j] - X[k]) * P[k];
					sumy += Math.abs(Y[j] - Y[k]) * P[k];
				}
				cost[i] = Math.min(cost[i], sumx);
				cost[i] = Math.min(cost[i], sumy);
			}
			for(int j = 1; j <= N; ++j) {
				dp[i][j] = inf;
			}
			for(int j = 0; j < N; ++j) {
				if(((i >> j) & 1) == 1) {
					dp[i][0] += Math.min(Math.abs(X[j]), Math.abs(Y[j])) * P[j];
				}
			}
		}
		int[] bitcnts = new int[1 << N];
		for(int i = 0; i < 1 << N; ++i) {
			bitcnts[i] = 0;
			for(int j = 0; j < N; ++j) {
				bitcnts[i] += ((i >> j) & 1);
			}
		}
		for(int i = 0; i < 1 << N; ++i) {
			for(int j = i; j >= 1; j = (j - 1) & i) {
				int last = bitcnts[i - j];
				for(int k = 0; k <= last; ++k) {
					dp[i][k + 1] = Math.min(dp[i][k + 1], dp[i - j][k] + cost[j]);
				}
			}
		}
		for(int i = 0; i <= N; ++i) {
			System.out.println(dp[(1 << N) - 1][i]);
		}
	}
}

Measured memory_bytes: 42692
n=int(input())
dp=[0]*(n+1)
h=list(map(int,input().split()))
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Measured memory_bytes: 52976
#include <bits/stdc++.h>
#define int long long
using namespace std;


signed main(){
	int H,N; cin>>H>>N;
	vector<int> dp(100000+1000,999999999999);
	vector<int>A(N);
	vector<int>B(N);
	dp[0]=0;
	for(int i=0;i<N;i++)cin>>A[i]>>B[i];
	for(int j=0;j<=H;j++){
		for(int i=0;i<N;i++){
			dp[j+A[i]]=min(dp[j+A[i]],dp[j]+B[i]);
		}
	}	
	int maxA=*max_element(A.begin(),A.end());
	int ans=dp[H];
	for(int i=0;i<=maxA;i++){
		ans=min(ans,dp[H+i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void) {
	int heap[251], heap_size, i;

	scanf("%d", &heap_size);
	for (i = 1; i <= heap_size; i++) {
		scanf("%d", heap+i);
	}
	for (i = 1; i <= heap_size; i++) {
		printf("node %d: key = %d, ", i, heap[i]);
		if (i/2 > 0) {
			printf("parent key = %d, ", heap[i/2]);
		}
		if (2*i <= heap_size) {
			printf("left key = %d, ", heap[2*i]);
		}
		if (2*i+1 <= heap_size) {
			printf("right key = %d, ", heap[2*i+1]);
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    //freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    ll x=0,n,c;
    c=INT_MIN;
    cin>>n;
    string s;
    cin>>s;
    for(ll i=0;i<n;i++)
    {
        if(s[i]=='I')
         x++;
         c=max(c,x);
        if(s[i]=='D')
         x--;

        c=max(c,x);  
    }
    cout<<c<<endl;
    return 0;

}

Measured memory_bytes: 3620
n=int(input())
arr=input()
prod=1
k=1;
l=list(map(int,arr.split(' ')))
#l.sort()

for x in l:
    if(x==0):
        k=0
        break

if(k==0):
    print(0)
else:
    for x in l:
        prod*=x
        if(prod>1000000000000000000):
            prod=-1
            break
    print(prod)


 

Measured memory_bytes: 23612
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    int n; cin >> n;
    vector<mint> a(n);
    mint sum = 0;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    mint ans = 0;
    for(int i=0; i<n; i++){
        ans += a[i] * (sum - a[i]);
    }

    cout << ans / 2 << endl;

    return 0;



}

Measured memory_bytes: 4752
#include <stdio.h>

int main () {

    int i, x, y, s;

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

        scanf("%d", &x); scanf("%d", &y);

        if (x == 0 && y == 0) {
            break;
        } else if (x > y) {
            s = x;
            x = y;
            y = s;
        } 

        printf("%d %d\n", x, y);

    }

    return 0;

}



Measured memory_bytes: 2052
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        Set<String> set = new HashSet<String>();
        for (long l = 0; l < n; l++) {
            set.add(sc.next());
        }
        sc.close();
        System.out.println(set.size());
    }
}


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

int main(){
  int n, k;
  int h;
  int ans = 0;

  cin >> n >> k;
  for(int i = 0; i < n; i++){
    cin >> h;
    if(h >= k)ans++;
  }
    
  cout << ans;

  return 0;
}

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

typedef long long int ll;

void fileioe(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout); 
	freopen("error.txt","w",stderr);
}
#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
#define fioe() fileioe()
#else
#define fioe() 1
#endif
//!

int main()
{
	GO
	//fioe();
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5]){
		cout<<"Yes"<<endl;
	}	
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

int main()
{
    int N, Y;
    cin >> N >> Y;
    for(int i=0; i<=N; i++){
        for(int j=0; i+j<=N; j++){
            auto k = N - i - j;
            int vsum = 0;
            vsum += 10000 * i;
            vsum += 5000 * j;
            vsum += 1000 * k;
            if(vsum == Y){
                cout << i <<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1"<<endl;
    return 0;
}

Measured memory_bytes: 256
// E. Magical Permutation
// time limit per test1 second
// memory limit per test256 megabytes
// inputstandard input
// outputstandard output
// Kuro has just learned about permutations and he is really excited to create a
// new permutation type. He has chosen 𝑛 distinct positive integers and put all
// of them in a set 𝑆. Now he defines a magical permutation to be:

// A permutation of integers from 0 to 2𝑥−1, where 𝑥 is a non-negative integer.
// The bitwise xor of any two consecutive elements in the permutation is an
// element in 𝑆. Since Kuro is really excited about magical permutations, he
// wants to create the longest magical permutation possible. In other words, he
// wants to find the largest non-negative integer 𝑥 such that there is a magical
// permutation of integers from 0 to 2𝑥−1. Since he is a newbie in the subject,
// he wants you to help him find this value of 𝑥 and also the magical
// permutation for that 𝑥.

// Input
// The first line contains the integer 𝑛 (1≤𝑛≤2⋅105) — the number of elements in
// the set 𝑆.

// The next line contains 𝑛 distinct integers 𝑆1,𝑆2,…,𝑆𝑛 (1≤𝑆𝑖≤2⋅105) — the
// elements in the set 𝑆.

// Output
// In the first line print the largest non-negative integer 𝑥, such that there
// is a magical permutation of integers from 0 to 2𝑥−1.

// Then print 2𝑥 integers describing a magical permutation of integers from 0 to
// 2𝑥−1. If there are multiple such magical permutations, print any of them.

// Examples
// inputCopy
// 3
// 1 2 3
// outputCopy
// 2
// 0 1 3 2
// inputCopy
// 2
// 2 3
// outputCopy
// 2
// 0 2 1 3
// inputCopy
// 4
// 1 2 3 4
// outputCopy
// 3
// 0 1 3 2 6 7 5 4
// inputCopy
// 2
// 2 4
// outputCopy
// 0
// 0
// inputCopy
// 1
// 20
// outputCopy
// 0
// 0
// inputCopy
// 1
// 1
// outputCopy
// 1
// 0 1
// Note
// In the first example, 0,1,3,2 is a magical permutation since:

// 0⊕1=1∈𝑆
// 1⊕3=2∈𝑆
// 3⊕2=1∈𝑆
// Where ⊕ denotes bitwise xor operation.

#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

using namespace std;

int n, m;
int i, j, k;

void solve() {
  cin >> n;
  cout << (3 * n * n) << endl;
  return;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SP << " " <<
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

#define int long long

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, D;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  REP(i, N) REP(j, D) cin >> X[i][j];
  int ans = 0;
  for(int i = 0; i < N - 1; i++) {
    for(int j = i + 1; j < N; j++) {
      int sum = 0;
      REP(k, D) { sum += pow(X[i][k] - X[j][k], 2); }
      int tmp = sqrt(sum);
      if(tmp * tmp == sum) { ans++; }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	string s;
	cin >> s;
	s[3] = '8';
	cout << s << endl;
	return 0;
}

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

int main(){
      int x1,y1,x2,y2;cin >> x1 >> y1 >> x2 >> y2;
      int x = x2 - x1;
      int y = y2 - y1;
      cout << x2 - y << " " << y2 + x << " " << x1 - y << " " << y1 + x;
}

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

using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL);


#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
typedef long long int llint;

int main(){
        fast_io
        string s1, s2;
        cin >> s1 >> s2;
        if(s1 == s2.substr(0,s1.size())) cout << "Yes\n";
        else cout << "No\n";
}


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

int len;
bool b=false;
int main(){
	char ch[65536];
	cin>>ch;
	len=strlen(ch);
	for(int i=0;i<len;i++){
		if(ch[i]=='C'){
			b=true;
		}
		if(ch[i]=='F'){
			if(b==true){
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

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

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

    sort(s.begin(),s.end());
    sort(d.begin(), d.end());
    reverse(d.begin(), d.end());

    if (s < d){
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int c=-1,f=-1;
    for(int i=0;i<s.size();i++){
        if(c==-1&&s.at(i)=='C'){
            c=i;
        }
        if(s.at(i)=='F'){
            f=i;
        }
    }
    if(min(c,f)>=0&&c<f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

class UnionFindTree {
   public:
    vector<int> parent;

    UnionFindTree(int n) {
        parent.resize(n);
        for (int i = 0; i < n; i++) {
            parent[i] = i;
        }
    }

    int root(int x) {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y) {
        int rx = root(x); int ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
    }

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

int main() {
    int N, M, K; cin >> N >> M >> K;
    UnionFindTree G(N);
    vector<set<int>> F(N);
    REP(i, 0, M) {
        int a, b; cin >> a >> b;
        G.unite(--a, --b);
        F[a].insert(b);
        F[b].insert(a);
    }
    vector<set<int>> B(N);
    REP(i, 0, K) {
        int a, b; cin >> a >> b;
        a--; b--;
        B[a].insert(b);
        B[b].insert(a);
    }

    vector<vector<int>> g(N);
    REP(i, 0, N) {
        g[G.root(i)].push_back(i);
    }

    REP(i, 0, N) {
        // cout << endl << "size of [" << i + 1 << "] : " << g[G.root(i)].size() << endl;
        int ans = g[G.root(i)].size() - 1 - F[i].size();
        for (auto b : B[i]) if (G.same(i, b)) ans--;
        cout << ans;
        if (i != N - 1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 34432
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main(void)
{
    int n,i;
    long a,t[200000],m=LONG_MAX;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%ld",&a);
        t[i]=a;
        if(0<i)t[i]+=t[i-1];
    }
    for(i=0;i<n-1;i++)if(m>labs(2*t[i]-t[n-1]))m=labs(2*t[i]-t[n-1]);
    printf("%ld",m);
    return 0;
}

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

#define INF 100100100
#define MOD 1000000007

using namespace std;

int main(int argc, char const* argv[])
{
   string S,T;
   cin >> S >> T;
   vector<int>f(26,-1),g(26,-1);
   for(int i=0;i<S.size();i++){
      int a = S[i] - 'a';
      int b = T[i] - 'a';

      if(f[a] != -1 || g[b] != -1){
         if(f[a] != b || g[b] != a){
            cout << "No" << endl;
            return 0;
         }
      }

      f[a] = b;
      g[b] = a;

   }
   cout << "Yes" << endl;
   return 0;
}


Measured memory_bytes: 776
#include <stdio.h>

int main(void) {
    int a,b;
    
    scanf("%d %d",&a,&b);
    
   if(a > b) {
       printf("a > b\n");
   }
   
   if(a == b) {
       printf("a == b\n");
   }
   
   if(a < b){
       printf("a < b\n");
   }
   
    return 0;
}




Measured memory_bytes: 2044
s = input()
mod = 10 ** 9 + 7

l = len(s)
s = [int(e) if e != "?" else -1 for e in s]
dp = [[0] * 13 for _ in range(l + 1)]
dp[0][0] = 1

for i in range(l):
	for k in range(10):
		if s[i] == -1 or s[i] == k:
			for j in range(13):
				nj = (j * 10 + k) % 13
				dp[i+1][nj] += dp[i][j]
				dp[i+1][nj] %= mod

ans = dp[l][5]
print(ans)


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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s;
    cin >> s;
    bitset<26> b;
    for (auto &c : s) {
        b[c - 'a'] = true;
    }
    for (int i = 0; i < 26; i++) {
        if (b[i] == false) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None\n";

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 512
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    l,r,d = readInt()
    ans = 0
    for i in range(l,r+1):
        if i%d==0:
            ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 9168