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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<vector<vector<int> > > house(5, vector<vector<int> >(4, vector<int>(11, 0)));
  for (int i = 0; i < n; ++i) {
    int b, f, r, v;
    fscanf(stdin, "%d %d %d %d", &b, &f, &r, &v);
    house[b][f][r] += v;
  }
  for (int i = 1; i <= 4; ++i) {
    if (i != 1) {
      fprintf(stdout, "%s\n", string(20, '#').c_str());
    }
    for (int j = 1; j <= 3; ++j) {
      for (int k = 1; k <= 10; ++k) {
        fprintf(stdout, "%2d", house[i][j][k]);
      }
      fprintf(stdout, "\n");
    }
  }
  return 0;
}

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

typedef long long ll;

using namespace std;

int main(){
    ll N;
    ll sum =0;
    cin >> N;
    ll m = N/3;
    ll l = N/5;
    ll k = N/15;
    sum = N*(N+1)/2 - 3*m*(m+1)/2 - 5*l*(l+1)/2 + 15*k*(k+1)/2;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> P;
struct pos {
  int row;
  int column;
};
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1 << 30;
const ll MOD = 1000000007;
int main(void) {
  int N, M;
  bool d[10][10];
  memset(d, 0, sizeof(d));
  vector<int> val;
  cin >> N >> M;
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    d[a][b] = true;
    d[b][a] = true;
  }

  rep(i, N) { val.push_back(i + 1); }

  Sort(val);

  int count = 0;

  do {
    if (val[0] != 1) continue;

    bool find = true;
    for (int i = 0; i < val.size() - 1; i++) {
      if (d[val[i]][val[i + 1]]) continue;
      find = false;
      break;
    }

    if (find) {
      count++;
    }

  } while (next_permutation(val.begin(), val.end()));

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      Long output = new Long(0);
      int N = sc.nextInt();
      if(N == 1){
        System.out.println(0);
        return;
      }else if(N == 2){
        System.out.println(1);
        return;
      }
      /*for(int i = 1; i <= N - 1; i++){
        output += i;
      }*/
      
      System.out.println(java.util.stream.LongStream.range(1, N).sum());
      //System.out.println();
	}
}


Measured memory_bytes: 26964
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;

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

vector<P> v;
long long int ans[200000];

int main(){
	
	long long int N;
	
	cin >> N;
	
	for(long long int i = 0; i < N; i++){
		ans[i] = 0;
		P p;
		cin >> p.first;
		p.second = -i;
		v.push_back(p);
	}
	
	sort(v.begin(), v.end());
	
	long long int pre_index = 190000;
	long long int pre_num = 0;
	
	for(long long int i = N - 1; i >= 0; i--){
		ans[pre_index] += (pre_num - v[i].first) * (N - 1 - i);
		pre_num = v[i].first;
		if(pre_index > -v[i].second){
			pre_index = -v[i].second;
		}
	}
	
	ans[pre_index] += pre_num * N;
	
	for(long long int i = 0; i < N; i++){
		cout << ans[i] << endl;
	}
	
	return 0;
}



Measured memory_bytes: 3568
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=100005,mod=1000000007;
int n,m,k,ans=1,pos[N],a[N],b[N],c[N],x[N],y[N],h[N],f[N];
bool cmp(int a,int b){
	return x[a]==x[b]?y[a]>y[b]:x[a]<x[b];
}
bool comp(int a,int b){
	return x[a]==x[b]&&y[a]==y[b];
}
void add(int i,int v){
	while(i<=h[0]){
		c[i]=(c[i]+v)%mod;
		i+=i&(-i);
	}
}
int sum(int i){
	int res=0;
	while(i){
		res=(res+c[i])%mod;
		i-=i&(-i);
	}
	return res;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=m;i++){
		scanf("%d",&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]>b[1]&&a[i]<b[m]){
			int tmp=lower_bound(b+1,b+m+1,a[i])-b;
			if(b[tmp]==a[i]){
				continue;
			}
			k++;
			pos[k]=k;
			y[k]=b[tmp]-a[i];
			x[k]=a[i]-b[tmp-1];
			h[++h[0]]=y[k];
		}
	}
	sort(pos+1,pos+k+1,cmp);
	k=unique(pos+1,pos+k+1,comp)-pos-1;
	sort(h+1,h+h[0]+1);
	h[0]=unique(h+1,h+h[0]+1)-h-1;
	for(int i,j=1;j<=k;j++){
		i=pos[j];
		y[i]=lower_bound(h+1,h+h[0]+1,y[i])-h;
		f[i]=(sum(y[i]-1)+1)%mod;
		ans=(ans+f[i])%mod;
		add(y[i],f[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3072
n = int(input())
a = [int(i) for i in input().split()]
count=0
i=0
while a[i]%2==0:
  if a[i]%2==0:
    a[i]//=2
  if i==n-1:
    count+=1
    i=0
  i+=1
print(count)
    
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
#define Bit(n) (1LL << (n))
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

int N, K;
int a[5010];
int dp[5010];

bool check(int x) {
  fill(dp, dp+5010, 0);
  dp[0] = 1;
  REP(i, N) {
    if (i == x) continue;
    REPR(j, K+1) {
      if (j-a[i] >= 0) dp[j] |= dp[j-a[i]];
    }
  }
  FOR(i, max(0LL, K-a[x]), K) if (dp[i]) return true;
  return false;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> K;
  REP(i, N) cin >> a[i];
  sort(a, a+N);
  int ng = -1, ok = N;
  while (ok-ng > 1) {
    int m = (ng+ok)/2;
    if (check(m)) ok = m;
    else ng = m;
  }
  if (ok < N && check(ok)) cout << ok << endl;
  else cout << N << endl;

  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

ll conb(ll n, ll r) {
	if (n - r < r) { return conb(n, n - r); }
	ll tmp = 1;
	FOR(i, n - r + 1, n + 1) {
		tmp *= i;
	}
	FOR(i, 1, r + 1) {
		tmp /= i;
	}
	return tmp;
}

ll mod(ll n, ll r) {
	ll q = n % r;
	return (q < 0) ? q + r : q;
}

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

	ll min = size;
	REP(i, s.size() - 1) {
		if (s[i] != s[i + 1]) {
			min = std::min(min, std::max(i + 1, size - i - 1));
		}
	}
	cout << min << endl;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int ji = num / 3600;
        int hunn = (num % 3600) / 60;
        int byou = (num % 3600) % 60;
        System.out.println(ji + ":" + hunn + ":" + byou);
    }
}



Measured memory_bytes: 26264
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

class UnionFind{ //連結判定
private:
    std::vector<int> parent; //parent[i] = parent of node i
    std::vector<int> rank;
    std::vector<int> size;
public:
    //constructor
    UnionFind(int N){
        for(int i=0; i<N; i++) parent.push_back(i); //parent = [0,1,..,N-1]
        for(int i=0; i<N; i++) rank.push_back(0); //rank = [0,0,..,0]
        for(int i=0; i<N; i++) size.push_back(1);
    }
    //initialize
    void init(int N){
        parent.clear();
        rank.clear();
        size.clear();
        for(int i=0; i<N; i++) parent.push_back(i); //parent = [0,1,..,N-1]
        for(int i=0; i<N; i++) rank.push_back(0); //rank = [0,0,..,0]
        for(int i=0; i<N; i++) size.push_back(1);
    }
    int root(int a){
        if(parent[a] == a) return a;
        return parent[a] = root(parent[a]); //親が自分自身になるまで再帰を呼び出す & 経路圧縮 
    }
    void unite(int a, int b){
        int rootA = root(a);
        int rootB = root(b);
        if(rootA == rootB) return; //ノードa, bがすでに連結しているとき
        //次数の大きい方を親として連結
        if(rank[rootA] < rank[rootB]){
            size[rootB] += size[rootA];
            parent[rootA] = rootB;
        }
        else{
            size[rootA] += size[rootB];
            parent[rootB] = rootA;
            if(rank[rootA] == rank[rootB]) rank[rootA]++;
        }
    }
    bool same(int a, int b){
        return root(a) == root(b); //ノードa, bが同じ木に属するかどうか
    }
    int get_size(int a){
        return size[root(a)];
    }
};

class Edge{
public:
    int from, to;
    long long cost;
    Edge(): from(0), to(0), cost(0){}
    Edge(int u, int v, long long w): from(u), to(v), cost(w){}
    ~Edge(){}
    bool operator<(const Edge &e)const{
        return cost < e.cost;
    }
};

int main()
{
    using P = std::pair<long long, int>;

    int N;
    std::cin >> N;
    std::vector<P> x(N), y(N);
    for(int i=0; i<N; i++){
        scanf(" %lld %lld", &x[i].first, &y[i].first);
        x[i].second = i; y[i].second = i;
    }

    std::sort(x.begin(), x.end());
    std::sort(y.begin(), y.end());
    std::vector<Edge> edge;
    for(int i=0; i<N-1; i++){
        edge.push_back(Edge(x[i].second, x[i+1].second, x[i+1].first - x[i].first));
        edge.push_back(Edge(y[i].second, y[i+1].second, y[i+1].first - y[i].first));
    }
    std::sort(edge.begin(), edge.end());

    long long min = 0;
    UnionFind uf(N);
    for(auto &&itr = edge.begin(); itr != edge.end(); itr++){
        int u = itr->from, v = itr->to;
        if(!uf.same(u, v)){
            uf.unite(u, v); min += itr->cost;
        }
    }
    std::cout << min << std::endl;
}

Measured memory_bytes: 9584
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();
		if(s1.charAt(0)==s2.charAt(2)&&s1.charAt(1)==s2.charAt(1) && s1.charAt(2) == s2.charAt(0)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
	
	// print
	static void print(String s) {
		System.out.println(s);
	}
	
	// union find lib
	// usage:
	// 最初にinitを呼ぶ
	// root: 直接は呼ばないで
	// unite: まとめる
	// same: グループ判定
	static void init(int par[], int N) {
		for(int i=0; i<N; i++) {
			par[i] = i;
		}
	}
	
	static int root(int x, int [] par) {
		if(par[x] == x) {
			return x;
		} else {
			return (par[x] = root(par[x], par));
		}
	}
	
	static boolean same(int x, int y, int[] par) {
		return root(x, par) == root(y, par);
	}
	
	static void unite(int x, int y, int[] par) {
		x = root(x, par);
		y = root(y, par);
		if(x == y) return;
		par[x] = y;
	}
	
	// end union find lib
	
	// number lib
	
	static int max(int...ls) {
		int ans = Integer.MIN_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.max(ans, ls[i]);
		}
		return ans;
	}
	
	static int min(int...ls) {
		int ans = Integer.MAX_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.min(ans, ls[i]);
		}
		return ans;
	}
	
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static long pow(long a, long b) {
		if(b==0) return 1;
		if(b==1) return a;
		if(b%2==0) {
			long d = pow(a, b/2);
			return d*d;
		} else {
			return a*pow(a, b-1);
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
	
	// end number lib
}

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

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

    set<ll> divA;
    set<ll> common;
    for(ll i = 1; i * i <= a; i++) {
        if(a % i == 0) {
            divA.insert(i);
            divA.insert(a/i);
        }
    }
    for(ll i = 1; i * i <= b; i++) {
        if(b % i == 0) {
            if(divA.find(i) != divA.end()) common.insert(i);
            if(divA.find(b/i) != divA.end()) common.insert(b/i);
        }
    }

    set<ll> primes;
    for(ll c : common) {
        for(ll i = 2; i * i <= c; i++) {
            while(c % i == 0) {
                primes.insert(i);
                c /= i;
            }
        }
        primes.insert(c);
    }
    cout << primes.size() << endl;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  ll n, k;
  cin >> n >> k;

  map<ll, ll> mll;
  rep (i, n) {
    int a, b;
    cin >> a >> b;
    mll[a] += b;
  }
  ll tmp = 0;
  for (auto &v : mll) {
    v.second += tmp;
    tmp = v.second;
  }

  for (auto v : mll) {
    if (k <= v.second) {
      cout << v.first << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 7536
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func solve(n, a, b int) int {
	if (b-a)%2 == 0 {
		return (b - a) / 2
	}

	return min(a+(b-a-1)/2, n-b+1+(b-a-1)/2)
}

func main() {
	n, _ := strconv.Atoi(input())
	a, _ := strconv.Atoi(input())
	b, _ := strconv.Atoi(input())
	fmt.Println(solve(n, a, b))
}


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

using namespace std;

const int INF = 1e9 + 5;

int main()
{
  int n;
  int h[100010];

  cin >> n;

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

  vector <int> dp(n, INF);
  dp[0] = 0;

  for (int i = 0; i < n-1; i++)
  {
    for (int j = i+1; j <= i+2; j++)
    {
      if (j < n)
      {
        dp[j] = min(dp[j], dp[i] + abs(h[i]-h[j]));
      }
    }
  }
  cout << dp[n-1] << "\n";

  return 0;
}


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

int main(){
    ll  n , m , l ;
    cin >> n >> m >> l ;
    ll count = 0 ;
    for(ll i = n ; i <= m ; i++ ){
      if(i%l == 0 )count++ ;
    }
    cout << count << endl;
}


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

 int main() {
   int n;
   cin >> n;
   int s = 0;
   int a = n;
   while (a > 0) {
     s += a % 10;
     a = a / 10;
   }
   if (n % s == 0) {
     cout << "Yes" << '\n';
   }else{
     cout << "No" << '\n';
   }
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int X[N];
  int count = 0;
  int result = 1000000;
for(int a = 0;a < N;a++)cin >> X[a];
for(int a = 1;a <= 100;a++){
  count = 0;
for(int b = 0;b < N;b++){
   count += pow(X[b] - a,2);
 }
  if(count <= result){
   result = count;
  }
}
cout << result << endl;

}

Measured memory_bytes: 256
#!/usr/bin/env python3

N = int(input())
S = [input() for i in range(N)]

ret = 0

for s in S:
    ret += s.count('AB')

D = [0] * N
for i in range(N):
    r = [0, 0]
    if S[i][0] == 'B':
        r[0] = 1
    if S[i][-1] == 'A':
        r[1] = 1

    D[i] = r

b_c = D.count([1, 0])
a_c = D.count([0, 1])
ab_c = D.count([1, 1])

if ab_c == 0:
    ret += min(b_c, a_c)
else:
    if a_c + b_c > 0:
        ret += ab_c + min(a_c, b_c)
    else:
        ret += ab_c - 1


print(ret)


Measured memory_bytes: 10436
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] food = new int[M];
		for(int i = 0; i < N; i++) {
			int K = sc.nextInt();
			for(int j = 0; j < K; j++) {
				food[sc.nextInt() -1]++;
			}
		}
		int result = 0;
		for(int i = 0; i < M; i++) {
			if(food[i] == N) {
				result++;
			}
		}
		System.out.println(result);
	}
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    int ans     = 0;
    int before  = 0;
    bool erased = true;
    rep(i, N) {
        if (before == A[i] && erased)
            erased = false;
        else if (before == A[i] && !erased)
            erased = true;
        else if (before != A[i] && erased) {
            before = A[i];
            erased = false;
        }
        else if (before != A[i] && !erased) {
            ans += 1;
            before = A[i];
        }
    }
    if (!erased)
        ans += 1;
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	string c[2];
	REP(i, 2) cin >> c[i];
	
	bool ans = true;
	ans &= c[0][0] == c[1][2];
	ans &= c[0][1] == c[1][1];
	ans &= c[0][2] == c[1][0];
	
	puts(ans ? "YES" : "NO");
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>

using namespace std;

stack<int> nums;

bool is_operator(string s) {
    if(s == "+" || s == "-" || s == "*") {
        return true;
    } else {
        return false;
    }
}

int getnpop() {
    int tmp;
    
    tmp = nums.top();
    nums.pop();
    
    return tmp;
}

void adder() {
    int tmp;
    
    tmp = getnpop();
    tmp = getnpop() + tmp;
    
    nums.push(tmp);
}

void substracter() {
    int tmp;
    
    tmp = getnpop();
    tmp = getnpop() - tmp;
    
    nums.push(tmp);
}

void multiplier() {
    int tmp;
    
    tmp = getnpop();
    tmp = getnpop() * tmp;
    
    nums.push(tmp);
}

int main() {
    string s;
    
    while(cin >> s) {
        if(is_operator(s)) {
            if(s == "+") {
                adder();
            } else if(s == "-") {
                substracter();
            } else if(s == "*") {
                multiplier();
            }
        } else {
            nums.push(stoi(s));
        }
    }
    
    cout << nums.top() << endl;
    
    return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  int x, y, z;
  cin >> x >> y >> z;
  
  int tmp = z;
  int ans = 0;
  for(int i = 0; i < 1000000; i++) {
    if(tmp + y + z <= x) {
      tmp = tmp + (y+z);
      ans++;
    } 
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
x = int(input())

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if x==2:
    print(2)
elif x%2==0:
    for i in range(1,10000,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass
else:
    for i in range(0,10000,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass

Measured memory_bytes: 3064
fn main() {
    let nk = read_vec::<usize>();
    let n = nk[0];
    let k = nk[1];
    let rsp = read_vec::<usize>();
    let r = rsp[0];
    let s = rsp[1];
    let p = rsp[2];
    let t: Vec<char> = {
        let t = read::<String>();
        t.chars().into_iter().collect()
    };

    let mut cnt = 0;
    let mut memo = Vec::new();
    for i in 0..n {
        if i >= k {
            if t[i] == t[i-k] {
                if t[i] == 'r' && memo[i-k] != 'p' {
                    cnt += p;
                    memo.push('p');
                } else if t[i] == 's' && memo[i-k] != 'r' {
                    cnt += r;
                    memo.push('r');
                } else if t[i] == 'p' && memo[i-k] != 's'{
                    cnt += s;
                    memo.push('s');
                } else {
                    memo.push('x');
                }
            } else {
                if t[i] == 'r' {
                    cnt += p;
                    memo.push('p');
                } else if t[i] == 's' {
                    cnt += r;
                    memo.push('r');
                } else {
                    cnt += s;
                    memo.push('s');
                }
            }
        } else {
            if t[i] == 'r' {
                cnt += p;
                memo.push('p');
            } else if t[i] == 's' {
                cnt += r;
                memo.push('r');
            } else {
                cnt += s;
                memo.push('s');
            }
        }
    }

    println!("{}", cnt);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        int[][] arr = new int[n][2];

        for (int i=0; i<n; i++){
            int x = sc.nextInt();
            int l = sc.nextInt();
            int left = x-l;
            int right = x+l;
            arr[i][0] = left;
            arr[i][1] = right;
        }

        Arrays.sort(arr, (a, b)->Integer.compare(a[1], b[1]));

//        System.out.println(arr[0][1]);

        int min = arr[0][1];

        ans++;

        for (int i=1; i<n; i++){
            if (arr[i][0]>=min){
                ans++;
                min = arr[i][1];
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std;

int main() {
	int A,B,C,K;
	scanf("%d%d%d",&A,&B,&C);
	scanf("%d",&K);

	for (;A >= B;B<<=1) K--;
	for (;B >= C;C<<=1) K--;

	if (K >= 0) printf("Yes\n");
	else printf("No\n");

	return 0;
}


Measured memory_bytes: 3760
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int D[100010],OD[100010],OP[100010];
int SSZ[100010];
vector<pii> ANS;
int CD[100010];
vector<int> G[100010];

void dfs(int idx,int par,int cnt)
{
	CD[idx]=cnt;
	for(auto e:G[idx])
	{
		if(e==par)continue;
		dfs(e,idx,cnt+1);
	}
}

bool func()
{
	dfs(0,-1,0);
	int t=0;
	rep(i,0,N)
	{
		t+=CD[i];
	}
	return t==D[0];
}
 
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin>>N;
	rep(i,0,N)
	{
		cin>>OD[i];
		D[i]=OD[i];
	}

	sort(D,D+N);

	rep(i,0,N)
	{
		int op=lower_bound(D,D+N,OD[i])-D;
		OP[op]=i;
	}

	bool ok=true;
	rrep(i,1,N)
	{
		SSZ[i]++;
		int sd=D[i]-(N-SSZ[i]*2);
		int idx=lower_bound(D,D+N,sd)-D;
		if(idx==N||idx==i||D[idx]!=sd)
		{
			ok=false;
			break;
		}
		SSZ[idx]+=SSZ[i];
		ANS.push_back(mp(idx,i));
		G[idx].push_back(i);
		G[i].push_back(idx);
	}

	if(!ok||!func())
	{
		cout<<-1<<endl;
		return 0;
	}

	for(auto p:ANS)
	{
		cout<<OP[p.first]+1<<" "<<OP[p.second]+1<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 14704
#include <stdio.h>

int N;
int A[114514];

int main(void) {
	int i;
	int gotiusa = 1;
	int kinnmoza = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 1; i < N; i++) {
		if ((kinnmoza > 0 && A[i - 1] > A[i]) || (kinnmoza < 0 && A[i - 1] < A[i])) {
			kinnmoza = 0;
			gotiusa++;
		} else if (kinnmoza == 0) {
			if (A[i - 1] < A[i]) kinnmoza = 1;
			else if (A[i - 1] > A[i]) kinnmoza = -1;
		}
	}
	printf("%d\n", gotiusa);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

#define int long long

typedef vector<int> vi;
typedef pair<int,int> ii;


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const int INF = 1e18;
const int mod = 1e9+7;
const int N = 2e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int32_t main(){
  fast;

  int n;
  cin >> n;
  cout << (n * n * n);
  

  return 0;
}

Measured memory_bytes: 256
fun main() = abc167c()

@OptIn(ExperimentalStdlibApi::class)
fun abc167c() {
    val (n, m, x) = readLine()!!.split(' ').map { it.toLong() }
    val books = (1..n).map {
        val map = readLine()!!.split(' ').map { it.toLong() }
        map[0] to map.drop(1)
    }

    var answer = Long.MAX_VALUE

    searchAllPatterns(2, n.toInt()) { b ->
        val filtered = books.filterIndexed { index, _ -> b[index] == 1L }

        val sum = LongArray(m.toInt())
        filtered.forEach { it.second.forEachIndexed { index, l -> sum[index] += l } }

        if (sum.all { it >= x }) {
            answer = filtered.map { it.first }.sum().coerceAtMost(answer)
        }
    }

    if (answer == Long.MAX_VALUE) answer = -1

    println(answer)
}

@Suppress("SameParameterValue")
private inline fun searchAllPatterns(numberOfChoices: Int, length: Int, action: (LongArray) -> Unit) {
    val patterns = (1..length).fold(1L) { acc: Long, _: Int -> acc * numberOfChoices }
    for (i in 0 until patterns) {
        val array = LongArray(length)
        var div = 1
        for (j in 0 until length) {
            array[length - j - 1] = (i / div) % numberOfChoices
            div *= numberOfChoices
        }
        action(array)
    }
}


Measured memory_bytes: 43844
n, x, m = map( int, input().split() )
# n, x, m = 10000000000, 10, 99959

found = [ -1 for _ in range( m ) ]
summation = [ 0 ]
a = x
length, loop_s, s_0, start = -1, -1, -1, -1
for i in range( n ):
    if found[ a ] > -1:
        length = i - found[ a ]
        loop_s = summation[ i ] - summation[ found[ a ] ]
        start = found[ a ]
        s_0 = summation[ start ]
        # print( length, loop_s, s_0, a, start )
        break
    else:
        found[ a ] = i
    # print( i, a )
    summation.append( summation[ -1 ] + a )
    a = ( a * a ) % m

if length < 0:
    print( summation[ n ] )
else:
    times = ( n - start ) // length
    rem = ( n - start ) % length
    rem_s = summation[ start + rem ] - s_0
    print( s_0 + loop_s * times + rem_s )

Measured memory_bytes: 13676
# Problem C - String Transformation

# input
S = list(input())
T = list(input())

# initialization
s_map = {}
t_map = {}
is_ok = True

# mapping
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if not s in s_map:
        s_map[s] = set([t])
    else:
        s_map[s].add(t)

    if not t in t_map:
        t_map[t] = set([s])
    else:
        t_map[t].add(s)

# check
# s check
for s in s_map:
    if len(s_map[s])>1:
        is_ok = False
# t check
for t in t_map:
    if len(t_map[t])>1:
        is_ok = False

# output
if is_ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 71496
package main

import "fmt"

func main() {
	for {
		var H, W int
		fmt.Scanf("%d %d", &H, &W)
		if H == 0 && W == 0 {
			break
		}
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				if i == 0 || j == 0 || i == H-1 || j == W-1 {
					fmt.Print("#")
				} else {
					fmt.Print(".")
				}
			}
			fmt.Print("\n")
		}
		fmt.Print("\n")
	}
}



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

using namespace std;

#define DICETOP 0
#define DICEFRONT 1
#define DICERIGHT 2
#define DICELEFT 3
#define DICEBACK 4
#define DICEBOTTOM 5

class Dice {
private:
	int *diceface;
public:
	Dice( int top, int front, int right, int left, int back, int bottom ) {
		diceface = new int[6];
		diceface[DICETOP] = top;
		diceface[DICEFRONT] = front;
		diceface[DICERIGHT] = right;
		diceface[DICELEFT] = left;
		diceface[DICEBACK] = back;
		diceface[DICEBOTTOM] = bottom;
	}
	~Dice( ) {
		delete [ ] diceface;
	}
	void roll( string cmd ) {
		int t;
		for( int i=0; i<cmd.length(); i++ ) {
			if( 'E' == cmd[i] ) {
				t = diceface[DICETOP];
				diceface[DICETOP] = diceface[DICELEFT];
				diceface[DICELEFT] = diceface[DICEBOTTOM];
				diceface[DICEBOTTOM] = diceface[DICERIGHT];
				diceface[DICERIGHT] = t;
			} else if( 'N' == cmd[i] ) {
				t = diceface[DICETOP];
				diceface[DICETOP] = diceface[DICEFRONT];
				diceface[DICEFRONT] = diceface[DICEBOTTOM];
				diceface[DICEBOTTOM] = diceface[DICEBACK];
				diceface[DICEBACK] = t;
			} else if( 'S' == cmd[i] ) {
				t = diceface[DICETOP];
				diceface[DICETOP] = diceface[DICEBACK];
				diceface[DICEBACK] = diceface[DICEBOTTOM];
				diceface[DICEBOTTOM] = diceface[DICEFRONT];
				diceface[DICEFRONT] = t;
			} else if( 'W' == cmd[i] ) {
				t = diceface[DICETOP];
				diceface[DICETOP] = diceface[DICERIGHT];
				diceface[DICERIGHT] = diceface[DICEBOTTOM];
				diceface[DICEBOTTOM] = diceface[DICELEFT];
				diceface[DICELEFT] = t;
			}
		}
		return;
	}
	int getDiceFace( int face ) {
		return diceface[ face ];
	}
};

int main( )
{
	int t, f, r, l, ba, bo;
	cin>>t>>f>>r>>l>>ba>>bo;
	Dice *dice = new Dice( t, f, r, l, ba, bo );

	string cmd;
	cin>>cmd;
	dice->roll( cmd );
	cout<<dice->getDiceFace( DICETOP )<<endl;

	delete dice;
	
	return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>

typedef struct
{
	int k, v[100];
	int d, f;
	int visited;
} Node;

int dfs(Node *node, int u, int t)
{
	if(node[u].visited == 0)
	{
		node[u].visited = 1;
		
		node[u].d = ++t;
		for(int i = 0; i < node[u].k; ++i)
		{
			t = dfs(node, node[u].v[i], t);
		}
		node[u].f = ++t;
	}
	return t;
}

int main()
{
	int n, u;
	Node node[100];
	
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d", &u);
		--u;
		
		scanf("%d", &node[u].k);
		for(int j = 0; j < node[u].k; ++j)
		{
			scanf("%d", &node[u].v[j]);
			--node[u].v[j];
		}
		node[u].visited = 0;
	}
	
	for(int i = 0, t = 0; i < n; ++i)
	{
		t = dfs(node, i, t);
	}
	
	for(int i = 0; i < n; ++i)
	{
		printf("%d %d %d\n", i+1, node[i].d, node[i].f);
	}
}



Measured memory_bytes: 2068
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String change[];
		String ans="A";
		String str;
		while(sc.hasNext()){
			str=sc.next();
			change=str.split(",");
			if(change[0].equals(ans))ans=change[1];
			else if(change[1].equals(ans))ans=change[0];
			//System.out.println(ans);
		}
		System.out.println(ans);
	}
}  

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

using namespace std;

struct node{
    int next,to,dis;
}a[10000100];
int head[1001000],dis[1001000],num;
bool vis[1001000];

typedef pair<int,int> pii;

priority_queue<pii,vector<pii>,greater<pii> > q;

int n,m,sx,sy,tx,ty,s,t;char Map[1010][1010];

int read(){
    int q=0;
    char c=getchar();
    while(c>'9'||c<'0')c=getchar();
    while(c>='0'&&c<='9')q=q*10+c-'0',c=getchar();
    return q;
}

void add(int fr,int to,int dis){
	// cout << fr << " " << to << " " << dis << endl;
    num++;
    a[num].next = head[fr];
    head[fr] = num;
    a[num].dis = dis;
    a[num].to = to ;
}

void Dijkstra(int s){
    memset(vis,0,sizeof vis);
    for(int i=1;i<=m*n;i++) dis[i] = 0x3f3f3f3f;
    dis[s] = 0;
    int p;
    q.push(make_pair(0,s));
    while(!q.empty()){
        p = q.top().second;q.pop();
        if(vis[p]) continue;
        vis[p] = true;
        for(int j = head[p];j != 0;j = a[j].next){
            if(dis[a[j].to]>dis[p]+a[j].dis){
                dis[a[j].to] = dis[p]+a[j].dis;
                if(!vis[a[j].to]) 
                	q.push(make_pair(dis[a[j].to],a[j].to));
            }
        }
    }
}



int main() {

	n = read(); m = read();
	sx = read(); sy = read();
	tx = read(); ty = read();
	s = (sx - 1) * m + sy;
	t = (tx - 1) * m + ty;
	for(int i = 1;i <= n; ++i)
		scanf("%s", Map[i] + 1);
	for(int i = 1;i <= n; ++i) {
		for(int j = 1;j <= m; ++j) {
			if(Map[i][j] == '#') continue;
			int u = (i - 1) * m + j;
			for(int dx = -2; dx <= 2; ++dx) {
				for(int dy = -2; dy <= 2; ++dy) {
					int x = i + dx, y = j + dy, v = (x - 1) * m + y;
					if(dx == 0 && dy == 0) continue;
					if(x <= 0 || y <= 0) continue;
					if(y >  m || x >  n) continue;
					if(Map[x][y] == '#') continue;
					add(u, v, (abs(dx) + abs(dy) == 1) ? 0 : 1);
				}
			}
		}
	}
	Dijkstra(s);
	if(dis[t] == 0x3f3f3f3f) dis[t] = -1;
	printf("%d\n", dis[t]);
}

// int main(){
//     n = read(); m = read(); s = read();
//     int x,y,z;
//     for(int i = 1; i <= m; i++ ){
//         x = read(); y = read(); z = read();
//         add(x, y, z);
//     }
//     Dijkstra(s);
// }

Measured memory_bytes: 83552
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
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; }

int H, W;
int fld[1500][1500];
int dp[1500][1500];

int main() {
    cin >> H >> W;
    rep(i, H) rep(j, W) cin >> fld[i][j];

    rep(i, W) dp[0][i] = (fld[0][i] + 1) % 2;
    rep(i, H) dp[i][0] = (fld[i][0] + 1) % 2;

    for (int i = 1; i < H; i++) {
        for (int j = 1; j < W; j++) {
            if (fld[i][j] == 1) dp[i][j] = 0;
            else {
                int t;
                t = min(dp[i-1][j-1], dp[i-1][j]);
                t = min(t, dp[i][j-1]);
                dp[i][j] = t + 1;
            }
        }
    }

    int ans = 0;
    rep(i, H) rep(j, W) chmax(ans, dp[i][j]);
    cout << ans*ans << endl;
}



Measured memory_bytes: 19496
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX 100000
#define NMAX 20

struct Node{
    int parent;
    int depth;
    int height;
    int brother;
    int child_l;
    int child_r;
};

Node N[MAX];

void addDepth(int id, int depth){
    N[id].depth = depth;
    
    if(N[id].child_l != -1) addDepth(N[id].child_l, depth+1);
    if(N[id].child_r != -1) addDepth(N[id].child_r, depth+1);
}

int getHeight(int id, int height){
    int h1, h2;
    h1 = height;
    h2 = height;
    
    if(N[id].child_l >= 0) h1 = getHeight(N[id].child_l, height) + 1;
    if(N[id].child_r >= 0) h2 = getHeight(N[id].child_r, height) + 1;
    
    N[id].height = max(h1, h2);
    return N[id].height;
}

int main(void){
    int n, root;
    cin >> n;
    
    for(int i = 0; i < n; i++){
        N[i].parent = -1;
        N[i].brother = -1;
        //N[i].degree = 0;
        N[i].depth = 0;
        N[i].child_l = -1;
        N[i].child_r = -1;
    }
    
    for(int i = 0; i < n; i++){
        int id, id_l, id_r;
        cin >> id >> id_l >> id_r;
        
        N[id].child_l = id_l;
        N[id].child_r = id_r;
        
        N[id_l].parent = id;
        N[id_l].brother = id_r;
        N[id_r].parent = id;
        N[id_r].brother = id_l;
    }
    
    root = n;
    for(int i = 0; i < n; i++){
        if(N[i].parent == -1){
            root = i;
            break;
        }
    }
    addDepth(root, 0);
    getHeight(root, 0);
    
    for(int i = 0; i < n; i++){
        cout << "node " << i << ": parent = " << N[i].parent << ", sibling = " << N[i].brother << ", ";
        if(N[i].child_l >= 0 && N[i].child_r >= 0) cout << "degree = 2";
        else if(N[i].child_l < 0 && N[i].child_r < 0) cout << "degree = 0";
        else cout << "degree = 1";
        cout << ", depth = " << N[i].depth << ", height = " << N[i].height << ", ";
        
        if(N[i].parent >= 0){
            if(N[i].child_l >= 0 || N[i].child_r >= 0) cout << "internal node";
            else cout << "leaf";
        }
        else cout << "root";
        cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3088
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	
	int a;
	int b;
	
	cin >> a;
	cin >> b;
	
	if(a > b){
		printf("a > b\n");
	}
	else if(a < b){
		printf("a < b\n");
	}
	else if(a = b){
		printf("a == b\n");
	}
    return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define ll long long
#define fs first
#define sec second
#define md 1000000007
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
using namespace std;
ll power(ll x, unsigned ll y, ll p)  
{  
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p  
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T=1;
    // cin>>T;
    while(T--){
    	string s,t;
        cin>>s>>t;
        ll ans=10000;
        for(ll i=0;i<s.size()-t.size()+1;i++){
            ll c=0;
            for(ll j=0;j<t.size();j++){
                if(s[i+j]!=t[j]) c++;
            }
            ans=min(ans,c);
        }
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3604
// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
#define N 405
long H,W,a,b,c;
char S[N][N];
void dfs(int x,int y){
  char t=S[x][y];
  (t-'#'?a:b)++;
  S[x][y]=0;//使用したら0にする
  up(i,-1,1){
    up(j,-1,1){
      if(i*i+j*j!=1)continue;//上下左右じゃなからスキップ
      if(x+i<0 || x+i>=H || y+j<0 || y+j>=W)continue;//範囲外ならスキップ
      if(S[x+i][y+j]+t=='#'+'.')dfs(x+i,y+j);
    }
  }
}
inline void solve(void){
  in(H,W);
  rep(i,H)in(S[i]);
  rep(i,H)rep(j,W){
    if(S[i][j]){
      a=b=0;//aは.の個数,bは#の個数
      dfs(i,j);
      c+=a*b;
    }
  }
  out(c);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;


int main(){
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> A(n);
  rep(i, n){
  if(i==0) A[i]=0;
  else {
    if(s.at(i-1)=='A'&&s.at(i)=='C') A[i] = A[i-1]+1;
    else A[i]= A[i-1];
  }  
  }
  int l, r;
  rep(i, q){
    cin >> l >> r;
    cout << A[r-1]-A[l-1] << endl;
  }
}

Measured memory_bytes: 1408
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*(N+1)
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1):
        if i+j>N-1:
            break
        else:
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
print(dp[N-1])




Measured memory_bytes: 55008
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define oo 9999999987654321LL
#define INT long long
using namespace std;
string s, t;

int main()
{
    int n, c;
    cin>>n>>s>>t;
    c = n;
    while( c > 0  and s.substr(n-c, c) != t.substr(0, c))
        c--;
    cout<<s.size()+t.size()-c<<endl;
}


Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr)
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Builder as BSB
import System.IO (stdout)
import Data.Monoid

warshallFloyd1 :: Int -> U.Vector (Int, Int, Int) -> V.Vector (U.Vector Int)
warshallFloyd1 !n !edges = runST $ do
  !arr <- V.replicateM n (UM.replicate n (10^9+1))
  U.forM_ edges $ \(a,b,c) -> do
    UM.write (arr V.! a) b c
    UM.write (arr V.! b) a c
  forM_ [0..n-1] $ \a -> do
    UM.write (arr V.! a) a 0
  flip V.imapM_ arr $ \ !k !a_k -> do
    V.forM_ arr $ \ !a_i -> do
      !a_ik <- UM.read a_i k
      forM_ [0..n-1] $ \j -> do
        a_kj <- UM.read a_k j
        UM.modify a_i (min (a_ik + a_kj)) j
  V.mapM U.unsafeFreeze arr

warshallFloyd2 :: Int -> Int -> V.Vector (U.Vector Int) -> V.Vector (U.Vector Int)
warshallFloyd2 !n !l !graph = runST $ do
  !arr <- V.replicateM n (UM.replicate n (10^9+1))
  flip V.imapM_ (V.zip graph arr) $ \ !a (!g_a,!a_a) -> do
    flip U.imapM_ g_a $ \ !b !v -> do
      when (v <= fromIntegral l) $ do
        UM.write a_a b 1
    UM.write a_a a 0
  flip V.imapM_ arr $ \ !k !a_k -> do
    V.forM_ arr $ \ !a_i -> do
      !a_ik <- UM.read a_i k
      forM_ [0..n-1] $ \j -> do
        a_kj <- UM.read a_k j
        UM.modify a_i (min (a_ik + a_kj)) j
  V.mapM U.unsafeFreeze arr

main = do
  [n,m,l] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  edges <- U.replicateM m $ do
    [a,b,c] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (a-1,b-1,c)
  let !w1 = warshallFloyd1 n edges
      !w2 = warshallFloyd2 n l w1
  q <- readLn
  queries <- U.replicateM q $ do
    [s,t] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (s,t)
  BSB.hPutBuilder stdout $ mconcat
    [ BSB.intDec (if d > 10^9 then -1 else d - 1) <> BSB.char7 '\n'
    | (s,t) <- U.toList queries
    , let d = w2 V.! (s-1) U.! (t-1)
    ]


Measured memory_bytes: 7676
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int flag=0;
    if(t.length()-s.length()!=1)
    cout<<"No"<<endl;
    else
    {
    	for(int i=0;i<s.length();i++)
    	{
    		if(s[i]!=t[i])
    		{
    			cout<<"No"<<endl;
    			flag=1;
    			break;
			}
		}
		if(flag==0)
		cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 3568