akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;


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

	int N;
	cin >> N;
	vector<ll> a(N);
	REP(i, N) cin >> a[i];
	ll res = -N;
	REP(i, N) res += a[i];
	cout << res << "\n";

	return 0;
}


Measured memory_bytes: 256
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

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

int main() {
  init();

  int N;
  cin >> N;
  vi P(N * N);
  cin >> P;

  int a[N][N];
  bool e[N][N] = {0};
  rep(i, (N + 1) / 2) {
    rep(j, N - i * 2) {
      a[i][j + i] = i;
      a[j + i][i] = i;
      a[N - i - 1][j + i] = i;
      a[j + i][N - i - 1] = i;
    }
  }

  int result = 0;
  for (int p : P) {
    p--;
    result += a[p / N][p % N]--;
    e[p / N][p % N] = 1;
    queue<int> que;
    que.push(p);
    vb visited(N * N, 0);
    while (!que.empty()) {
      int now = que.front();
      que.pop();
      visited[now] = 1;
      rep(i, 4) {
        int ny = now / N + dy[i];
        int nx = now % N + dx[i];
        int next = ny * N + nx;
        if (nx < 0 || nx >= N || ny < 0 || ny >= N || visited[next]) continue;
        if (chmin(a[ny][nx], a[now / N][now % N] + !e[ny][nx])) {
          que.push(next);
        }
      }
    }
  }

  out(result);
}


Measured memory_bytes: 5556
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] o = sc.next().toCharArray();
		char[] e = sc.next().toCharArray();
		sc.close();
		PrintWriter pw = new PrintWriter(out);
		for(i=0;i<e.length;i++) {
			pw.print(o[i]);
			pw.print(e[i]);
		}
		if(o.length!=e.length) {
			pw.print(o[o.length-1]);
		}
		pw.println();
		pw.flush();
	}
}


Measured memory_bytes: 21716
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("sse,sse2")
#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;

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

template<class T>
using ordered_multiset = tree <T, null_type ,  less_equal<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvii = vector<vii>;

#define all(x) x.begin(), x.end()
#define all_r(x) x.rbegin(), x.rend()
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, n) for(int i = n; i >= 0; --i)
#define f first
#define s second

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	char a;
	cin >> a;
	cout << (isupper(a) ? 'A' : 'a') << '\n';
 	return 0;
}

Measured memory_bytes: 3552
import math

k = int(input())
a,b = map(int, input().split())

if math.floor(b/k) - math.floor(a/k) >= 1 :
    print("OK")
elif a%k == 0 or b%k == 0 :
    print("OK")
elif a<=k and k<=b:
    print("OK")
else:
    print("NG")



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

typedef long long ll;

int main() {
    auto start = high_resolution_clock::now();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll K;
    cin >> K;

    queue<ll> q;
    for (int i = 1; i < 10; ++i) {
        q.push(i);
    }

    for (int i = 1; ; ++i) {
        ll n = q.front();
        if (i == K) {
            cout << n << "\n";
            return 0;
        }
        q.pop();
        if (n % 10 != 0) {
            q.push(n * 10 + (n % 10) - 1);
        }
        q.push(n * 10 + (n % 10));

        if (n % 10 != 9)
            q.push(n * 10 + (n % 10) + 1);
    }
}


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

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

    int win=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='o')
            win++;
    }

    if(win+15-s.size()>=8)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}

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

int main() {

	int N, K;
	int l[100];
	int tmp;
	long long int ans = 0;

	cin >> N >> K;
	for (int i = 1; i <= N; i++) {

		cin >> l[i];

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

		for (int j = i + 1; j <= N; j++) {

			if (l[i] < l[j]) {

				tmp = l[i];
				l[i] = l[j];
				l[j] = tmp;

			}

		}

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

		ans += l[i];

	}

	cout << ans << endl;

	return 0;
}

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

int N;
vector<vector<double>> dp(3000, vector<double>(3000));
//dp.at(i).at(j):i枚投げてj枚表の確率
vector<double> p(2999);

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> p.at(i);
    }
    dp.at(0).at(0) = 1;
    for (int i = 0; i < N ; i++) {
        for (int j = 0; j <= i; j++) {
            dp.at(i + 1).at(j + 1) += dp.at(i).at(j) * p.at(i);
            dp.at(i + 1).at(j) += dp.at(i).at(j) * (1 - p.at(i));
        }
    }
    double ans = 0;
    for (int i = (N + 1) / 2; i <= N; i++) {
        ans += dp.at(N).at(i);
    }
    printf("%.16f", ans);
}

Measured memory_bytes: 70656
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, sum, last, cnt, ans=INF, a[200010],b[200010];
Pll pl[200010];
string str, ss;
bool f;
char c;
struct Edge { LL to,cost; };
vector<Edge>vec[1000];
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i] >> b[i];
		if (a[i] > b[i])ans = min(b[i], ans);
		sum += a[i];
	}
	cout << (ans!=INF?sum-ans:0) << endl;
	return 0;
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-ff;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar(aa%10+'0');
	return;
}
const int mod=1e9+7;
long long n,F[1000005],S[1000005];
int main()
{
	n=read();F[0]=1;S[0]=1;
	for(int i=1;i<=n;++i) 
	{
		if(i>=3) F[i]=(F[i-1]+S[i-3])%mod;
		else F[i]=F[i-1];
		S[i]=(S[i-1]+F[i])%mod;
	}
	write((S[n-2]*(n-1)%mod*(n-1)%mod+(n-1)*S[n-1]%mod+1)%mod);
	return 0;
}

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

int X, N;
set<int> P;

int main(){
  cin >> X >> N;
  rep(i, N){
    int p;
    cin >> p;
    P.insert(p);
  }

  int diff = 110;
  int ans = 0;
  rep(i, 102){
    if (!P.count(i)){
      if (diff > abs(X-i)){
        diff = abs(X-i);
        ans = i;
      }
      diff = min(diff, abs(X-i));
    }
  }
  cout<< ans << endl;
}


Measured memory_bytes: 3548
#include<stdio.h>

int main(){
  int a,b,c,d,n;
  int x;

  while(scanf("%d",&n)!=EOF){
  	x=0;

   

   if(n>18){
     n=36-n;
   	}
   	
  for(a=0;a<10;a++){
  for(b=0;b<10;b++){
  for(c=0;c<10;c++){
  for(d=0;d<10;d++){
  if(a+b+c+d==n){
    x++;
	break;
  	}

  	}

  	}

  	}

  	}

  	
  printf("%d\n",x);
  
  }
return 0;
	}

Measured memory_bytes: 596
#include "iostream"
#include "vector"
#include "string"

using namespace std;

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

	S = to_string(N).back();

	if (S == "3") {
		cout << "bon";
	}
	else if ((S == "0") || (S == "1") || (S == "6") || (S == "8")) {
		cout << "pon";
	}
	else {
		cout << "hon";
	}

	return 0;
}

Measured memory_bytes: 3696
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        double a = Double.parseDouble(in.readLine());
        double b = 3;
        System.out.println((int) Math.pow(a, b));
    }
}

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

#define endl '\n'

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

    int n, m; cin >> n >> m;
    int result = 0;
    if (n >= 2) result += n*(n-1)/2;
    if (m >= 2) result += m*(m-1)/2;
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	ll n;cin>>n;
    vector<ll> a(n);
    rep(i,0,n) cin>>a[i];
    ll al = a[0];
    rep(i,1,n){
        al ^= a[i];
    }
    rep(i,0,n){
        ll ans = al^a[i];
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 4776
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        long k = in.nextLong();
        int[] a = in.nextIntArray(n);

        long ans = 0;
        long left = 0;
        long right = 0;
        for (int i=0; i < n-1; i++) {
            for (int j=i+1; j < n; j++) {
                if (a[i] > a[j]) {
                    right++;
                }
            }
        }

        for (int i=1; i < n; i++) {
            for (int j=0; j < i; j++) {
                if (a[j] < a[i]) {
                    left++;
                }
            }
        }

        ans += ((k * (k+1) / 2) % MOD) * right;
        ans %= MOD;
        ans += ((k * (k-1) / 2) % MOD) * left;
        ans %= MOD;

        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }

}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e6+5;
void solve(){
	int n,m,x; 
	cin>>n>>m>>x; 
	int a=0,b=0;
	for(int i=1;i<=m;i++){
		int y ;
		cin>>y; 
		if(y<x)a++;
		else b++;
	}
	cout<<min(a,b)<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}

///  a2+a1 a3+a1 a4+a1 a5+a1
///  a2+a2 a3+a2 a4+a2 a5+a2
///  a2+a3 a3+a3 a4+a3 a5+a3
/// x1 = 2 , x2 = 5
/// y1 = 1 , y2 = 3
/// 



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using Pii = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define _GLIBCXX_DEBUG
 
constexpr int MOD = 1000000007;
const int INF = 1 << 30;
 
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }


// 各操作を行う関数を実装する
 
// AとBに共通して含まれる要素からなる集合を返す
int main(){
int x;
  cin>>x;
  if(x>=30){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int X, N;

int main() {
	cin >> X >> N;
	vector<int> p(N);
	for (int i = 0; i < N; i++) { cin >> p[i]; }

	int d = 0;
	while (true) {
		bool mi = true;
		bool ma = true;
		for (int i = 0; i < N; i++) {
			if (X - d == p[i]) {
				mi = false;
			}
			if (X + d == p[i]) {
				ma = false;
			}
		}
		if (mi) {
			cout << X - d << endl;
			return 0;
		}
		if (ma) {
			cout << X + d << endl;
			return 0;
		}
		d++;
	}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
//#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    char c;
    cin >> c;
    if (c == toupper(c)) cout << 'A';
    else cout << 'a';
}


Measured memory_bytes: 3636
n, a, b = map(int, input().split())
amari = n % (a+b)
sho = n // (a+b)
if n <= a:
    print(n)
elif amari == 0:
    print(a*sho)
elif amari < a:
    print(a*sho + amari)
else:
    print(a*sho + a)


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int N; cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i *= 2) ans = i;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2010,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int power(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=mul(x,x))
		if (y&1) ans=mul(ans,x);
	return ans;
}
int n,k,dp[N][N],fac[N*N],ifac[N*N];
int C(int n,int m){
	return mul(fac[n],mul(ifac[m],ifac[n-m]));
}
int main()
{
	cin>>n>>k;
	if (k==1) return puts("1"),0;
	fac[0]=1;
	for (int i=1;i<=n*k;i++) fac[i]=mul(fac[i-1],i);
	ifac[n*k]=power(fac[n*k],p-2);
	for (int i=n*k;i;i--) ifac[i-1]=mul(ifac[i],i);
	dp[0][0]=1;
	for (int i=0;i<=n;i++)
	for (int j=0;j<=n;j++){
		if (i) dp[i][j]=inc(dp[i][j],dp[i-1][j]);
		if (i!=j&&j) dp[i][j]=inc(dp[i][j],mul(dp[i][j-1],C(i+j*(k-1)-1,k-2)));
	}
	printf("%d\n",mul(fac[n],dp[n][n]));
	return 0;
}

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

int main(void){
  int n,m,l;
  cin >> n >> m >> l;
  int a[n][m];
  int b[m][l];
  unsigned long long c[n][l];
  for(int i = 0; i < n; i++){
	for(int j = 0; j < m; j++){
	  cin >> a[i][j];
	}
  }
  for(int i = 0; i < m; i++){
	for(int j = 0; j < l; j++){
	  cin >> b[i][j];
	}
  }

  unsigned long long sum = 0;
  for(int i = 0; i < n; i++){
	for(int j = 0; j < l; j++){
	  for(int k = 0; k < m; k++){
		sum += a[i][k]*b[k][j];
	  }
	  c[i][j] = sum;
	  sum = 0;
	}
  }

  for(int i = 0; i < n; i++){
	for(int j = 0; j < l; j++){
	  if(j == l - 1)
		cout << c[i][j];
	  else
		cout << c[i][j] << " ";
	}
	cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3268
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


int main(){
ll x,y;
cin>>x>>y;
ll ans;
if((x<=y)&&(x>=0)){
    ans=y-x;
}
else if((x>y)&&(y>0)){
    ans = abs(x-y)+2;
}
else if((x>=0)&&(y<=-x)){
    ans=-y-x+1;
}
else if((x>0)&&(y>-x)&&(y<=0)){
    ans=y+x+1;
}
else if((x<0)&&(y>0)&&(x<=-y)){
    ans =-y-x+1;
}
else if((x<0)&&(y>0)&&(-y<x)){
    ans=y+x+1;
}
else if((x<0)&&(y==0)){
    ans=y-x;
}
else if((x<0)&&(y<0)&&(x<=y)){
    ans=y-x;
}
else if((x<0)&&(y<0)&&(y<x)){
    ans=-y+x+2;

}
cout<<ans<<endl;


return 0;
}

Measured memory_bytes: 3528
#!/usr/bin/env python3
import sys

def solve(N: int, M: int, K: int, A: "List[int]", B: "List[int]"):
    weightA = 0
    len_A = N
    for idx, a in enumerate(A):
        if weightA + a > K:
            len_A = idx
            break
        else:
            weightA += a
    max_count = current_count = len_A

    weightB = 0
    for b in B:
        if len_A==0 and weightA + weightB + b > K:
            break

        elif weightA + weightB + b <= K:
            weightB += b
            current_count += 1

        else:
            while weightA + weightB + b > K:
                len_A -= 1
                weightA -= A[len_A]
                current_count -= 1
                if len_A == 0:
                    break

            if weightA + weightB + b <= K:
                weightB += b
                current_count += 1
        max_count = max(max_count, current_count)

    print(max_count)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    solve(N, M, K, A, B)

if __name__ == '__main__':
    main()

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

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

    int ans = 0;
    for(int i=1;i<s.size();i++){
        if(s[i-1]==s[i]){
            ans++;
            s[i] = s[i]^1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <algorithm>

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
 using namespace std;
 int main(){
 	int n;
 	cin>>n;
 	map<int,int>ma;
 	int x;
 	for(int i=0;i<n;i++){
         cin>>x;
         ma[x]++;
 	}
    cout<<ma.size();
 	return 0;
 }

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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int x=0;
  int mx=0;
  for (int i=0;i<n;i++){
    if (s[i] == 'I')x++;
    else x--;
    if (mx < x) mx=x;
  }
  cout << mx << endl;
  return 0;
}

Measured memory_bytes: 256
const int N = 400005;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll k;
    cin >> k;
    vector<long long> a(50, 49 + k / 50);
    k %= 50;
    for (int i = 0; i < k; i++)
    {
        a[i] += 50;
        for (int j = 0; j < 50; j++) if (j != i) a[j]--;
    }
    cout << 50 << "\n";
    forn(i, 50) cout << a[i] << " ";
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


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

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
#define MOD 1000000007

using namespace std;

using ll = long long;
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

typedef stack<ll> llStack;
typedef queue<ll> llQueue;
typedef vector<ll> llVector;
typedef list<ll> llList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll N, M, Q;
  cin >> N >> M >> Q;
  ll a[Q], b[Q], c[Q], d[Q];
  for(int i=0;i<Q;i++){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  
  int A[N];
  for(int i=0;i<N;i++){
    A[i] = 1;
  }
  ll ans = 0;
  ll score = 0;
  ll aa;
  bool f = true;
  while(1){
    for(int i=0;i<Q;i++){
      if(A[b[i]-1]-A[a[i]-1] == c[i]){
        score += d[i];
      }
    }
    ans = max(ans, score);
    score = 0;
    
    for(int i=N-1;i>=0;i--){
      if(A[i] == M){
        continue;
      }
      A[i]++;
      aa = A[i];
      for(int j=i;j<N;j++){
        A[j] = aa;
      }
      break;
    }
    for(int i=0;i<N;i++){
      if(A[i] != M){
        f = false;
        break;
      }
    }
    if(f){
      break;
    }
    f = true;
  }
  
      
  
  
  
  cout << ans << endl;
}

Measured memory_bytes: 3632
while True:
    try:
        n = int(input())
        counter = 0

        for o in range(10):
            for p in range(10):
                for q in range(10):
                    for r in range(10):
                        if (o + p + q + r) == n:
                            counter = counter + 1

        print(counter)
    except:
        break


Measured memory_bytes: 5588
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }return 0; }
#define all(a)  (a).begin(),(a).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define vll vector<ll>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
const ll INF =1LL << 62;

int main(){
  string a;
  cin >> a;
  if(a == "A"){
    cout << "T" << endl;
  }
  else if(a == "T")
    cout << "A" << endl;
  else if(a =="C")
    cout << "G" << endl;
  else
    cout << "C" << endl;
}


Measured memory_bytes: 256
def get_ans(pairs, n):
    prs = {i:set() for i in range(1, n+1)}
    chd = {i:set() for i in range(1, n+1)}
    for a, b in pairs:
        prs[b].add(a)
        chd[a].add(b)

    root = None
    for i in prs:
        if len(prs[i]) == 0:
            root = i
            break
    assert root is not None

    dir_pr = {root:0}
    q = [root]
    while len(q) > 0:
        p = q.pop()
        for c in chd[p]:
            prs[c].remove(p)
            if len(prs[c]) == 0:
                q.append(c)
                dir_pr[c] = p

    for i in range(1, n+1):
        print(dir_pr[i])


if __name__ == '__main__':
    n, m = map(int, input().split())
    ps = []
    for i in range(n+m-1):
        ps.append(tuple(int(x) for x in input().split()))
    get_ans(ps, n)



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

typedef long long ll;
typedef long double ld;
typedef vector<ll> v1;
typedef vector<v1> v2;
typedef vector<v2> v3;

typedef unordered_map<ll, unordered_map<ll, ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

ll n;
vector<tuple<ll,ll,ll>> info;

void solve(ll cx, ll cy){
    ll x,y,h;
    tie(h,x,y) = info[0];
    ll ch = h + abs(x-cx) + abs(y-cy);
    // cerr << ch << endl;
    for(ll i = 1;i < n;i++){
        tie(h,x,y) = info[i];
        // cerr << x << " " << y << " " << h << endl;
        // cerr << max(ch-abs(x-cx)-abs(y-cy), 0ll) << endl;
        if(h != max(ch-abs(x-cx)-abs(y-cy), 0ll)){
            return;
        }
    }
    cout << cx << " " << cy << " " << ch << endl;
    exit(0);
}


int main(){
    cin >> n;
    info = vector<tuple<ll,ll,ll>>(n);
    for(ll i = 0;i < n;i++){
        ll x,y,h;
        cin >> x >> y >> h;
        info[i] = make_tuple(h,x,y);

    }
    sort(info.rbegin(),info.rend());
    for(ll i = 0;i <= 100;i++){
        for(ll j = 0;j <= 100;j++){
            solve(i,j);
        }
    }
    // solve(2,2);
}


Measured memory_bytes: 3568
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    X = input().rstrip('\n')

    M = X.count("1")
    flg = 0
    if M == 1:
        flg = 1
    x_major = 0
    x_minor = 0
    for i in range(N):
        add = int(X[i])
        x_major = (x_major * 2 + add)%(M+1)
        if flg == 0:
            x_minor = (x_minor * 2 + add)%(M-1)
    for i in range(N):
        if X[i] == "1":
            if flg:
                print(0)
                continue
            val = (x_minor - pow(2, N-i-1, M-1)) % (M-1)
        else:
            val = (x_major + pow(2, N-i-1, M+1)) % (M + 1)
        cnt = 1
        while val:
            val = val % bin(val).count("1")
            cnt += 1
        print(cnt)


if __name__ == '__main__':
    main()


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

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

    vector<long long> vec(N);
    for(int i=0; i<N; i++) {
        cin >> vec[i];
    }

    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    long long total = 0;
    
    if (K == 0) {
        for(int i=0; i<N; i++) {
            total += vec[i];
        }
    } else {
        for(int i=K; i<N; i++) {
            total += vec[i];
        }
    }

    cout << total << endl;
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int K;
int S;
int A[100000];
int main(){
  int i;
  int d;
  rd(N);
  rd(K);
  rd(S);
  if(S==1000000000){
    d =1000000000-1;
  }
  else{
    d =1000000000;
  }
  for(i=(0);i<(K);i++){
    A[i] = S;
  }
  for(i=(K);i<(N);i++){
    A[i] = d;
  }
  {
    int cTE1_r3A;
    if(N==0){
      putchar_unlocked('\n');
    }
    else{
      for(cTE1_r3A=(0);cTE1_r3A<(N-1);cTE1_r3A++){
        wt_L(A[cTE1_r3A]);
        wt_L(' ');
      }
      wt_L(A[cTE1_r3A]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// int N, K, S;
// int A[1d5];
// {
//   int d;
//   rd(N,K,S);
//   d = if[S==1d9, 1d9-1, 1d9];
//   rep(i,K) A[i] = S;
//   rep(i,K,N) A[i] = d;
//   wt(A(N));
// }


Measured memory_bytes: 1664
# -*- coding: utf-8 -*-
N = int(input())
A = [int(n) for n in input().split()]
stones = sum(A)
step = stones / int(N*(1+N)/2)

if step % 1 != 0:
    print("NO")
else:
    D = [(A[(n+1)%N] - A[n%N]) - step for n in range(N)]
    if all(d%N == 0 and d <= 0 for d in D):
        print("YES") 
    else:
        print("NO")

Measured memory_bytes: 14720
n,m,q = map(int, input().split())
mmap = [ [ 0 for j in range(n+1) ] for i in range(n+1) ]
for i in range(m):
  s,e = map(int, input().split())
  mmap[s][e] += 1
for i in range(n+1):
  for j in range(1,n+1):
    mmap[i][j] = mmap[i][j] + mmap[i][j-1]
for j in range(n+1):
  for i in range(n-1,0,-1):
    mmap[i][j] = mmap[i][j] + mmap[i+1][j]
for i in range(q):
  s,e = map(int, input().split())
  print(mmap[s][e])

Measured memory_bytes: 9460
// This code writed by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
signed main(void)
{
	int a;
	cin>>a;
	for(int i=1;i<=9;++i)
		for(int j=1;j<=9;++j)
			if(i*j==a)
			{
				puts("Yes");
				return 0;
			}
	puts("No");
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n , m ;
    cin >> n >> m ;
    int a[n] ;
    int r , l ;
    
    for(int j = 0 ; j < n ; j++ ){
        a[j] = 0;
    }

    for(int i = 0 ; i < m ; i ++ ){
          cin >> r >> l ;
          a[r-1]++ ;
          a[l-1]++ ;
    }

    for(int j = 0 ; j < n ; j++){
        cout << a[j] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >v2;
/*void bti(ll n)
{
ll k=1;
  while(n!=0)
    {
    bin[k++]=n%2;
    n/=2;
    }
}*/
/*void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}*/
int main()
{
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
      if(i%2==0)
      {
          if(s[i]=='L')
          {
              cout<<"No"<<endl;
              return 0;
          }
      }
      if(i%2==1)
      {
          if(s[i]=='R')
          {
              cout<<"No"<<endl;
              return 0;
          }
      }
  }
  cout<<"Yes"<<endl;
return 0;
}


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

int main() {
  string s;
  cin>>s;
  if(s.at(1)=='B') cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;

#define INF 10e6
#define X real()
#define Y imag()
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
typedef complex<double> P;


int n; //ビルの数
P build[1001]; //ビルの座標
double graph[1001][1001];//距離グラフ
double d[1001];  //最短距離
int prev[1001];  //経路
bool used[1001]; //	訪問済み

void initial(){
	for(int i=0;i<1001;i++)
		for(int j=0;j<1001;j++)
			graph[i][j]=(abs(build[i]-build[j]))<=50.0?abs(build[i]-build[j]):INF;
	return ;
}

void dijkstra(int s){
	fill(d,d+1001,INF);
	fill(used,used+1001,false);
	fill(prev,prev+1001,-1);
	d[s]=0;
	
	while(true){
		int v=-1;
		for(int u=0;u<n;u++){
			if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
		}
		if(v==-1)
			break;
		used[v]=true;
		for(int u=0;u<n;u++){
			if(d[u]>d[v]+graph[u][v])
				d[u]=d[v]+graph[u][v],prev[u]=v;
		}
	}
	return ;
}

vector<int> get_path(int t){
	vector<int> path;
	for(;t!=-1;t=prev[t])path.push_back(t);
	reverse(path.begin(),path.end());
	return path;

}

int main(){
	int tem,m;
	while(cin >> n,n){
		for(int i=0;i<n;i++)
			cin >>tem,cin >>build[tem-1].X>> build[tem-1].Y;
		initial();
		cin >> m;
		for(int i=0;i<m;i++){
			int s,g,c;
			vector<int> root;
			cin >> s >> g;
			dijkstra(s-1);
			if(d[g-1]>=INF)
				cout << "NA" << endl;
			else{
				root=get_path(g-1);
				c=0;
				EACH(j,root)
					cout<< (c? " ":"") << (*j)+1,c++;
				cout << endl;
			}
		}
	}

return 0;
}

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D,L,R;
  cin>>A>>B>>C>>D;
 L=A+B;
  R=C+D;
  if(L==R){
  cout<<"Balanced"<<endl;
  }
  if(L>R){
  cout<<"Left"<<endl;
  }
  if(R>L){
  cout<<"Right"<<endl;
  }
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#define MOD 1000000007
#define oo 987654321
#define INT long long
using namespace std;

int n, l, q, h[100010], dt[100010][20], a, b, now;

int main()
{
    scanf("%d", &n);
    for(int i = 1 ; i <= n ; i++ )
        scanf("%d", h+i);
    scanf("%d%d", &l, &q);
    for(int i = 1 ; i <= n ; i++ )
        dt[i][0] = (int)(upper_bound(h+1, h+n+1, h[i]+l)-h) - 1;
    for(int j = 1 ; j < 20 ; j++ )
        for(int i = 1 ; i <= n ; i++ )
            dt[i][j] = dt[dt[i][j-1]][j-1];
    while( q-- )
    {
        scanf("%d%d", &a, &b);
        if( a > b ) swap(a, b);
        int cnt = 0, d;
        for(int j = 19 ; j >= 0 ; j-- )
        {
            if( dt[a][j] < b )
            {
                cnt += ( 1<<j );
                a = dt[a][j];
                d = 0;
            }
            else d = j;
        }
        printf("%d\n", cnt + (1<<d));
    }
    return 0;
}


Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

int main(){
	string s; cin >> s;
	if(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi"){
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

from heapq import heappush, heappop

def dijkstra(su):
    costs = [ INF ] * (n+1)

    hq = []
    hq.append((0, su))

    while hq:
        c, u = heappop(hq)
        # log(" ", c,x,y)
        if c >= costs[u]:
            continue
        costs[u] = c

        for v in edges[u]:
            heappush(hq, (c + 1, v))

    return costs



INF = 999999999999999999999999
MOD = 10**9+7

n,m = get_nums_l()
edges = [ [] for _ in range(n+1)]
for _ in range(m):
    a,b = get_nums_l()
    edges[a].append(b)
    edges[b].append(a)


costs = dijkstra(1)



ans = [0] * (n+1)
for u in range(2, n+1):
    c = costs[u]
    for v in edges[u]:
        if costs[v]+1 == c:
            ans[u] = v
            break

print("Yes")
for u in range(2,n+1):
    print(ans[u])


Measured memory_bytes: 129200
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * 11112
 * 33222
 * 33444
 * 55554
 * 
 * */
int main() {
	int n, m;
	cin >> n >> m;
	int k;
	cin >> k;
	vector <int> color(k + 1);
	for (int i = 1; i <= k; i++) {
		cin >> color[i];
	}
	bool lr = true;
	int l = 1;
	vector<vector<int>> ans(n + 1, vector<int>(m + 1, 0));
	for (int i = 1; i <= n; i++) {
		if (lr) {
			for (int j = 1; j <= m; j++) {
				ans[i][j] = l;
				color[l]--;
				if (color[l] == 0)
					l++;
			}
		}
		else {
			for (int j = m; j >= 1; j--) {
				ans[i][j] = l;
				color[l]--;
				if (color[l] == 0)
					l++;
			}
		}
		lr = !lr;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cout << ans[i][j] << " ";
		}
		cout << "\n";
	}
}


Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
int n,d,a[20][20],cou1,ans,f[20][20];
double cou2;
int cal1(int x,int y)
{
	return (x-y)*(x-y);
}
double cal2(int x,int y)
{
	return (x-y)*(x-y);
}
int main()
{
	cin>>n>>d;
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=d;++j)
		{
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=n;++j)
		{
			cou1=0;
			cou2=0;
			if(i!=j&&f[i][j]==0)
			{
				f[i][j]=f[j][i]=1;
				for(int k=1;k<=d;++k)
				{
					cou1+=cal1(a[i][k],a[j][k]);
					cou2+=cal2(a[i][k],a[j][k]);
				}
				cou1=sqrt(cou1);
				cou2=sqrt(cou2);
				if(cou2-cou1==0) ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

string b;
void abc132a() {
  if (b == "A") {
    cout << "T\n";
  }
  else if (b == "T") {
    cout << "A\n";
  }
  else if (b == "C") {
    cout << "G\n";
  }
  else {
    cout << "C\n";
  }
}

int main() {
  cin >> b;
  abc132a();
  return 0;
}

Measured memory_bytes: 256
#import sys

#import numpy as np


def main(n,k,p,c):
    ans = -10**9
    for i in range(n):
        x = i
        t = k
        count = 0
        l = True
        sub = 0
        ln = 0
        while True:
            x = p[x] - 1
            if l:
                count += c[x]
                ln += 1
                if x == i:
                    if t > ln:
                        if count > 0:
                            sub += (t // ln - 1) * count
                            t %= ln
                            t += ln
                        else:
                            t = 0
                    l = False
            sub += c[x]
            t -= 1
            ans = max(sub, ans)
            if t < 1:
                break
    return ans


# >>> numba compile >>>
#if sys.argv[-1]=='ONLINE_JUDGE':
#  from numba.pycc import CC
#  cc=CC('my_module')
#  cc.export('main','i8(i8,i8,i8[:],i8[:])')(main)
#  cc.compile()
#  exit()
#from my_module import main
# <<< numba compile <<<
(n, k), p, c = [[*map(int,i.split())] for i in open(0)]
print(main(n,k,p,c))


Measured memory_bytes: 68764
import fractions
a, b, c, d = map(int, input().split())
cd = c * d // (fractions.gcd(c, d))
s = ((a - 1) // c) + ((a - 1) // d) - ((a - 1) // cd)
e = (b // c) + (b // d) - (b // cd)
print((b - (a - 1)) - (e - s))

Measured memory_bytes: 5048
import sys



if(__name__ == "__main__"):

    XY = input().strip().split()
    N_Animals = int(XY[0])
    N_Legs = int(XY[1])

    N_Turtles = (N_Legs - 2 * N_Animals) / 2
    N_Cranes = N_Animals - N_Turtles
    if(N_Turtles >= 0 and N_Cranes >= 0 and N_Turtles == int(N_Turtles) ):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 9200
#include<stdio.h>
#include<memory.h>
int max(int a, int b)
{
   if(a > b)return a;
   return b; 
}
int min(int a, int b)
{
    if(a < b)return a;
    return b;
}
int abs(int a)
{
    if(a<0)return -a;
    return a;
}
int h[100000];
int dp[100000];
int main()
{
    int N;
    //freopen("input.txt", "r", stdin);
    while(scanf("%d", &N) != EOF)
    {
        memset(dp, 0, sizeof(dp));
        for(int i=0; i<N; i++)
        {
            scanf("%d", &h[i]);
            int pre1 = max(0, i-1);
            int pre2 = max(0, i-2);
            dp[i] = min(dp[pre1] + abs(h[i]-h[pre1]), dp[pre2]+abs(h[i]-h[pre2]));
        }
        printf("%d\n", dp[N-1]);
    }
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    int n,m;
    cin >> n >> m;
    int height[n];
    for (int i=0;i<=n-1;i++)
    {
        cin >> height[i];
    }

    vector<int> arr[n];
    for (int i=0;i<=m-1;i++)
    {
        int a,b;
        cin >> a >> b;
        arr[a-1].push_back(b-1);
        arr[b-1].push_back(a-1);
    }

    int ans=0;
    for (int i=0;i<=n-1;i++)
    {
        bool flag=true;
        for (auto it=arr[i].begin();it!=arr[i].end();it++)
        {
            if (height[i]<=height[*it])
            {
                flag=false;
                break;
            }
        }

        if (flag)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9184