akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}

int main()
{
     int n;
     cin>>n;
     int a[n];
     for(int i=0;i<n;i++)
          cin>>a[i];
     int dp[n];
     dp[0]=0;
     dp[1]=abs(a[0]-a[1]);
     for(int i=2;i<n;i++)
     {
          dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
     }
     cout<<dp[n-1]<<'\n';
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
long long int ans=0;
long long sort(long long d[],int NumberArrays,int up){
  int tmp;
  for (int i = 0; i < NumberArrays-1; i++) {
    if (up && d[i]<d[i+1]) {
      d[i]=tmp;
      d[i]=d[i+1];
      d[i+1]=tmp;
    }else if (d[i]>d[i+1]) {
      d[i]=tmp;
      d[i]=d[i+1];
      d[i+1]=tmp;
    }
  }
}
//最大公約数
long long int getgcd(long long n, long long m)
{
  int r;
  if (n > m) {
    long long t = m;
    m = n;
    n = t;
  }
  while ((r = m % n) != 0) {
    m = n;
    n = r;
  }
return n;
}

//nの階乗を計算
long long factorial(long long n){
    long long int answer = 1;
while(n > 1){
  answer *= n;
  n--;
}
    return answer;
}

//組み合わせの数nCrを計算
long long calcNumOfCombination(long long  n, long long r){
    return factorial(n) / (factorial(r) * factorial(n-r));
}


int main(int argc, char* argv[]){
	long long int a = 0, b = 0,d=0,e=0,c[200001]={0};
	scanf("%lld",&a);
  for (int i = 0; i < a-1; i++) {
    scanf("%lld",&b);
    c[b]++;
  }
  for (int i = 1; i < a+1; i++) {
    printf("%lld\n",c[i]);
  }
  return 0;
}


Measured memory_bytes: 3296
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>

#define Rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())

#define eb emplace_back
#define dbg(x) cout<<#x" = "<<((x))<<endl
#define fs first
#define sc second
     
using namespace std;
     
     
typedef long long ll;
typedef pair<ll, ll> P;
     
     
int main(){
  ll N;

  cin >> N;

#ifdef DEBUG
  cout << "N=" << N << endl;
#endif

  ll x[N];
  ll y[N];
  ll h[N];

  for(int i = 0; i < N; ++i){
    cin >> x[i] >> y[i] >> h[i];
  }

  if( h[0] == 0 ){
    for(int i = 1; i < N; ++i){
      if(h[i] != 0){
	ll tmpx;
	ll tmpy;
	tmpx = x[0];
	tmpy = y[0];
	x[0] = x[i];
	y[0] = y[i];
	h[0] = h[i];
	x[i] = tmpx;
	y[i] = tmpy;
	h[i] = 0;
	break;
      }
    }
  }

  ll xx;
  ll yy;
  ll H;
  int flag = 0;
  for(int i = 0; i <= 100; ++i){
    for(int j = 0; j <= 100; ++j){
      flag = 1; xx = i; yy = j;      
      H = h[0] + abs(xx - x[0]) + abs(yy - y[0]);
      for(int k = 1; k < N; ++k){
	if(max(0LL, H - abs(xx - x[k]) - abs(yy - y[k])) != h[k]){
	  flag = 0;
	  break;
	}
      }
      if(flag == 1) break;
    }
    if(flag == 1) break;
  }

  cout << xx << " " << yy << " " << H << endl;
  
  return 0;
}


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

#define PB push_back
#define ld long double
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
#define ios ios_base::sync_with_stdio(0);
#define sz(s) (int)(s).size()
#define open(name) \
freopen(name".in", "r", stdin); \
freopen (name".out", "w", stdout);

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

const int N = 2e5 + 7;;
const int INF = 2e9 + 7;
const int logg = 20;
const double PI = 3.14;

using namespace std;

int dp[3007][3007];

void solve() {
    string s, t, ans;
    cin >> s >> t;
    int n = sz(s), m = sz(t);
    for (int i = 1; i <= n; i ++) {
        for (int j = 1; j <= m; j ++) {
            if (s[i - 1] != t[j - 1]) {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            } else {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
        }
    }
    while (dp[n][m]) {
        if (dp[n][m] == dp[n - 1][m]) n --;
        else if (dp[n][m] == dp[n][m - 1]) m --;
        else ans = s[n - 1] + ans, n --, m --;
    }
    cout << ans;
}
int main() {
    ios;
    solve();
}


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

using namespace std;

#define USE_IOSTREAM \
{\
	ios::sync_with_stdio(false);\
	cin.tie(0);\
	cout.tie(0);\
}

#define pii pair<int, int>
#define mp make_pair

typedef long long ll;

const int N = 1e5 + 100;
ll a[N];
ll b[N];

int main()
{
	USE_IOSTREAM;
	int n, i, j;
	ll sum;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i];
	}
	
	sum = 0;
	ll ans = 0;
	for (i = n; i >= 1; i--)
	{
		ll add = (a[i] + sum) % b[i];
		if (add)
		{
			add = b[i] - add;
		}
		ans += add;
		sum += add;
	}
	
	cout << ans << endl;
	
	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> b(n-1); REP(i, n-1) cin >> b[i];

    int sum = 0;
    sum += b[0];
    REP(i , n-2) sum += min(b[i], b[i+1]);
    sum += b[n-2];

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.parent = [-1] * n

    def root(self, a):
        if self.parent[a] < 0:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]

    def size(self, a):
        return -self.parent[self.root(a)]

    def connect(self, a, b) -> bool:
        a = self.root(a)
        b = self.root(b)

        if a == b:
            return False

        if self.size(a) < self.size(b):
            a, b = b, a

        self.parent[a] += self.parent[b]

        self.parent[b] = a

        return True


n, q = map(int, input().split())
unif = UnionFind(n)
for _ in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        unif.connect(x, y)
    else:
        print(1 if unif.root(x) == unif.root(y) else 0)



Measured memory_bytes: 5720
#include <iostream>
using namespace std;
void ABC100(void);
void ABC101(void);
void ABC102(void);
void ABC103(void);
void ABC104(void);
void ABC105(void);
void ABC106(void);
void ABC107(void);
void ABC108(void);
void ABC109(void);

int main(void){
    ABC108();
}

void ABC108(){
    int k;
    cin>>k;
    if(k%2==0)cout<<k*k/4<<endl;
    else cout<<(k+1)*(k-1)/4<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define maxn 100005
using namespace std;
int n,a[maxn],b[maxn],c[maxn];
long long num[maxn];
long long ans;
int o1(int x){
	int res=upper_bound(c+1,c+n+1,b[x])-c;
	return res;
}
int o2_(int x){
	int res=upper_bound(b,b+n+1,a[x])-b;
	return res;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) scanf("%d",&b[i]);
	for(int i=1;i<=n;i++) scanf("%d",&c[i]);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	int pos=o1(n);
	num[n]=n-pos+1;
	for(int i=n-1;i>=1;i--){
		while(pos>1&&b[i]<c[pos-1]){
			pos--;
		}
		num[i]=n-pos+1+num[i+1];
	}
	for(int i=1;i<=n;i++){
		ans+=num[o2_(i)];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
int main(){
	int n, t[100], ans = 0;
	string s[100], x;
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> s[a] >> t[a];
	}
	cin >> x;
	for (int i = 0; i < n; i++) {
		if (s[i] == x) {
			for (int j = i+1; j < n; j++) {
				ans += t[j];
			}
			break;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    string s, t; cin >> s >> t;
    bool flg = true;
    for(int i=0; i<3; i++) if(s[i] != t[2-i]) flg = false;

    if(flg) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

vector<vector<int>> tree(1000000);
vector<int> cnt(1000000);

void dfs(int now,int sum){
    cnt[now] += sum;
    for(int i = 0; i < tree[now].size(); i++){
        dfs(tree[now][i], cnt[now]);
    }
}

int main(){
    int n,q; cin >> n >> q;
    vector<int> a(n-1),b(n-1);
    rep(i,n-1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        if(a[i] > b[i]) swap(a[i],b[i]);
        tree[a[i]].push_back(b[i]);
    }
    vector<int> p(q),x(q);
    rep(i,q){
        cin >> p[i] >> x[i];
        cnt[p[i]-1] += x[i];
    }
    dfs(0,0);
    rep(i,n) cout << cnt[i] << endl;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    string s;
    cin >> s;

    ll a = stoi(s.substr(0, 2)), b = stoi(s.substr(2, 2));
    if(IN(1LL, 13LL, a) && IN(1LL, 13LL, b)) {
        cout << "AMBIGUOUS" << endl;
    } else if(IN(1LL, 13LL, a)) {
        cout << "MMYY" << endl;
    } else if(IN(1LL, 13LL, b)) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
Q = 10**9+7

def cmb(n,r):
    if n-r < r: r = n-r
    if r == 0: return 1
    denominator = 1                       #分母
    numerator = 1                         #分子
    for i in range(r):
        numerator *= n-i
        numerator %= Q
        denominator *= i+1
        denominator %= Q
    return numerator*pow(denominator, Q-2, Q)%Q

def main():
    n, a, b = map( int, input().split())
    print( (pow(2,n,Q) - cmb(n,a) - cmb(n,b)-1)%Q)
if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> vec(N, vector<int>(2));
  rep(i, N) {
    vec.at(i).at(0) = i + 1;
    vec.at(i).at(1) = 0;
  }
  int X;
  rep(i, M) {
    cin >> X;
    vec.at(X - 1).at(1) += 1;
    cin >> X;
    vec.at(X - 1).at(1) += 1;
  }
  rep(i, N) {
    cout << vec.at(i).at(1) << endl;
  }
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  cout << 180 * (n-2) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <iomanip>
#include <map>

using namespace std;

typedef long long ll;

int main() {
    ll N, P, kN;
    cin >> N >> P;
    
    ll k = 2;
    ll ans = 1;
    if (N == 1) ans = P;
    else {
        while (P >= pow(k, N)) {
            kN = pow(k, N);
            if (P % kN == 0) {
                P /= kN;
                ans *= k;
            } else {
                k++;
            }
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;
ll A[101010];
ll X[101010];

int main() {
  cin >> N;
  ll sum = 0;
  ll sum_a_odd = 0;
  rep(i, 0, N) {
    cin >> A[i];
    sum += A[i];
    if (i % 2 == 1) {
      sum_a_odd += A[i];
    }
  }
  X[0] = sum - 2 * sum_a_odd;

  rep(i, 0, N - 1) {
    int idx = (2 * i) % N;
    int idx1 = (2 * i + 1) % N;
    int idx2 = (2 * i + 2) % N;
    X[idx2] = X[idx] - 2 * (A[idx] - A[idx1]);
  }

  rep(i, 0, N) { cout << X[i] << endl; }
}


Measured memory_bytes: 2944
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int[] h = new int[n], dp = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
            if (i >= 1) dp[i] = dp[i - 1] + Math.abs(h[i - 1] - h[i]);
            if (i >= 2) dp[i] = Math.min(dp[i], dp[i - 2] + Math.abs(h[i - 2] - h[i]));
        }
        System.out.println(dp[n - 1]);
    }
}

Measured memory_bytes: 50864
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
using LLI = long long int;

int main(void) {
	string S,sub;
	LLI K = 0,pos1 = 1e9;
	cin >> S >> K;
	for (LLI i = 0; i < S.size();i++) {
		if (S[i] != '1') {
			pos1 = i;
			sub = S[i];
			break;
		}
	}
	if (pos1 >= K) {
		cout << '1' << endl;
	}
	else {
		cout << sub << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  lint a[N];
  REP(i,N)cin>>a[i];
  bool f=true;
  REP(i,N)if(a[i]%2==1)f=false;
  if(!f)cout<<"first"<<endl;
  else cout<<"second"<<endl;
  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define int             long long





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



  int n;
  cin >> n ;

  int a[n][3];
  int aa, b, c;
  int dp[n][3];

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


    }
  }
  dp[0][0] = a[0][0];
  dp[0][1] = a[0][1];

  dp[0][2] = a[0][2];
  //cout << dp[0][0] << " " << dp[0][1] << " " << dp[0][2] << endl;
  //cout << aa << " " << b << " " << c << endl;
  for (int i = 1; i < n; i++) {
    dp[i][0] = max(dp[i - 1][1] + a[i][0], dp[i - 1][2] + a[i][0]);
    dp[i][1] = max(dp[i - 1][0] + a[i][1], dp[i - 1][2] + a[i][1]);
    dp[i][2] = max(dp[i - 1][1] + a[i][2], dp[i - 1][0] + a[i][2]);
    //cout << dp[i][0] << " " << dp[i][1] << " " << dp[i][2] << endl;
  }
  cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;



  return 0;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int main()
{
    int x;
    cin >> x;

    int a = x / 500, b = x % 500, c = b / 5;
    cout << a * 1000 + c * 5 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    vector<int> a(5);
    int k;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;
    sort(a.begin(), a.end());
    cout << (a[4] - a[0] <= k ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

A = [ input() for _ in range(N) ]
B = [ input() for _ in range(M) ]

for i in range(N-M+1):
  for _ in range(A[i].count(B[0])):
    l = A[i].index(B[0])
    result = True
    for k in range(1, M):
      if B[k] != A[i+k][l:l+len(B[k])]:
        result = False
        break
    if result:
      print("Yes")
      exit()
    l += 1
      
print("No")

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

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a > b) cout << "a > b" << endl;
	else if (a < b) cout << "a < b" << endl;
	else cout << "a == b" << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>

#define MAXN 100000

typedef struct LIST {
	int cnt;
	int p[500];
} IT;

IT A[MAXN+1];
int  S[MAXN+1];

int longestpath ( int n )
{
	if ( S[n] != -1 ) return S[n];

	int max, tmp,i;

	max = longestpath(A[n].p[0]);
	for ( i = 1; i < A[n].cnt; i++ ) {
		tmp = longestpath(A[n].p[i]);
		if ( max < tmp ) max = tmp;
	}

	return S[n] = max+1;
}


int main(void)
{
	int n,m,i,tmp1,tmp2,max = -1;

	scanf("%d%d", &n,&m);

	for ( i = 0; i <= n; i++ ) A[i].cnt = 0,S[i] = -1;

	for ( i = 0; i < m; i++ ) {
		scanf("%d%d", &tmp1, &tmp2);
		A[tmp2].p[A[tmp2].cnt] = tmp1;
		A[tmp2].cnt++;
	}

	for ( i = 1; i <= n; i++ ) if ( A[i].cnt == 0 ) S[i] = 0;

	for ( i = 1; i <= n; i++ ) {
		tmp1 = longestpath(i);
		if ( max < tmp1 ) max = tmp1;
	}

	printf("%d\n", max);

	return 0;
}


Measured memory_bytes: 200832
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;

public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Map<Character,String> map = new HashMap<Character,String>();
        mapset(map);
        
        int n = scan.nextInt();
        for(int i=0;i<n;i++)
        {
            String testcase = scan.next();
            
            int start=0,pos=0,count=0,num=0;
            String ans="",tmp;
            char button;
            do{
                pos = testcase.indexOf("0",start);
                if(start!=pos)
                {
                    button = testcase.charAt(start);
                    count = pos-1-start;
                    if(button=='1')
                        num = count%5;
                    else if(button=='7' || button=='9')
                        num = count%4;
                    else
                        num = count%3;
                
                    tmp=map.get(button);
                    ans=ans+tmp.substring(num,num+1);
                }
                start=pos+1;
            }while(testcase.length()>start);
            
            System.out.println(ans);
        }    
    }
        
    public static void mapset(Map<Character,String> map)
    {
        map.put('1',".,!? ");   //5文字
        map.put('2',"abc");     //3文字
        map.put('3',"def");     //3文字
        map.put('4',"ghi");     //3文字
        map.put('5',"jkl");     //3文字
        map.put('6',"mno");     //3文字
        map.put('7',"pqrs");    //4文字
        map.put('8',"tuv");     //3文字
        map.put('9',"wxyz");    //4文字
    }
}

Measured memory_bytes: 24100
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    cin >>a>>b>>c;
    if (a!=b&&a!=c)
        cout <<a;
    else if (b!=c&&b!=a)
        cout <<b;
    else
        cout <<c;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const bool DBG = 1;

#define TRACE(x)    x
#define WATCH(x)    TRACE(cout << #x" = " << x << endl)
#define WATCHR(a,b) TRACE(for(auto it=a; it!=b;) cout<<*(it++)<<" ";cout<<endl)
#define WATCHC(V)   TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pair<int,int>> vpii;

int x[26];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(15);

	int n,m;
	cin >> n >> m;
	char c;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			cin >> c;
			x[c-'a']++;
		}
	}

	int nodd = 0;
	for(int i = 0; i < 26; i++) {
		//cout << x[i] << " ";
		if(x[i] % 2) {
			nodd++;
			x[i]--;
		}
	}
	//cout << endl;

	int desodd = (n % 2) && (m % 2);
	//cout << "Odd: " << nodd << " " << desodd << endl;
	if(nodd != desodd) {
		cout << "No" << endl;
		return 0;
	}

	int n2 = 0;
	for(int i = 0; i < 26; i++) {
		if(x[i] % 4 == 2) {
			n2++;
		}
	}

	int des2 = (n % 2) * (m / 2) + (m % 2) * (n / 2);
	//cout << "2mod4: " << n2 << " " << des2 << endl;
	if(n2 > des2) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        // 数値の取得
        Scanner scn = new Scanner(System.in);
        int i = scn.nextInt();
        scn.close();
        
        //一の位の取得
        int x = i % 10;
        
        //一の位に応じた分岐
        if(x == 3) {
            System.out.println("bon");
        } else if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9) {
            System.out.println("hon");
        } else {
            System.out.println("pon");
        }
    }
}

Measured memory_bytes: 35748
#include <stdio.h>

int main(){
  int n,m,temp,i;
  int h=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d",&temp);
    h+=temp;
  }
  if(n>=h){
    printf("%d\n",n-h);
  }else{
    printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 1728
import heapq
N, M = map(int, input().split())
jobs = {m:[] for m in range(1,M+1) }

for i in range(N):
  hi,yen = map(int, input().split())
  if hi <= M:
    jobs[hi].append(yen)
  
q = []
ans = 0
for i in range(1,M+1):
  for j in jobs[i]:
    heapq.heappush(q, -j)
  if len(q) > 0:
    a = heapq.heappop(q)
    ans += -a  
print(ans)

Measured memory_bytes: 26980
read K
printf %ld\\n {1{,0{{0..8}999999999999,99{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9}}}}}}}}}}}},{1..8}99{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9}}}}}}}}}}}},2{,{0..8}999{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9}}}}}}}}}}},3{,{0..8}9999{,9{,9{,9{,9{,9{,9{,9{,9{,9}}}}}}}}}},4{,{0..8}99999{,9{,9{,9{,9{,9{,9{,9{,9}}}}}}}}},5{,{0..8}999999{,9{,9{,9{,9{,9{,9{,9}}}}}}}},6{,{0..8}9999999{,9{,9{,9{,9{,9{,9}}}}}}},7{,{0..8}99999999{,9{,9{,9{,9{,9}}}}}},8{,{0..8}999999999{,9{,9{,9{,9}}}}},9{,{0..8}9999999999{,9{,9{,9}}}},{1..9}9{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9{,9}}}}}}}}}}}}}} | sort -n | head -$K

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

using  namespace std;

int main(int argc, char const *argv[])
{
    int N,M;
    cin>>N>>M;

    long long ans=(long long)(N-2)*(M-2);

    if(N==1&&M==1){
        ans=1;
    }else if(N==1||M==1){
        ans=N*M-2;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b , c;
    cin >> a >> b >> c;
    if( a == b && a != c ) cout << c;
    else if( a == c && a != b ) cout << b;
    else if( b == a && b != c ) cout << c;
    else if( b == c && b != a ) cout << a;
    else if( c == a && c != b ) cout << b;
    else if( c == b && c != a ) cout << a;
    else cout << a;
}


Measured memory_bytes: 3664
# GCD and LCM

import sys


def gcd(x, y):
	while x != y:
		if x > y:
			x -= y
		else:
			y -= x
	return x

datas = []

for line in sys.stdin:
	datas.append(map(int, line.split()))

for data in datas:
	g = gcd(data[0], data[1])
	print "{0} {1}".format(g, data[0] * data[1] / g)

Measured memory_bytes: 4220
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<a*b/2<<endl;
    if(a/2==c&&b/2==d){
        cout<<1<<endl;
    }
    else{
        cout<<0<<endl;
    }
    
}

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

int main(){
	long long n;
	cin >> n;

	long long a[n];

	long long res = 1;
	for(int i=0; i<n; i++){
		cin >> a[i];
		if (a[i] == 0) res = 0;
	}

	if (res == 0){
		cout << res << endl;
		return 0;
	}

	for(int i=0; i<n; i++){
		if (a[i] <= (long long)1e18/res)
			res *= a[i];
		else{
			cout << "-1" << endl;
			return 0;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 4304
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

static const int MAX = 1e5;
int n, k, now, cnt, ans, l, r, tmp, next_l, next_r;
char S[MAX];
string s;
vector<int> C;

int main() {
    scanf("%d %d", &n, &k);
    scanf("%s", S);
    s = S;
    now = 1;
    cnt = 0;

    for ( int i = 0; i < n; i++ ) {
        if ( s[i] == '0' + now ) {
            cnt++;
        } else {
            C.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }

    if ( cnt != 0 ) {
        C.push_back(cnt);
    }

    if ( C.size() % 2 == 0 ) {
        C.push_back(0);
    }

    ans = 0;
    l = 0;
    r = 0;
    tmp = 0;

    for ( int i = 0; i < (int)C.size(); i += 2 ) {
        next_l = i;
        next_r = min(i + 2 * k + 1, (int)C.size());

        while ( next_l > l ) {
            tmp -= C[l];
            l++;
        }
        
        while ( next_r > r ) {
            tmp += C[r];
            r++;
        }
        
        ans = max(tmp, ans);
    }

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



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

using namespace std;

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

    string res = "Yes";
    if(N%2!=0 || S.substr(0, N/2)!=S.substr(N/2, N/2)) res = "No";

    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	String A = sc.next();
      	String B = sc.next();
      	String C = sc.next();
      
      	if(A.equals(B)){
			System.out.println(C);        	
        }else if(B.equals(C)){
          	System.out.println(A);
        }else{
        	System.out.println(B);
        }
    }
}

Measured memory_bytes: 23764
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得

            int N = int.Parse(str[0]);
            int A = int.Parse(str[1]);
            int B = int.Parse(str[2]);

            int maxkoubaisu = 0;

            if( A > B)
            {
                maxkoubaisu = B;
            }
            else
            {
                maxkoubaisu = A;
            }

            int minkoubaisu = 0;

            if(N - (A + B) >= 0)
            {
                minkoubaisu = 0;
            }
            else
            {
                minkoubaisu = (A + B) - N;
            }
    
            Console.WriteLine(maxkoubaisu + " " + minkoubaisu);
	}
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

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

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;
  vs s(n);
  rep(i, n) {
    cin >> s[i];
  }

  vll cnt(n);
  vll minus(n);
  vll mr(n);

  rep(idx, n) {
    ll c = 0;
    rep(i, s[idx].size()) {
      if (s[idx][i] == '(') {
        c++;
      } else {
        c--;
      }
      chmin(minus[idx], c);
    }
    cnt[idx] = c;

    c = 0;
    for (int i = s[idx].size() - 1; i >= 0; i--) {
      if (s[idx][i] == ')') {
        c++;
      } else {
        c--;
      }
      chmin(mr[idx], c);
    }
  }

  if (accumulate(all(cnt), 0ll) != 0) {
    cout << "No" << endl;
    return 0;
  }

  vector<P> p, mn;

  ll sum = 0;
  ll sumr = 0;

  rep(i, n) {
    if (minus[i] == 0) {
      sum += cnt[i];
    } else if (mr[i] == 0) {
      sumr -= cnt[i];
    } else if (cnt[i] >= 0) {
      p.emplace_back(-minus[i], cnt[i]);
    } else {
      mn.emplace_back(-mr[i], -cnt[i]);
    }
  }

  sort(all(p));
  for (const auto& it : p) {
    if (sum < it.first) {
      cout << "No" << endl;
      return 0;
    }
    sum += it.second;
  }

  sort(all(mn));
  for (const auto& it : mn) {
    if (sumr < it.first) {
      cout << "No" << endl;
      return 0;
    }
    sumr += it.second;
  }

  cout << "Yes" << endl;

  return 0;
}


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

int main()
{
	const int n = 5;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int k;
	cin >> k;
	cout << (a[n - 1] - a[0] <= k ? "Yay!" : ":(") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",(long long)x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll fmod(ll x){if (x<mod) return x;return x%mod;}
ll mul(ll a, ll b, ll c){
	ll ret=0;while(b){if (b%2) ret=(ret+a)%c;a=(a*2)%c;b>>=1;}
    return ret;
}
int modpow(ll a, ll b){
    ll ret=1;while(b){if (b%2) ret=(ret*a)%mod;a=(a*a)%mod;b>>=1;}
    return (int)ret;
}
inline int inv(int x){ return modpow(x, mod-2);}
int isprime[N];
void calc_prime(){
	isprime[1]=1;for(ll i=2;i<N;i++) if (!isprime[i]) for(ll j=i*i;j<N;j+=i) isprime[j]=1;
}
VI v[N];
multiset<int, greater<int> > s;
int main(){
    int n, m;sc(n);sc(m);
    fr(i, 1, n){
        int a, b;sc(a);sc(b);
        v[a].pb(b);
    }
    int cnt = 0;
    ll ans = 0;
    for(int i=m;i;i--){
        cnt++;
        for(auto u: v[cnt]) s.insert(u);
        // trace(cnt);
        // for(auto it: s) pr(it);n_l;
        if (s.size()){
            ans += *s.begin();
            s.erase(s.begin());
        }
        // trace(ans);n_l;
    }
    lpr(ans);n_l;
    return 0;
}



Measured memory_bytes: 32304
// -*- coding:utf-8-unix -*-

use proconio::{fastout, input};

#[fastout]
fn main() {
    const bits: u32 = 32;
    input! {
        n: usize,
        xy: [(isize, isize); n],
    }
    fn parity(xxyy: (isize, isize)) -> usize {
        return ((xxyy.0 + xxyy.1).abs() as usize) % 2;
    }
    let theparity = parity(xy[0]);
    for i in 2..=n {
        if parity(xy[i - 1]) != theparity {
            println!("-1");
            return;
        }
    }
    let directions = vec![vec!['L', 'D'], vec!['U', 'R']];
    if theparity == 0 {
        println!("{}", bits + 1);
        print!("1 ");
        for i in 0..bits - 1 {
            print!("{} ", 1usize << i);
        }
        println!("{}", 1usize << (bits - 1));
        let dsum = 1usize << bits;
        for &(x, y) in &xy {
            let mut u = ((x + y + (dsum as isize)) / 2) as usize;
            let mut v = ((x + (dsum as isize) - y) / 2) as usize;
            print!("L");
            for _ in 0..=bits - 1 {
                let uu = u % 2;
                let vv = v % 2;
                print!("{}", directions[uu][vv]);
                u /= 2;
                v /= 2;
            }
            println!("");
        }
    } else {
        println!("{}", bits);
        for i in 0..bits - 1 {
            print!("{} ", 1usize << i);
        }
        println!("{}", 1usize << (bits - 1));
        let dsum = (1usize << bits) - 1;
        for &(x, y) in &xy {
            let mut u = ((x + y + (dsum as isize)) / 2) as usize;
            let mut v = ((x + (dsum as isize) - y) / 2) as usize;
            for _ in 0..=bits - 1 {
                let uu = u % 2;
                let vv = v % 2;
                print!("{}", directions[uu][vv]);
                u /= 2;
                v /= 2;
            }
            println!("");
        }
    }
}


Measured memory_bytes: 2224
s = input()
n = len(s)

ans=[0] * n

cnt_r = 0
cnt_l = 0


# 左から
for i in range(n):
  if s[i] == 'R':
    cnt_r += 1
  else:
    if cnt_r % 2 == 0:
      ans[i] += cnt_r // 2
      ans[i-1] += cnt_r // 2
    else:
      ans[i] += cnt_r // 2
      ans[i-1] += (cnt_r + 1) // 2
    cnt_r = 0

#右から
for i in range(n)[::-1]:
  if s[i] == 'L':
    cnt_l += 1
  else:
    if cnt_l % 2 == 0:
      ans[i] += cnt_l // 2
      ans[i+1] += cnt_l // 2
    else:
      ans[i] += cnt_l // 2
      ans[i+1] += (cnt_l + 1) // 2
    cnt_l = 0
    
    

print(' '.join(map(str,ans)))





Measured memory_bytes: 10484
#include<stdio.h>
#include<string.h>
#include<math.h>
void fanc(int,int);
int a,s,d[100][100],f[4]={-1,0,1,0},g[4]={0,-1,0,1},h,q,w,e,r;
int main(void)
{
	int i,j,k;
	while(1){
		scanf("%d %d",&a,&s);
		if(a==0&&s==0) break;
		for(i=0;i<a;i++){
			for(j=0;j<s;j++){
				scanf("%d",&d[i][j]);
			}
		}
		h=0;
		for(i=0;i<a;i++){
			for(j=0;j<s;j++){
				if(d[i][j]==1){
					q=0;
					fanc(i,j);
				}
			}
		}
		printf("%d\n",h);
	}
	return 0;
}
void fanc(int w,int e)
{
	int i,j,z,x;
	for(i=0;i<4;i++){
		z=w+f[i];
		x=e+g[i];
		if(z<a&&z>=0&&x<s&&x>=0&&d[z][x]==1){
			q++;
			d[z][x]=0;
			if(h<q) h=q;
			fanc(z,x);
			d[z][x]=1;
			q--;
		}
	}
}

Measured memory_bytes: 2616
N = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")

for i in range(N):
    for j in range(i + 1, N):
        if S[i] != S[j]:
            x = 2 * j - i
            if x < N and S[i] != S[x] and S[x] != S[j]:
                ans -= 1

print(ans)


Measured memory_bytes: 73620
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int tv = sc.nextInt();
		int ta = sc.nextInt();
		int av = sc.nextInt();
		int aa = sc.nextInt();
		while(true) {
			av -= ta;
			if(av <= 0) {
				 System.out.println("Yes");
				 break;
			}
			tv -= aa;
			if(tv <= 0) {
				System.out.println("No");
				break;
			}
		}
	}
}

Measured memory_bytes: 35736
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  int x[n];
  int y[n];
  rep(i,n) {
    cin>>x[i];
    y[i] = x[i];
  }
  sort(y, y + n);
  map<int, int> mp;
  rep(i,n) {
    if(n / 2 > i) {
      mp[y[i]] = y[n/2];
    } else {
      mp[y[i]] = y[n/2 - 1];
    }
  }
  rep(i,n) {
    cout << mp[x[i]] << endl;
  }

  return 0;
}


Measured memory_bytes: 13440
#include <iostream>

using namespace std;

int main(){
	int h,w,a,b;cin >> h >> w >> a >> b;
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if((i<b)^(j<a))
				cout<<1;
			else
				cout<<0;
		}
		cout << endl;
	}
}


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

int main() {
  int a,b;
  cin >> a >> b;
  int d = a / b;
  int r = a % b;
  double f = double(a) / b;
  cout << d << " " << r << " ";
  cout << fixed << setprecision(5) << f << endl;
}



Measured memory_bytes: 3280
#include <cstdio>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;

typedef long long ll;

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

    ll sum = 0, a;
    vector<ll> cum(N);
    for (ll &c : cum) {
        scanf("%lld", &a);
        sum += a;
        c = sum;
    }

    ll mini = LONG_LONG_MAX;
    for (int i = 0; i < N - 1; i++) {
        mini = min(mini, abs(cum[i] - (sum - cum[i])));
    }

    printf("%lld\n", mini);
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define Rint register int
#define mem(a,b) memset(a,(b),sizeof(a))
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define For(i,j,k) for(Rint i=(j),i##end=(k);i<=i##end;i++)
#define Fordown(i,j,k) for(Rint i=(j),i##end=(k);i>=i##end;i--)
#define Travel(i,u,v) for(Rint i=beg[u],v=to[i];i;i=nex[i],v=to[i])

using namespace std;
typedef long long LL;

template<typename T>inline void read(T &x){
	x=0;T w=1,ch=getchar();
	while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
	x=x*w;
}

const int N=1e6+10;
LL n,m,lcm,x,y,lcmp;
char a[N],b[N];

int main(){
//	File("A");
	cin>>n>>m>>a>>b;
	lcm=n*m/__gcd(n,m);
	x=lcm/n;y=lcm/m;
	lcmp=x*y/__gcd(x,y);
	for(LL i=0;i<lcm;i+=lcmp){
		if(a[i/x]!=b[i/y]){
			puts("-1");
			return 0;
		}
	}
	printf("%lld\n",lcm);
	return 0;
}

Measured memory_bytes: 384
from bisect import bisect_right
from bisect import bisect_left

N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
ans = 0
for b in B:
  ans += (bisect_left(A, b) * (N-bisect_right(C, b)))

print(ans)

Measured memory_bytes: 23348
import sys
input = sys.stdin.readline
from bisect import bisect_right

N = int(input())
l = [-int(input())]

for i in range(N-1):
  ai = -int(input())
# 各色の最大値がlの要素になるようにリストを拡大させていく
  if l[-1] <= ai:
    l.append(ai)
  else:
    b = bisect_right(l, ai)
    l[b] = ai
    
print(len(l))

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

int main() {
  int n, m;
  cin >> n >> m;
  int ACnum = 0, WAnum = 0;
  vector<bool> ac(n);
  vector<int> wa(n);
  rep(i, n) {
    ac[i] = false;
    wa[i] = 0;
  }
  rep(i, m) {
    int p;
    string s;
    cin >> p >> s;
    --p;
    if(ac[p]) continue;
    if(s == "AC") {
      ac[p] = true;
      ACnum++;
      WAnum += wa[p];
    } else if(s == "WA") {
      wa[p]++;
    }
  }
  cout << ACnum << " " << WAnum << endl;
}

Measured memory_bytes: 640
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int n,m,a[2020202],sum=0;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        

	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		sum+= a[i];
	}
	int cur = 0;
	int ans = 1e18;
	for(int i=1;i<=n;i++){
		ans = min(ans, abs(sum-2*cur) );
		cur+= a[i];
	}
	cout << ans << endl;
    

return 0;
}
///....


Measured memory_bytes: 1792
L,R=map(int,input().split())
left,right=L%2019,R%2019
minimum=2018**2
if R-L>=2019:
    minimum=0
else:
    for i in range(left,right+1):
        for j in range(i+1,right+1):
            minimum=min(minimum,i*j%2019)
print(minimum)

Measured memory_bytes: 3060
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
    int n ;
    cin >> n ;
    int a[n+1] ;
    a[0] = -1 ;
    a[1] = -1 ;

    for(int i=2;i<=n;i++){
       cin >> a[i] ;
    } 

    int ans[n] ;
    for(int i=0;i<n;i++){
       ans[i] = 0 ;
    }
    
    for(int i=2;i<=n;i++){
       ans[a[i]-1] += 1 ;
    }
    
    for(int i=0;i<n;i++){
        cout << ans[i] << endl;
    }


	return 0;
}



Measured memory_bytes: 5152
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){	
	string s;
	cin >> s;
	int ans=0;
	string now="";
	string pre="";
	for(int i=0;i<s.size();i++){
		if(pre==""){
			pre=s[i];
			ans++;
			continue;
		}else{
			now+=s[i];
		}
		if(now!=pre){
			pre=now;
			ans++;
			now="";
		}
	}
	cout << ans << endl;		
	return 0;
}


Measured memory_bytes: 3676
//34
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  for(int p,q;cin>>p>>q;){
    vector<int> v;
    p*=10;
    for(;;){
      v.push_back(p);
      cout<<p/q;
      p=(p%q)*10;
      if(p==0){
	cout<<endl;
	break;
      }else if(find(v.begin(),v.end(),p)!=v.end()){
	int i=find(v.begin(),v.end(),p)-v.begin();
	cout<<endl;
	cout<<string(i,' ')<<string(v.size()-i,'^')<<endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    while (n) {
        ans++;
        n /= k;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256