akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pi;

const int MAXN = 1e5 + 1;
int g[3][3];

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

    for(int i=0;i<3;++i) for(int j=0;j<3;++j) cin >> g[i][j];

    bool check = false;
    int a[3];
    for(a[0] = 0;a[0]<=g[0][0];++a[0])
    {
        int b[3];
        b[0] = g[0][0]-a[0];
        b[1] = g[0][1]-a[0];
        b[2] = g[0][2]-a[0];

        a[1] = g[1][0] - b[0];
        a[2] = g[2][0] - b[0];

        if(b[1]*b[2]*a[1]*a[2] < 0) continue;
        check = true;
        for(int i=0;i<3;++i)
            for(int j=0;j<3;++j)
            {
                if(g[i][j]!=a[i]+b[j]) {check = false;break;}
            }
    }
    if(check) cout << "Yes";
    else cout << "No";

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define per(i,m,n) for(int i=m;i>=n;i--)
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d",x)
#define sl(x) scanf("%lld",&x)
#define pl(x) printf("%lld",x)
const int N = 1e4+10;
const int mod = 1e9+7;
const int inf = 1e9+10;
#define maxn 1000086
int n;
signed main(){
    int x;
    si(x);
    x++;
    x%=2;
    cout<<x;
    return 0;
}

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

using namespace std;

int main(void) {
  long long n, k;
  cin >> n >> k;
  map <int, long long> mp;
  for(int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    mp[a] += b;
  }

  long long sum = 0;
  for(int i = 1; i <= 100000; i++) {
    sum += mp[i];
    if(sum >= k) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;

int ans,ans2;

signed main(){

	int n,d,x[111][111];
	cin>>n>>d;
	rep(i,n)rep(j,d)cin>>x[i][j];

	rep(i,n){
		rep(j,n){
			if(i==j)continue;
			int sum=0;
			rep(k,d){
				sum+=abs(x[i][k]-x[j][k])*abs(x[i][k]-x[j][k]);
			}
			if(ceil(sqrt(sum))==floor(sqrt(sum)))ans++;
		}
	}
    cout<<ans/2<<endl;
    
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for a in range(A + 1):
    sum = 500 * a
    if sum == X:
        ans += 1
        break
    elif sum > X:
        break
    else:
        d = X - sum
        for b in range(B + 1):
            for c in range(C + 1):
                t = 100 * b + 50 * c
                if t == d:
                    ans += 1
                    break
                elif t > d:
                    break
                else:
                    continue

print(ans)

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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back

using namespace std;

typedef long long ll;

const int N = 1e6 + 5;

int ar[105];

int main() {
	int a, b, c, cnt = 0;
	cin >> a >> b >> c;
	ar[a] ++;
	ar[b] ++;
	ar[c] ++;
	for (int i = 1; i <= 100; i ++)
		cnt += ar[i] > 0;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define int long long
#define P pair<int,int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'

const int max_v = 1010;
int N,W;
int v[max_v], w[max_v];
int dp[110][10010];

signed main() {
    cin >> N >> W;
    for(int i = 1; i <= N; i++){
        cin >> v[i] >> w[i];
    }
    memset(dp,0, sizeof(dp));
    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= W; j++){
            if(j - w[i] >= 0){
                dp[i][j] = max(dp[i][j - w[i]] + v[i], dp[i-1][j - w[i]] + v[i]);
            }
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
        }
    }
    cout << dp[N][W] << endl;
}



Measured memory_bytes: 11724
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	sum := 0
	for i := 0; i < n; i++ {
		sum += i
	}
	fmt.Println(sum)
}


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

int n, mn=101010, a[101], c=0, s=0;

int main(){
cin >> n;
for(int i =0; i<n ;i++)
{
    cin >> a[i];
    if(a[i]%10==0)c++;
    else {
        mn = min(mn, a[i]);
    }
    s+=a[i];
}
if(c==n)return 0*printf("%d", 0);
if(s%10==0)cout << s-mn << endl;
else cout << s << endl;


return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

const ll MOD = 1e9 + 7;

ll fib[1000];

// Fibonacci数列を埋める
void precalc() {
    fib[0] = 1;
    fib[1] = 1;
    for(int i = 2; i < 1000; ++i) {
        fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
    }
    return;
}

// 正方行列の積
vector<vector<ll>> matmul(vector<vector<ll>> a, vector<vector<ll>> b) {
    int l = a[0].size();

    vector<vector<ll>> ret(l, vector<ll>(l, 0));

    for (int i = 0; i < l; ++i) {
        for (int j = 0; j < l; ++j) {
            for (int k = 0; k < l; ++k) {
                ret[i][j] += a[i][k] * b[k][j];
                ret[i][j] %= MOD;
            }
        }
    }
    return ret;
}

// ダブリングによる行列累乗
vector<vector<ll>> matpow(vector<vector<ll>> m, int n) {
    int l = m[0].size();

    // 単位行列を返す
    if (n == 0) {
        for (int i = 0; i < l; ++i) {
            for (int j = 0; j < l; ++j) {
                m[i][j] = (i == j);
            }
        }
        return m;
    }

    if (n == 1) return m;

    if (n % 2) {
        return matmul(matpow(m, n - 1), m);
    } else {
        return matpow(matmul(m, m), n / 2);
    }
}


int main() {
    // Fibonacci数列を先に求める
    precalc();

    int H, W, K;
    cin >> H >> W >> K;
    --K;

    vector<vector<ll>> M(W, vector<ll>(W, 0));
    // 以降Mは0-indexedであることに注意

    // 左に移動するパターン
    for (int i = 2; i <= W; ++i) {
        M[i - 2][i - 1] = fib[i - 2] * fib[W - i] % MOD;
    }

    // 右に移動するパターン
    for (int i = 1; i <= W - 1; ++i) {
        M[i][i - 1] = fib[i - 1] * fib[W - i - 1] % MOD;
    }

    // 真下に移動するパターン
    for (int i = 1; i <= W; ++i) {
        M[i - 1][i - 1] = fib[i - 1] * fib[W - i] % MOD;
    }

    auto res = matpow(M, H);
    cout << res[K][0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <cctype>

using namespace std;

int main(){
	char c;
	cin >> c;
	c++;
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 3544
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    cout << (n+1)/2 << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  set<int>a,b;
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    a.insert(x);
  }
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    b.insert(x);
  }
  vector<int>c;
  set_symmetric_difference(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
  for(int i=0;i<c.size();i++)cout<<c[i]<<endl;
}


Measured memory_bytes: 23736
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
#define P pair<int,int>
//printf("%.12Lf\n",);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}
int pow(int b,int a){	
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}
int sankaku(int a){
	return a*(a+1)/2;
} 
signed main(){
	sc(s)
	if(s[2]==s[3]&&s[4]==s[5])c("Yes")
	else c("No")
}		

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
c = 0
for i in range(N):
  if L[i] % 2 == 0:
    if L[i] % 3 == 0:
      c += 1
    elif L[i] % 5 == 0:
      c += 1
    else:
      c = 0
      break
  else:
    c += 1

if c == N:
  print("APPROVED")  
else:
  print ("DENIED")

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

using namespace std;

int main(){
    string N;
    int ans=0;
    bool ten = true;
    cin >> N;
    for(int i=0;i<N.size();i++){
        ans += (int)N[i] - '0';
    }

    if(ans == 1){
        cout << ans + 9 << endl;
    }else{
        cout << ans << endl;
    }
}

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

#define pb push_back
#define all(a) (a).begin(), (a).end()

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

template<typename T> using V = vector<T>;

// borrowed from neal's code
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

const double PI = acos(-1);

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int r; cin >> r;
    cout << 2 * PI * r;
}

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

using namespace std;

int comp(const void* a, const void* b) {
  return *(int*)a > *(int*)b;
}

int findNumberOfTriangles(int arr[], int n) {
	qsort(arr, n, sizeof(arr[0]), comp);
  int count = 0;
  for (int i = 0; i < n - 2; ++i) {
    int k = i + 2;
    for (int j = i + 1; j < n; ++j) {
			while (k < n && arr[i] + arr[j] > arr[k])
			++k;
			if(k > j)
			count += k - j - 1;
		}
	}
	return count;
}

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << findNumberOfTriangles(a, n) << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
using namespace std;
int main(){
  int a,b,n;
  cin>>a>>b>>n;
  if (a + b >= n)
  cout<<"Yes";
  else
  cout<<"No";
  system ("pause");
  return 0;
  }

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; ++i) cin >> A[i];
    ll ans = LOWINF;
    for(int i = 0; i <= 100; ++i) {
        ll sum = 0;
        for(int j = 0; j < N; ++j) {
            sum += (A[j]-i)*(A[j]-i);
        }
        chmin(ans,sum);
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll k,a,b; cin >> k >> a >> b; bool flag = false;
  
  for(ll i=a; i <= b; i++){
    if(i % k == 0){
      flag = true;
      break;
    }
  }
  
  if(flag) cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <limits.h>
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;

    int *v = new int[n];
    int *cost = new int[n];

    for(int i = 0; i < n; i++)
        cin >> v[i];

    cost[0] = 0;
    cost[1] = abs(v[1] - v[0]) + cost[0];
    for(int i = 2; i < n; i++){
        cost[i] = INT_MAX;
        for(int j = 1; j <= k; j++)
            if((i-j) >= 0)
                cost[i] = min((abs(v[i]-v[i-j])+cost[i-j]), cost[i]);
    }

    cout << cost[n-1];

    return 0;
}


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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<ll> t(n);
    for(int i = 0; i < n; i++) {
        cin >> t[i];
    }
    ll g=t[0];
    for(int i = 1; i < n; i++) {
        g = g/__gcd(g,t[i])*t[i];
    }
    cout << g << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
int gcd(int a, int b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
int ans = 0;
int s[10][10];
int k[10];
int p[10];
void bit(int m, int n, int d) {
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			bool w = true;
			rep(i, 0, d) {
				int x = 0;
				rep(j, 0, k[i])if (now[s[i][j] - 1] == '1')x++;
				if (x % 2 != p[i])w = false;
			}
			if (w)ans += 1;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}
;
int main() {
	llint a, b;
	cin >> a >> b;
	int ans;
	if (a > 9)ans = b;
	else ans = b+(100 * (10 - a));
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
n = int(input())
low = 0
hi = 10**9

li = []
lin = []

for _ in range(n):
    x,y,h = map(int,input().split())
    if h != 0:
        li.append((x,y,h))
    lin.append((x,y,h))

for i in range(101):
    for j in range(101):
        flag = True
        h = li[0][2]+abs(i-li[0][0])+abs(j-li[0][1])
        for a,b,c in lin:
            if max(h-abs(i-a)-abs(j-b),0) != c:
                flag = False
                break
        if flag:
            print(i,j,h)
            exit()

Measured memory_bytes: 3064
package main
 
import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
const initBufSize, maxBufSize = 10000, 1000000
 
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
 
func nextInts(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = nextInt()
	}
	return res
}
 
func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}
 
func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}
 
func abs(n int) int {
	return int(math.Abs(float64(n)))
}
 
func pow(r, n int) int {
	return int(math.Pow(float64(r), float64(n)))
}
 
func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initBufSize), maxBufSize)
	n := nextInt()
	k := nextInt()
	sum := 0
	for i := 1; i <= n; i++ {
		sum += i
	}
 
	//選ぶ数を1つずつ減らしながら和の最大値と最小値を求める
	i := n + 1           //選ぶ個数
	max, min := sum, sum //N+1個選ぶ時の和の最大値と最小値
	maxCalc := 0         //和の最大値から引く数
	minCalc := n         //和の最小値から引く数
	ans := 0
	for i >= k {
		//N+1個選ぶ時を考慮した分岐
		if i < n+1 {
			max -= maxCalc
			min -= minCalc
			maxCalc++
			minCalc--
		}
		//fmt.Println("i:", i, "max:", max, "min:", min)
		ans += max - min + 1
		ans %= 1000000007
		i--
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1760
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n, m;
	cin >> n >> m;
	Vec a(n), b(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];
	sort(all(a));
	sort(all(b));
	reverse(all(a));
	reverse(all(b));
	a.pb(0), b.pb(0);

	ll pos1 = 0, pos2 = 0;
	ll ans = 1, space = 0;
	repnr(i, n*m){
		if(i == a[pos1] && i == b[pos2]){
			space += pos1+pos2;
			pos1++, pos2++;
		}else if(i == a[pos1]){
			ans *= pos2;
			ans %= MOD;
			space += pos2-1;
			pos1++;
		}else if(i == b[pos2]){
			ans *= pos1;
			ans %= MOD;
			space += pos1-1;
			pos2++;
		}else{
			ans *= space;
			ans %= MOD;
			space--;
		}
	}
	if(pos1 == n && pos2 == m) co(ans);
	else co(0);

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int min(int array[], int n, int sum){
    int min = abs(sum - 2*array[0]);
    for(int i=1; i<n; i++){
        if(abs(sum - 2*array[i]) < min){
            min = abs(sum - 2*array[i]);
        }
    }
    return min;
}

int main(void){
    int N;
    scanf("%d", &N);
    int W[N];
    int sum[N];
    scanf("%d", &W[0]);
    sum[0] = W[0];
    for (int i = 1; i < N; i++){
        scanf("%d", &W[i]);
        sum[i] = sum[i-1] + W[i];
    }
    printf("%d\n", min(sum, N, sum[N-1]));
    return 0; 
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  long long x;
  scanf("%d%lld",&n,&x);
  long long a[2000];
  for(int i=0;i<n;i++){
    scanf("%lld",a+i);
  }
  static long long M[2001][2001];
  for(int i=0;i<n;i++){
    M[i][i]=a[i];
    for(int j=i+1;j<n;j++){
      M[i][j]=min(M[i][j-1],a[j]);
    }
  }
  long long ans=100000000000000ll;
  for(int t=0;t<n;t++){
    long long S=x*t;
    for(int i=0;i<n;i++){
      S+=(t<=i?M[i-t][i]:min(M[0][i],M[n-(t-i)][n-1]));
    }
    ans=min(ans,S);
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 22784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

// https://atcoder.jp/contests/abc069/submissions/6395790 写経

ll c[10002];
ll glid[101][101];
int main() {
	ll h,w,C;
	cin>>h>>w>>C;
	for(int i=0;i<C;i++){
		cin>>c[i];
	}
	ll k=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(c[k]==0){
				k++;
			}
			c[k]--;
			glid[i][j]=k+1;
		}
	}
	bool turn=false;
	for(int i=0;i<h;i++){
		if(turn==false){
			for(int j=0;j<w;j++){
				cout << glid[i][j]<< " ";
			}
		}
		else{
			for(int j=w-1;j>=0;j--){
				cout << glid[i][j]<<" ";
			}
		}
		cout << endl;
		if(turn){
			turn=false;
		}
		else{
			turn=true;
		}
	}
	return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int n;
	for (cin >> n; n--; )
	{
		string a, b;
		cin >> a >> b;

		string c;

		int add = 0;
		int len = max(a.length(), b.length());
		for (int i = 0; i < len; i++)
		{
			int a0 = 0, b0 = 0;
			int ai = a.length() - i - 1;
			if (ai >= 0)
			{
				a0 = atoi(a.substr(ai, 1).c_str());
			}
			int bi = b.length() - i - 1;
			if (bi >= 0)
			{
				b0 = atoi(b.substr(bi, 1).c_str());
			}
			
			int c0 = a0 + b0 + add;
			add = (c0 >= 10) ? 1 : 0;

			c += to_string(c0).back();
		}
		if (add == 1)
		{
			c += to_string(1);
		}
		reverse(c.begin(), c.end());

		cout << (c.length() > 80 ? "overflow" : c) << endl;
	}
}


Measured memory_bytes: 3216
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 final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long n = parseLong(sc.next());
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		if(k==10) {
			ans = (int) floor(log10(n)+1);
		} else {
			ans = (int) floor(log(n)/log(k)+1);
		}
		out.println(ans);
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, M, a, DP[100001];
bool b[100001];

int main() {
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		cin >> a;
		b[a] = true;
	}
	DP[0] = 1;
	DP[1] = !(b[1]);
	for (int i = 2; i <= N; ++i) {
		DP[i] = (DP[i - 1] + DP[i - 2]) % mod;
		if (b[i])DP[i] = 0;
	}
	cout << DP[N] << endl;
}

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

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

  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  vector<int> x;
  vector<int> y;
  for (int i = 0; i <= 15; i++) {
    for (int j = 0; j < 15; j++) {
      x.push_back(100 * (a * i + b * j));
    }
  }
  for (int i = 0; i < 1500; i++) {
    for (int j = 0; j < 1500; j++) {
      y.push_back(c * i + d * j);
    }
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  int u = 0, v = 0;
  for (int &s : x) {
    if (s > f) break;
    if (s == 0) continue;
    for (int &t : y) {
      if (s + t > f) break;
      if ((100 + e) * t > (s + t) * e) break;
      if (t * u >= v * (s + t)) {
        u = s + t;
        v = t;

      }
    }
  }
  cout << u << " " << v << '\n';
  return 0;
}

Measured memory_bytes: 18792
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
Scanner kb=new Scanner(System.in);
double x=kb.nextDouble();
double y=kb.nextDouble();
int p=(int)x/(int)y;
int q=(int)x%(int)y;
System.out.printf("%d %d %f\n",p,q,x/y);
	}

}

Measured memory_bytes: 28236
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数
char s[2000][2001];
int cnt[2000][2000][2] = { 0 };

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}

int main() {
	int h,w;
	scanf("%d%d", &h, &w);

	REP(i, h) {
		scanf("%s", s[i]);
	}

	REP(i, h) {
		int start = 0;
		REP(j, w) {
			if (s[i][j] == '#') {
				FOR(k, start, j) {
					cnt[i][k][0] = j - start;
				}
				start = j + 1;
				continue;
			}
			if (j == w - 1) {
				FOR(k, start, j+1) {
					cnt[i][k][0] = j - start + 1;
				}
			}
		}
	}
	REP(i, w) {
		int start = 0;
		REP(j, h) {
			if (s[j][i] == '#') {
				FOR(k, start, j) {
					cnt[k][i][1] = j - start;
				}
				start = j + 1;
				continue;
			}
			if (j == h - 1) {
				FOR(k, start, j + 1) {
					cnt[k][i][1] = j - start + 1;
				}
			}
		}
	}
	
	int ans = 0;
	REP(i, h) {
		REP(j, w) {
			ans = Max(ans, cnt[i][j][0]+ cnt[i][j][1]-1);
		}
	}
	PRINTD(ans);
}


Measured memory_bytes: 35328
let lines = require('fs').readFileSync('/dev/stdin', 'utf8');

let hour = 60 * 60;

let second = lines-0;
let str = '';

str += Math.floor(second / hour);
second -= Math.floor(second / hour) * hour;
str += ':';
str += Math.floor(second / 60);
second -= Math.floor(second / 60) * 60;
str += ':';
str += second;


console.log(str)


Measured memory_bytes: 15096
#include<stdio.h>

 

int main (){

  int i, n, a[10000];

  scanf("%d",&n);

 

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

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

  }

 

  int min = a[0], max = a[0];

  long long int sum = 0;

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

    if ( a[i] < min ){

      min = a[i];

    }else if ( a[i] > max ){

      max = a[i];

    }

    sum += a[i];

  }

 

  printf("%d %d %lld\n",min,max,sum);

 

  return 0;

}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
    long long int  x,k,d,min1;
    cin>>x>>k>>d;
    x=abs(x);
    long long int r=x/d;
    if(r>k){
        min1=x-d*k;
    }
    else{
        k-=r;
        bool even=k%2?false:true;
        if(even){
            min1=abs(x-d*r);
        }
        else{
            min1=min(abs(x-d*(r+1)),abs(x-d*(r-1)));
        }
    }
    cout<<min1;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
  long double a, b, c;
  cin >> a >> b >> c;
  
  long double eps = 1.0E-14;
  
  if ( sqrt(a) + sqrt(b) + eps < sqrt(c)) {
    cout << "Yes" << endl; 
  }
  else {
    cout << "No" << endl; 
  }
}

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

using namespace std;
int main() {
  int x, y;
  cin >> x >> y;

  int xGroup = 0;
  int yGroup = 0;
  if (x == 2) {
    xGroup = 2;
  } else if (x == 4 || x == 6 || x == 9 || x == 11) {
    xGroup = 1;
  }

  if (y == 2) {
    yGroup = 2;
  } else if (y == 4 || y == 6 || y == 9 || y == 11) {
    yGroup = 1;
  }

  if (xGroup == yGroup)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// マス数 - 取得
	int liMCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liMCnt);

	// マス - 取得
	int liPre = 0;
	for (i = 0; i < liMCnt; i++) {
		int liNow;
		fscanf(szpFpI, "%d", &liNow);

		// 比較
		if (liNow > liPre) {
			liPre = liNow - 1;
		}
		else if (liNow == liPre) {
		}
		else {
			return -1;
		}
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	if (liRet == 0) {
		sprintf(lc1Buf, "Yes\n");
	}
	else {
		sprintf(lc1Buf, "No\n");
	}
	fOut(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

using ll = long long;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SIZE(a) ((int)(a).size())

using row = vector<int>;

int n;

pair<int,int> calc(const row& a, int bit) {
	int cnt[2] = {0, 0};
	for (auto& e : a) {
		++cnt[(e >> bit) & 1];
	}
	return {cnt[0], cnt[1]};
}

int getBit(const row& a, const row& b, int bit) {
	int result = 0;
	auto A = calc(a, bit);
	auto B = calc(b, bit);
	result = (1LL*A.first*B.second+1LL*A.second*B.first) % 2;
	row x(n), y(n);
	REP(i, n) x[i] = a[i] % (1 << bit), y[i] = b[i] % (1 << bit);
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	int j = n-1;
	REP(i, n) {
		while (j >= 0 && x[i]+y[j] >= (1 << bit)) --j;
		result ^= (n-j-1) % 2;
	}
	return result;
}

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

	cin >> n;
	row a(n), b(n);
	REP(i, n) cin >> a[i];
	REP(i, n) cin >> b[i];

	int result = 0;

	REP(i, 30) result |= getBit(a, b, i) << i;

	cout << result << '\n';

	return 0;
}

Measured memory_bytes: 3456
import java.io.*;
class Main {
    public static void main( String[] args ) throws IOException {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        String line = br.readLine();
        String[] p = line.split( " ", 0 );
        boolean flg = true;
        for( int i = 1 ; i < p.length ; i++ ) {
            if( Integer.parseInt( p[ i - 1 ] ) >= Integer.parseInt( p[ i ] ) ) {
                flg = false;
                break;
            }
        }
        if( flg ) {
            System.out.println( "Yes" );
        } else {
            System.out.println( "No" );
        }
    }
}

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


int main()
{
	int c=0;
	double a,b,min=1e18;
	cin>>a>>b;
	for(int i=1;i<=1000;i++)
	{
		if(floor(i*0.08)==a && floor(i*0.1)==b)
		{
			if(i<min)min=i;
			c++;
		}
	}
	if(c>0)cout<<min;
	else cout<<"-1";
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;

const int kMaxL = 1e5 + 5;
char str[kMaxL];
int n;

int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (int i = 1; i < n; ++i) {
    if (str[i] == str[i + 1]) {
      return printf("%d %d\n", i, i + 1), 0;
    } else if (str[i] == str[i + 2]) {
      return printf("%d %d\n", i, i + 2), 0;
    }
  }
  return puts("-1 -1"), 0;
}


Measured memory_bytes: 256
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let scan_string () = Scanf.scanf " %s" (fun x -> x)
let scan_array len read_func = Array.init len (fun _ -> read_func())
let print_int n = Printf.printf "%d\n" n

let max_dist = int_of_float 1e15

let warshall_floyd mat n =
  for k = 0 to n-1 do
    for i = 0 to n-1 do
      for j = 0 to n-1 do
        mat.(i).(j) <- (min mat.(i).(j) (mat.(i).(k) + mat.(k).(j)))
      done
    done
  done


let () =
  let n = scan_int() and m = scan_int() and l = scan_int() in
  let dist_mat = Array.make_matrix n n max_dist in
  let _ =
    for i = 0 to n-1 do
      dist_mat.(i).(i) <- 0
    done in
  let _ =
    for i = 0 to m-1 do
      let a = scan_int() and b = scan_int() and c = scan_int() in
      let _ = dist_mat.(a-1).(b-1) <- c in
      dist_mat.(b-1).(a-1) <- c
    done in
  let _ = warshall_floyd dist_mat n in
  let _ =
    for i = 0 to n-1 do
      for j = 0 to n-1 do
        if dist_mat.(i).(j) <= l then dist_mat.(i).(j) <- 1
        else dist_mat.(i).(j) <- max_dist
      done
    done in
  let _ = warshall_floyd dist_mat n in
  let q = scan_int() in
  for i = 0 to q-1 do
    let s = scan_int() and t = scan_int() in
    if dist_mat.(s-1).(t-1) = max_dist then print_int (-1)
    else print_int (dist_mat.(s-1).(t-1) - 1)
  done
  

Measured memory_bytes: 5376
use std::collections::HashMap;

fn main() {
    let n: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse().unwrap()
    };

    let a: Vec<isize> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };

    let mut ans = 0;
    let mut map = HashMap::new();
    for i in 0..n {
        *map.entry(a[i]).or_insert(0) += 1;
        ans += a[i];
    }

    let q: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse().unwrap()
    };

    for _ in 0..q {
        let (b, c): (isize, isize) = {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            let mut iter = buf.split_whitespace();
            (
                iter.next().unwrap().parse().unwrap(),
                iter.next().unwrap().parse().unwrap(),
            )
        };
    
        map.entry(b).or_insert(0);
        ans += (c - b) * map[&b];
        println!("{}", ans);

        *map.entry(c).or_insert(0) += map[&b];
        map.remove(&b);
    }
}

Measured memory_bytes: 7224
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	int count = 0;
	string W;
	string t;
	cin >> W;
	while (cin >> t, t != "END_OF_TEXT")
	{
		transform(t.begin(), t.end(), t.begin(), ::tolower);
		if (t == W)
		{
			count++;
		}
	}
	cout << count << endl;
}


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

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }
int main(void)
{
	string s;
	string t;
	cin>>s;
	cin>>t;
	if(s[0]==t[2]&&s[1]==t[1]&&s[2]==t[0]) cout<<"YES"<<endl;	
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	var S string
	fmt.Scan(&S)
	SS := make([]string, len(S))
	for i, c := range []rune(S) {
		SS[i] = string(c)
	}
	RS, GS, BS := make([]int, N), make([]int, N), make([]int, N)
	if SS[0] == "R" {
		RS[0] = 1
	} else if SS[0] == "G" {
		GS[0] = 1
	} else if SS[0] == "B" {
		BS[0] = 1
	}
	for i, c := range SS {
		if i == 0 {
			continue
		}
		if c == "R" {
			RS[i] = RS[i-1] + 1
			GS[i] = GS[i-1]
			BS[i] = BS[i-1]
		} else if c == "G" {
			RS[i] = RS[i-1]
			GS[i] = GS[i-1] + 1
			BS[i] = BS[i-1]
		} else if c == "B" {
			RS[i] = RS[i-1]
			GS[i] = GS[i-1]
			BS[i] = BS[i-1] + 1
		}
	}

	ans := 0
	for i := 0; i < N; i++ {
		for j := i + 2; j < N; j++ {
			if (SS[i] == "R" && SS[j] == "B") || (SS[i] == "B" && SS[j] == "R") {
				ans += GS[j] - GS[i]
				if (i+j)%2 == 0 && SS[(i+j)/2] == "G" {
					ans -= 1
				}
			}
			if (SS[i] == "R" && SS[j] == "G") || (SS[i] == "G" && SS[j] == "R") {
				ans += BS[j] - BS[i]
				if (i+j)%2 == 0 && SS[(i+j)/2] == "B" {
					ans -= 1
				}
			}
			if (SS[i] == "B" && SS[j] == "G") || SS[i] == "G" && SS[j] == "B" {
				ans += RS[j] - RS[i]
				if (i+j)%2 == 0 && SS[(i+j)/2] == "R" {
					ans -= 1
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2068
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    int n=s.length();
    char c[256] = {0},d[256] = {0};
    for(int i=0; i<n; i++){
        if(c[s[i]] == 0 && d[t[i]] == 0) {
            c[s[i]] = t[i];
            d[t[i]] = s[i];
        }
        if(c[s[i]] != 0) {
            if(c[s[i]] != t[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            if(d[t[i]] != s[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 776
#include<iostream>
using namespace std;
int main(){
  int x1,y1,x2,y2,c,d;
  cin>>x1>>y1>>x2>>y2;
  c=x2-x1;
  d=y2-y1;
  cout<<x2-d<<" "<<y2+c<<" "<<x1-d<<" "<<y1+c;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        else{ 
            for(int i=1;i<=H;i++){
                for(int j=1;j<=W;j++){
                    if((i+j)%2==0){
                        cout<<"#";
                    }
                    else{
                        cout<<".";
                        }
                        
                    }
                    
                    cout<<endl;
                }
               cout <<endl; 
            }
        
        }
    return 0;
}


Measured memory_bytes: 3108
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll S;
    cin >> S;
    ll len = 1e9;
    ll mod = S % len;
    ll addv = (len - mod) % len;
    ll val = S + addv;
    cout << 0 << ' ' << 0 << ' ' << len << ' ' << addv << ' ' << 1 << ' ' << val / len << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char ball;
	char c1, c2;
	
	ball = 'A';
	
	while (scanf("%c,%c", &c1, &c2) != EOF){
		if (ball == c1){
			ball = c2;
		}
		else if (ball == c2){
			ball = c1;
		}
	}
	
	printf("%c\n", ball);
	
	return (0);
}

Measured memory_bytes: 544
def rank(num):
  if num==10000:
    return 1
  else:
    return(num%10+int(num%100/10)+int(num%1000/100)+int(num%10000/1000))
 
n,a,b = map(int,input().split())
count = 0
 
for i in range(1,n+1):
  if a <= rank(i) <= b:
    count +=i
 
print(count)

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

using namespace std;

const int MOD=1e9+7;

//const int MOD=998244353;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    
    vector<int> v(n+1);
    for(int i=1; i<=n; i++){
        cin>>v[i];
        if(v[i]>i){
            cout<<-1;
            return 0;
        }
    }
    list<int> ans={0};
    for(int i=1; i<=n; i++){
        if(i==v[i]) ans.push_back(v[i]);
        else{
            auto it=ans.begin();
            advance(it,v[i]);
            ans.insert(it,v[i]);
        }
    }
    auto it=ans.begin();
    it++;
    for(;it!=ans.end();it++){
        cout<<*it<<'\n';
    }
    
    
    
}

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

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

	int n, x;
	cin >> n >> x;

	vector<int> A(n);
	rep(i, n)
		cin >> A.at(i);
	sort(A.begin(), A.end());
	rep(i, n)
	{
		x -= A.at(i);
		if (x == 0)
		{
			cout << i + 1 << endl;
			return (0);
		}
		else if (x < 0)
		{
			cout << i << endl;
			return (0);
		}
	}
	cout << n - 1 << endl;
}


Measured memory_bytes: 256