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

using namespace std;

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

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

typedef complex<double> Point;

double angle(const Point& v1, const Point& v2) {
    double res = arg(v1 / v2);
    if (res < 0) res += 2*pi;
    return min(2*pi-res, res);
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n; cin >> n;
    double R, th; cin >> R >> th; th *= pi / 180;
    vector<Point> v(n);
    REP(i, n) {
        ll x, y; cin >> x >> y;
        v[i] = Point(x, y);
    }
    vector<vector<vector<bool>>> G(n, vector<vector<bool>>(n, vector<bool>(n, false)));
    REP(i, n) REP(j, n) REP(k, n) {
        if (i == j || j == k || k == i) continue;
        // i -> j -> k テ」ツ?ィテ」ツ??」ツ?妥」ツつ凝」ツ??
        Point v1 = v[j] - v[i];
        Point v2 = v[k] - v[j];
        if (angle(v1, v2) <= th+eps) {
            G[i][j][k] = true;
        }
    }
    vector<vector<double>> dist(n, vector<double>(n));
    REP(i, n) REP(j, n) dist[i][j] = abs(v[i]-v[j]);
    ll ans = 0;
    vector<vector<vector<double>>> dp(2, vector<vector<double>>(n, vector<double>(n, linf)));
    dp[0][0][0] = 0;
    REP(t, 10010) {
        dp[t+1&1].assign(n, vector<double>(n, linf));
        REP(prev, n) REP(now, n) {
            double l = dp[t&1][prev][now];
            if (l > R+eps) continue;
            ans = max(ans, t);
            REP(to, n) {
                if (prev != now && !G[prev][now][to]) continue;
                if (now == to) continue;
                dp[t+1&1][now][to] = min(dp[t+1&1][now][to], l + dist[now][to]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(LL x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(LL x){write(x);putchar('\n');}
const LL mod=1e9+7;
const int MAXM=100005;
int a[MAXM],n,m;
void ad(LL &x,LL y){x+=y;if(x>=mod)x-=mod;}
struct matrix
{
	LL m[3][3];
	matrix(){memset(m,0,sizeof(m));}
	friend matrix operator *(matrix u1,matrix u2)
	{
		matrix ret;
		for(int i=0;i<=2;i++)for(int j=0;j<=2;j++)for(int k=0;k<=2;k++)
			ad(ret.m[i][k],u1.m[i][j]*u2.m[j][k]%mod);
		return ret;
	}
}nxt,temp,st;
matrix pow_mod(matrix u1,int b)
{
	matrix ans;
	for(int i=0;i<=2;i++)ans.m[i][i]=1;
	while(b)
	{
		if(b&1)ans=ans*u1;
		u1=u1*u1;b>>=1;
	}
	return ans;
}
void vio()
{
	matrix u1;
	u1.m[0][0]=st.m[0][0];
	u1.m[0][1]=(st.m[0][0]*2+st.m[0][1])%mod;
	u1.m[0][2]=(st.m[0][1]+st.m[0][2]+st.m[0][0])%mod;
	st=u1;
}
int main()
{
	n=read(),m=read();
	for(int i=1;i<=m;i++)a[i]=read();
	st.m[0][0]=1;
	nxt.m[0][0]=nxt.m[2][0]=1;
	nxt.m[0][1]=nxt.m[2][1]=2;nxt.m[1][1]=1;
	nxt.m[1][2]=1;nxt.m[2][2]=2;nxt.m[0][2]=1;
	int lst=0;
	for(int i=1;i<=m;i++)
	{
		temp=pow_mod(nxt,a[i]-lst);
		st=st*temp;
		vio();lst=a[i]+1;
	}
	temp=pow_mod(nxt,n-lst);
	st=st*temp;
	pr2(st.m[0][2]);
	return 0;
	
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

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

    vector <tuple<string, int, int>> a;
    for (int i=1; i<=N; i++) {
        string S;
        int P;
        cin >> S >> P;
        P = -P;
        a.push_back(tie(S, P, i));
    }
    sort(a.begin(), a.end());
    for (int i=0; i<N; i++) {
        cout << get<2>(a[i]) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;cin>>s;
  string t;cin>>t;
  ll l=s.length();
  ll sz='z'-'a'+1;

  vector<vector<ll>>idx(sz);
  rep(i,l){
    idx[s[i]-'a'].push_back(i);
  }
  rep(i,sz){
    idx[i].push_back(l);
  }
  ll res=0,id=-1,f=1;
  rep(i,t.length()){
    ll nid=*lower_bound(all(idx[t[i]-'a']),id+1);
  //  cout<<id<<endl;
  
    if(idx[t[i]-'a'].size()==1){
      f=0;
      break;
    }
    if(nid==l){
      id=idx[t[i]-'a'][0];
      res+=l;
      continue;
    }
    //cout<<id<<" "<<nid<<endl;
    id=nid;
  }
  if(f){
    cout<<res+id+1<<endl;
  }
  else{
    cout<<-1<<endl;
  }




  return 0;

}


Measured memory_bytes: 1736
import math
import queue
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1


n = readInt()
d = defaultdict(int)
for i in range(n):
	d[readChar()]+=1

d = sorted(d.items(), key=lambda x:x[1], reverse=True)
maxCount = d[0][1]

ans = []

for i in range(len(d)):
	if d[i][1]==maxCount:
		ans.append(d[i][0])
	else:
		break

ans.sort()

for i in range(len(ans)):
	print(ans[i])

Measured memory_bytes: 44112
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
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<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}

int main(){
    ll N;
    cin >> N;
    vector<ll> x(N),y(N);
    rep(i,N){
        cin >> x[i] >> y[i];
    }
    map<Pll,ll> mp;
    rep(i,N){
        rep(j,N){
            if(i == j)continue;
            mp[Pll(x[i]-x[j], y[i]-y[j])]++;
        }
    }
    ll M = 0;
    for(auto& e:mp){
        cmax(M, e.second);
    }
    cout << N-M << endl;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int x;

int main(void) {
  // Here your code !
  scanf("%d", &x);

  if (x == 3 || x == 5 || x == 7) {
    printf("YES\n");
  }
  else {
    printf("NO\n");
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M=10;
char S[M][M];
int h,w;

int main(){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;++i)
		scanf("%s",S[i]);
	if(S[0][0]!='#'){
		puts("Impossible");
		return 0;
	}
	int x=0,y=0,cnt=1;
	while(x!=h-1 || y!=w-1){
		bool mx=x+1<h && S[x+1][y]=='#';
		bool my=y+1<w && S[x][y+1]=='#';
		if(mx==my){
			puts("Impossible");
			return 0;
		}
		if(mx)
			++x;
		else
			++y;
		++cnt;
	}
	for(int i=0;i<h;++i)
		for(int j=0;j<w;++j)
			if(S[i][j]=='#')
				--cnt;
	puts(cnt==0?"Possible":"Impossible");
	return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
using namespace std;


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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

	int T;
	cin >> T;

	vector<int> V(T);

	ll sum = 0;

	for(int qq = 0; qq < T; qq++){
		cin >> V[qq];
		sum += V[qq];
	}

	ll sum2 = sum;

	sum = ceil((double)sum/T);

	ll ans = 0;

	sort(V.begin(), V.end());

	for(int i = 0; i < T; i++){
		ans += (V[i] - sum)*(V[i] - sum);
	}

	ll ans2 = 0;
	
	sum2 /= T;

	for(int i = 0; i < T; i++){
		ans2 += (V[i] - sum2)*(V[i] - sum2);
	}

	cout << min(ans,ans2) << endl;

	

	return 0;
}


Measured memory_bytes: 3688
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D,E,N,X[10];
    ll ans=0;
    string S;
    bool F=false;
int main(){
    cin>>A;
    cout<<A+A*A+A*A*A;
    return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(void) {
  int S;
  int h, m, s;

  scanf("%d", &S);

  h = S / 3600;
  m = (S % 3600) / 60;
  s = (S % 3600) % 60;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

Measured memory_bytes: 592
import sys

def main():
  input = sys.stdin.readline
  N = int(input())
  ans = 0
  for _ in range(N):
    x, u = map(str, input().split())
    if u == 'JPY':
      ans += float(x)
    else:
      ans += float(x) * 380000
    
  print(ans)


if __name__ == '__main__':
  main()


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

int main() {
  vector<vector<int>> a(3, vector<int>(3));
  rep(i, 3) rep(j, 3) {
    cin >> a.at(i).at(j);
  }
  int n;
  cin >> n;
  vector<vector<int>> cmp(3, vector<int>(3));
  rep(i, n) {
    int b;
    cin >> b;
    rep(j, 3) rep(k, 3) {
      if(b == a.at(j).at(k)) cmp.at(j).at(k) = 1;
    }
  }
  bool flag = false;
  int tmp = 0;
  int tmp_4 = 0;
  rep(i, 3) {
    if(cmp.at(i).at(i) == 1) tmp++;
    if(cmp.at(i).at(2-i) == 1) tmp_4++;
    if(tmp == 3) flag = true;
    if(tmp_4 == 3) flag = true;
    int tmp_2 = 0;
    int tmp_3 = 0;
    rep(j, 3) {
      if(cmp.at(i).at(j) == 1) tmp_2++;
      if(cmp.at(j).at(i) == 1) tmp_3++;
      if(tmp_2 == 3) flag = true;
      if(tmp_3 == 3) flag = true;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#define INF 1000000013
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll dp[1010][1010];

int main(){
  ll h,w;
  cin >> h >> w;
  char a[h][w];
  for(ll i=0;i<h;i++) for(ll j=0;j<w;j++) cin >> a[i][j];
  for(ll i=1;i<=h;i++){
    for(ll j=1;j<=w;j++){
      if(i==1&&j==1) dp[i][j]=1;
      else{
        if(a[i-1][j-1]=='.'){
          if(i!=1&&a[i-2][j-1]=='.') dp[i][j]+=dp[i-1][j];
          if(j!=1&&a[i-1][j-2]=='.') dp[i][j]+=dp[i][j-1];
          dp[i][j]%=mod;
        }
      }
    }
  }
  cout << dp[h][w] << endl;
}

Measured memory_bytes: 9088
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        mut x: usize,
        y: usize
    };
    let mut count = 0;
    while x <= y {
        count += 1;
        x *= 2;
    }
    println!("{}", count);
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

ll cnt[60];

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    rep(i, N) rep(j, 60) if (a[i] >> j & 1) cnt[j]++; // 2進数各桁の1が立っている回数を数える

    mint ans = 0;
    mint p = 1;
    rep(i, 60) {
        if (i != 0) p *= 2;
        ans += mint(cnt[i]) * mint(N - cnt[i]) * p;
    }
    cout << ans.x << endl;
}


Measured memory_bytes: 2560
//問題URL
    //http://abc076.contest.atcoder.jp/tasks/abc076_c

    //解き方メモ
    //tが当てはまる場所を探し、残り?は辞書順先頭のaで埋める
    //tが２箇所以上に当てはまる場合、なるべく後ろに当てはめる（当てはめなかった側はaで埋まるため、そちらが辞書順で先になる）
    //そのため、tが当てはまる場所は後方から探す
    
    #include<iostream>
    #include<string>
    using namespace std;

    int main(){
        string sd,t;

        //sd,t入力
        cin >> sd >> t;

        bool flag;
        for(int i = sd.length()-t.length(); i>=0; i--){ //i:tが当てはまるか試行する部分文字列の先頭位置
            string ts = sd.substr(i,t.length()); //ts:sの部分文字列。tが当てはまるか判定する対象

            //tsにtが当てはまるか判定。当てはならない時にbreak
            flag = true;
            for(int j=0;j<ts.length();j++){
                if(ts[j] != t[j] && ts[j] != '?') {
                    flag = false;
                    break;
                }
            }
            if(flag){ //一致した場合
                sd.replace(i,t.length(),t); //tに置き換え
                break;
            }
        }

        //tが当てはまった場合
        if(flag){
            //?を全てa（辞書順先頭文字）に置換
            for(int i=0;i<sd.length();i++){
                if(sd[i]=='?'){
                    sd[i] = 'a';
                }
            }
        } else {
            sd = "UNRESTORABLE";
        }

        //出力
        cout << sd << endl;

        return 0;
    }

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////

void no(){
    cout<<"NO"<<endl;
    exit(0);
}

int main(){fastio
    
    ll a,va,b,vb;
    cin>>a>>va>>b>>vb;
    ll t;cin>>t;
    if(va<vb){
        no();
    }
    ll dis=abs(a-b);
    if(dis<=abs(va-vb)*t){
        cout<<"YES"<<endl;
    }else{
        no();
    }
    
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 998244353;

int N;
int dp[100010][3];
int abc[100010][3];

int MAX_happy(int N){
    for(int i = 0; i < 3; i++){
        dp[0][i] = 0;
    }
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < 3; j++){
            dp[i][j] = max(dp[i-1][(j+1)%3] + abc[i-1][j], dp[i-1][(j+2)%3] + abc[i-1][j]);
        }
    }
    return max(dp[N][0], max(dp[N][1], dp[N][2]));
}



int main(void){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
    }
    cout << MAX_happy(N) << endl;
}



Measured memory_bytes: 2560
from collections import Counter
n=int(input())
s=[]
count=[]
for i in range(n):
    s.append(input())
c=Counter(s)
freq_scores = c.most_common()
max_count = freq_scores[0][1]
modes = []
for num in freq_scores:
    if num[1] == max_count:
        modes.append(num[0])
modes.sort()
for mode in modes:
    print(mode)

Measured memory_bytes: 47636
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#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(a) (a).begin(),(a).end()
int INF=1e9;
int MOD=1000000007;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
double EPS = 1e-5;
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;
	return a+b;
}
struct P{
	double x,y;
	P(){}
	P(double x,double y):x(x),y(y){}
	P operator + (P p){
		return P(add(x,p.x),add(y,p.y));
	}
	P operator - (P p){
		return P(add(x,p.x),add(y,-p.y));
	}
	P operator * (P p){
		return P(x*p.x,y*p.y);
	}
};
double dist(P a,P b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int cnt(P pos,vector<P> dat){
	int res=0;
	REP(i,dat.size()){
		if(dist(pos,dat[i])<=1.0+EPS)res++;
	}
	return res;
}
int main(){
	int n;
	double x,y;
	while(scanf("%d",&n)&&n){
		vector<P> dat;
		REP(i,n){
			cin>>x>>y;
			dat.PB(P(x,y));
		}
		int ans=1;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				P a=dat[i],b=dat[j];
				P mid=P((a.x+b.x)/2.0,(a.y+b.y)/2.0);
				double dx=a.y-b.y,dy=b.x-a.x;
				double d=dist(a,b);
				if(d>2)continue;
				double dd=sqrt(dx*dx+dy*dy);
				double ddd=sqrt(1-d*d/4);
				dx=dx/dd*ddd;dy=dy/dd*ddd;
				ans=max(ans,cnt(P(mid.x+dx,mid.y+dy),dat));
				ans=max(ans,cnt(P(mid.x-dx,mid.y-dy),dat));
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1272
#include <stdio.h>

int main(void) {
	int N, A, B, C, D;
	int i;
	int count1 = 0;
	int count2 = 0;

	scanf("%d%d%d%d%d", &N, &A, &B, &C, &D);

	char masu[N];

	for (i = 0;i < N;i++) {
		scanf("%s", &masu[i]);
	}

	if (C < D) {
		for (i = A;i <= C-3;i++) {
			if (masu[i] == '#'&& masu[i+1]=='#'){
				count1++;
			}
		}

		for (i = B;i <= D - 3;i++) {
			if (masu[i] == '#' && masu[i + 1] == '#') {
				count1++;
			}
		}

		if (count1 == 0) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}
	else {
		for (i = A;i <= C - 3;i++) {
			if (masu[i] == '#' && masu[i + 1] == '#') {
				count1++;
			}
		}
		for (i = B - 2;i <= D - 2;i++) {
			if (masu[i] == '.' && masu[i + 1] == '.' && masu[i + 2] == '.') {
				count2++;
			}
		}
		if (count1==0 && count2 > 0) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}

	return 0;

}

Measured memory_bytes: 512
a, b, c, d = (int(i) for i in input().split(" "))
alice_times = set([i for i in range(a, b + 1)])
bob_times = set([i for i in range(c, d + 1)])

if len(set(alice_times & bob_times)) > 0:
    print(len(set(alice_times & bob_times)) - 1)
else:
    print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N;


//解法
void solve() {

	ll ans = 0;

	map<ll, ll> mp;

	for (ll num = 2; num <= N; num++) {
		ll num2 = num;
		for (ll i = 2; num2 != 1; i++) {
			if (num2%i == 0) {
				mp[i]++;
				num2 = num2 / i;
				i--;
			}
		}
	}

	for (int i = 1; i <= 97; i++) {

		if (mp.find(i) == mp.end()) continue;

		if (mp[i] >= 74) {
			ans++;
		}

		for (int j = i + 1; j <= 97; j++) {

			if (mp.find(j) == mp.end()) continue;

			if (mp[i] >= 2 && mp[j] >= 24) {
				ans++;
			}
			if (mp[i] >= 4 && mp[j] >= 14) {
				ans++;
			}
			if (mp[i] >= 24 && mp[j] >= 2) {
				ans++;
			}
			if (mp[i] >= 14 && mp[j] >= 4) {
				ans++;
			}

			for (int k = j + 1; k <= 97; k++) {

				if (mp.find(k) == mp.end()) continue;

				if (mp[i] >= 2 && mp[j] >= 4 && mp[k] >= 4) {
					ans++;
				}
				if (mp[i] >= 4 && mp[j] >= 2 && mp[k] >= 4) {
					ans++;
				}
				if (mp[i] >= 4 && mp[j] >= 4 && mp[k] >= 2) {
					ans++;
				}

			}

		}
	}

	cout << ans;

	return;
}

int main() {
	//入力

	cin >> N;

	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int A=sc.nextInt(), B=sc.nextInt(), C=sc.nextInt(), D=A-B;
    if(C<=D) System.out.println(0);
    else System.out.println(C-D);
  }
}

Measured memory_bytes: 35616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, int>;
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep1(i, n) for (int i = 1; i < (int)n; i++)
const ll mod = 1e9 + 7;
const ll inf = 1e12;
const double pi = 3.141592;
const int di[4] = {1, 0, -1, 0};
const int dj[4] = {0, 1, 0, -1};

int dfs(int i, int a, int b, int c, const vector<int>& l, int A, int B, int C){
    if(i == l.size()){
        if(!a || !b || !c)
            return 100000;
        else
            return abs(a - A) + abs(b - B) + abs(c - C);
    }

    int res1 = dfs(i + 1, a, b, c, l, A, B, C);
    int res2 = dfs(i + 1, a + l[i], b, c, l, A, B, C) + (a ? 10 : 0);
    int res3 = dfs(i + 1, a, b + l[i], c, l, A, B, C) + (b ? 10 : 0);
    int res4 = dfs(i + 1, a, b, c + l[i], l, A, B, C) + (c ? 10 : 0);
    return min({res1, res2, res3, res4});
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,a,b,c;
    cin >> n >> a >> b >> c;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    cout << dfs(0, 0, 0, 0, l, a, b, c) << "\n";
    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

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

  int N;
  std::cin >> N;

  std::string S, T;
  std::cin >> S >> T;

  for(int i=0;i<N;++i){
      std::cout << S[i] << T[i];
  }
  std::cout << std::endl;
}


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

public class Main{

	public static void main(String[] args) throws IOException
	{
		int nCount=0;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );

		String strWord = br.readLine();

		while(true)
		{
			String[] strText = br.readLine().split(" ");
			if(strText[0].equals("END_OF_TEXT") ) break;

			for(String str : strText)
			{
				if(str.equalsIgnoreCase(strWord) ) nCount++;
			}
		}

		System.out.println(nCount);

	}
}

Measured memory_bytes: 24296
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        a: i32,
        b: i32
    }
    println!("{}", std::cmp::max(a - b * 2, 0));
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
AB = sorted(ab, reverse=True, key=lambda x:x[1])
s = [0] * n
ans = "IMPOSSIBLE"
for a,b in ab:
    if a == 1: s[b-1] = 1
    else: break
for A, B in AB:
    if B == n:
        if s[A-1] == 1:
            ans = "POSSIBLE"
    else: break
print(ans)

Measured memory_bytes: 56808
N = int(input())
K = int(input())
S = str(N)
n = len(S)
def c(x,y):
    X = 1
    Y = 1
    for i in range(y):
        X *= (x-i)
        Y *= (y-i)
    return X//Y
k = K
ans = 0
for i in range(n):
    if k < 0:
        break
    x = int(S[i])
    y = n - 1 - i
    if i == 0:
        k -= 1
        ans += (x-1)*(9**k)*(c(y,k))
        continue
    if x == 0:
        continue
    k -= 1
    if k >= 0:
        ans += (x-1)*(9**k)*(c(y,k))
    ans += (9**(k+1))*c(y,(k+1))
if i == n-1:
    if k == 0:
        ans += 1
for i in range(1,n):
    if i < K:
        continue
    ans += (9**K)*c(i-1,K-1)
print(ans)

Measured memory_bytes: 3064
from heapq import heappop as pop
from heapq import heappush as push

INF = 10 ** 18

class edge:
  def __init__(self, to, cost):
    self.to = to
    self.cost = cost

#V, E, r = map(int,input().split())
N, M, K = map(int,input().split())

G = [[] for i in range(N)]
#G[i]...頂点iからの辺list、(行き先、コスト)

d = [INF for i in range(N)]
#d[i]...スタートからみた頂点iまでの最短距離

def dijkstra(lst):
  que = []
  for s in lst:
    d[s] = 0
    push(que, (0,s))

  while len(que):
    p = pop(que)
    v = p[1]
    if (d[v] < p[0]):
      continue
    for i in range(len(G[v])):
      e = G[v][i]
      if d[e.to] > d[v] + e.cost:
        d[e.to] = d[v] + e.cost
        push(que, (d[e.to], e.to))

for i in range(M):
  s, t, c = map(int,input().split())
  s -= 1
  t -= 1
  G[s].append(edge(t,c))
  G[t].append(edge(s,c))


lst =  [int(input()) - 1 for i in range(K)]
dijkstra(lst)

anss = []
append = anss.append

for i in range(N):
  for e in G[i]:
    x = d[i] + d[e.to] + e.cost
    if x % 2:
      append(x // 2 + 1)
    else:
      append(x // 2)

print(max(anss))


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-b)<=d && abs(b-c)<=d){
    cout << "Yes" << endl;
  }else if(abs(a-c)<=d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

double p[3000];
double dp[3000][3000];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cout << fixed << setprecision(10);
    //dp[idx][heads] = dp[idx-1][heads]*p[idx-1] + dp[idx-1][heads-1]*(1 - p[idx-1])
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= i; j++){
            dp[i][j] = (j ? dp[i-1][j-1]*p[i-1] : 0) + dp[i-1][j]*(1 - p[i-1]);
        }
    }
    double ans = 0;
    for(int i = 0; i <= n; i++){
        if(i > n - i)
            ans += dp[n][i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 68992
//https://atcoder.jp/contests/abc141/tasks/abc141_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    string s; cin>>s;    
    map<string,string> tbl={{"Sunny","Cloudy"}, {"Cloudy","Rainy"}, {"Rainy","Sunny"}};
    cout<<tbl[s]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

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

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  int N, M;
  cin >> N >> M;
  VI vx(N);
  VI mod(M,0);
  VI pr(M,0);
  for(auto &x : vx) {
    cin >> x;
  }
  sort(vx.begin(), vx.end());
  int prvx = -1;
  for(auto &x : vx) {
    mod[x % M]++;
    if(prvx == x) {
      pr[x % M]++;
      prvx = -1;
    } else {
      prvx = x;
    }
  }
  ll ans = 0;
  ans += mod[0] / 2;
  if(M % 2 == 0) {
    ans += mod[M/2] / 2;
  }
  REP(i,1,(M+1)/2) {
    int diff = mod[i] - mod[M-i];
    if(diff >= 2) {
      int p = min(diff / 2, pr[i]);
      ans += p + mod[M-i];
    } else if (diff <= -2) {
      int p = min((-diff) / 2, pr[M-i]);
      ans += p + mod[i];
    } else {
      ans += min(mod[i], mod[M-i]);
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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

  if (n.at(0) == '9' || n.at(1) == '9') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3580
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	static void Main(){
		int n=int.Parse(Console.ReadLine());
		int[] a=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		long[,] dp=new long[n,n];
		for(int i=0;i<n;i++){dp[i,0]=a[i];}
		for(int i=1;i<n;i++){
			for(int j=0;j+i<n;j++){dp[j,i]=Math.Max(dp[j,0]-dp[j+1,i-1],dp[j+i,0]-dp[j,i-1]);}
		}
		Console.WriteLine("{0}",dp[0,n-1]);
	}
}

Measured memory_bytes: 83424
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i_, __start, __end) for(ll i_=(ll)__start; i_<(ll)__end; i_++)
#define print(_a) cout << _a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");

vector<pair<ll, ll>> ab;
ll dp[3001][3001] = {};
int main(){
    ll n, t, ans=0;
    
    cin >> n >> t;
    rep(i, 0, n){
      ll a, b;
      cin >> a >> b;
      ab.push_back(make_pair(a, b));
    }
    sort(ab.begin(), ab.end());

    rep(time, 1, t){
      rep(i, 0, n){
        if(ab[i].first <= time){
          if(dp[time][i] < ab[i].second + dp[time - ab[i].first][i]){
            dp[time][i+1] = ab[i].second + dp[time - ab[i].first][i];
          }else{
            dp[time][i+1] = dp[time][i];
          }
        }else{
          dp[time][i+1] = dp[time][i];
        }
        if(i < n-1){
          ans = max(ans, dp[time][i+1] + ab[i+1].second);
        }
      }
    }
  
  print(ans);

  return 0;
}

Measured memory_bytes: 70656
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b;
	int sum;
	string str;
	string s,t;
	char c;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 

	cin >> n >> m;
	cin >> a >> b;
	//cin >> a >> b >> m;
	//cin >> str;
	//cin >> n;
	
	//cin >> s >> t;
	//cin >> c;

	vi.resize(10000);
	fill(vi.begin(), vi.begin()+m, a);
	fill(vi.begin()+m, vi.end(), b);

	cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



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

using namespace std;

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

	int32_t N, M;
	cin >> N >> M;
	vector<int32_t> num(N, 0);
	vector<bool> visited(N, false);

	bool status = true;

	for(int q = 0; q < M; ++q)
	{
		int32_t s, c;
		cin >> s >> c;
		--s;

		if(visited[s])
		{
			if(c != num[s])
			{
				status = false;
				break;
			}
		}
		else
		{
			num[s] = c;
			visited[s] = true;
		}
	}

	if(status)
	{
		if(N != 1)
		{
			if(num[0] == 0)
			{
				if(visited[0])
				{
					status = false;
				}
				else
				{
					num[0] = 1;
				}
			}
		}
	}

	if(status)
	{
		for(const auto& digit : num)
		{
			cout << digit;
		}
	}
	else
	{
		cout << "-1";
	}

	cout << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n;
int a[100001];
int ans=1;
int main(){
  cin >> n;
  for(int i=0;i<n;i++)cin >> a[i];
  int f=0;
  int x=a[0];
  for(int i=1;i<n;i++){
    if(f==0){
      if(x>a[i]) f=1;
      else if(x<a[i]) f=2;
    }
    else if(f==1){
      if(x<a[i]){
	f=0;
	ans++;
      }
    }
    else{
      if(x>a[i]){
	f=0;
	ans++;
      }
    }
    x=a[i];
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
uses crt;
var h,qh:array[0..100000] of longint;
     i,n:longint;
function min(a,b:longint):longint;
begin
    if a<b then exit(a) else exit(b);
end;
begin
   clrscr;
   readln(n);
   qh[1]:=0;   
   for i := 1 to n do read(h[i]);
   qh[2]:=abs(h[2]-h[1]);
   h[0]:=0;
   for i:=3 to n do 
          qh[i]:=min(abs(h[i]-h[i-1])+qh[i-1],abs(h[i]-h[i-2])+qh[i-2]);
      writeln(qh[n]);
      readln;
end.


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

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);

int main() {
    fastio;

    string s;
    cin >> s;

    set<char> A;
    FOR(i, 0, s.size()) {
        A.insert(s[i]);
    }

    if (s.size() == A.size()) {
        cout << "yes" << "\n";
    } else {
        cout << "no" << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int d, n;
  cin >> d >> n;
  int ans = 0;

  if(d == 0){
    if(n == 100) ans = n+1;
    else ans = n;
  }
  if(d == 1){
    if(n == 100) ans = n*100 + 100;
    else ans = n * 100;
  }
  if(d == 2){
    if(n == 100) ans= n* 10000 + 10000;
    else  ans = n * 10000;

  }

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

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
    ll L, R;
    cin >> L >> R;
    ll ans = 2019;

    for (ll i = 0; i < 2019 && L+i < R; ++i) {
        for (ll j = i+1; j <= 2019 && L+j <= R; ++j) {
            ans = min(ans, ((L+i)*(L+j))%2019);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
n,m = map(int,input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x:int(x)-1,input().split())
    
    g[a].append(b)
    g[b].append(a) 
to = {}   
dist = [-1 for _ in range(n)]
dist[0] = 0
q = deque()
q.append(0)
while (len(q) > 0):
    v = q.popleft()
    for nv in g[v]:
        if (dist[nv] != -1):continue
        dist[nv] = dist[v] + 1
        q.append(nv)
        to[nv] = v
        
print('Yes')
for i in range(1,n):
    print(to[i]+1)

Measured memory_bytes: 41768
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

#define int long long
const int INF = 0x3f3f3f3f3f3f3f3f;
vector<int> v;

signed main()
{
	int N, K, Q;
	cin >> N >> K >> Q;
	for (int i = 0; i < N; ++i) {
		int X;
		cin >> X;
		v.push_back(X);
	}
	
	int mn = INF;
	for (int lower: v) {
		//cout << "lower: " << lower << endl;
		int L = 0, R = 0;
		vector<int> removed;
		while (L < N) {
			while (L < N && v[L] < lower)
				++L;
			R = L;
			while (R < N && v[R] >= lower)
				++R;
			vector<int> copy;
			if (R-L >= K) {
				for (int i = L; i < R; ++i) {
					copy.push_back(v[i]);
				}
				sort(copy.begin(), copy.end());
				for (int i = 0; i < (R-L) - (K-1); ++i) {
					removed.push_back(copy[i]);
				}
			}
			L = R;
		}
		if ((int)removed.size() >= Q) {
			sort(removed.begin(), removed.end());
			mn = min(mn, removed[Q-1]-removed[0]);
		}
	}
	cout << mn << endl;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
int N, L;

scanf("%d %d", &N, &L);

int i, j;
int taste[N], sum = 0, z[N], ans[N];
for(i = 0; i < N; i ++){
    sum += taste[i] = L+i;
}
for(i = 0; i < N; i++){
    z[i] = sum;
    ans[i] = 0;
    for(j = 0; j < N; j ++){
        if(i != j){
            ans[i] += taste[j];
        }
    }
    z[i] -= ans[i];
    if(z[i] < 0) z[i] *= -1;
}

int eat = z[0], p = 0;
for(i = 1; i < N; i++){
    if(eat > z[i]){
        eat = z[i];
        p = i;
    }
}

printf("%d\n", ans[p]);

return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
const int I=100005;
struct node{
	int ai,bi;
}t[I];
using namespace std;
int f[I];
int n,m,ans;

int  Get(int x){
	if(x==-1||x==f[x])return x;
	return f[x]=Get(f[x]);
}

bool cmp(node a,node b){return a.bi>b.bi;}

int main(){
	
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>t[i].ai>>t[i].bi;
	sort(t+1,t+n+1,cmp);
	for(int i=1;i<=m;i++) f[i]=i;
	f[0]=-1;
	for(int i=1;i<=n;i++){
		int need=m-t[i].ai+1;
		if(need<=0) continue;
		int p=Get(need);
		if(p==-1) continue;
		f[p]=Get(p-1);ans+=t[i].bi;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        ll n,m;
        cin>>n>>m;

        pnc p(n+m,MOD);

        ll ans=0;

        for(ll i=0;i<=n;i++)
        {
            ll temp=p.COMB(n,i);

            temp*=(p.PERM(m,i));

            temp%=MOD;

            temp*=(((p.PERM(m-i,n-i))*p.PERM(m-i,n-i))%MOD);
            temp%=MOD;

            if(i%2==0)
            {
                ans+=temp;
                ans%=MOD;
            }
            else
            {
                ans=(ans-temp+MOD)%MOD;
            }
            
        }

        cout<<ans;
    }
}

Measured memory_bytes: 11100
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;


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

	int K, A, B;
	cin >> K >> A >> B;
	bool ok = false;
	for(int i=A;i<=B;i++){
		if(i % K == 0){
			ok = true;
		}
	}
	cout << (ok ? "OK" : "NG") << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <map>
using namespace std;
	int n;
	pair<string,int> sp;
	map<pair<string,int>,int> g;
int main(){
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> sp.first >> sp.second;
    sp.second*=-1;
    g[sp]=i;
  }
  for(auto itr:g){
    cout << itr.second << endl;
  }
}

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

int main() {

  int n, height = 1;
  cin >> n;
  vector<int> vec(n);
  for(int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }

  sort(vec.begin(), vec.end());

  for(int i = 0; i < (n - 1); i++) {
    if(vec.at(i) < vec.at(i + 1)) height++;
  }

  cout << height << endl;
}


Measured memory_bytes: 256