akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc() {
//	return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x) {
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
typedef long long ll;
const int mod = 998244353;
const int maxn = 200000 + 5;
const int maxm = 1000000 + 5;
int n;
int a[maxn];
int m;
int f[maxm];
int inv[maxm];
vector<int> rec[maxm];
inline int add(int x) {
	return x >= mod ? x - mod : x;
}
inline int dec(int x) {
	return x < 0 ? x + mod : x;
}
void init(int n) {
	inv[1] = 1;
	for(int i = 2; i <= n; ++i) {
		inv[i] = (ll)(mod - mod / i) * inv[mod % i] % mod;
	}
}
int solve() {
	init(m);
	for(int i = 1; i <= m; ++i) {
		for(int j = i; j <= m; j += i) {
			rec[j].push_back(i);
		}
	}
	int an = 0;
	for(int i = 1; i <= n; ++i) {
		int x = a[i];
		for(unsigned int j = 0; j < rec[x].size(); ++j) {
			f[rec[x][j]] = add(f[rec[x][j]] + x);
		}
		an = dec(an - x);
	}
	for(int i = m; i >= 1; --i) {
		f[i] = (ll)f[i] * f[i] % mod;
		for(int j = (i << 1); j <= m; j += i) {
			f[i] = dec(f[i] - f[j]);
		}
		an = (an + (ll)f[i] * inv[i]) % mod;
	}
	an = (ll)an * inv[2] % mod;
	return an;
}
int main() {
	read(n);
	for(int i = 1; i <= n; ++i) {
		read(a[i]);
		m = max(m, a[i]);
	}
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 123520
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int a,b;
  cin>>a>>b;
  rep(i,1255){
    int na=i*0.08;
    int nb=i*0.10;
    if(na==a && nb==b){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


int main(){
    int A, B;
    cin >> A >> B;

    int price0 = (int)ceil((double)A / 0.08);
    bool flag0 = false;
    if ((int)floor(price0 * 0.1) == B) flag0 = true;

    int price1 = (int)ceil((double)B / 0.1);
    bool flag1 = false;
    if ((int)floor(price1 * 0.08) == A) flag1 = true;

    if (flag0) {
        if (flag1) cout << min(price0, price1) << endl;
        else cout << price0 << endl;
    } else if (flag1) {
        if (flag0) cout << min(price0, price1) << endl;
        else cout << price1 << endl;
    } else {
        cout << -1 << endl;
    }
}

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

int main( int argc, char *argv[] )
{
  int a,b;
  int ra, rb;
  int rr;

  scanf( "%d %d", &a, &b );

  ra = a * 100/ 8;
  rb = b * 100/ 10;
  if( ra < rb ) rr = ra;
  else rr = rb;

  while( 1 ){
    if( (rr*108/100)-rr == a && (rr*110/100)-rr == b ){
      printf( "%d\n", rr );
      break;
    }
    if( (rr*108/100)-rr > a && (rr*110/100)-rr > b ){
      printf( "-1\n" );
      break;
    }
    rr += 1;
  }

/*
  long long n;
  long long nn;

  long long a;
  long long b;
  long long aa;
  long long l;

  scanf( "%lld %lld %lld", &n, &a, &b );
  aa = a + b;
  l = n / aa;
  nn= l * a;

  if( a < (n-(a+b)*l) ) nn += a;
  else nn += (n-(a+b)*l);

  printf( "%lld\n", nn );
*/
}



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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    vint a(3);
    rep(i, 3) cin >> a[i];
    sort(ALL(a));
    int ans = 0;
    if (a[0] % 2 != a[1] % 2 || a[0] % 2 != a[2] % 2 || a[1] % 2 != a[2] % 2)
    {
        if (a[0] % 2 == a[1] % 2)
        {
            ++a[0];
            ++a[1];
            ++ans;
        }
        else if (a[0] % 2 == a[2] % 2)
        {
            ++a[0];
            ++a[2];
            ++ans;
        }
        else
        {
            ++a[1];
            ++a[2];
            ++ans;
        }
    }
    sort(ALL(a));
    ans += (a[2] - a[0] + a[2] - a[1]) / 2;
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
// solved few days ago
#include <iostream>
#include <cmath>

using namespace std;
typedef long long ll;

const ll mod = 1000000007;

int memo[300000]={0};

void init(){
	memo[0]=1;
	ll a = 1;
	for(int i=1;i<300000;i++){
		a*=i;
		a%=mod;
		memo[i]=a;
	}
}

ll mypow(ll a,ll b){
	if(b==1)return a;
	if(b==0)return 1;
	ll r = mypow(a,b/2);
	r = (r*r)%mod;
	if(b%2==1)r*=a;
	r%=mod;
	return r;
}

ll moddiv(ll a,ll b){
	return (a*mypow(b,mod-2))%mod;
}

ll fact(int n){
	ll a=1;
	for(int i=1;i<=n;i++){
		a*=i;
		a%=mod;
	}
	return a;
}

ll c(int n,int r){
	if(r<0)return 0;
	if(n<r)return 0;
	if(r==0)return 1;
	
	int a = memo[n];
	int b = memo[r];
	int c = memo[n-r];
	ll t = moddiv(a,b);
	t = moddiv(t,c);
	return t;
}

/*
int i=0;
ll route(int n,int m){
	i++;
	return c(n+m,min(n,m));
}

ll f(int n,int m,int k){
	if(k==0)return route(n,m);
	ll a=0;
	if(n>0)a += f(n-1,m,k);
	if(m>0)a += f(n,m-1,k);
	a += f(n+1,m,k-1);
	a += f(n,m+1,k-1);
	a%=mod;
	return a;
}*/

int main(){
	init();
	int n,m,k;
	cin >> n >> m >> k;
	ll ans=0;
	for(int i=0;i<=k;i++){
		int L = i;
		int D = k-i;
		ll x = c(n+L*2,L)-c(n+L*2,L-1);
		ll y = c(m+D*2,D)-c(m+D*2,D-1);
		ll comb = c(n+m+2*k,n+2*L);
		ll t = (x*y)%mod;
		t = (t*comb)%mod;
		ans = (ans+t)%mod;
	}
	while(ans<0)ans+=mod;
	cout << ans << endl;
}

Measured memory_bytes: 2004
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        Set<Integer> ls = new HashSet<>();
        Set<Integer> doubles = new HashSet<>();
        Set<Integer> triple = new HashSet<>();
        Map<Integer, Long> counts = new HashMap<>();
        for(int i=0;i<N;i++){
            int L = sc.nextInt();
            counts.computeIfAbsent(L, z->0L);
            counts.put(L, counts.get(L)+1);
            if(ls.contains(L)){
                if(doubles.contains(L)){
                    triple.add(L);
                }
                doubles.add(L);
            }
            ls.add(L);
        }
        int[] L = new int[ls.size()];
        int ind=0;
        for(int l:ls){
            L[ind] = l;
            ind++;
        }
        Arrays.sort(L);
        N = ls.size();
        long cnt=0;
        for(int i=0;i<N-1;i++){
            for(int j=i+1;j<N;j++){
                int k=j+1;
                while(k < N && L[k] < (L[i] + L[j])){
                    cnt +=  (counts.get(L[i]) * counts.get(L[j]) * counts.get(L[k]) );
                    k++;
                }
            }
        }

        ind=0;
        int[] D = new int[doubles.size()];
        for(int l:doubles){
            D[ind] = l;
            ind++;
        }
        Arrays.sort(D);

        for(int i=0;i<D.length;i++){
/*            int k=0;
            while(k<N && L[k] < 2*D[i]){
                cnt++;
                k++;
            }*/
            for(int j=0;j<N;j++){
                if(L[j] < 2*D[i] && L[j] != D[i]){
                    long DC = counts.get(D[i]);
                    cnt+=((DC * (DC-1) * counts.get(L[j]))/2);
                }
            }
        }
        for(int t:triple){
            long T = counts.get(t);
            cnt += T*(T-1)*(T-2)/6;
        }
        System.out.println(cnt);
    }
}



Measured memory_bytes: 346984
x, k, d = [int(i) for i in input().split()]
x = abs(x)
moves_to_base_without_exceeding = x // d
if(x - k * d >= 0):
    print(x - k * d)
elif(((moves_to_base_without_exceeding - k) % 2 == 0)):
    print(x % d)
else:
    print(d - (x % d))

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=25;
const int M=26;
#define endl '\n'

char str[N];

int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cout.setf(ios::fixed),cout.precision(3);
	ll n,base=26,cnt=0;
	cin>>n;
	n--;
	while(n>=base){
		n-=base;
		base*=M;
	}
	base/=M;
	while(base){
		str[cnt++]=(n/base)+'a';
		n%=base;
		base/=M;
	}
	str[cnt]='\0';
	cout<<str<<endl;
	return 0;
}

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

int a, b, k;

int main() {
  cin >> a >> b >> k;
  rep (i, k) {
    if (a + i <= b) cout << a + i << endl;
  }
  rep (i, k) {
    if (a - b + 2 * k < i + 2) cout << b - k + i + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3600
s = list(input())
N = len(s)

if s[0] == s[N-1]:
    flag1 = True
else:
    flag1 = False
if N%2 == 0:
    flag2 = True
else:
    flag2 = False

if (flag1 != flag2):
    print ('Second')
else:
    print ('First')

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


int main() {
	string s;
	cin >> s;
	int a = 200001;
	int z = 0;
	rep(i, s.length()) {
		if (s[i] == 'A' && a > i) {
			a = i;
		}
		if (s[i] == 'Z' && z < i) {
			z = i;
		}
	}
	cout << z - a + 1<< endl;
	return 0;

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,m,ans;
int main(){
	n=read();m=read();
	if(m>=n)puts("unsafe");
	else puts("safe");
}

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

int main(){
  int n,t,a,h,p;
  double min=100000000000;
  double x;
  cin >> n;
  cin >> t >> a;
  
  for(int i=0;i<n;i++){
    cin >> h;
    x=t-h*0.006;
    if(min > abs(a-x)){min=abs(a-x);p=i+1;}
  }
  cout << p;
  return 0;
}

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

int main(){
  int64_t A, B, C;
  cin >> A >> B >> C;
  if(A%2+B%2+C%2<3){
    cout << 0 << endl;
  }
  else{
    cout << min(A*B, min(B*C, C*A)) << endl;
  }
}

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    int scr[100000];
    rep(i, n) scr[i] = k-q;

    rep(i, q) {
        int a;
        cin >> a;
        scr[a-1]++;
    }

    rep(i, n) {
        if (scr[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int dist(int x1,int y1,int x2,int y2){
  // マンハッタン距離？を返す
  return abs(x1-x2) + abs(y1-y2);
}

int check(int i,int j,vector<int> &X,vector<int> &Y,vector<int> &H,int N){
  // 座標(j,i)について、全ての条件を満たすようなピラミッドの高さがあるかをチェック
  int res = 0;
  int buf = INT_MAX;
  rep(qq,N){
    int x = X[qq], y = Y[qq], h = H[qq];
    // (x,y)の高さがhである
    if (h > 0){
      // 高さがhであれば(j,i)からの距離を足せばそのまま(j,i)の高さになる
      if (res == 0) res = h + dist(j,i,x,y);
      if (res != h + dist(j,i,x,y)) return 0;
    }else{
      // 高さが0であれば(j,i)からの距離(を足したもの)が高さの最大値になる(それより大きくなることはない)
      chmin(buf, dist(j,i,x,y));
      if (res > buf) return 0;
    }
  }
  return res;
}

int main() {
  int N; cin >>N;
  vector<int> x(N),y(N),h(N);
  rep(i, N) cin >>x[i] >>y[i] >>h[i];
  for (int i=0; i<=100; i++){
    for (int j=0; j<=100; j++){
      // 各々の座標(j,i)とかについて条件が合っているかをチェック
      // 全ての条件を満たしていればそれが答え
      int height = check(i,j,x,y,h,N);
      if (height){
        cout <<j <<" " <<i <<" " <<height <<endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
string str;
int R, S, P; //gu choki pa

int dp[2][3];

ll pre(string& s) {
	int m = sz(s);
	memset(dp, 0, sizeof(dp));
	int now = 0, nex = 1;

	rep(i, 0, m) {
		rep(j, 0, 3) {
			rep(k, 0, 3) {
				if(j == k) continue;
				int cost = k == 0 && s[i] == 's' ? R
						: k == 1 && s[i] == 'p' ? S
						: k == 2 && s[i] == 'r' ? P
						: 0;
				// debug(i, j, k, s[i], cost);
				MAX(dp[nex][k], dp[now][j] + cost);
			}
		}
		swap(nex, now);
	}
	return max(dp[now][2], max(dp[now][0], dp[now][1]));
}

void solve() {
	cin >> N >> K;
	cin >> R >> S >> P;
	cin >> str;
	ll ans = 0;
	rep(i, 0, K) {
		string s;
		for(int j = i; j < N; j += K) {
			s += str[j];
		}
		ans += pre(s);
	}
	cout << ans << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fr(a,b) for(int i=a;i<b;i++)
#define frn(a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define vpi vector<pair<int,int>>
void fast(){ 
ios_base::sync_with_stdio(false); cin.tie(NULL); 
#ifndef ONLINE_JUDGE 
	freopen("input.txt","r",stdin); 
	freopen("output.txt","w",stdout); 
#endif
}
#define test int t;cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define pu push

int32_t main(){
	fast();
	int n,m,x;
	cin>>n>>m>>x;
	int a[n+2][m+2];
	fr(0,n)for(int j = 0;j<=m;j++) cin>>a[i][j];
	int ar[m+1] = {0};
	
	int ans = 10000000000000000;
	fr(1,(1<<(n+1))){
		int c = 0;
		fr(0,m) ar[i] = 0;
		for(int j = 0;j<n;j++){
			if(i & (1<<j)){
				c+=a[j][0];
				for(int k=1;k<=m;k++) ar[k-1]+=a[j][k];
			}
		}
		int d = 0;
		for(int j=0;j<m;j++){
			if(ar[j]<x) d=1;
		}
		if(d == 0){
			ans = min(ans,c);
		}
	}
	if(ans !=10000000000000000) cout<<ans;
	else cout<<"-1";
}

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

#define ii pair<int,int> 
#define iii pair<int,ii> 

const int MAXN = 2e5 + 5;
const int INF = 1e9 + 5;

int n, q, s[MAXN], t[MAXN], x[MAXN], d[MAXN];
vector<iii> event;
set<int> block;
int ans[MAXN];

int main(){
	scanf("%d %d", &n, &q);
	for(int i = 0; i < n; ++i){
		scanf("%d %d %d", &s[i], &t[i], &x[i]);
		int interL = s[i]-x[i], interR = t[i]-x[i];
		// Pass as query
		event.push_back(iii(interL, ii(-x[i], 0))); // Add ban
		event.push_back(iii(interR-1, ii(x[i], 0))); // Lift ban
	}
	for(int i = 0; i < q; ++i){
		scanf("%d", &d[i]);
		event.push_back(iii(d[i], ii(0, i)));
	}
	sort(event.begin(), event.end());
	for(iii i : event){
		if(i.second.first == 0){
			// Find nearest roadblock
			int idx = i.second.second;
			if(block.empty()){
				ans[idx] = -1;
			}else
				ans[idx] = *block.begin();
		}else{
			if(i.second.first < 0){
				// Add ban
				block.insert(-i.second.first);
			}else{
				block.erase(i.second.first);
			}
		}
	}
	for(int i = 0; i < q; ++i){
		printf("%d\n", ans[i]);
	}
}

Measured memory_bytes: 22632
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<int> H(N);
  for (int i = 0; i < N; i++)
  {
    cin >> H[i];
  }
  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    bool can = true;
    for (int nv : G[i])
    {
      if (H[i] <= H[nv])
      {
        can = false;
      }
    }
    if (can)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8692
#include <cstring>
#include <bits/stdc++.h>
using namespace std;
int main(){
int W,H,N;
cin>>W>>H>>N;
int vec[W][H]={};
int a,b,c;
for(int i=0; i<N;i++){
cin>>a>>b>>c;
if(c==1){
for(int j=0;j<a;j++){
for(int k=0;k<H;k++){
vec[j][k]=1;}}}
if(c==2){
for(int j=a;j<W;j++){
for(int k=0;k<H;k++){
vec[j][k]=1;}}}
if(c==3){
for(int j=0;j<W;j++){
for(int k=0;k<b;k++){
vec[j][k]=1;}}}
if(c==4){
for(int j=0;j<W;j++){
for(int k=b;k<H;k++){
vec[j][k]=1;}}}
}
int counter=0;
for(int j=0;j<W;j++){
for(int k=0;k<H;k++){
if(vec[j][k]==0)
counter++;}}
cout<<counter<<endl;}



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

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

	vector<ll>a;
	for (ll i = 1;i*i <= n;i++) {
		if (n%i == 0) {
			a.push_back(i);
		}
	}
	ll ans = 100;
	for (ll i = 0;i < a.size();i++) {
		ll m = max(a[i], n / a[i]);
		ll count = 0;
		while (m != 0) {
			m /= 10;
			count++;
		}
		ans = min(ans, count);
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
#define rll register ll 
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	// no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} 
using io :: gi;
using io :: putc;
using io :: print;
const int N=1e5+5;
int ax[N];
ll ap[N];
int main(){
	ri n,s,i,l,r,last;
	rll ans;
	gi(n);gi(s);
	for(i=1;i<=n;++i) gi(ax[i]),gi(ap[i]);
	l=1;r=n;
	ans=0;last=-1;
	while(ax[l]<s&&s<ax[r]){
		if(ap[l]>=ap[r]){
			if(last!=1) ans+=ax[r]-ax[l];
			ap[l]+=ap[r];
			--r;
			last=1;
		}
		else{
			if(last!=0) ans+=ax[r]-ax[l];
			ap[r]+=ap[l];
			++l;
			last=0;
		}
	}
	if(s<=ax[l])
		ans+=ax[r]-s;
	else
		ans+=s-ax[l];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> ll size(const T &x) { return x.size(); }
#define rep(i,a,b) for(ll i = (a); i < (b); ++i)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
#define MOD 1000000007
#define pb push_back
#define fs first
#define sc second
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int INF = 2147493647;
const double pi = acos(-1);
const double EPS = 1e-9;

int main()
{
    int m, d;
    cin >> m >> d;
    int cnt = 0;
    rep(i,1,m+1){
        rep(x,1,d+1){
            int f = x % 10;
            int s = x / 10;
            if(s >= 2 && f >= 2) if(f*s == i) cnt++;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;

vector<int> a;

int cnt(int k){
    auto it1 = lower_bound(a.begin(), a.end(), k);
    auto it2 = upper_bound(a.begin(), a.end(), k);

    return (int)(it2 - it1);
}

int main() {
    int n;
    cin >> n;
    a = vector<int>(n, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    int ans = 0;
    for(int x = 0; x < 1e5; ++x){
        int cnt1 = cnt(x - 1);
        int cnt2 = cnt(x);
        int cnt3 = cnt(x + 1);
        ans = max(ans, cnt1 + cnt2 + cnt3);
    }

    cout << ans << endl;
}

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

int eulerPhi(int n) {
	int m = n;
	int p = 2;
	int pi = n;
	do
	{
		if (n % p == 0) {
			while (n % p == 0)
			{
				n /= p;
			}
			pi -= pi / p;
		}
		p++;
	} while ((n > 1) || (p * p <= m));
	if (n > 1) {
		pi -= pi / n;
	}
	return pi;
}

int main()
{
	int n;
	cin >> n;
	cout << eulerPhi(n) << endl;
	return 0;
}


Measured memory_bytes: 3120
import sys

def main():
    input = sys.stdin.readline
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k * d)
    else:
        tmp = abs(x) - d * (abs(x) // d)
        if (k - abs(x) // d) % 2 == 0:
            print(tmp)
        else:
            print(abs(tmp - d))


if __name__ == '__main__':
    main()

Measured memory_bytes: 61724
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stack>
#include <queue>

using namespace std;
#define Fill(a, b) memset(a, b, sizeof(a))
#define Debug(x) cout << #x << "=" << (x) << endl;
typedef long long LL;
const LL inf = 1LL << 61;
const LL mod = 1000000007;
#define DEBUG
#ifdef DEBUG
#endif
const int maxn = 1e5+10;


int a[maxn], b[maxn];
int main()
{
    std::ios::sync_with_stdio(false);
    int n, k;
    scanf("%d%d", &n, &k);
    for(int i = 0; i < n; i++)
    {
    	scanf("%d%d", &a[i], &b[i]);
    }
    LL ans = 0;
    for(int i = 0; i < n; i++)
    {
    	if((a[i]|k)>k)continue;
    	ans += b[i];
    }
    for(int bit = 30; bit >= 0; bit--)
    {
    	if(k&(1<<bit))
    	{
    		int newk = (k-(1<<bit))|((1<<bit)-1);
    		//Debug(newk);
    		LL tans = 0;
    		for(int i = 0; i < n; i++)
    		{
    			if((a[i]|newk)>newk)continue;
    			tans += b[i];
    		}
    		ans = max(ans, tans);
    	}
    }
    printf("%lld\n", ans);























    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;

int main(){

  char b;
  cin >>b;
  char c;
  if(b=='A')c='T';
  if(b=='T')c='A';
  if(b=='C')c='G';
  if(b=='G')c='C';
  cout << c << endl;


}

Measured memory_bytes: 3520
// 問題URL
//

import java.util.*;
import java.lang.*;
import java.util.stream.*;


public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String[] a = scanner.nextLine().split(" ");
        String[] b = scanner.nextLine().split(" ");
        String[] c = scanner.nextLine().split(" ");
        int[] bingo = new int[Integer.parseInt(scanner.next())];

        for(int i =0; i < bingo.length; i++) {
            bingo[i] = Integer.parseInt(scanner.next());
        }

        //System.out.println(bingo.length);
        int[] ia = Stream.of(a).mapToInt(Integer::parseInt).toArray();
        int[] ib = Stream.of(b).mapToInt(Integer::parseInt).toArray();
        int[] ic = Stream.of(c).mapToInt(Integer::parseInt).toArray();


        int array[][] =  {
               ia,
               ib,
               ic
        };


        for(int i =0; i < array.length; i++) {
            for (int j =0; j < array.length; j++) {
                for(int k =0; k < bingo.length; k++) {
                    if (array[i][j] == bingo[k]) {
                        array[i][j] = -1;
                    }
                }
            }
        }
        if(
                (array[0][0] < 0 && array[0][1] < 0 && array[0][2] < 0) ||
                (array[0][0] < 0 && array[1][0] < 0 && array[2][0] < 0) ||
                (array[0][0] < 0 && array[1][1] < 0 && array[2][2] < 0) ||
                (array[0][1] < 0 && array[1][1] < 0 && array[2][1] < 0) ||
                (array[0][2] < 0 && array[1][2] < 0 && array[2][2] < 0) ||
                (array[1][0] < 0 && array[1][1] < 0 && array[1][2] < 0) ||
                (array[2][0] < 0 && array[2][1] < 0 && array[2][2] < 0) ||
                (array[2][0] < 0 && array[1][1] < 0 && array[0][2] < 0)
        ){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        //System.out.println(Arrays.toString(array[0]));
        //System.out.println(Arrays.toString(array[1]));
        //System.out.println(Arrays.toString(array[2]));
    }
}

Measured memory_bytes: 28884
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int N,A[200001],B[200001];
int Bnum[200001]={},num[200001]={},nokori[200001]={};
int ans[200001];
int main(){
	priority_queue<pint> Q;
	scan(N);
	rep(i,N){
		scan(A[i]);
		num[A[i]]++;
	}
	rep(i,N){
		scan(B[i]);
		num[B[i]]++;
		Bnum[B[i]]++;
	}
	rep1(i,200000){
		if(Bnum[i]) Q.push(mp(num[i],i));
	}
	int nummax=0;
	rep1(i,200000){
		nummax=max(nummax,num[i]);
	}
	if(nummax>N){
		prin("No");
		return 0;
	}
	rep(i,N){
		pint t=Q.top();
		Q.pop();
		debug(i,A[i],t.first,t.second,nokori[t.second]);
		if(nokori[t.second]>0){
			t.first-=nokori[t.second];
			nokori[t.second]=0;
			Q.push(t);
			i--;
			continue;
		}
		if(t.second!=A[i]){
			ans[i]=t.second;
			t.first--;
			nokori[A[i]]++;
			Bnum[t.second]--;
			if(Bnum[t.second]>0) Q.push(t);
		}
		else{
			if(Q.empty()){
				prin("No");
				return 0;
			}
			pint t2=Q.top();
			debug(i,A[i],t2.first,t2.second,nokori[t2.second]);
			Q.pop();
			if(nokori[t2.second]>0){
				t2.first-=nokori[t2.second];
				nokori[t2.second]=0;
				Q.push(t2);
				Q.push(t);
				i--;
				continue;
			}
			ans[i]=t2.second;
			t2.first--;
			nokori[A[i]]++;
			Bnum[t2.second]--;
			if(Bnum[t2.second]>0) Q.push(t2);
			Q.push(t);
		}
	}
	prin("Yes");
	rep(i,N){
		printf("%d ",ans[i]);
	}
	kaigyo;
	return 0;
}


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

using namespace std;
void dfs(const string& str, char ch, const int& n) {
  //cout << str << endl;
  if (str.length() == n) {
    cout << str << '\n';
    return;
  }
  for (char c = 'a'; c <= ch; ++c)
    dfs(str + c, (c == ch ? (char)(ch + 1) : ch), n);
}
int main() {
  int n;
  cin >> n;
  string str;
  dfs(str, 'a', n);
  return 0;
}

Measured memory_bytes: 1536
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,x;
    cin>>n>>x;
    int sum=0,mini=INT_MAX;
    forn(i,n){
        int x;
        cin>>x;
        sum += x;
        mini = min(mini,x);
    }
    cout<<(n+(x-sum)/mini)<<endl;
    return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[2]={1,0},dy[2]={0,1};

bool check(int n,int m,int x,int y) {
  if(x<0 || x>=n) return false;
  if(y<0 || y>=m) return false;
  return true;
}

int main() {
  int n,m;
  cin >> n >> m;
  int a[n][m];
  rep(i,n) {
    string s;
    cin >> s;
    rep(j,m) a[i][j]=(int)s[j]-'0';
  }
  queue<P> que;
  que.push(P(0,0));
  int d[n][m];
  fill(d[0],d[n],MAX);
  d[0][0]=0;
  while(!que.empty()) {
    P p=que.front();
    que.pop();
    int nx=p.F,ny=p.S;
    rep(i,2) {
      int x=nx+dx[i],y=ny+dy[i];
      if(check(n,m,x,y)) {
	int z=d[nx][ny]+a[x][y];
	if(z<d[x][y]) {
	  que.push(P(x,y));
	  d[x][y]=z;
	}
      }
    }
  }
  pr(d[n-1][m-1]);
  return 0;
}


Measured memory_bytes: 1248
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#define ll long long
#define ld long double
using namespace std;
int read(){int x;scanf("%d",&x);return x;}
int maxn,minn;
const int MAXN=100005;
int a[MAXN],b[MAXN];
int main(){
	int n=read(),m=read();
	if(n>m) n=m;
	minn=1e9+7,maxn=-1e9;
	for(int i=1;i<=m;i++) a[i]=read(),minn=min(minn,a[i]),maxn=max(maxn,a[i]);
	sort(a+1,a+m+1);
	for(int i=1;i<m;i++) b[i]=a[i+1]-a[i];
	sort(b+1,b+m);
	int ans=maxn-minn;
	for(int i=1;i<n;i++) ans-=b[m-i];
	printf("%d\n",ans); 
	return 0;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
for g in ab:
    dis = 10**9
    point = 0
    for c in range(m):
        d = abs(g[0]-cd[c][0]) + abs(g[1]-cd[c][1])
        if(dis > d):
            dis = d
            point = c + 1
    print(point)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
int a[200010]={0};
int main()
{
	int n,i,t;
	cin>>n;
	for(i=1;i<n;i++)
	{
		scanf("%d",&t);
		a[t]++;
	}
	for(i=1;i<=n;i++)
	{
		printf("%d\n",a[i]);
	}
	return 0;
}

Measured memory_bytes: 4536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int X = sc.nextInt();
		if (A <= X && (A + B) >= X)
			System.out.println("YES");
		else
			System.out.println("NO");
		sc.close();
	}
}

Measured memory_bytes: 23632
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    int n,m;
    cin>>n>>m;
    vector<int>v[n+1];
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=1;i<n+1;i++)
    cout<<v[i].size()<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


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

int main() {
  int N; 
  string S;
  int P = 0;
  int W = 0;
  int G = 0;
  int Y = 0;
  cin >> N;

  // ここにプログラムを追記

  for (int i = 0 ; i < N ; i++) {
    cin >> S;
    if (S == "P") {
      P++;
    } else if (S == "W") {
      W++;
    } 
    if (S == "G") {
      G++;
    } 
    if (S == "Y") {
      Y++;
    } 
  }

  if ( P == 0 || W == 0 || G == 0 || Y == 0) {
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }

}



Measured memory_bytes: 3576
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int C[30];

int main(){
  string S;
  cin>>S;
  for(int i=0;i<(int)S.size();i++){
    if(C[S[i]-'a']!=0){
      cout<<"no"<<endl;
      return 0;
    }
    C[S[i]-'a']++;
  }
  cout<<"yes"<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int L = sc.nextInt();
    List<String> a = new ArrayList<>();
    // String a[] = new String[N];
    for(int i=0; i<N ;i++){
        a.add(sc.next());
        // a[i] = sc.next();
    }
    Collections.sort(a);
    String sum = "";
    for(String s : a){
        sum = sum.concat(s);
    }
        System.out.println(sum); 

    }    
}

Measured memory_bytes: 24276
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int n;
    cin >> n;
    cout << n / 3 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

void _main() {
  int A, B, C;
  cin >> A >> B >> C;

  if (A==B && B==C) {
    cout << "0" << "\n";
    return;
  }

  int ans = 0;
  if (A%2==B%2 && A%2!=C%2) {
    A++, B++, ans++;
  } else if (A%2==C%2 && A%2!=B%2) {
    A++, C++, ans++;
  } else if (B%2==C%2 && B%2!=A%2) {
    B++, C++, ans++;
  }

  int MAX = max({A, B, C});
  ans += (MAX-A) / 2;
  ans += (MAX-B) / 2;
  ans += (MAX-C) / 2;

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////

ll dp[10005] = {};

int main(){
    int n,h;
    cin >> h >> n;

     rep(i,1,h+1){
	 dp[i] = linf;
     }

     rep(i,0,n){
	 int a,b;
	 cin >> a >> b;
	 rep(j,0,h){
	     if(dp[j] == linf)continue;
	     
	     if( j + a <= h){
		 dp[j + a] = min(dp[j + a] , dp[j]  + b);
	     }else{
		  dp[h] = min(dp[h],dp[j] + b);
	     }
	 }

	 // rep(j,0,h+1)PS(dp[j]);
	 //PN;
     }
   
     P(dp[h]);
    return  0;
}


Measured memory_bytes: 384
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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 pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h, w, n;
    cin >> h >> w>>n;
    VP vec(n);
    rep(i, n)
    {
        ll x,y;
        cin>>y>>x;
        x--;y--;
        vec[i].F=x;
        vec[i].S=y;
    }
    sort(all(vec));
    ll dx[] = {-1, -1, -1, 0, 1, 1, 1, 0,0};
    ll dy[] = {-1, 0, 1, 1, 1, 0, -1, -1,0};
    V res(10);
    rep(i, n)
    {
        rep(j, 9)
        {
            int cnt = 0;
            ll x = vec[i].F + dx[j];
            ll y = vec[i].S + dy[j];
            if(!(x<w-1&&x>=1&&y<h-1&&y>=1)){
                continue;
            }
            rep(k, 9)
            {
                P temp={x+dx[k],y+dy[k]};
                if (binary_search(all(vec), temp))
                {
                    cnt++;
                }
            }
            res[cnt]++;
          //  cout<<vec[i].F<<" "<<vec[i].S<<" "<<dx[j]<<" "<<dy[j]<<" "<<cnt<<endl;
        }
        
    }
    ll sum=(h-2)*(w-2);
    rep3(i,1,10){
        sum-=res[i]/i;
    }
    cout<<sum<<endl;
    rep3(i,1,10){
        cout<<res[i]/i<<endl;
    }
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

signed main(){
    int n;cin>>n;
    int a[3*n];
    REP(i,3*n)cin>>a[i];
    vector<int> plus(3*n,0);
    priority_queue<int,vector<int>,greater<int>>pq;
    vector<int> minus(3*n,0);
    priority_queue<int>mq;
    for(int i=0;i<n;i++){
        plus[n-1]+=a[i];
        pq.push(a[i]);
    }
    for(int i=2*n;i<3*n;i++){
        minus[2*n]+=a[i];
        mq.push(a[i]);
    }
    for(int i=n;i<2*n;i++){
        pq.push(a[i]);
        plus[i]=plus[i-1]+a[i]-pq.top();
        pq.pop();
    }   
    for(int i=2*n-1;i>=n;i--){
        mq.push(a[i]);
        minus[i]=minus[i+1]+a[i]-mq.top();
        mq.pop();
    }
    int ans=-INF;
    for(int i=n-1;i<2*n;i++) chmax(ans,plus[i]-minus[i+1]);
    cout<<ans<<endl;
}

Measured memory_bytes: 9588
N,M=(int(x) for x in input().split())
if not 0 <= N <= 100:
    print('N is not appropreate')
elif not 0 <= M <= 100:
    print('M is not appropreate')
elif N+M < 2:
    print('num of ball is too small')
else:
    print(int((N*(N-1)+M*(M-1))/2))

Measured memory_bytes: 3060