akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

int main(){
  int n;
  cin >> n;
  vi a(n);
  rep(i, 0, n)
    cin >> a[i];
  
  ll sum = 0;
  int mx = a[0];
  
  rep(i, 0, n){
    if(mx > a[i])
      sum += mx-a[i];
    else
      mx = a[i];
  }
  
  cout << sum << endl;
  
  return 0;
  
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define push_back pb
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int R,G,B,N;
	cin>>R>>G>>B>>N;
	int ans = 0;
	int rmax = N/R;
	int gmax = N/G;
	for (int r = 0; r <=rmax; ++r){
		for (int g = 0; g <= gmax; ++g){
			int cnt = r*R + g*G;
			if(N>=cnt&&((N-cnt)%B == 0))ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
def erase_first_zero_then_eval(lo, ro, ans)
	return false if ((lo.size >= 2) and lo[0] == "0") or ((ro.size >= 2) and ro[0] == "0")
	return true if lo.to_i + ro.to_i == ans.to_i
	return false
end
readlines.each do |l|
	(0..9).to_a.each do |x|
		lo, ro, ans = l.gsub("X", x.to_s).scan(/\d+/)
		if erase_first_zero_then_eval(lo, ro, ans)
			puts x
			break
		end
		puts "NA" if x == 9
	end
end

Measured memory_bytes: 6132
import itertools

H,W,M=map(int,input().split())
d={}
nh=[0]*H
nw=[0]*W
for _ in range(M):
    h,w=map(int,input().split())
    h-=1
    w-=1
    d[(h,w)]=1
    nh[h]+=1
    nw[w]+=1
hmax=max(nh)
wmax=max(nw)
is_h=[i for i in range(H) if nh[i]==hmax]
is_w=[i for i in range(W) if nw[i]==wmax]

for i_h,i_w in itertools.product(is_h,is_w):
    if (i_h,i_w) not in d:
        print(hmax+wmax)
        break
else:
    print(hmax+wmax-1)

Measured memory_bytes: 90276
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a+b>=a-b&&a+b>=a*b){
		cout<<a+b<<endl;
	}
	else if(a-b>=a+b&&a-b>=a*b){
		cout<<a-b<<endl;
	}
	else cout<<a*b<<endl;
}


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

typedef long long ll;

int main () {
	ll ans = 0;
	int n; cin >> n;
	ll in[n];
	int neg = 0;
	for (int i = 0; i < n; i++) {
		cin >> in[i];
		if (in[i] < 0) neg++;
		in[i] = abs(in[i]);
	}

	sort(in,in+n);

	for (int i = 1; i < n; i++)
		ans += in[i];

	if (neg&1) ans -= in[0];
	else ans += in[0];

	cout << ans << endl;

	return 0;
}


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

int main() {
  double N, T, A;
  cin >> N >> T >> A;
  vector<double> H(N);
  for(int i = 0; i < N; i++) {
    cin >> H[i];
  }
  double ans = 1000;
  int place = 0;
  for(int i = 0; i < N; i++) {
    if(abs(A - (T - H[i] * 0.006)) < ans) {
      ans = abs(A - (T - H[i] * 0.006));
      place = i + 1;
    }
  }
  cout << place << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

vector<long> dic(100010); //2のn乗(1e14を上限)

void Initdic(){
  long tmp = 1;
  rep(i,100010){
    dic.at(i) = tmp;
    tmp = min(tmp*2, (long)1e14);
  }
}

int main(){
  Initdic();
  int n;
  cin >> n;
  vector<long> a(n+1);
  rep(i,n+1) cin >> a.at(i);
  if(n == 0){
    if(a.at(0) == 1) cout << 1 << endl;
    else cout << -1 << endl;
    return 0;
  }else if(a.at(0) != 0){
    cout << -1 << endl;
    return 0;
  }

  vector<long> s(n+1); //深さiの頂点数の下限
  vector<long> t(n+1); //深さiの頂点数の上限
  vector<long> mini(n+1); //深さiの葉じゃない頂点数の下限
  vector<long> maxi(n+1); //深さiの葉じゃない頂点数の上限
  s.at(n) = a.at(n);
  t.at(n) = a.at(n);
  for(int i=n-1;i>=0;i--){
    s.at(i) = (s.at(i+1)+1)/2 + a.at(i); //深さiの頂点数の下限
    t.at(i) = t.at(i+1) + a.at(i); //深さiの頂点数の上限
  }
  mini.at(n) = a.at(n);
  rep(i,n){
    mini.at(i) = s.at(i) - a.at(i);
  }

  maxi.at(n) = a.at(n);
  for(int i=n-1;i>=0;i--){
    maxi.at(i) = min(dic.at(i)-a.at(i), t.at(i) - a.at(i)); 
  }

  for(int i=1;i<n;i++){
    maxi.at(i) = min(maxi.at(i), maxi.at(i-1)*2-a.at(i));
  }

  long ans = a.at(n);

  rep(i,n){
    ans += maxi.at(i) + a.at(i);
    if(maxi.at(i) < mini.at(i)){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  
}

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

using namespace std;

#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<

typedef long long llint;

const int MOD = 1e9 + 7;
const int MAXN = 2010;

int n, k;
int a[MAXN];

int add(int a, int b) {
  if (a + b >= MOD) return a + b - MOD;
  if (a + b < 0) return a + b + MOD;
  return a + b;
}

int mul(int a, int b) {
  return (llint) a * b % MOD;
}

int main(void) {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);

  int A = 0, B = 0;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (a[i] > a[j]) ++A;

  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (a[i] > a[j]) ++B;

  int sol = 0;
  llint coef = (llint) k * (k - 1) / 2;
  coef %= MOD;

  sol = mul(k, A);
  sol = add(sol, mul((int) coef, B));

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0) break; 
            
            for(int i = 0; i < H; i++){
                for(int j = 0; j < W; j++){
                    System.out.print("#");
                }
                System.out.println();
            }

            System.out.println();
        }

        sc.close();
    }
}


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

typedef long long ll;
typedef long double ld;

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

    int W, a, b;
    cin >> W >> a >> b;

    if(b < a) swap(a, b);

    if(a + W >= b) {
        cout << 0 << endl;
        return 0;
    }

    cout << b - a - W << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1000000007;
// const ll INF = 1000000000000000000LL;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  //追加するのは左か右
  int l=0; //左に追加する(
  int r=0; //右に追加する)
  rep(i,s.size()){
    if(s[i]=='('){
      r++;
    }
    if(s[i]==')'){
      if(r>0) r--;
      else l++;
    }
  }
  s.insert(0,string(l,'('));
  s.insert(s.size(),string(r,')'));
  cout << s << endl;
  return 0;
}


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

int main(){
    double a,b;
    int C;
    cin>>a >> b >> C;
    double PI = acos(-1); 
    double d=(PI*C/180);
    double s=a*b*sin(d)/2;
    double l=a+b+sqrt(a*a+b*b-2*a*b*cos(d));
    double h=(2*s)/a;
    
    printf("%8lf\n",s);
    printf("%8lf\n",l);
    printf("%8lf\n",h);
    
    return 0;
}


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

int main()
{
    vector<int> vec(3);
    cin >> vec[0] >> vec[1] >> vec[2];
    bool isFinished = false;
    while (!isFinished) {
        bool isSorted = true;
        for (int i = 0; i < vec.size(); i++) {
            if (i == vec.size() - 1)
                continue;

            if (vec[i] > vec[i + 1]) {
                int tmp = vec[i];
                vec[i] = vec[i + 1];
                vec[i + 1] = tmp;
                isSorted = false;
            }

        }
        isFinished = isSorted;
    }
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i];
        if (i != vec.size() - 1)
            cout << ' ';
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3068
fun main() {
  val (x, y) = readLine()!!.split(" ").map(String::toInt)
  if((y-2*x)%2==0 && (4*x-y)%2==0 && y-2*x>=0 && 4*x-y>=0) {
    println("Yes")
    return
  }
  println("No")
}

Measured memory_bytes: 36440
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <ostream>
#include <istream>
#include <typeinfo>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <limits>
#include <fstream>
#include <array>
#include <list>
#include <bitset>
#include <functional>
#include <random>
#include <cstring>
#include <chrono>
#include<string>
using namespace std;
#define endl "\n"
#define ll long long int
#define ld long double
#define AREA(a,b) (a*b)
#define f(i, n) for (int i = 0; i < (n); i++)
#define rof(i, n) for (int i = ((n) - 1); i >= 0; i--)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector<ll>
#define pb push_back
#define mx 1000005
#define ASCII 256

ll pos[100001];

void testcases(){
    ll arr[101]={0};
    ll n,a,b,indx=0;
    cin>>n;
    while(n--){
        cin>>a>>b;
        if(a==b){
            arr[indx]=1;
            indx++;
        }
        else{
            indx++;
        }
    }
    ll flag=0;
    for(ll i=0;i<=101-2;i++){
        if(arr[i]==1 && arr[i+1]==1 && arr[i+2]==1){
            flag=1;
        }
    }
    if(flag==1){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

int main(){
    boost;


//    int test;
//    cin>>test;
//    int t=1;
//    while(test--){
//        //cout<<"Case #"<<t<<": ";
//        testcases();
//        t++;
//    }


  testcases();
}


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

using namespace std;

int const N = 1234567;

vector<int> edges[N];

int dfs(int v, int pv) {
  int g = 0;
  for (int to : edges[v]) {
    if (to == pv) continue;
    g ^= 1 + dfs(to, v);
  }
  return g;
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    edges[x].push_back(y);
    edges[y].push_back(x);
  }
  if (dfs(0, -1) == 0) {
    puts("Bob");
  } else {
    puts("Alice");
  }
}

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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T> inline void scf(T &x)
{
	bool f = 0;
	x = 0;
	char c = getchar();
	while(c != '-' && (c < '0' || c > '9')) c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	if(f) x = -x;
	return;
}

template <typename T1, typename T2> void scf(T1 &x, T2 &y)
{
	scf(x);
	return scf(y);
}

template <typename T1, typename T2, typename T3> void scf(T1 &x, T2 &y, T3 &z)
{
	scf(x);
	scf(y);
	return scf(z);
}

template <typename T1, typename T2, typename T3, typename T4> void scf(T1 &x, T2 &y, T3 &z, T4 &w)
{
	scf(x);
	scf(y);
	scf(z);
	return scf(w);
}

inline char mygetchar()
{
	char c = getchar();
	while(c == ' ' || c == '\n') c = getchar();
	return c;
}

template <typename T> inline bool chkmax(T &x, const T &y)
{
	return y > x ? x = y, 1 : 0;
}

template <typename T> inline bool chkmin(T &x, const T &y)
{
	return y < x ? x = y, 1 : 0;
}

#ifdef King_George
#define DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

//---------------------------------------------------------head----------------------------------------------------

int main()
{
	LL a, b, c, d, n;
	scf(a, b, c, d);
	scf(n);
	chkmin(b, a * 2);
	chkmin(c, b * 2);
	chkmin(d, c * 2);
	LL ans = (n / 2) * d + (n % 2) * c;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int Mo=998244353;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar();}
	while(c>='0'&&c<='9') {x=(x<<1)+(x<<3)+(c^48);c=getchar();}
	if(f) x=-x;
	return x;
}
inline void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
}
int main()
{
	int a=read(),b=read();
	for(int i=1;i<=3;i++)
	{
		if(i!=a&&i!=b) cout<<i<<endl;
	}
	return 0;
}

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

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

    int n;
    cin >> n;
    int f[n][10];
    int p[n][11];
    rep(i,n){
        rep(j,10){
            cin >> f[i][j];
        }
    }
    rep(i,n){
        rep(j,11){
            cin >> p[i][j];
        }
    }
    
    int ans = -(1 << 30);
    
    for(int b=1; b < (1 << 10); b++){
        int sum = 0;
        
        rep(i,n){
            int count = 0;
            rep(j,10){
                if((b >> j & 1) && f[i][j]) count++;
            }
            
            sum += p[i][count];
        }
        
        ans = max(ans, sum);
    }
    
    cout << ans << endl;

    return 0;
}

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

count = 0
flg = False

for i in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
        if count == 3:
            flg = True
    else:
        count = 0

if flg:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9152
N,K=map(int,input().split())
x=list(map(int,input().split()))
ans=1000000000
for i in range(N-K+1):
    l=x[i]
    r=x[i+K-1]
    if ans>=min(abs(l)+abs(l-r),abs(r)+abs(l-r)):
        ans=min(abs(l)+abs(l-r),abs(r)+abs(l-r))
print(ans)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type &a){for(auto elem:a)cout<<elem<<' ';cout<<endl;}

struct UnionFind{
	vector<int> par;//xの親はpar[x].x自身が親ならpar[x]<0で、-par[x]がその集合のサイズ.
	
	UnionFind(int n):par(n,-1){}//コンストラクタ.
	
	void reset(int n){par.assign(n,-1);}
	int root(int x){return par[x]<0?x:par[x]=root(par[x]);}//再帰.
	int size(int x){return -par[root(x)];}
	bool same(int x,int y){return root(x)==root(y);}
	bool unite(int x,int y){
		x=root(x);
		y=root(y);
		if(x==y) return false;//do nothing.
		if(size(x)<size(y)) swap(x,y);//merge technique.
		par[x]+=par[y];
		par[y]=x;
		return true;
	}
};

int main(){
	int n,k,l;
	cin>>n>>k>>l;
	
	UnionFind uf(n),uff(n);
	REP(i,k){
		int p,q;
		scanf("%d%d",&p,&q);
		uf.unite(--p,--q);
	}
	REP(i,l){
		int r,s;
		scanf("%d%d",&r,&s);
		uff.unite(--r,--s);
	}
	
	map<pii,int> mp;
	REP(i,n){
		pii p(uf.root(i),uff.root(i));
		mp[p]++;
	}
	
	REP(i,n){
		pii p(uf.root(i),uff.root(i));
		cout<<mp[p]<<endl;
	}
	return 0;
}//解説参考.

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

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

	for (int i = 0; i < s.size(); i++) {
		char ch = s.at(i);
		if (ch == ',') {
			cout << ' ';
		}
		else {
			cout << ch;
		}
	}
	cout << endl;
}

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

int main()
{
  char b;
  cin >> b;

  if(b == 'A') cout << 'T';
  if(b == 'T') cout << 'A';
  if(b == 'G') cout << 'C';
  if(b == 'C') cout << 'G';

  cout << endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, maxim = 0;
    cin >> N;

    vector<ll> V(N+1);

    for (int i = 0; i < N; i++)
        cin >> V[i];

    V[N] = (10e+9) +7;
    int k = 0;
    for (int i = 0; i < N;i++) {
        if (V[i] >= V[i+1]) k++;        
        else {
            maxim = max(maxim, k);
            k = 0;
        }
    }

    cout << maxim << endl;
    
    return 0;
}

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


int main() {
int N;
cin >> N;
int vec[2000010];
for(int i = 0; i < N; i++){
cin >> vec[i];
}
int num = 1;
int bre = 0;
for(int i = 0; i < N; i++){
if(vec[i] != num) bre++;
else num++;

if(i == N-1 && num == 1 ) bre = -1;

}
cout << bre << endl;

}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
string s,t;
int main(){
	ios::sync_with_stdio(0);
	cin>>s>>t;
	int ans=0;
	rep(i,sz(s))
	if(s[i]!=t[i])
	ans++;
	cout<<ans; 
	re 0;
}

Measured memory_bytes: 3756
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
//#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m,q;
	cin>>n>>m>>q;
	vs tmp(m,"");
	rep(i,n)rep(j,m){
		char c;cin>>c;
		tmp[j]=c+tmp[j];
	}
//	rep(i,m)cout<<in[i]<<endl;
	bool h=false;
	rep(x,m-1)rep(y,n){
		vs in=tmp;
		swap(in[x][y],in[x+1][y]);
		rep(i,m){
			string t="";
			rep(j,n)if(in[i][j]!='.')t+=in[i][j];
			while(t.size()!=n)t+=".";
			in[i]=t;
		}
		while(1){
			vvi to(m,vi(n));
			rep(i,m)rep(j,n-1)if(in[i][j]!='.'){
				int t=j;
				while(t+1<n&&in[i][t]==in[i][t+1])t++;
				if(t-j+1>=q)loop(k,j,t+1)to[i][k]=true;
				j=t;
			}
			rep(i,n)rep(j,m-1)if(in[j][i]!='.'){
				int t=j;
				while(t+1<m&&in[t][i]==in[t+1][i])t++;
				if(t-j+1>=q)loop(k,j,t+1)to[k][i]=true;
				j=t;
			}
			bool he=false;
			rep(i,m){
				string t="";
				rep(j,n)if(!to[i][j])t+=in[i][j];
				while(t.size()!=n)t+=".";
				if(in[i]!=t)he=true;
				in[i]=t;
			}
			if(!he)break;
		}
		bool H=true;
		rep(i,m)rep(j,n)if(in[i][j]!='.')H=false;
		if(H)h=true;
	}
	if(h)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e6+10;
ll prime[N],k,t,n;
bool isprime[N];
void Prime(){
    fill(isprime,isprime+N,1);
    k=0;
    prime[1]=0;
    for(ll i=2;i<N;i++){
        if(isprime[i]){
            prime[k++]=i;
            for(ll j=2;i*j<N;j++)
                isprime[i*j]=0;
        }
    }
}

ll solve(ll n){
    ll cnt=0,ans=0;
    for(ll i=0;i<k&&prime[i]*prime[i]<=n;i++){
        if(n%prime[i]==0){
            cnt=0;
            while(n%prime[i]==0){
                cnt++;
                n/=prime[i];
            }
            ans?ans=__gcd(ans,cnt):ans=cnt;
        }
    }
    if(n>1) ans?ans=__gcd(ans,n):ans=1;
    return ans;
}

int main(){
  int x;cin>>x;
  if(x>=30) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 3620
(N, ) = [int(n) for n in input().split()]
L = [int(n) for n in input().split()]
L.sort()

ans = 0
for i in range(N):
    Li = L[i]
    for j in range(i+1, N):
        Lj = L[j]
        if Li != Lj:
            for k in range(j+1, N):
                Lk = L[k]
                if Li + Lj > Lk and Lk != Li and Lk != Lj:
                    #print(i,j,k, Li, Lj, Lk)
                    ans += 1
print(ans)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define ftype  long double
#define endl '\n'
#define pr pair<ll,ll>
#define debug(x) cout<<#x<<" "<<x<<endl;
using namespace std;
void masterstroke(){
	ll n;cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
    ll a1=n/2-1;
    ll a2=n/2;
    cout<<a[a2]-a[a1]<<endl;
	
}
int main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 ll t=1;//cin>>t;
	 for(ll i=0;i<t;i++)masterstroke();
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

int a[200000], b[200000], ac, bc, aa[200000], bb[200000];

int solve() {
  for(int i = 0; i < 200000; i++) {
    if(aa[i] == 1 && 1 == bb[i]) return 1;
  }
  return 0;
}

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for(int i = 0; i < m; i++) {
    int _a, _b; scanf("%d %d", &_a, &_b);
    if(_a == 1) {
      aa[_b] = 1;
    } else if(_b == n) {
      bb[_a] = 1;
    }
  }
  puts(solve() ? "POSSIBLE" : "IMPOSSIBLE");
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
template<typename T1, typename T2>
inline bool cmn (T1& a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<typename T1, typename T2>
inline bool cmx (T1& a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k, q; std::cin >> n >> k >> q;
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) std::cin >> a[i];
  auto sub_count = [&] (int l, int r, int X) {
    assert(0 <= l && l <= r && r <= n);
    int ret = std::count_if(a.begin() + l, a.begin() + r, [X](int z){return z <= X;});
    cmn(ret, r - l - k + 1);
    cmx(ret, 0);
    return ret;
  };
  auto count = [&] (int X, int Y) {
    int ret = 0;
    int l = 0;
    for (int r = 0; r <= n; r++) {
      if (r == n || a[r] < Y) {
        if (l < r) ret += sub_count(l, r, X);
        l = r + 1;
      }
    }
    return ret;
  };
  constexpr int inf = 1 << 30;
  int ret = inf;
  for (auto Y : a) {
    auto check = [&] (int X) {
      return count(X, Y) >= q;
    };
    if (!check(inf)) continue;
    int ok = inf, ng = Y - 1, md;
    while (abs(ok - ng) > 1) {
      md = (ok + ng) >> 1;
      if (check(md)) ok = md;
      else ng = md;
    }
    cmn(ret, ok - Y);
  }
  std::cout << ret << std::endl;
  return 0;
}

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

#define pii pair<int,int>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define deb(x) cerr<<#x" = "<<x<<nl
#define in() ( { int a ; scanf("%d",&a); a; } )

const int N=3e5+9;

int32_t main()
{
    int n=in();
    string s;
    cin>>s;
    for(int i=0;i<(int)s.size();i++) s[i]='A'+(s[i]-'A'+n)%26;
    cout<<s<<nl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[110][100010];
int main(){
    int n,W; cin >> n >> W;
    vector<int> w(n),v(n);
    for(int i=0;i<n;++i) cin >> w[i] >> v[i];
    for(int i=0;i<n;++i){
        for(int j=0;j<=W;++j){
            dp[i+1][j] = dp[i][j];
            if(j-w[i]>=0){
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]] + v[i]);
            }
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

int mainsolve(){

	ll h,w,k;
	cin >> h >> w >> k;
	vector<string> s(h);
	rep(i,h) cin >> s[i]; // 1: white

	
	ll res = 1e9;
	rep(svar,1<<(h-1)){

		ll num = __builtin_popcountll(svar) + 1;
		vector<ll> group(h); // 各行目が何番目のgroupに属するか
		rep(i,h-1){
			if((svar>>i) & 1) group[i+1] = group[i] + 1;
			else group[i+1] = group[i];
		}
		assert(group[h-1] == num-1);

		vector<vector<ll>> memo(num,vector<ll>(w)); // 横に切り終わった後の各blockのwhile数
		rep(i,h) rep(j,w) if(s[i][j]=='1') memo[group[i]][j]++;
		bool isNG = false;
		rep(i,num) rep(j,w) if(memo[i][j] > k) isNG = true;
		if(isNG) continue; // 横に切った時点でoutならとばす

		// 縦に切る
		ll cnt = num-1;		
		vector<ll> now(num);
		rep(j,w){
			bool isOK = true;
			rep(i,num){
				now[i] += memo[i][j];
				if(now[i] > k){
					isOK = false;
					continue;
				}
			}

			if(!isOK){
				cnt++;
				rep(i,num) now[i] = memo[i][j];
			}

		}

		res = min(res,cnt);
	}

	cout << res << endl;
	return 0;

	
}

int main(){

	return mainsolve();
}

Measured memory_bytes: 384
# coding: utf-8


def main():
    
    n = int(input())
    s, t = input().split(' ')
    
    new = []
    for i in range(n):
        new.append(s[i])
        new.append(t[i])

    print(''.join(new))    
    
    return 0
    
    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll                    long long int
#define pb                    push_back
#define F                     first
#define S                     second
using namespace std;

ll MOD = 1000000007;
int n,m,x;
int ans = INT_MAX;
int fd = -1;
int mp[15][15];
    
void back(int cost, int ind,int c[], int vals[]){
    int f = 1;
    for(int i=0;i<m;i++)
    {
        if(vals[i] < x)
        {
            f=0;
            break;
        }
    }
    if(f == 1)
    {
        ans = min(ans, cost);
        fd =1;
    }
    if(ind == n) return;
    cost += c[ind];

    for(int i=0;i<m;i++)
    {
        vals[i]+=mp[ind][i];
    }
    back(cost, ind+1, c ,vals);
    cost -= c[ind];
    for(int i=0;i<m;i++)
    {
        vals[i]-=mp[ind][i];
    }
    back(cost, ind+1,c,vals);

}
int main()
{
    cin>>n>>m>>x;
    int c[n] = {0};
    int  t[m] ={0};
    for(int i=0;i<n;i++){
        cin>>c[i];
        for(int j=0;j<m;j++) cin>>mp[i][j];
    }
    int vals[m] = {0};
    back(0,0,c,vals);
    if(fd ==-1) ans = -1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#define ll long long
#define mod 998244353
using namespace std;
int n;
ll p2[10000010],p3[10000010],inv[10000010],ifac[10000010],fac[10000010];
inline ll calc(int n,int m){
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
inline ll solve(){
	ll res=0;
	for(register int i=(n>>1)+1;i<=n;i++){
		res=(res+calc(n,i)*p2[n-i]%mod)%mod;
	}
	return res;
}
int main(){
	scanf("%d",&n);
	inv[1]=1;
	for(register int i=2;i<=n;i++)inv[i]=inv[mod%i]*(mod-mod/i)%mod;
	p2[0]=p3[0]=fac[0]=ifac[0]=1;
	for(register int i=1;i<=n;i++){
		p2[i]=p2[i-1]*2%mod;
		p3[i]=p3[i-1]*3%mod;
		fac[i]=fac[i-1]*i%mod;
		ifac[i]=ifac[i-1]*inv[i]%mod;
	}
	printf("%lld",(p3[n]-2ll*solve()%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 390912
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <deque>
#include <valarray>
#include <unordered_map>
#include <unordered_set>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
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(b<a){a=b;return 1;}return 0;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl;
#define OUTD(x) cout << fixed << x << endl;
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 1000000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  IN(ll,N);
  IN(ll,M);
  vvll road(N,vll(0));
  REP(i,M){
    ll a,b;
    cin >> a >> b;
    road.at(a-1).push_back(b-1);
    road.at(b-1).push_back(a-1);
  }
  vll ans(N,0);
  ans.at(0) = INF;
  vb flag(N,true);
  queue<ll> que;
  que.push(0);
  while(que.size()){
    ll num = que.front();
    que.pop();
    if(flag.at(num)){
      flag.at(num) = false;
      for(ll s : road.at(num)){
        if(ans.at(s) == 0){
          que.push(s);
          ans.at(s) = num + 1;
        }
      }
    }
  }
  for(ll i = 1; i < N; i++){
    if(ans.at(i) == 0){
      OUT("No");
      return 0;
    }
  }
  OUT("Yes");
  for(ll i = 1; i < N; i++){
    OUT(ans.at(i));
  }
}

Measured memory_bytes: 12956
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  ULL n;
  cin>>n;
  VEC<ULL>A(5);
  REP(i,0,5)cin>>A[i];
  sort(ALL(A));
  // DUMP(A);
  ULL mi = A[0];
  ULL ans = (n+mi-1)/mi + 4;
  cout<<ans<<endl;

  return 0;
}


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

int solve(long long n) {
    if (n == 0) return 1;
    vector<long long> f;
    for (long long i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            f.push_back(i);
            n /= i;
        }
    }
    if (n > 1) f.push_back(n);

    int ans = 0;
    int i = 0;
    while (i < f.size()) {
        int j = i + 1;
        while (j < f.size() && f.at(j) == f.at(i)) j++;
        int count = j - i;
        int sum = 0;
        i = j;
        for (int x = 1; x + sum <= count; x++, ans++) sum += x;
    }
    return ans;
}

int main() {
    long long n;
    cin >> n;
    cout << solve(n) << endl;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define M 1000000/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

typedef struct {
  char order[6];
  char word[12];
} Orders;

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; /* your task */; }
int h2(int key){ return 1 + (key % (M - 1)); /* your task */; }

int find(char str[]){

    /* your task */
  long long key,i,h;
  key = getKey(str);
  while(1){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
    i++;
  }
  return 0;
}

int insert(char str[]){

    /* your task */
  long long key,i = 0,h;
  key = getKey(str);
  while(1){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
    i++;
  }

}

int main(){
  int i, n, h;
  Orders *bb;
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
  scanf("%d", &n);
  bb = (Orders *)malloc(n * sizeof(Orders));
  for(i = 0;i < n;i++){
    scanf("%s %s",bb[i].order,bb[i].word);

    if(bb[i].order[0] == 'i'){
      insert(bb[i].word);
    }
    else {
      if(find(bb[i].word) == 1) printf("yes\n");
      else printf("no\n");
    }
  }
  free(bb);
  return 0;
}



Measured memory_bytes: 32756
FB = (1..15).map{|x|[[:Fizz][x%3],[:Buzz][x%5]]*''}
loop do
  m, n = gets.split.map(&:to_i)
  break if m == 0
  pos = []
  ret = Array.new(m){|i|i+1}
  (FB*(n/15)+FB[0,n%15]).map.with_index{|v,i| v==''? (i+1).to_s : v}.zip(n.times.map{gets.chomp}).map.with_index{|(a,b),i| i if a!=b}.compact[0,m-1].unshift(0).each_cons(2).with_index{|(a,b),i| pos << (b-a)%(m-i)}
  pos.reduce(0){|s,t| ret.slice!(t=(s+t)%ret.size); t-1}
  puts ret.join(' ')
end 

Measured memory_bytes: 10828
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int s=calcDigitSum(n);
		
		String ans=(n%s==0)?"Yes":"No";
		System.out.println(ans);
	}
	
	private static int calcDigitSum(int n) {
		int digitSum = 0;
		for (int i = n; i > 0; i /= 10) {
			digitSum += i % 10;
		}
		return digitSum;
	}
}


Measured memory_bytes: 23892
def solve():
  n,l = map(int,input().split())
  
  length = [int(input()) for i in range(n)]
  pare = [(length[i], i) for i in range(n)]
  pare.sort(reverse=True)
  dp = [0] * (n + 1)
  for p in pare:
    i = p[1]
    if i == 0:
      dp[i] = dp[i + 1] + (l - length[i])
    else:
      dp[i] = max(dp[i - 1], dp[i + 1]) + (l - length[i])
  print(max(dp))
solve()


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

int main(){
	int n;
	while( cin >> n , n ){
		for(int i=0 ; i < n ; i++ ){
			int a1, b1, c1, d1, a2, b2, c2, d2;
			cin >> a1 >> b1 >> c1 >> d1 >> a2 >> b2 >> c2 >> d2;
			int w = a1 * a2 - b1 * b2 - c1 * c2 - d1 * d2;
			int x = a1 * b2 + a2 * b1 + c1 * d2 - c2 * d1;
			int y = a1 * c2 - b1 * d2 + a2 * c1 + b2 * d1;
			int z = a1 * d2 + b1 * c2 - b2 * c1 + a2 * d1;
			cout << w << " " << x << " " << y << " " << z << endl;
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n, m, cnt;
int head[MAX], vet[MAX], h[MAX], Next[MAX];

void add(int x, int y){
    cnt++;
    Next[cnt] = head[x];
    head[x] = cnt;
    vet[cnt] = y;
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        scanf("%d", &h[i]);
    }
    int x, y;
    for(int i = 1; i <= m; i++){
        scanf("%d%d", &x, &y);
        add(x, y), add(y, x);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int flag = 1;
        for(int j = head[i]; j; j = Next[j]){
            int v = vet[j];
            if(h[v] >= h[i]) flag = 0;
        }
        if(flag) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6124
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();

		int ans = 0;
		if (B / A > C) {
			ans = C;
		} else {
			ans = B / A;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
	string s;
	int m = 10000,a;
	cin >> s;
	for (int i = 0; i < s.length() - 2; ++i) {
		a = stoi(s.substr(i, 3));
		if (abs(a - 753) < m)m = abs(a - 753);
	}
	cout << m << "\n";
	return 0;
}

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

const ll INF = 1ll << 60;
ll MOD = 998244353;

int main()
{

    int n, d;
    cin >> n;
    cin >> d;
    vector<vector<int>> x(n, vector<int>(d));

    REP(i, n)
    REP(j, d)
    cin >> x[i][j];
    int ans = 0;

    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            int a = 0;
            for (int k = 0; k < d; ++k)
            {
                int diff = abs(x[i][k] - x[j][k]);
                a += diff * diff;
            }
            bool ok = false;
            for (int k = 0; k <= a; k++)
            {
                if (k * k == a)
                {
                    ok = true;
                }
            }
            if (ok)
                ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

class Baseball{
private:
	int runner; // 0~3: the number of runner
	int out_count; //0~2: out count
	int point;

public:
	Baseball(){
		runner = 0;
		out_count = 0;
		point = 0;
	}

	int judge(std::string event){
		if(event == "HIT"){
			return single_hit();
		}else if(event == "HOMERUN"){
			return home_run();
		}else{
			return out();
		}
	}

	void display(){
		std::cout << point << std::endl;
	}

	int single_hit(){
		(runner == 3) ? ++point : ++runner;
		return 1;
	}

	int home_run(){
		point = point + runner + 1;
		runner = 0;
		return 1;
	}

	int out(){
		if(out_count == 2){
			display();
			return 0;
		}else{
			++out_count;
			return 1;
		}
	}
};

int main(){
	int n; // the number of datasets
	std::cin >> n;

	for(int i = 0; i < n; ++i){
		Baseball inning;
		std::string eve;
		std::cin >> eve;
		while(inning.judge(eve) == 1){
			std::cin >> eve;
		}
	}
	return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>

int main()
{
     char s[27];
     int i, j, size;

     for(i = 0; i < 27; i++)
     {
         scanf("%c", &s[i]);

         if(s[i] == '\n')
         {
              size = i;
              break;
         }
     }

     for(i = 0; i < size; i++)
     {
          for(j = 0; j < size; j++)
          {
               if(i != j){
                    if(s[i] == s[j]){
                         printf("no\n");
                         return 0;
                    }
               }
          }
     }

     printf("yes\n");
     return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  int n;
  int out = 0;
  int max_cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int i2 = i;
    int cnt = 0;
    while (i2 % 2 == 0) {
      i2 /= 2;
      cnt++;
    }
    if (max_cnt <= cnt) {
      max_cnt = cnt;
      out = i;
    };
  }
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    vector<int> d(s.size());
    //cout << (char)(int)'A'; これはおけ
	rep(i,s.size()) {
    	//cout << (char)s[i] + 1;
        d[i] = s[i] + N;
        //cout << d[i] << ' '; こいつも動作した！
        if (d[i] > 90) d[i] -= 26;
        cout << (char)d[i];
      
    }
    //cout << 'A' + 1;　これもおけ
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i], A[i]--;
  int B[N];
  for (int i = 0; i < N; i++) cin >> B[i];
  int C[N - 1];
  for (int i = 0; i < N - 1; i++) cin >> C[i];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += B[A[i]];
    if (i + 1 < N && A[i + 1] == A[i] + 1) ans += C[A[i]];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3600
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int H, W;
	boolean[][] map;
	int[][] distMat;
	int count = 0;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		this.H = Integer.parseInt(tokens[0]);
		this.W = Integer.parseInt(tokens[1]);
		this.map = new boolean[H][W];
		for (int i = 0; i < H; ++i) {
			String line = in.readLine();
			for (int j = 0; j < W; ++j) {
				if (line.charAt(j) == '.') {
					this.map[i][j] = true;
					++this.count;
				} else {
					this.map[i][j] = false;
				}
			}
		}

		this.distMat = new int[H * W][H * W];
		for (int i = 0; i < H * W; ++i) {
			Arrays.fill(this.distMat[i], Integer.MAX_VALUE / 2);
		}
		for (int h = 0; h < H; ++h) {
			for (int w = 0; w < W; ++w) {
				if (h + 1 != H) {
					// (h, w)と(h+1, w)がつながっているかを判定する
					if (this.map[h][w] && this.map[h + 1][w]) {
						this.distMat[h * W + w][(h + 1) * W + w] = 1;
						this.distMat[(h + 1) * W + w][h * W + w] = 1;
					}
				}
				if (w + 1 != W) {
					// (h, w)と(h, w+1)がつながっているかを判定する
					if (this.map[h][w] && this.map[h][w + 1]) {
						this.distMat[h * W + w][h * W + (w + 1)] = 1;
						this.distMat[h * W + (w + 1)][h * W + w] = 1;
					}
				}
			}
		}
	}

	void calc() {
		// ワーシャルフロイド
		for (int k = 0; k < H * W; ++k) {
			int h2 = k / W;
			int w2 = k % W;
			if (!this.map[h2][w2]) {
				continue;
			}
			for (int i = 0; i < H * W; ++i) {
				int h0 = i / W;
				int w0 = i % W;
				if (!this.map[h0][w0]) {
					continue;
				}
				for (int j = i + 1; j < H * W; ++j) {
					int h1 = j / W;
					int w1 = j % W;
					if (!this.map[h1][w1]) {
						continue;
					}
					if (i == j) {
						continue;
					}
					this.distMat[i][j] = Math.min(this.distMat[i][j], this.distMat[i][k] + this.distMat[k][j]);
					this.distMat[j][i] = this.distMat[i][j];
				}
			}
		}
	}

	void showResult() {
		int result = 0;
		for (int i = 0; i < H * W; ++i) {
			int h0 = i / W;
			int w0 = i % W;
			for (int j = i + 1; j < H * W; ++j) {
				int h1 = j / W;
				int w1 = j % W;
				if (this.map[h0][w0] && this.map[h1][w1]) {
					result = Math.max(result, this.distMat[i][j]);
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 23124