akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;


void solve(){
    int h,w;
    cin>>h>>w;
    vector<vector<int>>a(h,vector<int>(w)),b(h,vector<int>(w));
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h)rep(j,w)cin>>b[i][j];
    const int l=6400;
    vector<vector<bitset<2*l>>>dp(h,vector<bitset<2*l>>(w));
    dp[0][0][6400+abs(a[0][0]-b[0][0])]=1;
    rep(i,h){
      rep(j,w){
        if(i>0){
          dp[i][j]|=dp[i-1][j]<<(abs(a[i][j]-b[i][j]));
          dp[i][j]|=dp[i-1][j]>>(abs(a[i][j]-b[i][j]));
        }
        if(j>0){
          dp[i][j]|=dp[i][j-1]<<(abs(a[i][j]-b[i][j]));
          dp[i][j]|=dp[i][j-1]>>(abs(a[i][j]-b[i][j]));
        }
      }
    }
    int ans=1e6;
    rep(i,2*l){
      if(dp[h-1][w-1][i]){
        chmin(ans,abs(6400-i));
      }
    }
    cout<<ans<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 10496
import numpy as np

L = input()
mod = 10**9+7

DP = np.zeros((len(L)+1, 2), int)
DP[0][0] = 1

for i in range(len(L)):
    if L[i] == '1':
        DP[i+1][0] = DP[i][0] * 2
        DP[i+1][1] = DP[i][0] + DP[i][1] * 3
    else:
        DP[i+1][0] = DP[i][0]
        DP[i+1][1] = DP[i][1] * 3
    DP[i+1] %= mod

print(sum(DP[-1]) % mod)

Measured memory_bytes: 16092
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main() {
	int n; cin>>n; n++;
	VL a(n); rep(i,n) cin>>a[i];
	VL b(n);
	ll sum=0LL;
	REP(i,n){
		sum+=a[i];
		b[i]=sum;
	}
	// rep(i,n) cerr<<b[i]<<' '; cerr<<endl;
	ll ans=0LL; ll p=1LL;
	rep(i,n){
		if(a[i]>p) return cout<<-1<<endl,0;
		if(b[i]<p) p=b[i];
		ans+=p;
		p=(p-a[i])*2;
		// cerr<<i SP ans SP p<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4792
n = int(input())
h = [int(x) for x in input().split()]
dp = [0]*n
dp[n-2] = abs(h[n-1]-h[n-2])

for i in range(n-3,-1,-1):
  dp[i] = min(dp[i+1]+abs(h[i]-h[i+1]),dp[i+2]+abs(h[i]-h[i+2]))
  
print(dp[0])

Measured memory_bytes: 20424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main(){
    ll n,k;
    cin>>n>>k;
    ll dp[k+1],ans=0;
    for(ll i=k;i>=1;i--){
        dp[i]=power(k/i,n);
        for(ll j=2*i;j<=k;j+=i) dp[i]-=dp[j];
        ans=(ans+i*dp[i]%mod)%mod;
    }
    cout<<(ans+mod)%mod;
    return 0;
}


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

int main()
{
	int n, i, br=0;
	scanf("%d", &n);
	string s;
	cin >> s;

	if(n%2==0){
		for(i=0; i<n/2; i++){
			if(s[i]!=s[n/2+i]) br++;
		}
	}
	if(n==1 || n%2==1){
		printf("No");
		return 0;
	}
	if(br>0){
		printf("No");
		return 0;
	}
	printf("Yes");

    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

mod = 10**9+7
res = 0

for i in range(N):
    for j in range(i):
        if A[j] < A[i]:
            res += (K-1)*K//2
            res %= mod
    for j in range(i+1, N):
        if A[j] < A[i]:
            res += (K+1)*K//2
            res %= mod

print(res)

Measured memory_bytes: 9352
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define lmt 600001
int _I(){int x; scanf("%d",&x); return x;}
bool prime[lmt+5];
vector< long > pp;
void seive(){
    //int i,j;
    pp.push_back(2);
    for(long i = 4; i <= lmt; i+=2) prime[ i ] = 1;
    for(long i = 3; i <= lmt; i+=2){
        if(!prime[ i ]){
            pp.push_back(i);
            for(long j = i*3; j <= lmt; j+=i<<1) prime [ j ] = 1;
        }
    }
    prime[0]=prime[1]=1;
}
long long ar[300005];
void Lipu_mira()
{
    stack <char> q;
    string s;
    cin>>s;
    for( int i = 0; i < s.size(); i++){
        if(s[i]=='B' && q.size()){
            q.pop();
        }
        else if(s[i]!='B'){
            q.push(s[i]);
        }
    }
    s.clear();
    while(!q.empty()){
        s+=(q.top());
        q.pop();
    }
    reverse(s.begin(),s.end());
    cout<<s<<"\n";
}
int main()
{
    //seive();
    //while(true)
    Lipu_mira();
    return 0;
}


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

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		if (n == m )
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}

Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
const int MAX = 15;
const int INF = 1e9;
int es[MAX][MAX]={};
int cs[1<<MAX]={};
int dp[MAX][1<<MAX];

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

  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    es[a][b]=es[b][a]=c;
  }

  int sz=1<<n;
  for(int bit=0;bit<sz;bit++)
    for(int i=0;i<n;i++)
      for(int j=0;j<i;j++)
        if((bit>>i)&(bit>>j)&1)
          cs[bit]+=es[i][j];

  memset(dp,-1,sizeof(dp));
  MFP([&](auto dfs,int v,int bit)->int{
        int &res=dp[v][bit];
        if(~res) return res;

        int cand=(sz-1)-bit;
        if(v==n-1) return res=cs[cand];

        res=-INF;
        for(int u=0;u<n;u++){
          if(!es[u][v]) continue;
          if((bit>>u)&1) continue;
          for(int nbit=cand;nbit;nbit=(nbit-1)&cand)
            if((nbit>>v)&(~nbit>>u)&1)
              chmax(res,dfs(u,bit|nbit)+es[v][u]+cs[nbit]);
        }
        return res;
      })(0,0);

  int ans=-dp[0][0];
  for(int i=0;i<n;i++)
    for(int j=0;j<i;j++)
      ans+=es[i][j];

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2304
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int main() {
    int N;
    cin >> N;
    cout << 180 * (N-2) << endl;
    return 0;
}


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

void pLost(char e, bool *exists_count) {
  for (int i = 1; i < 14; ++i) {
    if (!exists_count[i]) {
      cout << e << ' ' << i << '\n';
    }
  }
}

int main() {
  int n;
  bool S[14]{false}, H[14]{false}, C[14]{false}, D[14]{false};
  cin >> n;
  for (int i = 0; i < n; ++i) {
    char e;
    int rank;
    cin >> e >> rank;
    switch (e) {
      case 'S':
        S[rank] = true;
        break;
      case 'H':
        H[rank] = true;
        break;
      case 'C':
        C[rank] = true;
        break;
      case 'D':
        D[rank] = true;
        break;
      default:
        break;
    }
  }
  pLost('S', S);
  pLost('H', H);
  pLost('C', C);
  pLost('D', D);
}



Measured memory_bytes: 3096
using System;

namespace A___1222
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] input = Console.ReadLine().ToCharArray();
            int result = 0;

            for (int i = 0; i < input.Length; i++)
            {
                if (input[i].Equals('2'))
                {
                    result++;
                }
            }
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define ceil(a,b) ((a+b-1)/b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int A, B;
    cin >> A >> B;
    if (A < 9 && B < 9)
        cout << "Yay!";
    else
        cout << ":(";
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

#define MAX_N 110
#define MAX_W 10100

int n,P[MAX_N],V[MAX_N], C;
int dp[MAX_N][MAX_W];

int main() {
  cin >> n >> C;
  rep(i,n) cin >> P[i] >> V[i];
  for(int i=1;i<=n;++i) {
    for(int sum_V=0;sum_V<=C;++sum_V) {
      dp[i][sum_V] = max(dp[i][sum_V],dp[i-1][sum_V]);
      if( sum_V-V[i-1] >= 0 ) {
        dp[i][sum_V] = max(dp[i][sum_V],
                           dp[i-1][sum_V-V[i-1]]+P[i-1]);
      }
    }
  }
  cout << dp[n][C] << endl;
  return 0;
}
 

Measured memory_bytes: 5216
mod = 10 ** 9 + 7

n, m = map(int, input().split())
A = [int(input()) for _ in range(m)]
not_wet = [True] * (n + 1)
for a in A:
    not_wet[a] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(1, n + 1):
    if not_wet[i]:
        if i == 1:
            dp[i] = dp[i - 1] % mod
        else:
            dp[i] = dp[i - 1] + dp[i - 2] % mod
print(dp[n] % mod)


Measured memory_bytes: 15072
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    string a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    rep(i,a.length()){
        map<int,char>mp;
        mp[a[i]]++;mp[b[i]]++;mp[c[i]]++;
        ans += (int)mp.size() - 1;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
# 入力
SA=list(input())
SB=list(input())
SC=list(input())

# 次に捨てる人（初期値は'A')
x='a'

while True:
  if x=='a':
    # リストの要素が0ならば終了する
    if len(SA)==0:
      print('A')
      exit()

    # 先頭要素を除去してxに代入
    x=SA[0]
    SA.remove(x)
  elif x=='b':
    # リストの要素が0ならば終了する
    if len(SB)==0:
      print('B')
      exit()

    # 先頭要素を除去してxに代入
    x=SB[0]
    SB.remove(x)
  else:
    # リストの要素が0ならば終了する
    if len(SC)==0:
      print('C')
      exit()

    # 先頭要素を除去してxに代入
    x=SC[0]
    SC.remove(x)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, a[5050], b[5050], dp[5050][5050];
pair<int,int> p[5050];

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a[i] >> b[i];
		p[i] = {a[i]+b[i], i};
	}
	sort(p, p+n);
	rep(i,5050) rep(j,5050) dp[i][j] = 1ll<<60;
	dp[0][0] = 0;
	rep(i,n) rep(j,n) if (dp[i][j]!=1ll<<60) {
		int id = p[i].second;
		chmin(dp[i+1][j], dp[i][j]);
		if (dp[i][j]<=a[id]) chmin(dp[i+1][j+1], dp[i][j] + b[id]);
	}
	int res = 0;
	rep(i,n+1) if (dp[n][i]!=1ll<<60) res = i;
	cout << res << endl;
}

Measured memory_bytes: 199680
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll, ll>
#define pb push_back
#define ll long long
#define ld long double	
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e18
// double power(double num, double g) {
// 	if (g == 0)return 1;
// 	if (g % 2 == 1)return (num * power((num * num), g / 2));
// 	return power( (num * num) , g / 2);
// }

int main(){
	ll X;
	cin >> X;
	int ans = 0;
	ll val = 100;
	while(val < X){
		val*=1.01;
		ans++;
	}
	cout << ans;
}



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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    (n, ) = [int(e) for e in lines[0].split(" ")]
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):

    result = dict([(i, 0) for i in range(1, n+1)])

    for i in range(n-1):
        result[a[i]] = result[a[i]] + 1

    return  list(result.values())


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Measured memory_bytes: 122424
#include <stdio.h>

int main(){
    int w,h;
    while(1){
        scanf("%d %d", &h, &w);
        if(h == 0 && w == 0){
            break;
        }
        
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if((i + j) % 2 == 0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2056
#include <stdio.h>

long calc(long max, long count) {
  int i;
  long mx = 0, mn = 0;
  //for(i = 1;i < count;i++) mn += i;
  mn = (count - 1) * count / 2;
  mx = max * count - mn;
  return mx - mn + 1;
}

int main(void) {
  int n, k;
  
  scanf("%d %d", &n, &k);
  if(k > n) {
    printf("1\n");
    return 0;
  }
  int i;
  long ret = 0;
  for(i = k;i <= n + 1;i++) {
    ret += calc(n, i);
  }
  ret %= 1000000007;
  printf("%ld\n", ret);
  return 0;
}


Measured memory_bytes: 2148
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	string a,b,c;
	cin >> n >> a >> b >> c;
	int ans = 0;
	for(int i = 0; i < n; i++){
		if(a[i] != b[i] && b[i] != c[i] && a[i] != c[i]) ans += 2;
		if(a[i] == b[i] && b[i] != c[i]) ans += 1;
		if(b[i] == c[i] && c[i] != a[i]) ans += 1;
		if(c[i] == a[i] && a[i] != b[i]) ans += 1;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
h_input = list(map(int,input().split()))

ans_li = [True]*n
for i in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1

    if h_input[a]>h_input[b]:
        ans_li[b]=False
    if h_input[a]<h_input[b]:
        ans_li[a]=False
    if h_input[a]==h_input[b]:
        ans_li[a]=False
        ans_li[b]=False
print(sum(ans_li))

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

// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

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

	vector<int> rightcnt(N, 0);
	int maxcnt = 0;
	for (int i = N-2; i >= 0; --i) {
		if (H[i] >= H[i + 1]) {
			rightcnt[i] = rightcnt[i + 1] + 1;
		}
		else {
			rightcnt[i] = 0;
		}
		chMax(maxcnt, rightcnt[i]);
	}

	cout << maxcnt << "\n";
	return 0;
}


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

int main(){
	int n;
	int i;
	int data;

	scanf("%d", &n);
	for(i=1; i<=n; i++){
		if(i%3==0)
			printf(" %d", i);
		else{
			data = i;
			while(data>1){
				
				if(data%10 == 3){
					printf(" %d", i);
					break;
				}
				data = data/10;
			}			
		}
	}
	printf("\n");
	

	return 0;

}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

using PDI = pair<double, int32>;

const int64 mod = 1e9+7;

int32 dx[4] = {-1, 1, 0, 0};
int32 dy[4] = {0, 0, -1, 1};

int main(void){
	int32 N;
	cin >> N;
	int32 res = 0;
	FOR(i, 2, 55556){
		int32 cnt = 0;
		FOR(j, 2, i){
			if(i%j == 0) cnt++;
		}
		if(cnt == 0 && i%5 == 1){
			cout << i << endl;
			res++;
			if(res == N) break;
		}
	}
}


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

int main() {
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	int num1=abs(x-a);
	int num2=abs(x-b);
	if(num1>num2) printf("B\n");
	if(num1<num2) printf("A\n");
	return 0;
}

Measured memory_bytes: 256
from itertools import permutations


n, m, r = map(int, input().split())
towns = list(map(int, input().split()))

INF = float('inf')

graph = [[INF for _ in range(n)] for _ in range(n)]

for i in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

# ワーシャルフロイド

for k in range(n):
    for i in range(n):
        for j in range(n):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

min_dist = 10**10
for route in permutations(towns, r):
    dist = 0
    for i in range(r-1):
        a = route[i] - 1
        b = route[i+1] - 1
        dist += graph[a][b]
    if dist < min_dist:
        min_dist = dist

print(min_dist)


Measured memory_bytes: 72920
#include <stdio.h>

int main(){
  int i,j;
  int H, W;

  while(1){
    scanf("%d %d", &H, &W);
    if(H == 0 && W == 0){
      break;
    }
    for(i=0; i<H; i++){
      for(j=0; j<W; j++){
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2040
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    int data[3];
    rep(i, 3)
    {
        cin >> data[i];
    }
    rep(i, 3)
    {
        if (data[i] == data[(i + 1) % 3])
        {
            cout << data[(i + 2) % 3] << endl;
            return 0;
        }
    }
}

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


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

typedef long long ll;
using namespace std;

int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

int main() {
    ll ans = 0;
    int k;
    cin >> k;
    for (int i = 1; i <= k; i++)
        for (int l = 1; l <= k; l++)
            for (int n = 1; n <= k; n++)
                ans += gcd(gcd(i, l), n);
    cout << ans;
    return 0;
}


Measured memory_bytes: 3632
/*
   Creator - Glitched
   Yeet!!
*/

#include "bits/stdc++.h"

using namespace std;
#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define elif else if
#define flush cout<<"\n"
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);

ll power(ll x, ll y){
    ll ans = 1;

    loop(i,0,y){
        ans = ans*x;
    }
    return ans;
}

int main()
{
    ll x,n;
    cin>>x>>n;

    ll dp[x+1];
    dp[0] = 0;
    pair<ll,ll> p[n];

    loop(i,1,x+2){
        dp[i] = -1;
    }

    loop(i,0,n){
        cin>>p[i].ff>>p[i].ss;
       
    }

    loop(i,1,x+2){

        
            dp[i] = mod;
            loop(j,0,n){

                if(p[j].ff <= i){
                    dp[i] = min(dp[i], dp[i - p[j].ff]+p[j].ss);
                }
                else{
                    dp[i] = min(dp[i], p[j].ss);
                }
            }
        

        // cout<<dp[i]<<" ";

    }
    cout<<dp[x];
    flush;




    

    
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

typedef long long ll;

bool debug = false;
const int NIL = -1;
const int INF = 1000000000;
const int NUM = 100010;
clock_t START, END;

int V, E, Q;

struct Edge {
	int from, to;
	Edge(int u, int v) :from(u), to(v) {}
};

struct Dijkstra {
	int n, m;
	vector<Edge> edges;
	vector<int> G[NUM];

	int pre[NUM], lowlink[NUM], sccno[NUM], scc_cnt, dfs_clock;
	stack<int> S;

	void init(int n) {
		this->n = n;
		edges.clear();
		for (int i = 0; i < n; i++) {
			G[i].clear();
		}
	}

	void AddEdge(int from, int to) {
		edges.push_back(Edge(from, to));
		m = edges.size();
		G[from].push_back(m - 1);
	}

	void dfs(int u) {
		pre[u] = lowlink[u] = ++dfs_clock;
		S.push(u);
		for (int i = 0; i < G[u].size(); i++) {
			int v = edges[G[u][i]].to;
			if (!pre[v]) {
				dfs(v);
				lowlink[u] = min(lowlink[u], lowlink[v]);
			}
			else if (!sccno[v])
				lowlink[u] = min(lowlink[u], pre[v]);
		}
		if (lowlink[u] == pre[u]) {
			scc_cnt++;
			for (;;) {
				int x = S.top();
				S.pop();
				sccno[x] = scc_cnt;
				if (x == u)
					break;
			}
		}
	}

	void find_scc(int n) {
		dfs_clock = scc_cnt = 0;
		memset(sccno, 0, sizeof(sccno));
		memset(pre, 0, sizeof(pre));
		for (int i = 0; i < n; i++)
			if (!pre[i])
				dfs(i);
	}
};

Dijkstra solve;

int main(void)
{
	if (debug) {
		START = clock();
		freopen("in29.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int s, t, u, v;
	cin >> V >> E;
	solve.init(V);
	for (int i = 0; i < E; i++) {
		scanf("%d%d", &s, &t);
		solve.AddEdge(s, t);
	}
	solve.find_scc(V);
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		scanf("%d%d", &u, &v);
		if (solve.sccno[u] == solve.sccno[v])
			cout << "1" << endl;
		else
			cout << "0" << endl;
	}
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 7048
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 2e5 + 5;
const int INF = 1e9 + 7;
int dp[MAXN];
int arr[MAXN][3];
class Fenwick{
public:
    vector < int > bit;
    int n;
    Fenwick(int n){
        this->n = n;
        bit.resize(n + 1);
    }
    int getMax(int idx){
        int ret = 0;
        for (; idx > 0; idx -= idx & (-idx))
            ret = max(ret, bit[idx]);
        return ret;
    }
    void update(int idx, int val) {
        for (; idx <= n; idx += idx & (-idx))
            bit[idx] = max(bit[idx], val);
    }
};
int32_t main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> arr[i][1];
    for(int i = 1; i <= n; i++) cin >> arr[i][2];
    Fenwick fen(n);
    dp[1] = arr[1][2];
    fen.update(arr[1][1], arr[1][2]);
    for(int i = 2; i <= n; i++){
        int k = fen.getMax(arr[i][1] - 1);
        dp[i] = k + arr[i][2];
        fen.update(arr[i][1], dp[i]);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, dp[i]);
     //   cout << dp[i] << " ";
    }
    //cout << '\n';
    cout << ans << '\n';
}


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

typedef long long ll;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define int ll

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;

void solve() {
	string s, t;
	cin >> s >> t;

	int sz = s.size();
	int tz = t.size();
	int ans = tz;

	F0R(i, sz - tz + 1) {
		int cnt = 0;
		F0R(j, tz) {
			if (s[i + j] != t[j]) cnt++;
			// cerr << s[i + j] << ' ' << t[j] << '\n';
		}
		// cerr << '\n';
		ans = min(ans, cnt);
		// D1(cnt);
	}

	cout << ans;
}

int32_t main() {
	_

#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
	solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}



Measured memory_bytes: 3712
import java.util.*;

public class Main{

    static double x;

    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		x = sc.nextDouble();

        double ok = Math.PI / 2.0;
        double ng = 0;
        for(int i = 0; i < 100000 ; i++){
            double mid = (ok + ng) / 2.0;
            if(f(a, b, mid) < x) ok = mid;
            else ng = mid;
        }

        System.out.println(Math.toDegrees(ok));

    }

    static double f(double a, double b, double t){

        if(t > Math.PI / 2.0){
            return 0.0;
        }
        double ans;
        if(x >= a * a * b / 2){
            ans = a * a * b - a * a * a * Math.tan(t) / 2.0;
        }else{
            ans = a * b * b / Math.tan(t) / 2.0;
        }

        return ans;

    }

}


Measured memory_bytes: 24660
import copy


def BubbleSort(C, n):
    flag = 1
    while flag:
        flag = 0
        for i in range(n-1, 0, -1):
            if int(C[i][1]) < int(C[i - 1][1]):
                C[i], C[i-1] = C[i-1], C[i]
                flag = 1
    return C


def SelectionSort(C, n):
    for i in range(n-1):
        minj = i
        for j in range(i, n):
            if int(C[j][1]) < int(C[minj][1]):
                minj = j
        if minj != i:
            C[i], C[minj] = C[minj], C[i]
    return C


n = int(input())
C = list(input().split())
C2 = C.copy()

print(*BubbleSort(C, n), sep=' ')
print("Stable")
print(*SelectionSort(C2, n), sep=' ')
if C ==C2:
    print("Stable")
else:
    print("Not stable")



Measured memory_bytes: 6344
# 全探索 : 全列挙 (全4問)

# 1 How many ways? (AOJ)

import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

n = 1
x = 1
while True:
    n, x = map(int, input().split())
    if (n, x) == (0, 0):
        sys.exit(0)
    else:
        L = []
        ans = 0
        for i in range(1, n + 1):
            for j in [k for k in range(1, n + 1) if k != i]:
                k = x - (i+j)
                if i != k and j != k and sorted((i,j,k)) not in L and k in range(1, n+1):
                    ans += 1
                    L.append(sorted((i, j, k)))
        print(ans)


Measured memory_bytes: 5836
S, T = [input() for x in range(2)]
max_match_len = 0

for i in range(len(S)):
  if len(S) - len(T) < i:
    break
  compare_s = S[i:i+len(T)]
  match_len = 0
  for j in range(len(T)):
    if compare_s[j] == T[j]:
      match_len += 1
  else:
    if max_match_len < match_len:
      max_match_len = match_len
print(len(T) - max_match_len)

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

map<long, long> prime_factor(long N) {
  map<long, long> res;
  for (long i = 2; i * i <= N; i++) {
    while (N % i == 0) {
      res[i]++;
      N /= i;
    }
  }
  if (N != 1) {
    res[N] = 1;
  }
  return res;
}

int main() {

  long n;
  cin >> n;

  map<long, long> m = prime_factor(n);

  cout << n << ":";

  for (auto item:m) {
    for (int i = 0; i < item.second; i++) {
      cout << " " << item.first;
    }
  }

  cout << endl;

  return 0;

}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 1011
#define INF 1e9
 
struct Edge{
    int u,v;
};
 
vector<int> G[MAX];
 
int bfs(int s,int t){
    queue<int> Q;
    Q.push(s);
    int dist[MAX];
    fill(dist,dist+MAX,INF);
    dist[s] = 0;
   
    while(!Q.empty()){
	int v = Q.front(); Q.pop();
	if(v == t) return dist[t];
	for(int i = 0 ; i < (int)G[v].size() ; i++){
	    if(dist[v] + 1 < dist[G[v][i]]){
		dist[G[v][i]] = dist[v] + 1;
		Q.push(G[v][i]);
	    }
	}
    }
    return INF;
}
 
int main(){
    int N,S,T,M;
    while(cin >> N,N){
	vector<Edge> e;
	cin >> S >> T >> M;
	S--; T--;
	for(int i = 0 ; i < MAX ; i++){
	    G[i].clear();
	}
	for(int i = 0 ; i < M ; i++){
	    int u,v;
	    cin >> u >> v;
	    u--; v--;
	    e.push_back((Edge){u,v});
	    G[u].push_back(v);
	}
	int res,nc,num;
	res = nc = bfs(S,T);
	for(int i = 0 ; i < (int)e.size() ; i++){
	    for(int j = 0 ; j < N ; j++){
		G[j].clear();
	    }
	    swap(e[i].u,e[i].v);
	    for(int j = 0 ; j < (int)e.size() ; j++){
		G[e[j].u].push_back(e[j].v);
	    }
	    int r = bfs(S,T);
	    if(r < res){
		res = r;
		num = i+1;
	    }
	    swap(e[i].u,e[i].v);
	}
	if(res == nc){
	    cout << res << " " << 0 << endl;
	}else{
	    cout << res << " " << num << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 3304
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  int dp[n];
  for(int i=0;i<n;i++)
    dp[i]=INT_MAX;
  dp[0]=0;
  for(int i=1;i<n;i++)
  {
    for(int j=1;j<=2;j++)
    {
      if(i-j>=0)
        dp[i]=min(dp[i],(dp[i-j]+abs(a[i-j]-a[i])));
    }
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 4304
/*A1,A2,A3,... ANのうち、異なる2要素の差の絶対値の最大値を求める。 */

#include <stdio.h>
#include <stdlib.h>
#define N 101

int abs(int n){
	return (n>0) ? n : -n;
}

int main(){
	int n,a[N],i,j,max;
	
	int index1,index2;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d ",&a[i]);
	}
	
	max = abs(a[0] - a[1]);
	index1 = 0;
	index2 = 1;

 	for(i=0;i<n;i++){
 		for(j=i+1;j<n;j++){
 			if(max < abs(a[j]-a[i])){
 				max = abs(a[j]-a[i]);
 			}
 		}
 	}
 
 	printf("%d\n",max);
	
	return 0;
}

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

int main()
{
  int n, sum = 0;
  cin >> n;
  vector<int> s(n);
  for (int i = 0; i < n; i++)
  {
    cin >> s.at(i);
    sum += s.at(i);
  }
  sort(s.begin(), s.end());
  for (int i = 0; i < n; i++)
  {
    if (s.at(i) % 10 != 0)
    {
      break;
    }
    if (i == n - 1)
    {
      cout << 0 << endl;
      return 0;
    }
  }

  if (sum % 10 == 0)
  {
    for (int i = 0; i < n; i++)
    {
      if (s.at(i) % 10 != 0)
      {
        sum -= s.at(i);
      }
      if (sum % 10 != 0)
      {
        break;
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<int> to[200005];

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    rep(i, 0, n){
        cin >> h[i];
    }
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    int ans = 0;
    rep(i, 0, n){
        int flag = 0;
        for(int x : to[i]){
            if(h[i] <= h[x]) flag = 1;
        }
        if(flag == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)


class Graph
{
public:
	explicit Graph( int nodeSize )
		: mNodeSize( nodeSize )
		, mEdgeSize( 0 )
		, mEdge( nodeSize )
		, mDepth( nodeSize )
		, mMark( nodeSize )
		, mMark2( 0 )
		{}
	
	// Edge定義
	struct Edge
	{
		bool operator<( const Edge& other )
		{ return this->cost != other.cost ?
			this->cost < other.cost : this->to < other.to;  }
		int to; int cost; int rev;
	};
	
	// Edge情報を読み取る
	void readEdge_Undirect_NoCost( int m ) { readEdge_( m, false, false ); }
	void readEdge_Direct_NoCost( int m ) { readEdge_( m, true, false ); }
	void readEdge_Undirect_Cost( int m ) { readEdge_( m, false, true ); }
	void readEdge_Direct_Cost( int m ) { readEdge_( m, true, true ); }
	void readEdge_Direct_Flow( int m ) { readEdge_Flow_( m ); }
	
private:
	void readEdge_( int m, bool isDirected, bool isCost )
	{
		REP( i, m )
		{
			int a, b, c = 1, r = -1;
			cin >> a >> b;
			if( isCost ) cin >> c;
			mEdge[a-1].push_back( { b-1, c, -1 } );
			if( !isDirected ) mEdge[b-1].push_back( { a-1, c, r } );
			++mEdgeSize;
		}
	}
	void readEdge_Flow_( int m )
	{
		REP( i, m )
		{
			int a, b, c;
			cin >> a >> b >> c;
			mEdge[a-1].push_back( { b-1, c, int(mEdge[b-1].size()) } );
			mEdge[b-1].push_back( { a-1, 0, int(mEdge[a-1].size() - 1) } );
			++mEdgeSize;
		}
	}
	
public:
	// 必要なときだけメモリ確保するように
	void assignMark2()
	{
		vector<int> tmp( mNodeSize, cINFINT );
		mMark2.assign( mNodeSize, tmp );
	}
	void setupMark2ForCost()
	{
		REP( i, mNodeSize )
		{
			mMark2[i][i] = 0;
			for( const auto& e : mEdge[i] ) mMark2[i][e.to] = e.cost;
		}
	}


public:
	// MARK構造体
	struct MARK
	{
		int num = 0;
		MARK& operator+=( const MARK& rhs )
		{
			this->num += rhs.num;
			return *this;
		}
	};

public:
	int mNodeSize; // VertexSize
	int mEdgeSize; // EdgeSize
	vector< vector< Edge > > mEdge; // 隣接リスト
	
	// 作業用変数
	vector<int> mDepth /* Used */;
	vector<int> mMark;
	// 必要なときだけメモリ確保するように
	vector< vector<int> > mMark2;
};


int bfs_connect( Graph& g, int startNode, int goal )
{
	fill( ALL( g.mDepth ), -1 );
	queue<ll> que;
	que.push(startNode);
	g.mDepth[startNode] = 0;
	while(!que.empty())
	{
		ll v = que.front();que.pop();
		for( const auto& e : g.mEdge[v] )
		{
			if( g.mDepth[e.to] >= 0 ) continue;
			if( e.to == goal ) return g.mDepth[v] + 1;
			g.mDepth[e.to] = g.mDepth[v] + 1;
			que.push( e.to );
		}
	}
	return -1;
}

int main()
{
	cin.tie( 0 ); ios::sync_with_stdio( false );
	int n, m;
	cin >> n >> m;
	Graph g( 3 * n );
	REP( i, m )
	{
		int a, b, c = 1;
		cin >> a >> b;--a;--b;
		g.mEdge[a].push_back( { b+n, c, -1 } );
		g.mEdge[a+n].push_back( { b+2*n, c, -1 } );
		g.mEdge[a+2*n].push_back( { b, c, -1 } );
		g.mEdgeSize += 3;
	}
	int s,t;cin>>s>>t;
	--s;--t;
	
	ll ans = bfs_connect( g, s, t );
	cout << ( ans == -1 ? -1 : ans / 3 ) << endl;
	
	return 0;
}

Measured memory_bytes: 19072
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
    int k,n,i;
    std::string s;
    std::cin >> s;
    n = s.l_ength()-1;
    std::cin >> k;
    for(i=0; i<n; ++i){
        if(('{'-s[i])%26>k){
            continue;
        }
        k -= ('{'-s[i])%26;
        s[i] = 'a';
    }
    k += s[n]-'a';
    k %= 26;
    s[n] = 'a'+k;
    std::cout << s << std::endl;
	return 0;
}


Measured memory_bytes: 3772
#include <stdio.h>
#include <string.h>

int main(void){
    char s[100001];
    scanf("%s",s);
    long int n;
    n=strlen(s);
    
    int i;
    int ans=0;
    for(i=0;i<=n-2;i++){
        if(s[i]!=s[i+1]){
            ans++;
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

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

	int mini = INT_MAX;
	rp(i,N){
		int c,t; cin>>c>>t;
		if(t<=T){
			mini = min(mini,c);
		}
	}
	if(mini==INT_MAX) ote("TLE");
	else ote(mini);

}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	a, b, c, d := nextInt(), nextInt(), nextInt(), nextInt()

	for a > 0 && c > 0 {
		c -= b
		if c <= 0 {
			fmt.Println("Yes")
			return
		}
		a -= d
		if a <= 0 {
			fmt.Println("No")
			return
		}
	}

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 1756
#089
#ある学校には、N人の生徒がいる
#2人以下のグループだと❎
#3人以上のグループを最大で x　個作れるとき、x　を出力せよ
# 1 <= N <= 1000
#入力は全て整数のみ
#生徒数　N　の入力
N = int(input(''))

#生徒数　N を3で割って切り捨てる
answer=int(N/3)

#結果
print(answer)

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

int main()
{
    int n,flag=0,i=n-1;
    char s[i];
    scanf("%d",&n);
    scanf("%s",s);
    if(n%2) printf("No");
    else{
        for(int j=0;j<(n/2);j++)
        {
            if(s[j]!=s[j+(n/2)])
                flag=1;
        }
        if (flag==1) printf("No");
        else printf("Yes");
    }

    return 0;
}


Measured memory_bytes: 3752
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT cin.tie(0); ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll A, B;
    cin >> A >> B;
    cout << A * B - (A + B) + 1 << endl;

    return 0;
}

Measured memory_bytes: 3588
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long x;
  cin >> x;
  if (x < 1200) puts("ABC");
  else puts("ARC");
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static int maxDepth;
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int diff = b - a;
		
		int towA = 1;
		int towB = 3;
		while(true) {
			int tmp = towB - towA;
			if(tmp == diff) {
				System.out.println(towB-b);
				break;
			}
			towA = towB;
			towB = towB + tmp+1;
			
			
				
				
		}
	}
}



Measured memory_bytes: 21844
S = input()
N = len(S)

for n in range(N-1):
  if S[n] == S[n+1]:
    print(n+1, n+2)
    exit()
for n in range(N-2):
  if S[n] == S[n+2]:
    print(n+1, n+3)
    exit()
print(-1, -1)

Measured memory_bytes: 3188
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>

using namespace std;

int main()
{
	long long int a, b, c, k;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	if(k%2==0){
		printf("%lld\n", a-b);
	}else{
		printf("%lld\n", b-a);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,i;
double ans,a[500001];
int main(){
	scanf("%d",&n);
	for(i=1;i<=n*2;i++)scanf("%lf",&a[i]);
	sort(a+1,a+n*2+1);
	for(i=1;i<=n*2;i++)ans+=1.0*(i-1)*a[i];
	printf("%.10lf",ans/(double)(n*2-1));
}

Measured memory_bytes: 1792