akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#define N 1000000
#define L 14
char A[N][L];
int getChar(char c);
long long getKey(char str[]);
int h1(int key){ return key%N; }
int h2(int key){ return 1+(key%(N-1)); }
int find(char str[]);
int insert(char str[]);
int main(){
  int i, n;
  char str[L], cmp[9];
  for(i = 0; i < N; i++){
    A[i][0] = '\0';
  }
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s %s", cmp, str);
    if(cmp[0] == 'i'){
      insert(str);
    } else {
      if(find(str)){
        printf("yes\n");
      } else {
        printf("no\n");
      } }
  }
  return 0; }
int getChar(char c){
  if( c == 'A') return 1;
  else if( c == 'C') return 2;
  else if( c == 'G') return 3;
  else if( c == 'T') return 4;
  else return 0;
}
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for (i = 0; i < strlen(str); i++){
    sum += p*(getChar(str[i]));
    p *= 5; }
  return sum; }
int find(char str[]){
  int i, h;
  h = (h1(getKey(str)) + i * h2(getKey(str))) % N;
  for(i = 0; i < 14; i++){
    h = (h1(getKey(str)) + i * h2(getKey(str))) % N;
    if(strcmp(A[h], str) == 0) return 1;
  }
  return 0; }

int insert(char str[]){
  int i;
  if(find(str)) return 0;
  for(i = 0; i < 14; i++){
    if(A[ (h1(getKey(str)) + i * h2(getKey(str))) % N ][0] == '\0'){
      strcpy(A[ (h1(getKey(str)) + i * h2(getKey(str))) % N ], str);
      return 1;
    } }
  return 0; }


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

using namespace std;

const auto INF = (int) 1e9;

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

    int f[100][10] = {};
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 10; ++j) {
            cin >> f[i][j];
        }
    }

    int p[100][11];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 11; ++j) {
            cin >> p[i][j];
        }
    }

    int ans = -INF;
    for (unsigned int sched = 1; sched < (1U << 10); ++sched) {//営業予定ごと
        int sum = 0;
        for (int shop = 0; shop < n; ++shop) {//お店ごと
            int cnt = 0;
            for (unsigned int i = 0; i < 10; ++i) {//曜日時間帯ごと
                if ((sched & (1U << i)) && f[shop][i]) {
                    cnt++;
                }
            }
            sum += p[shop][cnt];
        }
        ans = max(ans, sum);
    }

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] V = new int[N];
		int[] C = new int[N];

		for(int i = 0; i < N; i++) {
			V[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			C[i] = sc.nextInt();
		}

		int Vsum = 0;
		int Csum = 0;
		int max = Vsum - Csum;
		for(int i = 0; i < N; i++) {
			Vsum += V[i];
			Csum += C[i];

			if(max < (Vsum - Csum)) {
				max = Vsum - Csum;
			}else {
				Vsum -= V[i];
				Csum -= C[i];
			}

		}

		System.out.println(max);

	}

}


Measured memory_bytes: 35636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FASTIO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define ll long long int
#define F first
#define S second
#define pll pair<ll,ll>
#define vl vector<ll>
#define pb push_back

struct compare {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		if ((a.S - a.F) != (b.S - b.F)) return ((a.S - a.F) > (b.S - b.F));
		else return (a.F < b.F);
	}
};
const ll INF = 1e18 + 5;
int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	FASTIO;
	ll n, wmax; cin >> n >> wmax;
	vl w(n), v(n);
	for (int i = 0; i < n; i++) cin >> w[i] >> v[i];
	ll sum = 0;
	for (auto x : v) sum += x;
	vl dp(sum + 1, INF);
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = sum; j >= 0; j--) {
			if ((j + v[i]) <= sum) dp[j + v[i]] = min(dp[j] + w[i], dp[j + v[i]]);
		}
	}
	ll ans = 0;
	for (int i = 0; i <= sum; i++) {
		if (dp[i] <= wmax) ans = i;
	}
	cout << ans << endl;

}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;

int main() {
    cin >> n >> m;
    Vi res(n, -1);
    REP(i, m) {
        int x, y; cin >> x >> y;
        x--;
        if (res[x] != -1 && res[x] != y) {
            std::cout << -1 << '\n';
            return 0;
        }
        res[x] = y;
    }
    if (n > 1 && res[0] == 0) {
        std::cout << -1 << '\n';
        return 0;
    }
    REP(i, n) {
        if (i == 0) {
            if (res[0] == -1) {
                if (n == 1) {
                    std::cout << 0;
                } else {
                    std::cout << 1;
                }
            } else {
                std::cout << res[0];
            }
        } else {
            if (res[i] == -1) {
                std::cout << 0;
            } else {
                std::cout << res[i];
            }
        }
    }
    std::cout << '\n';

    return 0;
}


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

int main()
{
	int n = 0;
	std::cin >> n;

	std::string str;
	std::cin >> str;

	for (std::size_t index = 0; index < str.length(); ++index)
	{
		str.at(index) = ((str.at(index) - 'A' + n) % 26) + 'A';
	}
	std::cout << str << std::endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
pair<int,int> rp[4];
char bd[4][4];
int dfs(char c){
	if(c=='I')return 1;
	int r=0;
	rep(y,4)rep(x,4)if(bd[y][x]=='.'){
		bd[y][x]=c;
		rep(k,4){
			int ny=y+rp[k].first,nx=x+rp[k].second;
			if(0<=ny&&ny<4&&0<=nx&&nx<4&&bd[ny][nx]=='.'){
				bd[ny][nx]=c;
				r+=dfs(c+1);
				bd[ny][nx]='.';
			}
		}
		bd[y][x]='.';
		if(r>0)return r;
	}
	return 0;
}
int main(){
	int a,b;
	while(cin>>a,a<5){
		cin>>b; rp[0]=make_pair(b,a);
		rep(i,3)cin>>a>>b,rp[i+1]=make_pair(b,a);
		rep(i,4)rep(j,4)bd[i][j]='.';
		cout<<dfs('A')<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int mod;
struct mint {
  long long x;
  mint(long long x=0) : x((x%mod+mod)%mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const {
    return mint(*this) += a;
  }
  mint operator-(const mint& a) const {
    return mint(*this) -= a;
  }
  mint operator*(const mint& a) const {
    return mint(*this) *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2); }
  mint& operator/=(const mint& a) { return *this *= a.inv(); }
  mint operator/(const mint& a) const {
    return mint(*this) /= a;
  }
};
istream& operator>>(istream& is, const mint& a) {
  return is >> a.x;
}
ostream& operator<<(ostream& os, const mint& a) {
  return os << a.x;
}

struct Rerooting {
  struct DP {
    mint dp;
    DP(int dp=1) : dp(dp) {}
    DP operator+(const DP& a) const {
      DP res(*this);
      res.dp *= a.dp;
      return res;
    }
    DP add_root() const {
      DP res(*this);
      res.dp+=1;
      return res;
    }
  };

  int n;
  vector<vector<int>> to;
  vector<vector<DP>> dp;
  vector<DP> ans;
  Rerooting(int n) : n(n), to(n), dp(n), ans(n) {}
  void add_edge(int s, int t) {
    to[s].push_back(t);
  }
  void init() {
    dfs(0);
    bfs(0);
  }

  DP dfs(int v, int p=-1) {
    DP dp_sum;
    dp[v] = vector<DP>(to[v].size());
    for (int i = 0; i < to[v].size(); i++) {
      int u = to[v][i];
      if (u == p) continue;
      dp[v][i] = dfs(u, v);
      dp_sum = dp_sum + dp[v][i];
    }
    return dp_sum.add_root();
  }
  void bfs(int v, const DP& dp_p=DP(), int p=-1) {
    int deg = to[v].size();
    for (int i = 0; i < deg; i++) {
      if (to[v][i] == p) dp[v][i] = dp_p;
    }

    vector<DP> dp_l(deg+1), dp_r(deg+1);
    for (int i = 0; i < deg; i++) {
      dp_l[i+1] = dp_l[i] + dp[v][i];
    }
    for (int i = deg-1; i >= 0; i--) {
      dp_r[i] = dp_r[i+1] + dp[v][i];
    }
    ans[v] = dp_l[deg];

    for (int i = 0; i < deg; i++) {
      int u = to[v][i];
      if (u == p) continue;
      DP d = dp_l[i] + dp_r[i+1];
      bfs(u, d.add_root(), v);
    }
  }
};

int main(){
  int n;
  cin>>n>>mod;
  Rerooting tree(n);
  rep(i,n-1){
    int s,t;
    cin>>s>>t;
    s--;t--;
    tree.add_edge(s,t);
    tree.add_edge(t,s);
  }
  tree.init();
  rep(i,n){
    cout<<tree.ans[i].dp<<endl;
  }
  return(0);
}


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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> a(N,0);
  for (int i = 0; i < N; i++) cin >> a.at(i);
  for (int i = 0; i < N-K; i++){
    if (a.at(i) < a.at(K+i)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 4044
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	long double ans;
	int N;
	cin >> N;
	if (N % 2 == 0)cout << setprecision(20) << 1.0 / 2.0 << endl;
	else {
		N = (long double)N;
		cout << setprecision(20) << ((N+1.0)/2.0) / N << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#方針: 753数を全列挙
 
def is_753?(s)
  f7=f5=f3 = false
  s.chars do |c|
    case c
    when "7"
      f7=true
    when "5"
      f5=true
    when "3"
      f3=true
    end
  end
  return f7&&f5&&f3
end
 
list = ["7","5","3"]
ary = []
(3..9).each do |digit|
  (0..3**digit-1).each do |bit|
    tmp = ""
    (0..digit-1).each do |i|
      tmp += list[bit.to_s(3).rjust(digit,"0")[i].to_i]
    end
    ary << tmp if is_753?(tmp)
  end
end
 
n = gets.to_i
 
ans = 0
ary.each_with_index do |a, i|
  if a.to_i <= n
    ans+=1
  end
end
 
p ans

Measured memory_bytes: 3836
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
using namespace std;
const int  N = 55+66;
#define  LL long long
LL len[N];
LL P[N];

LL f(LL n,LL x)
{
	if(x==0) return 0;
	if(n==0) return 1;
	else if(n!=0&&x==1){
		return 0;
	}else if(x<1+len[n-1]){
		return f(n-1,x-1);
	}else if(x==1+len[n-1]){
		return P[n-1];
	}
	else if(x==1+len[n-1]+1){
		return P[n-1]+1;
	}else if(x<=2+len[n-1]*2){
		return 1+P[n-1]+f(n-1,x-(2+len[n-1]));
	}else{
		return 1+2*P[n-1];
	}
}


int main()
{
	P[0]=1;
	len[0]=1;
	for(int i=1;i<=50;i++){
		len[i]=len[i-1]*2+3;
		P[i]=P[i-1]*2+1;
	}
	LL n,x;
	cin>>n>>x;
	cout<<f(n,x)<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<P> vp;

const int MAX_N = 500005;

int dp[MAX_N];
int bak[MAX_N],nxt[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    s += "#";
    int bk = -1;
    rep(i,n){
        bak[i] = bk;
        if(s[i] == '0'){
            bk = i;
        }
    }
    int nx = n;
    rrep(i,n){
        nxt[i] = nx;
        if(s[i] == '0'){
            nx = i;
        }
    }
    rep(i,n){
        dp[i+1] = max(dp[i+1],dp[i]);
        // 1011111...(もらうDP)
        if(s[i] == '1'){
            if(1 <= bak[i] && s[bak[i] - 1] == '1'){
                dp[i + 1] = max(dp[i + 1],dp[bak[i] - 1] + i - bak[i]);
            }
        }
        // ...1111101(あげるDP)
        if (s[i] == '1') {
            if (nxt[i] < n - 1 && s[nxt[i] + 1] == '1') {
                dp[nxt[i] + 2] = max(dp[nxt[i] + 2], dp[i] + nxt[i] - i);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const int mod = 1e9 + 7;
int dp[10005][105][2];
string s;
int d;

int add(int a, int b)
{
  a = (a + mod) % mod;
  b = (b + mod) % mod;
  return (a + b) % mod;
}

int solve(int idx, int rem, bool smaller)
{
    if(idx == s.size())
      return rem == 0;
    int &ans = dp[idx][rem][smaller];
    if(~ans)
      return ans;
    ans = 0;
    for(int i = 0; i < 10; i++)
    {
      if(smaller || (s[idx] - '0' >= i))
      {
        ans = add(ans, solve(idx + 1, (rem + i) % d, smaller | (i < s[idx] - '0')));
      }
    }
    return ans;
}

int main()
{
  cin >> s >> d;
  memset(dp, -1, sizeof dp);
  cout << add(solve(0, 0, 0), -1);
  return 0;
}


Measured memory_bytes: 9344
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int n, m, q;
vector<int> a, b, c, d;
int ans = 0;
void dfs(vector<int> A)
{
    if (A.size() == n + 1)
    {
        int now = 0;
        repi(i, q, 0)
        {
            if (A[b[i] - 1] - A[a[i] - 1] == c[i])
                now += d[i];
        }
        ans = max(ans, now);
        return;
    }
    A.push_back(A.back());
    while (A.back() <= m)
    {
        dfs(A);
        A.back()++;
    }
}
int main()
{
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    repi(i, q, 0)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>

int main(){ 
        double x[5],xp,y[5],yp; 
   int i,t; 
   while(0<=scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&xp,&yp)){
        x[3]=x[0];  
      y[3]=y[0]; 
       x[4]=x[1];  
      y[4]=y[1];     
   t=0; 
       for(i=0;i<3;i++){
            if(((y[i+1]-y[i])/(x[i+1]-x[i])*(xp-x[i])+y[i]-yp)*((y[i+1]-y[i])/(x[i+1]-x[i])*(x[i+2]-x[i])+y[i]-y[i+2])<=0){ 
               t=1;  
              break;
            }  
      }  
       if(t==1){      
      printf("NO\n");   
     }else{    
        printf("YES\n"); 
       }  
   }
     return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
#define pi       const int pi=3.1415926535
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int n;
  string ans;
  string s;
  string t;
  cin>>n>>s>>t;
  int cnt=0;
  rep(i,n){
    if(s.substr(n-1-i)==t.substr(0,i+1)){
      cnt=i+1;
    }
  }
  ans=s+t.substr(cnt);
  cout<<ans.size();
}

Measured memory_bytes: 256
alphaList = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
i = int(input())
str = input()
out = ""
for s in str :
    out = out + alphaList[(alphaList.index(s) + i) % 26]
print(out)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
using namespace std;
#define N 50
int i,n,p,tmp;
int ca[N];
bool sen(int tmp){
	int ans = 0;
	for(int i=0;i<n;i++){
		if(ca[i]==tmp) ans++;
	}
	if(ans) return false;
	else return true;
}

int main(){
	while(cin >> n >> p){
	//cin >> n >> p;	
		if(n==0&&p==0) break;
		tmp = p;
		for(i=0;i<n;i++) ca[i]=0;
		
		int k,j = 0;
		while(sen(tmp)){
			k = j%n;
			if(p==0){
				p += ca[k];
				ca[k] = 0;
			}else{
				p -= 1;
				ca[k]++;
			}
			j++;
		}
	    for(i=0;i<n;i++){
	    	if(ca[i]==tmp) cout << i <<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
//#define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 7
#define MIN 2
#define _MAX 1025
int main(void)
{
	char str[_MAX],ans[MAX];
	int year, mon, day, _cou = 0;
	int cou = 0;
	gets_s(str);
	for (int i = 0; str[i] != '\0'; ++i) {
		if ((str[i] == ' ' || str[i] == '.') || str[i] == ',') {
			if (2 < cou && cou < 7) {
				ans[cou] = '\0';
				if (_cou != 0) {
					printf(" ");
				}
				printf("%s", ans);
				++_cou;
			}
			cou = 0;
		}
		else {
			if (cou < 7) {
				ans[cou] = str[i];
			}
			++cou;
		}
	}
	printf("\n");
}

Measured memory_bytes: 1112
//abc157_a.cpp
//Sun Mar  1 20:09:41 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

int main(){
	int n;
	cin >> n;
	int ans = 0;
	if (n%2==1){
		ans = n/2+1;
	}else {
		ans = n/2;
	}
	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
n,m = map(int, input().split())
h = list(map(int, input().split()))
path = [list(map(int, input().split())) for i in range(m)]

ans = [[i] for i in h]

for i in path:
    ans[i[0]-1].append(h[i[1]-1])
    ans[i[1]-1].append(h[i[0]-1])


count = 0
for i in ans:
    if len(i)==1:
      count += 1
    elif i[0] == max(i) and i.count(i[0])==1:
      count +=1
print(count)


Measured memory_bytes: 44352
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
const ll INF = 1001001001;

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> X(N);

    ll ans = INF;
    for(ll i=0;i<N;i++) cin >> X[i];
    for(ll i=0;i<=N-K;i++){
        ll pre_ans;
        ll l = i,r = i+K-1;
        if(X[l]*X[r] < 0){
            pre_ans = min(abs(X[l]),abs(X[r]))*2 + max(abs(X[l]),abs(X[r]));
        }
        else{
            pre_ans = max(abs(X[l]),abs(X[r]));
        }
        ans = min(ans,pre_ans);
    }
    cout << ans << endl;

}


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

typedef long long ll;
#define pii pair<int ,int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 2005

int n ,x , y;
int a[MAXX][MAXX];
int ans[MAXX];

int main()
{
    _FastIO;
    cin >> n >> x >> y;
    int d = y - x - 1;
    for(int i = 1; i < n; i++){
        for(int j = i + 1; j <= n; j++){
            a[i][j] = j - i;
            if(i <= x && j >= y){
                a[i][j] -= d;
                ans[a[i][j]]++;
                continue;
            }
            if((i <= x && j <= x) || (i >= y && j >= y)){
                ans[a[i][j]]++;
                continue;
            }
            if(i <= x && j > x){
                a[i][j] = min(x - i + 1 + y - j , a[i][j]);
                ans[a[i][j]]++;
                continue;
            }
            if(i > x && j >= y){
                a[i][j] = min(j - y + 1 + i - x , a[i][j]);
                ans[a[i][j]]++;
                continue;
            }
            if(i > x && j < y){
                a[i][j] = min(i - x + 1 + y - j , a[i][j]);
                ans[a[i][j]]++;
                continue;
            }
        }
    }
    for(int i = 1; i < n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 15360
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

bool solve(vector<pair<int,int> > vec, int lim) {
  sort(vec.begin(), vec.end());
  if (vec[0].first > 0) return false;
  int right = vec[0].second;

  for (int i = 0; i < vec.size(); ++i) {
    if (right < vec[i].first) return false;
    right = max(right, vec[i].second);
    if (right >= lim) return true;
  }

  return false;
}

int main() {
  int N, W, H;
  vector<pair<int,int> > vx, vy;
  while (cin >> N >> W >> H) {
    vx.clear(); vy.clear();
    for (int i = 0; i < N; ++i) {
      int x, y, w;
      cin >> x >> y >> w;
      vx.push_back( make_pair( max(0, x-w), min(W, x+w) ) );
      vy.push_back( make_pair( max(0, y-w), min(H, y+w) ) );
    }
    if (solve(vx, W) || solve(vy, H)) puts("Yes");
    else puts("No");
  }
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s.front() == s.back()){
        cout << (s.length() % 2 == 0 ? "First" : "Second") << endl;
    }else{
        cout << (s.length() % 2 == 1 ? "First" : "Second") << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
int main(){
    long N, A, B;
    std::cin >> N >> A >>B;

    long ans = N / (A + B) * A;
    if(N % (A + B) < A){
        ans += N % (A + B);
    }
    else{
        ans += A;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
a,b,c,x,y = map(int,input().split())
if a+b < c:
    print(a*x+b*y)
else:
    if x < y:
        print(min(x*c*2+(y-x)*b,y*c*2,a*x+b*y))
    else:
        print(min(y*c*2+(x-y)*a,x*c*2,a*x+b*y))


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



int main(){
    char x,y;
    cin >> x >> y;
    if(x<y) cout << '<' << endl;
    else if(x>y) cout << '>' << endl;
    else cout << '=' << endl;
    return 0;
}

Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((k (read))
         (a (read))
         (b (read)))
    (if (or (>= a k) (>= a b))
        (println (+ 1 k))
        (if (evenp (+ k (- a) 1))
            (println (max (+ k 1)
                          (+ a (floor (* (- b a) (+ k (- a) 1)) 2))))
            (println (max (+ k 1)
                          (+ 1 a (floor (* (- b a) (- k a)) 2))))))))

#-swank(main)


Measured memory_bytes: 18916
#include <stdio.h>
int main(void)
{

  int n, h = 0, m = 0;
  scanf("%d", &n);
 
  h = n / 3600;
  n = n % 3600;

  m = n / 60;
  n = n % 60;

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


    
    

  return 0;
}

Measured memory_bytes: 592
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

oni = a + v*t
nige = b + w*t
if a < b:
    if a + v*t >= b + w*t:
        print('YES')
    else:
        print('NO')
else:
    if a -v*t <= b - w*t:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int N=303,M=1e9+7;
void ad(int32_t &x,int32_t y){if((x+=y)>=M)x-=M;}
int l[N],r[N],x[N];
int mnl[N][4];
int mxl[N][4];
int32_t dp1[N][N],dp2[N][N];
bool ok[N][N][N];
int32_t main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;++i)forn(j,4)mnl[i][j]=n+1,mxl[i][j]=-1;
    forn(i,m){
        cin>>l[i]>>r[i]>>x[i];
        if(l[i]==1&&r[i]==1&&x[i]!=1){
            cout<<"0\n";
            return 0;
        }
        for(int j=l[i];j<=r[i];++j){
            upn(mnl[j][x[i]],l[i]);
        }
        upx(mxl[r[i]][x[i]],l[i]);
    }
    forn(i,n+1){
        forn(j,max(1ll,i)){
            forn(k,max(1ll,j)){
                ok[i][j][k]=1;
                ok[i][j][k]&=mnl[i][1]>j;
                ok[i][j][k]&=mnl[i][2]>k;
                ok[i][j][k]&=mxl[i][2]<=j;
                ok[i][j][k]&=mxl[i][3]<=k;
                // dbg(i,j,k,ok[i][j][k]);
            }
        }
    }
    auto dp=dp1,ndp=dp2;
    dp[0][0]=3;
    for(int i=1;i<n;++i){
        memset(ndp,0,sizeof dp1);
        forn(o1,i){
            forn(o2,max(1ll,o1)){
                int32_t val=dp[o1][o2];
                if(ok[i+1][o1][o2]){
                    ad(ndp[o1][o2],val);
                }
                if(ok[i+1][i][o2]){
                    ad(ndp[i][o2],val);
                }
                if(ok[i+1][i][o1]){
                    ad(ndp[i][o1],val);
                }
            }
        }
        memcpy(dp,ndp,sizeof dp1);
    }
    int ans=0;
    forn(i,n)forn(j,n)ans+=dp[i][j];
    ans%=M;
    cout<<ans<<'\n';

    return 0;
}

Measured memory_bytes: 18952
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))

#include <bits/stdc++.h>
using namespace std;
long long ret,n,k,x,y,ctr;
vector<long long> xlist,ylist,xsort,ysort;

int main(){
    LL(n);
    LL(k);
    REP(i,n){
        LL(x);
        LL(y);
        xlist.push_back(x);
        xsort.push_back(x);
        ylist.push_back(y);
        ysort.push_back(y);
    }
    sort(xsort.begin(),xsort.end());
    sort(ysort.begin(),ysort.end());

    ret = (int64_t)1<<62;

    REP(xi,n){ FOR(xj,xi+1,n){
        REP(yi,n){ FOR(yj,yi+1,n){
            ctr = 0;
            REP(i,n){
                if (xsort[xi] <= xlist[i] && xlist[i] <= xsort[xj] && ysort[yi] <= ylist[i] && ylist[i] <= ysort[yj] ){ctr++;}
            }
            if (ctr>=k) {ret = min(ret,((xsort[xj]-xsort[xi])*(ysort[yj]-ysort[yi]))); }
    }}}}
    printf("%lld\n",ret);
}


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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int N,M,Q;
vector<ll> a,b,c,d;

ll score(const vector<int> &A){
    ll res=0;
    for(int i=0;i<Q;i++){
        if(A[b[i]]-A[a[i]]==c[i]) res+=d[i];
    }
    return res;
}

ll dfs(vector<int> &A){
    if(A.size()==N){
        return score(A);
    }

    ll res=0;

    int start=(A.empty() ? 0 : A.back() );
    for(int v=start;v<M;++v){
        A.push_back(v);
        res=max(res,dfs(A));
        A.pop_back();
    }
    return res;
}

int main(){
    cin>>N>>M>>Q;
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);
    
    REP(i,Q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
        b[i]--;
    }
    
    //全探索
    vector<int> A;
    cout<<dfs(A)<<endl;

    
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
#include <map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

using namespace std;
 
class DisjointSet {
    public:
        vector<int> p;
        DisjointSet() {}
        DisjointSet(int n){
            p.resize(n, 0);
            for(int i = 0; i < n; i++){
                makeSet(i);
            }
        }
        
        void makeSet(int x){
            p[x] = x;
        }
        
        bool same(int x, int y){
            return findSet(x) == findSet(y);
        }
        
        int findSet(int x){
            if(x != p[x]){
                p[x] = findSet(p[x]);
            }
            
            return p[x];
        }
        
        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }
        
        void link(int x, int y){
            p[y] = x;
        }
};

const int MAX_N = 200050;
const int MAX_K = 100050;

int N, K, L;
int p[MAX_K], q[MAX_K], r[MAX_K], s[MAX_K];

DisjointSet ds1 = DisjointSet(MAX_N);
DisjointSet ds2 = DisjointSet(MAX_N);
 
int main(void){
    cin >> N >> K >> L;

    for (int i = 1; i <= K; i++) {
        std::cin >> p[i] >> q[i];
    }
    for (int i = 1; i <= L; i++) {
        std::cin >> r[i] >> s[i];
    }
    
    for(int i = 1; i <= K; i++){
        if(!ds1.same(p[i], q[i])) ds1.unite(p[i], q[i]);
    }
    
    for(int i = 1; i <= L; i++){
        if(!ds2.same(r[i], s[i])) ds2.unite(r[i], s[i]);
    }
    
    //vector<pair<int, int> > com(N+1);
    map<pair<int, int>, int> S;
    for(int i = 1; i <= N; i++){
        //com[i].first = ds1.findSet(i);
        //com[i].second = ds2.findSet(i);
        //S[com[i]] += 1;
        S[std::pair<int, int>({ds1.findSet(i), ds2.findSet(i)})] += 1;
    }
    
    for(int i = 1; i <= N; i++){
        cout << S[std::pair<int, int>({ds1.findSet(i), ds2.findSet(i)})] << " ";
    }
    cout << endl;
    
    return 0;
    
    
}

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

int main(){
	int n,x=0,m=0;
  	cin >> n;
  	for (int i=1;i<=n;i++){
      	int l=0,k=i;
      	for (int j=1;j<=n;j++){
        	if (k%2!=0)break;
          	k /= 2;
          	l++;
        }
      	if (l>=x) {
          	x=l;
          	m=i;
        }
    }
  	cout << m << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{long long int n;
cin>>n;
char s[4];
char s1[]="AC",s2[]="WA",s3[]="TLE",s4[]="RE";
long long int c1=0,c2=0,c3=0,c4=0;
while(n--){
    cin>>s;
    if( strcmp ( s, s1 )==0){
        c1++;
    }
    if(strcmp ( s, s2 )==0){
        c2++;
    }
    if(strcmp ( s, s3)==0){
        c3++;
    }
    if(strcmp ( s, s4 )==0){
        c4++;
    }
}
    cout<<"AC"<<" "<<"x"<<" "<<c1<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<c2<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<c3<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<c4<<endl;
    
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r; cin>>r;
    cout<<setp(12);
    cout<<(double)r*2*M_PI<<endl;
    return 0;
}


Measured memory_bytes: 3804
import sys

s = sys.stdin.readline().rstrip()
h = [0] * len(s)

start={}
d=0
for i,c in enumerate(s):
    if c=='\\':
        start[d] = i
        d -= 1;
    if c=='/':
        d += 1
        if start.get(d, -1)>=0:
            for j in range(start[d],i):
                h[j] += 1

print(sum(h))
narea=0
areas=''
ssum=0
for i in h:
    ssum += i
    if i==0:
        if ssum>0:
            narea+=1
            areas += ' ' + str(ssum)
            ssum=0

if narea>0: print(narea,areas,sep='')
else:       print(narea)



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

using namespace std;

int main(void)
{
    unsigned long long int N;
    cin >> N;
    
    if(N == 1){
        cout << 0 <<endl;
        return 0;
    }
    vector<bool> isPrime((int)sqrt(N) + 1, true);
    int maxv = sqrt(N);
    int ans = 0;
    for(int i = 2; i <= maxv; i++){
        if(isPrime[i] == false)    continue;
        int count = 0;
        while(N % i == 0){
            count++;
            N /= i;
        }
        if(count == 0)  continue;
        int sum = 0;
        for(int j = 1; (sum += j) <= count ; j++){
            ans++;
        }
        
        for(int j = i; j <= maxv; j+=i){
            isPrime[j] = false;
        }
    }
    if(N != 1)  ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3836
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var dish1 = Convert.ToInt32(input[0]);
        var weight1 = Convert.ToInt32(input[1]);
        var dish2 = Convert.ToInt32(input[2]);
        var weight2 = Convert.ToInt32(input[3]);

        if (dish1 + weight1 == dish2 + weight2) Console.WriteLine("Balanced");
        else if (dish1 + weight1 > dish2 + weight2) Console.WriteLine("Left");
        else Console.WriteLine("Right");
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
 
using namespace std;
 
int main()
{
	long long ans = 0;
	int N;
	cin >> N;
 
	vector<int> input[] = { vector<int>(N),vector<int>(N),vector<int>(N) };
 
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < N; j++)
		{
			cin >> input[i][j];
		}
 
		sort(input[i].begin(), input[i].end());
	}
 
	for (int i = 0; i < N; i++)
	{
		int x = input[1][i];
		
		long long a_count = upper_bound(input[0].begin(), input[0].end(), x - 1) - input[0].begin();
 
		long long c_count = input[2].end() - lower_bound(input[2].begin(), input[2].end(), x + 1);
		ans += a_count * c_count;
	}
	
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 1408
import java.util.*;
public class Main {
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N,M;
    N=sc.nextInt();
    M=sc.nextInt();
    int [] num_road = new int[N];
    for(int a=0;a<M;a++){
        int a_city =sc.nextInt();
        int b_city =sc.nextInt();
        num_road[a_city-1]++;
        num_road[b_city-1]++;
    }
    for(int b=0;b<N;b++){
        System.out.println(num_road[b]);
    }

}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int mod=1000000007;
ll dp[41][1<<17];
int main(){
    int n,x,y,z;
    cin>>n>>x>>y>>z;
    ll tot=1;
    rep(i,n) tot*=10,tot%=mod;
    int s=x+y+z,xyz=(1<<(x-1))|(1<<(x+y-1))|(1<<(s-1)),msk=(1<<s)-1;
    dp[0][0]=1;
    rep(i,n)rep(j,1<<s)if(dp[i][j]!=0)FOR(k,1,11){
        int nx=((j<<k)|(1<<(k-1)))&msk;
        if((nx&xyz)!=xyz){
            dp[i+1][nx]+=dp[i][j];
            dp[i+1][nx]%=mod;
        }
    }
    ll ut=0;
    rep(i,1<<s){
        ut+=dp[n][i];
        ut%=mod;
    }
    cout<<(tot-ut+mod)%mod<<endl;
    return 0;
}


Measured memory_bytes: 40192
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    int a;
    cin >> a;
    if (a >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

///Author:Refat(BSMRSTU)///

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 2e5 + 5;
const int M = 1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
ll ar[N],br[N];
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);
    int test=1;
    ll n,k,ans=-1,cnt,v;
    ///scanf("%d",&test);
    for(int cs=1; cs<=test; cs++) {
        scanf("%lld %lld",&n,&k);
        for(int i=1; i<=n; i++) {
            scanf("%lld",&ar[i]);
        }
        for(int i=1; i<=n; i++) {
            scanf("%lld",&br[i]);
        }
        sort(ar+1,ar+n+1);
        sort(br+1,br+n+1);
        if(k==0ll) {
            printf("%lld\n",max(ar[1]*br[n],ar[n]*br[1]));
        } else {
            reverse(ar+1,ar+n+1);
            ll l=0ll,r=ar[1]*br[n],mid,cnt;
            while(l<=r) {
                mid=(l+r)>>1ll;
                cnt=0ll;
                for(int i=1; i<=n; i++) {
                    cnt+=max(0ll,ar[i]-(mid/br[i]));
                }
                if(cnt<=k) {
                    r=mid-1;
                    ans=mid;
                } else {
                    l=mid+1;
                }
            }

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



Measured memory_bytes: 3328
#include <stdio.h>

int main(void) {
	int i,j,k,n,r,p,c;
	int card[50],buf[50];
	scanf("%d %d",&n,&r);
	while(n != 0){
		for(i=0,j=n;i<n;i++,j--){
			card[i] = j;
		}
		for(i=0;i<r;i++){
			scanf("%d %d",&p,&c);
			for(j=0;j<p-1;j++){
				buf[j] = card[j];
			}
			for(k=0;k<c;k++,j++){
				card[k] = card[j];
			}
			for(j=0;j<p-1;j++,k++){
				card[k] = buf[j];
			}
		}
		printf("%d\n",card[0]);
		scanf("%d %d",&n,&r);
	}
	return 0;
}

Measured memory_bytes: 600
/******

AUTHOR : RUDRANSH TRIPATHI, IIIT NAGPUR, CCID(rt24) & CFID(rsgt24)

MOTTO : Use criticism as fuel and you will never run out of energy.
        AIM : TO BECOME A BETTER CODER
        INTROSPECT + COURSE CORRECTIONS = CATALYST FOR SUCCESS
        Every moment is an opportunity to better yourself
        
*******/

#include<bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define pb push_back
#define mp make_pair
#define d(x) cout<<x<<"\n"

/*int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

int powermod(int A, int p, int MOD = mod){
    A%=MOD;
    int res  = 1;
    while(p){
        if(p&1)
            res = ((__int128)res*A)%MOD;
        
        A = ((__int128)A*A)%MOD;
        p>>=1;
    }

    return res;
}*/

int32_t main(void)
{
    fastio
    int t=1;
    while(t--)
    {
        int n;
        cin>>n;
        int ar[n];
        
        for(int i=0;i<n;i++)
        cin>>ar[i];
        //sort(ar,ar+n);
        
        if(n<3)
        {
            cout<<0<<"\n";
            continue;
        }
        int count=0;
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                for(int k=j+1;k<n;k++)
                {
                    if((ar[i]+ar[j]>ar[k]&&ar[k]+ar[j]>ar[i]&&ar[i]+ar[k]>ar[j])&&(ar[i]!=ar[j]&&ar[j]!=ar[k]&&ar[k]!=ar[i]))
                    {
                        count++;
                        //cout<<i+1<<j+1<<k+1<<"\n";
                    }
                }
            }
        }
        
        cout<<count<<"\n";
        
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second 

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)


ll gcd(ll a, ll b) 
{ 
    if (a == 0) return b; 
    return gcd(b % a, a); 
} 

int main(){
    
    fastio;

    ll t; t=1;
    while(t--){
        ll n,m;
        cin>>n>>m;
        ld a[n]; ld sum=0;
        rep(i,n){cin>>a[i]; sum+=a[i];}
        sort(a,a+n);
        if(m>n) cout<<"No";
        else{
            if(a[n-m]>=(double)(sum/(double)(4*m))) cout<<"Yes";
            else cout<<"No";
        }
    }
    return 0;
}

Measured memory_bytes: 256
//20
#include<iostream>
#include<algorithm>

using namespace std;

struct S{
  int o,f,m;
  void upd(int x){
    if(x<0){
      f-=x;
    }else{
      o=min(m,o+x);
    }
  }
};

int main(){
  for(int w,h;cin>>w>>h,w|h;){
    int f,m,o;
    cin>>f>>m>>o;
    int g[10][10];
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>g[i][j];
      }
    }
    int dp[11][10][51];
    fill(dp[0][0],dp[11][0],1<<30);
    for(int i=0;i<w;i++){
      dp[0][i][o]=0;
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	for(int k=2;k<=m;k++){
	  S c={k-1,dp[i][j][k],m};
	  c.upd(g[i][j]);
	  for(int l=j;;){
	    S ca=c;
	    for(int r=l;;){
	      S cb=ca;
	      for(int ll=r;;){
		S cc=cb;
		for(int rr=ll;;){
		  dp[i+1][rr][cc.o]=min(cc.f,dp[i+1][rr][cc.o]);
		  rr++;
		  cc.o--;
		  if(w<=rr||cc.o<1)break;
		  if(max(r,j)<rr){
		    cc.upd(g[i][rr]);
		  }
		}
		ll--;
		cb.o--;
		if(ll<0||cb.o<1)break;
		if(ll<l){
		  cb.upd(g[i][ll]);
		}
	      }
	      r++;
	      ca.o--;
	      if(w<=r||ca.o<1)break;
	      if(j<r){
		ca.upd(g[i][r]);
	      }
	    }
	    l--;
	    c.o--;
	    if(l<0||c.o<1)break;
	    c.upd(g[i][l]);
	  }
	}
      }
    }
    int r=*min_element(dp[h][0],dp[h+1][0]);
    if(r<=f){
      cout<<r<<endl;
    }else{
      cout<<"NA"<<endl;
    }
  }
  return 0;
}

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

int main() {
    int k;
    cin >> k;
    set<int> s;
    int a=7%k;
    int n=1;
    while (s.count(a)==0) {
        if (a%k==0) {
            cout << n << endl;
            return 0;
        }
        s.insert(a);
        a=(a*10+7)%k;
        n++;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 50476
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

#define MAX 100005


signed main(void) {
    int n, wei;
    cin >> n >> wei;
    vi w(n),v(n);
    rep(i,n) cin >> w[i] >> v[i];
    vector<vi> dp(n+1, vi(MAX, wei+1));
    dp[0][0] = 0;
    rep(i,n)rep(j,MAX)if(dp[i][j] <= wei){
        //cout << i << " " << j << " " << dp[i][j] << endl;
        dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        dp[i+1][j+v[i]] = min(dp[i+1][j+v[i]], dp[i][j]+w[i]);
    }
    int ans = 0;
    rep(j,MAX)if(dp[n][j] <= wei)ans = max(ans, j);
    cout << ans << endl;
}


Measured memory_bytes: 80260
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int a, b;
	for (; cin >> a >> b;)
	{
		cout << a + b << endl;
	}
}


Measured memory_bytes: 3068