akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
struct edge{
    int from, to;
    string s;
};
int n, a, s, g;
int main() {
    while(cin >> n >> a >> s >> g, n){
        vector<edge> E;
        rep(i, a){
            int from, to;
            string str;
            cin >> from >> to >> str;
            E.pb((edge){from, to, str});
        }
        vector<string> dp(n);
        vector<bool> done(n);
        bool end = false;
        done[g] = true;
        while(!end){
            end = true;
            rep(i, a){
                int from = E[i].from;
                int to = E[i].to;
                string str = E[i].s;
                if((dp[from] > str + dp[to] || !done[from]) && done[to] && dp[from].size() < 260){
                    end = false;
                    done[from] = true;
                    dp[from] = str + dp[to];
                }
            }
        }
        if(dp[s].size() < 250 && dp[s].size() > 0) cout << dp[s] << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1260
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, D: "List[int]"):    
    D = list(map(str,D))
    while True:
        for d in D:
            if d in str(N):
                N += 1
                break
        else:
            print(N)
            break

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(K)]  # type: "List[int]"
    solve(N, K, D)

if __name__ == '__main__':
    main()


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    string S;
    cin >> S;
    int a, b;
    a = b = 0;
    REP(i,S.size()){
        if(S[i] == '1') a++;
        else b++;
    }
    cout << 2 * min(a,b) << endl;
}

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

int main()
{
	long long n;
	cin>>n;
	vector<long long>v;
	v.push_back(n);
	long long cnt=1;
	while(1){
		if(n&1){
			if(find(v.begin(),v.end(),3*n+1)!=v.end())break;
			cnt++;
			v.push_back(3*n+1);
			n=3*n+1;
		}
		else {
			if(find(v.begin(),v.end(),n/2)!=v.end())break;
			cnt++;
			v.push_back(n/2);
			n/=2;
		}
	}
	cout<<cnt+1<<"\n";
	return 0;
}


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

int main()
{
	int S;
	int h,m,s;
	int a;
	
	cin>>S;
	
	h=S/3600;
	a=S%3600;
	m=a/60;
	s=a%60;
	
	cout<<h<<':'<<m<<':'<<s<<endl;
	return 0;
	
}

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

using namespace std;
using ll = long long;

int main() {
  int n,k;
  cin >> n >> k;
  vector<ll> h(n);

  rep(i,n) cin >> h[i];

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

  ll ans = 0;

  for (int i = 0; i < n-k; i++) {
    ans += h[i];
  }

  cout << ans << endl;

}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e5+3;
const int INF = 1e9;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    //int ntest; cin >> ntest; while(ntest--)
    {
        int a,b,c,k;
        cin >> a >> b >> c >> k;
        int ans = 0;
        ans += min(a,k);
        k -= min(a,k);
        k -= min(b,k);
        ans -= min(c,k);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

class DoublingVal {
public:
  int N;
  int logK;
  vector<vector<pair<int, ll>>> next;

  DoublingVal(int N, vector<int>& ini, vector<ll>& A, ll K) {
    logK = log2(K);
    next = vector<vector<pair<int, ll>>>(logK+1, vector<pair<int, ll>>(N));
    rep(i, N) {
      next[0][i].first = ini[i];
      next[0][i].second = A[i];
    }
    rep(k, logK) {
      rep(i, N) {
        next[k+1][i].first = next[k][next[k][i].first].first;
        next[k+1][i].second = next[k][i].second + next[k][next[k][i].first].second;
      }
    }
  }

  pair<int, ll> query(int p, ll q) {
    ll sum = 0;
    for(int k=logK; k>=0; k--) {
      if(p == -1) break;
      if((q>>k)&1) {
        sum += next[k][p].second;
        p = next[k][p].first;
      }
    }
    return make_pair(p, sum);
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, x, m; cin >> n >> x >> m;
  vector<int> to(m);
  vector<ll> val(m);
  rep(i, m) {
    to[i] = 1LL*i*i%m;
    val[i] = i;
  }
  DoublingVal dbl(m, to, val, n);
  cout << dbl.query(x, n).second << endk;
  return 0;
}


Measured memory_bytes: 59360
n = 1_000_000

is_prime = [false]*2 + [true]*(n-2)

max_n = Math.sqrt(n).floor + 1
2.upto(max_n) do |i|
  next unless is_prime[i]
  (i*i).step(by: i, to: n) do |j|
    is_prime[j] = false
  end
end

prime_count = []
count = 0
1.upto(n) do |i|
  count += 1 if is_prime[i]
  prime_count[i] = count
end

while n = gets.to_i
  break if n == 0
  puts prime_count[n]
end

Measured memory_bytes: 32140
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict
def main():
    A=input()
    len_a=len(A)
    dp=[0]*len_a
    dp[0]=1
    dd=defaultdict(int)
    dd[A[0]]+=1
    for i in range(1,len_a):
        a=A[i]
        dp[i]=i-dd[a]
        dd[a]+=1
    print(sum(dp))

if __name__=='__main__':
    main()

Measured memory_bytes: 42608
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------

ll permMod(int x) {
  ll res = 1;
  rep1(i, x+1) {
    res = (res * i) % MOD;
  }
  return res;
}

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

  if(abs(n - m) > 1) cout << 0 << endl;
  else if(abs(n - m) == 1) cout << (permMod(n) * permMod(m)) % MOD << endl;
  else cout << (2 * permMod(n) * permMod(m)) % MOD << endl;

  return 0;
}

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

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    ll W, H;
    cin >> W >> H;
    if (H > W)swap(H, W);
    if (W == 1 && H == 1)
        cout << 1 << endl;
     else if (H == 1)
        cout << W - 2 << endl;
    else
        cout << (W - 2)*(H - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

vector<ll> B;

int main(){
    int N;
    ll tmp, tmp2, tmp3;
    ll sum=0;

    cin >> N;
    B.resize(N-1);
    rep(i,N-1) cin >> B[i];
    tmp2 = B.back();
    sum += tmp2;
    B.pop_back();
    for(int i=0; i<N-2; i++){
        tmp = B.back();
        B.pop_back();
        if(tmp < tmp2){
            sum += tmp;
        }else{
            sum += tmp2;
        }
        tmp2 = tmp;
        //cout << sum <<endl;
    }
    sum += tmp2;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long n,a[100005],ans1=0,ans2=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(a[i]==a[i+1]){
			ans1=ans2;
			ans2=a[i];
			i++;
		}
	}
	if(ans1==0){
		cout<<"0"<<endl;
	}
	else{
		cout<<ans1*ans2<<endl;
	}
  return(0);
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
	int N,a,b;
	cin >> N >> a >> b;

	int sum = 0;
	int digit = 0;
	int c = 0;
	{
		int n = N;
		while (1) {
			digit++;
			if (n < 10) { c = n; break;  }
			n /= 10;
		}
	}

	int *D = new int[digit];
	int Dsum = 0;
	for (int i = 0; i < digit; i++) {
		D[i] = 0;
	}
	for (int i = 1; i <= N; i++) {
		D[0]++;
		Dsum++;
		for (int k = 0; k < digit; k++) {
			if (D[k] == 10) {//加算
				D[k] = 0; D[k + 1]++;
				Dsum-=9;
			}
			else {
				break;
			}
		}
		if (a <= Dsum && Dsum <= b) {
			sum+=i;
		}
		if (D[digit - 1] == c && i % 10 == D[0]) {
			int n = N;
			bool flag = true;
			for (int k = 0; k < digit; k++) {
				if (D[k] != n % 10) {
					flag = false;
					break;
				}
				n /= 10;
			}
			if (flag) { break; }
		}
	}

	cout << sum << endl;

	delete[] D;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, D;

int main() {
	cin >> N >> D;
	D = D * 2 + 1;
	cout << (N - 1) / D + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define AUTO(e,v) for(auto e:v)
#define EACH(i,v) for(auto i=v.begin();i!=v.end();++i)
#define REACH(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define LB(c,x) distance((c).begin(),lower_bound(ALL(c),x))
#define UB(c,x) distance((c).begin(),upper_bound(ALL(c),x))
#define COUNT(c,x) (lower_bound(ALL(c),x)-upper_bound(ALL(c),x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DEL(v) decltype(v)().swap(v)
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;
#define NL cerr<<endl;
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T sum(vector<T>&v){return accumulate(ALL(v),T());}
template<typename T>T sum(vector<T>&v,int a,int b){return accumulate(v.begin()+a,v.begin()+b,T());}
template<typename T>T max(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T min(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T max_index(vector<T>&v){return distance((v).begin(),max_element(ALL(v)));}
template<typename T>T min_index(vector<T>&v){return distance((v).begin(),min_element(ALL(v)));}

struct edge { int to, cost; };

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}

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

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

   int ans = (A + B) % 24;
   cout << ans << endl;

   return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    string s;
    cin >> s;
    // cout << s.length() / 2 << " " << s.length() << endl;
    string s1 = s.substr(0, s.length() / 2);
    string s2 = s.substr(s.length() / 2 + 1, s.length() / 2);

    bool flag = true;

    rep(i, s.length()/2) {
        if (s[i] != s[s.length() - 1 - i]) flag = false;
    }

    rep(i, s1.length()/2) {
        if (s1[i] != s1[s1.length() - 1 - i]) flag = false;
    }

    rep(i, s2.length() / 2) {
        if (s2[i] != s2[s2.length() - 1 - i]) flag = false;
    }

    cout << (flag ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#define speed  ios_base::sync_with_stdio(0);cin.tie(0) ; cout.tie(0);   
#define ll long long
#define pb push_back
#define endl "\n"
#define ff first
#define ss second
#define mod 1000000007
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef map<ll, ll> mpll;
typedef map<vector<ll>, ll> mpvl;
int main()
{
  speed;
  ll t;
 

 t=1;
  while(t--)
  {  
    ll a,b,c,k;

      cin>>a>>b>>c>>k;
     
      if((a==0)&&(b==0)&&(c==0))
      {
        cout<<0<<endl;
        return 0;
      }
      if((a+b)>=k)
      {
        cout<<min(a,k)<<endl;
      }
      else 
      {
        ll diff =k-(a+b);
        cout<<a-diff<<endl;
      }
      

    
  }
}

Measured memory_bytes: 3692
#include<iostream>
using namespace std;
int a[1000003];
int main(){
int n,c=0;
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;;i++){
bool d=1;
for(int j=1;j<=n;j++)
if(a[j]%2!=0){
d=0;
break;}
if(!d) break;
if(d){
c++;
for(int j=1;j<=n;j++)
a[j]/=2;}
}
cout<<c;}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    int a[44];
    int n, i;
    a[0] = 1;
    a[1] = 1;
     
    scanf("%d", &n);
     
    for (i = 2; i <= n; i++){
        a[i] = a[i - 2] + a[i - 1];
    }
     
    printf("%d\n", a[n]);
    
    return (0);
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int arr[102]={0};
 int x;
 int sp,n;
 cin>>sp>>n;
 for(int i=0;i<n;i++)
 {
   cin>>x;
   arr[x]++;
 }
 int ans1,ans2;
 for(int i=sp;i>=0;i--)
 {
     if(arr[i]==0)
      { ans1=i;
       break; 
      }
    
 }
 for(int i=sp+1;i<=101;i++)
 {
   if(arr[i]==0)
    {
      ans2=i;
      break;
    }
 }
 cout<<(abs(sp-ans1)<=abs(sp-ans2)?ans1:ans2);


}

Measured memory_bytes: 3612
#include <iostream>  
#include <cstdio>  
#include <cstring>  
#include <algorithm>  
#include <cmath>  
#include <string>  
#include <map>  
#include <stack>  
#include <vector>  
#include <set>  
#include <queue>  
#pragma comment (linker,"/STACK:102400000,102400000")  
#define maxn 10000+10  
#define MAXN 2005  
#define mod 1000000009  
#define INF 0x3f3f3f3f  
#define pi acos(-1.0)  
#define eps 1e-6  
#define lson rt<<1,l,mid  
#define rson rt<<1|1,mid+1,r  
typedef long long ll;  
using namespace std;  
  
struct Edge  
{  
    int u,v;  
    double dis;  
}edge[maxn*maxn/2];  
  
int N,M;  
int father[maxn];  
double x[maxn],y[maxn];  
  
int cmp(Edge x,Edge y)  
{  
    return x.dis>y.dis;  
}  
  
void init(int n)  
{  
    for (int i=1;i<=n;i++)  
        father[i]=i;  
}  
  
int find_father(int x)  
{  
    if (x!=father[x])  
        father[x]=find_father(father[x]);  
    return father[x];  
}  
  
double Kruskal()  
{  
    double s=0;  
    for (int i=0;i<M;i++)  
    {  
        int fu=find_father(edge[i].u);  
        int fv=find_father(edge[i].v);  
        if (fu!=fv)  
        {  
            father[fu]=fv;  
            s+=edge[i].dis;     //不需要破?的?的?度之和  
        }  
    }  
    return s;  
}  
  
int main()  
{  
    while (~scanf("%d%d",&N,&M))  
    {  
        init(N);  
        for (int i=1;i<=N;i++)  
            scanf("%lf%lf",&x[i],&y[i]);  
        int u,v;  
        double sum=0.0;  
        for (int i=0;i<M;i++)  
        {  
            scanf("%d%d",&u,&v);  
            edge[i].u=u;  
            edge[i].v=v;  
            edge[i].dis=sqrt( (x[u]-x[v])*(x[u]-x[v])+(y[u]-y[v])*(y[u]-y[v]) );  
            sum+=edge[i].dis;       //sum存下所有?的?度之和  
        }  
        sort(edge,edge+M,cmp);  
        printf("%.3f\n",sum-Kruskal());  
    }  
    return 0;  
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], b = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] % 2) b++;
}
cout << (b % 2 ? "NO\n" : "YES\n" );
return 0;
}

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

cookbook = [0] * N

for n in range(N):
    line = input().split()
    s = line[0]
    p = int(line[1])
    cookbook[n] = (n + 1, s, p)

l = sorted(cookbook, key = lambda x: (x[1], -x[2]))
for item in l:
    print(item[0])

Measured memory_bytes: 3060
use std::collections::HashSet;

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    let l1 = s.len();
    let hs = s.into_iter().collect::<HashSet<_>>();
    let l2 = hs.len();
    yn(l1 == l2);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("yes");
    } else {
        println!("no");
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		if((A+B)%2 != 0)System.out.println("IMPOSSIBLE");
		else {
			long AB = (A+B)/2;
			System.out.println(Math.abs(AB));
		}
	}
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define ran 100001
bool f[ran];int p[ran],s[ran];int lp;
int main(){
	f[0] = f[1] = true;
	for(int i=2; i<ran; i++){
		if(!f[i]){
			p[lp++] = i;
		}
		for(int j=0; j<lp; j++){
			int x = i*p[j];
			if(x>=ran)break;
			f[x] = true;
			if(i%p[j]==0)break;
		}
	}
	for(int i=3; i<ran; i++){
		s[i] = s[i-1];
		if(!f[i] && !f[(i+1)/2]){
			s[i]++;
		}
	}
	int q;
	for(scanf("%d",&q); q--;){
		int x,y;
		scanf("%d%d",&x,&y);
		printf("%d\n",s[y]-s[x-1]);
	}
	return 0;
}


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

using namespace std;

long long n;

int main() {
    cin >> n;

    long long ans = n;
    for(long long i = 1; i * i <= n; ++i) {
        if (n % i == 0)
            ans = min(ans, i + n/i - 2);
    }

    cout << ans << 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 = Integer.parseInt(sc.next());
    	int b = Integer.parseInt(sc.next());
    	int c = Integer.parseInt(sc.next());
    	if (a + b >= c){
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}
    }
}

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

int main(void) {
	set<int> S;
	int q, com, x, y;
	cin >> q;
	while (q--) {
		cin >> com;
		switch (com) {
			case 0:
				cin >> x;
				S.insert(x);
				cout << S.size() << endl;
				break;
			case 1:
				cin >> x;
				if (S.find(x) != S.end()) {
					cout << "1\n";
				} else {
					cout << "0\n";
				}
				break;
			case 2:
				cin >> x;
				S.erase(x);
				break;
			case 3:
				cin >> x >> y;
				set<int>::iterator it = S.lower_bound(x);
				set<int>::iterator end = S.upper_bound(y);
				while (it != end) {
					cout << *it << endl;
					it++;
				}
				break;
		}
	}
}


Measured memory_bytes: 12440
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd long double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF 999999999999999999
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       dd a;
       dd b;
       cin>>a>>b;
       dd ans=(dd)a*(dd)b;
       ans=(floor)(ans);
       cout<<fixed<<setprecision(0)<<ans<<"\n";
       //cout<<(ll)ans<<"\n";
   }
}

Measured memory_bytes: 3804
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

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


    int main(){
      int n,r;cin>>r>>n;
      r = 10-min(r,10);
      int res = n+(100*r);
      cout<<res;
    }
    


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);

    final int F = 500; // 500円
    int k = sc.nextInt(); // 枚数
    int x = sc.nextInt(); // 円

    if (F * k >= x) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21712
# -*- coding:utf-8 -*-
import sys
import math

array =[]
for line in sys.stdin:
    array.append(line)
    
for i in range(len(array)):
    num = array[i].split(' ')
    a = int(num[0])
    b = int(num[1])
    n = a + b
    print(int(math.log10(n) + 1))

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

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

const long long INF = 1LL << 60;
const int MAX_N = 1e5 + 10;

int n, k;
long long h[MAX_N], dp[MAX_N];

int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i];
	}

	for (int i = 0; i < MAX_N; ++i)
	{
		dp[i] = INF;
	}

	dp[0] = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 1; j <= k; ++j)
		{
			chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
		}
	}
	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
    int a,b,c;
    string s,t;
    ll x,y;

    cin >> a >> b;
    cout << a*(a-1)/2+b*(b-1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int		n,m,k;
vector<int>	a(200001);

// 二分探索法
// k回まで切って丸太がindex以下になるればtrue;
bool isOK(int index) {
	int		i,c=0;
	
	for(i=0;i<n;i++) {
		c += (a[i]+index-1)/index - 1;
	}
	if (c<=k) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search() {
    int left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = m+1; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        int mid = left + (right - left) / 2;

        if (isOK(mid)) right = mid;
        else left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

int main() {
	int		b,c,h,i,j,l,x,y;
	int		ans = 0;
	cin >> n >> k;
	for(i=0;i<n;i++) {
		cin >> a[i];
		m = max(m , a[i]);
	}

	if (m!=0) ans = binary_search();

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


Measured memory_bytes: 3868
n,m=map(int,input().split())
ab=[list(map(int, input().split())) for _ in range(m)]
# bに注目してソート
ab = sorted(ab, key=lambda x: x[1])
ans=0
left=-1
for i in range(m):
    if ab[i][0]<=left<ab[i][1]:
        continue
    left=ab[i][1]-0.5
    ans+=1
print(ans)


Measured memory_bytes: 65368
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n,k,m;
	while(cin >> n >> k >> m,n){
		vector<bool> stone(n,true);
		int stone_ct = 0;
		int index = m - 1;
		int interval = 0;
		while(true){
			if(!stone[index]){
				index = index + 1 < n ? index + 1 : 0;
			}else if(interval == 0){
				stone[index] = false;
				stone_ct++;
				//							cout << index << endl;
				if(stone_ct == n - 1){
					break;
				}else{
					interval = (k % (n - stone_ct) - 1 + n - stone_ct)%(n-stone_ct);
					index = index + 1 < n ? index + 1 : 0;
				}
			}else{
				index = index + 1 < n ? index + 1 : 0;
				interval--;
			}
		}
		REP(i,n){
			if(stone[i]){
						cout << i + 1 << endl;
						break;
			}
		}
	}
  return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define ll long long
#define mod1 (pow(10,7)+7)
#define mod2 (pow(10,9)+9)
#define lim 1000000000
#define isvowel(c) (c=='a' || c=='e' || c=='i' || c=='o' || c=='u')

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
/*#ifndef ONLINE_JUDGE
    freopen("input.txt","rt",stdin);
    freopen("output.txt","w",stdout);
#endif*/
    ll T;
    string yes="YES";
    string no="NO";
    //cin>>T;
    T=1;
    while(T--){
        ll n;
        cin>>n;
        for(ll i=n;i<=lim;i++){
            bool ok=true;
            for(ll j=2;j<=sqrt(i);j++)
                if(i%j==0){
                    ok=false;
                    break;
                }
            if(ok){
                cout<<i;
                break;
            }
        }
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 int main(void) {
   int a,b,c,d;
   cin >> a >>b;
   c=a%2;
   d=b%2;
   if (c==1 && d==1){
     cout << "Odd" << endl;
   }
   else {
     cout << "Even" << endl;
   }
 }

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 200005
const int mod=1000000007;
const int inv2=500000004;
int fir[N],nxt[2*N],to[2*N],cnt;
void adde(int a,int b)
{
	to[++cnt]=b;nxt[cnt]=fir[a];fir[a]=cnt;
	to[++cnt]=a;nxt[cnt]=fir[b];fir[b]=cnt;
}
int siz[N],pw[N],fa[N];
void dfs(int u)
{
	siz[u]=1;
	for(int v,p=fir[u];p;p=nxt[p]){
		v=to[p];
		if(v!=fa[u]){
			fa[v]=u;
			dfs(v);
			siz[u]+=siz[v];
		}
	}
}
int main()
{
	int n,i,u,v,p,sz,ans=0,tmp;
	scanf("%d",&n);pw[0]=1;
	for(i=1;i<=n;i++)pw[i]=1ll*inv2*pw[i-1]%mod;
	for(i=1;i<n;i++){
		scanf("%d%d",&u,&v);
		adde(u,v);
	}
	dfs(1);
	for(i=1;i<=n;i++){
		tmp=0;
		for(p=fir[i];p;p=nxt[p]){
			v=to[p];sz=siz[v];
			if(v==fa[i])sz=n-siz[i];
			tmp=(1ll*tmp+1ll*pw[n-sz]*(1ll-1ll*pw[sz]+1ll*mod))%mod;
		}
		tmp=(tmp+pw[n])%mod;
		ans=(1ll*ans+1ll*inv2-1ll*tmp+1ll*mod)%mod;
	}
	printf("%d",ans);
}

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

int main() {
    int N, X;
    cin >> N >> X;
    vector<int> m(N);
    for (int i=0; i<N; i++) cin >> m.at(i);
    int Nokori = X;
    for (int i=0; i<N; i++) Nokori -= m.at(i);
    sort(m.begin(), m.end());
    cout << Nokori/m.at(0) + N << "\n";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int c1,c5,c10,c50,c100,c500;
	cin>>c1>>c5>>c10>>c50>>c100>>c500;
	if(c1*1+c5*5+c10*10+c50*50+c100*100+c500*500<1000){
		cout<<"0"<<endl;
	}else if(c1*1+c5*5+c10*10+c50*50+c100*100+c500*500>=1000){
		cout<<"1"<<endl;
	}
}

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

int main() {
    int h, w;
    cin >> h >> w;
    char s[h][w];
    int mine[h+2][w+2];
    for (int i = 0; i < h+2; i++) {
        for (int j = 0; j < w+2; j++) { 
            mine[i][j] = 0;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) { 
            cin >> s[i][j];
            if (s[i][j] == '#') mine[i+1][j+1] = 1;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            //cout << s[i-1][j-1];
            if (s[i][j] == '.') {
                int sum = 0;
                for (int a = i; a <= i+2; a++) {
                    for (int b = j; b <= j+2; b++) {
                        if (mine[a][b] == 1) sum++;
                    }
                }
                cout << sum;
            } else cout << "#";
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	char c[100][100];
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>c[i];
	}
	for(int i=0;i<b+2;i++)cout<<'#';
	cout<<endl;
	for(int i=0;i<a;i++){
		cout<<'#';
		for(int j=0;j<b;j++){
			cout<<c[i][j];	
		}
		cout<<'#'<<endl;
		
	}
	for(int i=0;i<b+2;i++)cout<<'#';
	cout<<endl;
}

Measured memory_bytes: 256
function Main(s) {
  var s = s.split("\n")[0].split(" ").map(e => parseInt(e, 10)).sort((a, b) => b - a);
  var cnt = 0;
  if ((s[1] - s[2]) % 2 === 0) {
    while(s[0] != s[1] || s[0] != s[2]) {
      if (s[0] > s[1]) {
        s[1]++;
        s[2]++;
        cnt++;
      } else {
        s[2] += 2;
        cnt++;
      }
    }
  } else {
    s[0]++;
    s[1]++;
    cnt++;
    while(s[0] != s[1] || s[0] != s[2]) {
      if (s[0] > s[1]) {
        s[1]++;
        s[2]++;
        cnt++;
      } else {
        s[2] += 2;
        cnt++;
      }
    }
  }
  console.log(cnt);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A, M));

        sc.close();
    }

    static long solve(int[] A, int M) {
        Map<Integer, Integer> sumToCount = new HashMap<>();
        sumToCount.put(0, 1);

        long result = 0;
        int sum = 0;
        for (int Ai : A) {
            sum = (sum + Ai) % M;
            result += sumToCount.getOrDefault(sum, 0);
            sumToCount.put(sum, sumToCount.getOrDefault(sum, 0) + 1);
        }

        return result;
    }
}

Measured memory_bytes: 61140
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int a,n;
    cin>>n;
    long long cnt[1002];
    REP(i,1001)cnt[i]=0;
    REP(i,n){
        cin>>a;
        cnt[a]++;
    }
    long long ans=0;
    for(int i=1;i<=1000;i++){
        for(int j=i;j<=1000;j++){
            for(int k=j;k<=1000;k++){
                if(i<j+k&&j<k+i&&k<i+j){
                    if(i==j){
                        if(cnt[i]<2)continue;
                        if(j==k){
                            if(cnt[i]<3)continue;
                            ans+=cnt[i]*(cnt[i]-1)*(cnt[i]-2)/6;
                        }else{
                            ans+=cnt[i]*(cnt[i]-1)*cnt[k]/2;
                        }
                    }else{
                        if(j==k){
                            if(cnt[j]<2)continue;
                            ans+=cnt[i]*cnt[j]*(cnt[j]-1)/2;
                        }else{
                            ans+=cnt[i]*cnt[j]*cnt[k];
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int[] n = new int[4];
        for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        
        String ans = "Good";
        for(int i = 0; i < 3; i++) {
            
            if(n[i] == n[i+1]) {
                ans = "Bad";
                break;
            }
            
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
# define ll long long
# define ld long double
# define pb push_back

  
    // for(int i=0;i<n;i++){  
        
    //     int x,y;
    //     cin>>x>>y;
        
    //     v.pb({x,y});         //make pair in vector
    // }
 
using namespace std;
 
int main()
{

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll  n;
    cin>>n;
    cout<<2*(3.14159)*n; }

Measured memory_bytes: 3800
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
const int MAX = 2e5 + 10;
ll n;  ll a[MAX];
ll sd(ll x){
	ll sum=0;
	for(ll i=0;i<n;i++){
		sum += abs(a[i] - x);
	}
	return sum;
}

int main()
{
	cin>>n;
	for(ll i=0;i<n;i++){
		ll x; cin>>x;
		a[i] = x - i - 1;
	}
	sort(a,a+n);
	if(n%2 == 1){
		cout<<sd(a[(n-1)/2]);
	}
	else{
		cout<<min(sd(a[n/2]),min(sd(a[(n/2)-1]),sd((a[n/2]+a[(n/2)-1])/2)));
	}
}

Measured memory_bytes: 1792
S = input()
T = input()
N = len(S)

X = {}
for i in range(N):
  if T[i] not in X.keys():
    X[T[i]] = []
  X[T[i]].append(S[i])
Y = {}
for i in range(N):
  if S[i] not in Y.keys():
    Y[S[i]] = []
  Y[S[i]].append(T[i])

for i,j in X.items():
  if len(set(j)) >= 2:
    print('No')
    exit()
for i,j in Y.items():
  if len(set(j)) >= 2:
    print('No')
    exit()
print('Yes')


Measured memory_bytes: 8112
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

int main(){

  int n,m;
  cin  >> n >> m;

  int c[m];
  for(int i=0;i<m;i++)cin >> c[i];

  int dp[n+1];
  for(int i=0;i<n+1;i++)dp[i]=i;

  for(int i=0;i<n+1;i++){
    for(int j=0;j<m;j++){
      if(i>=c[j])dp[i]=min(dp[i],dp[i-c[j]]+1);
    }
  }

  cout << dp[n] << endl;

}


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

const int INF = 1001001001;

int main(){
  int n;
  cin >> n;
  int u,v,w;
  vector<vector<pair<int,int>>> to(n,vector<pair<int,int>>(0));
  for(int i=0;i<n-1;i++){
    cin >> u >> v >> w;
    u--; v--;
    to.at(u).push_back(make_pair(v,w));
    to.at(v).push_back(make_pair(u,w));
  }
  vector<int> ans(n,-1);
  ans.at(0) = 0;
  queue<int> q;
  q.push(0);
  while(q.size()){
    int scope;
    scope = q.front();
    q.pop();
    for(auto a:to.at(scope)){
      if(ans.at(a.first) == -1){
        q.push(a.first);
        ans.at(a.first) = (a.second%2 + ans.at(scope)%2)%2; 
      }
    }
  }
  for(int i=0;i<n;i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 6784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n){
		cin>>a[i];
	}
	sort(begin(a),end(a));
	int ans=0;
	rep(i,n){
		chmax(ans,int(upper_bound(begin(a),end(a),a[i]+2)-begin(a)-i));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int n;
  	cin >> n;
  	string s[n];
  	for(int i = 0 ;i < n ;i++){
    	cin >> s[i]; 
    }
  	map< string , int > mp;
  	char pre = s[0][0];
  	for(int i = 0 ; i < n ;i++){
      if(mp[s[i]] != 0 || s[i][0] != pre){
      	//cout << i << endl;
       	cout << "No" << endl;
        return 0;
      }
      mp[s[i]] = 1;
      pre = s[i][s[i].size() - 1];
    }
  	cout << "Yes" << endl;
 	return 0; 
 	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll a, b, n;
  cin >> a >> b >> n;
  ll ans = 0;
  if (n < b){
    ans = a * n / b - n / b * a;
  }
  else{
    ans = a * (b - 1) / b;
  }
  print(ans);
}

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

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

using namespace std;

using ll = long long int;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec)
{
  for (ll i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  return os;
}

double c(ll a)
{
  return a * (a - 1) / 2;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, tmp, cnt = 0, l;
  map<ll, ll> p;
  cin >> n;
  vector<ll> a(n);
  vector<ll> s(n + 1, 0);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  rep(i, n)
  {
    s[i + 1] = s[i] + a[i];
  }
  ll o = -999;
  for (ll i = 0; i <= n; ++i)
  {
    p[s[i]]++;
  }

  for (const auto &a : p)
  {
    if (a.second >= 2)
    {
      cnt += static_cast<ll>(c(a.second));
    }
  }
  std::cout << cnt << endl;
}

Measured memory_bytes: 15872
#include <stdio.h>
#include <ctype.h>

int main(void){

	char str1[11],str2[11],str3[11];

	scanf("%s %s %s",str1,str2,str3);

	printf("%c%c%c\n",toupper(str1[0]),toupper(str2[0]),toupper(str3[0]));

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;


int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<int> v(n); {
		rep(i, n) cin >> v[i];
	}

	map<int, int> odd, even; {
		rep(i, n) {
			if (i % 2 == 1) odd[v[i]]++;
			else even[v[i]]++;
		}
	}

	vector<pair<int, int>> pairo, paire; {
		pairo.push_back(make_pair(0, -1));
		paire.push_back(make_pair(0, -1));
		for (const auto u : odd) {
			pairo.push_back(make_pair(u.second, u.first));
		}
		for (const auto u : even) {
			paire.push_back(make_pair(u.second, u.first));
		}

		sort(pairo.begin(), pairo.end());
		reverse(pairo.begin(), pairo.end());
		sort(paire.begin(), paire.end());
		reverse(paire.begin(), paire.end());
	}

	int ans = n; {
		rep(i, 2)rep(j, 2) {
			if (pairo[i].second == paire[j].second) continue;
			ans = min(ans, n - pairo[i].first - paire[j].first);
		}
	}
	printf("%d\n", ans);

	return 0;
}

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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

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

signed main(){
    int n, q;
    cin >> n >> q;
    ll a[n], x[q];
    REP(i,n){
        cin >> a[i];
    }
    REP(i,q){
        cin >> x[i];
    }
    REP(i,q){
        ll sum = 0, ans = 0;
        int right = 0;
        for(int left = 0; left < n; left++){
            while(sum + a[right] <= x[i]){
                sum += a[right];
                right++;
            }
            ans += right - left;
            sum -= a[left];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3880
# その日に行なった活動も保持しておく
N = int(input())
vacation = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
# テーブル上で真下には遷移できないだけ
i = 1
dp[0][0] = vacation[0][0]
dp[0][1] = vacation[0][1]
dp[0][2] = vacation[0][2]
for a, b, c in vacation[1:]:
    dp[i][0] = max(dp[i-1][1]+a, dp[i-1][2]+a)
    dp[i][1] = max(dp[i-1][0]+b, dp[i-1][2]+b)
    dp[i][2] = max(dp[i-1][0]+c, dp[i-1][1]+c)
    i += 1

print(max(dp[N-1]))


Measured memory_bytes: 75480
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var I=0;I<Arr.length;I++){
   var Sum=Arr[I]-0;
   if(Sum==0)break;
   var sum=0;
   for(var i=0;i<9;i++)sum+=(Arr[I+i+1]-0);
   console.log(Sum-sum);
   I+=9;
}

Measured memory_bytes: 7644