akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long x = in.nextLong();
			long ans = 0;

			if (x % 11 == 0) {
				ans = x / 11 * 2;
			} else if (x % 11 <= 6) {
				ans = x / 11 * 2 + 1;
			} else {
				ans = x / 11 * 2 + 2;
			}

			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

	static void print(int[][] dp) {
		int n = dp.length;
		int m = dp[0].length;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				System.out.print(dp[i][j] + " ");
			}
			System.out.print("\n");
		}
		System.out.print("\n");
	}

}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，出現位置，DP
// 余事象，包除
// データ構造
// 問題の特徴量
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int N;cin >> N;
VI S(N-1), C(N-1), F(N-1); rep(i, 0, N-1) cin >> C[i] >> S[i] >> F[i];

rep(i, 0, N - 1){
    int t = S[i] + C[i];
    rep(j, i + 1, N - 1){
        if (t > S[j])
            t += (F[j] - t % F[j]) % F[j] + C[j];
        else 
            t = S[j] + C[j];
    }
    cout << t << "\n";
}

cout << "0\n";
}

// 境界，出力文字列 チェック



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,cnt = 0,ans = 1;
    string s;
    cin >> n >> s;
    rep(i, n){
        if (s[cnt] != s[i]) {
            ++ans;
            cnt = i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007


//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}


int main(){
	int n;
	scanf("%d", &n);
	int array[101];
	for(int i=0; i<n; i++){
		scanf("%d", &array[i]);
	}
	int sum=0, sqsum=0, mid, ans=0;
	for(int i=0; i<n; i++){
		sum += array[i];
		sqsum += array[i]*array[i];
	}
	mid = sum/n;
	ans = n*mid*mid -2*mid*sum + sqsum;
	int tmp = n*(mid+1)*(mid+1) -2*(mid+1)*sum + sqsum;
	if(tmp<ans) ans = tmp;
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 128
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n,a,b = readline() |> split |> parseMap
	if n == 1&&a!=b
		println(0)
	elseif a>b
		println(0)
	else
		println((b-a)*(n-2)+1)
	end
end
main()

Measured memory_bytes: 110444
import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  long L = sc.nextLong();
	  long R = sc.nextLong();
	  long ans = 2020;
	  boolean isZero = false;
	  
	  //2019の倍数があるか調べる
	  for(long i=L; i<=R; i++) {
		  if ( i %2019 == 0) {
			  isZero =true;
			  break;
		  }
	  }
	  if(!isZero) {
	  //なかった場合は全探索。最大でも2018*2017/2回で済む？
	  for(long i=L; i<R; i++) {
		  for(long j = i+1; j<=R; j++) {
			  long x = (i * j) %2019;
			  if(ans > x) ans = x;
		  }
	  }
	  }
	  
	  if(isZero) out.println(0);
	  else out.println(ans);
	  
  	}
  }	  

Measured memory_bytes: 21840
import sys
from itertools import combinations
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().strip().split()]
b = [int(x) for x in input().strip().split()]

all_cards = []
for i, (aa, bb) in enumerate(zip(a, b)):
    if i % 2:
        aa, bb = bb, aa
    all_cards.append([aa, bb, i])

def cnt(l):
    ret = 0
    for i in range(len(l)-1):
        for j in range(i+1, len(l)):
            if l[i][1] > l[j][1]:
                ret += 1
    return ret

ans = float('inf')
for cards in combinations(all_cards, (n + 1)// 2):
    acards = []
    for card in cards:
        acards.append([card[0],card[2]])
    bcards = []
    for card in all_cards:
        if [card[0],card[2]] not in acards:
            bcards.append([card[1],card[2]])

    acards.sort()
    bcards.sort()
    abcards = []
    # print(acards, bcards)
    for i in range(len(bcards)):
        abcards.extend([acards[i], bcards[i]])
    else:
        if n % 2:
            abcards.append(acards[-1])
    # print(abcards)
    if abcards != sorted(abcards, key=lambda x: x[0]):
        continue
    ans = min(ans, cnt(abcards))

if ans == float('inf'):
    ans = -1
print(ans)

Measured memory_bytes: 3188
#!/usr/bin/env python3
from collections import deque

INF = 10**9
k = int(input())

# (辺の伸びる先, コスト)
G = [((10 * i % k, 0), ((i + 1) % k, 1)) for i in range(k)]
s = 1

# 01 - BFS
dist = [INF] * k
S = deque([s])
T = deque()
dist[s] = 0

d = 0
while S:
    while S:
        v = S.popleft()
        for w, c in G[v]:
            if d + c < dist[w]:
                dist[w] = d + c
                if c:
                    T.append(w)
                else:
                    S.append(w)
    S, T = T, S
    d += 1

print(dist[0] + 1)

Measured memory_bytes: 30580
#include<bits/stdc++.h>
#define F first
#define S second
#define endl "\n"
#define Endl "\n"
#define lop(i,n) for(i=0;i<n;i++)
#define lop1(i,n) for(i=1;i<=n;i++)
#define lopxy(i,x,y) for(i=x;i<y;i++)
#define ll long long
#define vl vector<long long>
#define pll pair<long long,long long>
#define sl set<long long>
#define uset unordered_set<long long>
#define umap unordered_map
#define prq priority_queue
#define pqll priority_queue<ll> 
#define hell 1000000007
#define mod 998244353
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define N 100000
#define N2 200000
#define bpc(x) __builtin_popcount(x)
#define inf 1e16
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define D1(x) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<endl
#define D2(x,y) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define D3(x,y,z) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
using namespace std;
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return (power(x, y / 2) * power(x, y / 2)) % mod;
    else
        return ((x * power(x, y / 2)) % mod * power(x, y / 2)) % mod;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;  
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
  
// Returns nCr % p using Fermat's little theorem. 
ll fac[N+1]; 
void pre(ll p){
    fac[0] = 1; 
    for (ll i=1 ; i<=N; i++) 
        fac[i] = (fac[i-1]*i)%p; 
}
ll nCrModPFermat(ll n, ll r, ll p) 
{ 
   if (r==0) 
      return 1; 
    if(r>n)
      return 0;
    return (fac[n]* modInverse(fac[r], p) % p * modInverse(fac[n-r], p) % p) % p; 
}
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt.txt","r",stdin);
    freopen("output.txt.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    string s;
    cin>>s;
    if(s[s.length()-1]=='s'){
        cout<<s<<"es";
    }
    else cout<<s<<"s";

    cerr<<(1000*clock())/CLOCKS_PER_SEC<<"ms";
    return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
constexpr ll dx[]={1,0,-1,0};
constexpr ll dy[]={0,1,0,-1};
main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);
  
  ll h,w;
  cin>>h>>w;
  char a[h][w];
  queue<tuple<ll,ll,ll>> que;
  vector<vector<ll>> cost (h,vector<ll>(w,INF));
  rep(i,h)rep(j,w){
    cin>>a[i][j];
    if(a[i][j]=='#')que.emplace(i,j,0);
  }

  while(!que.empty()){
    ll x,y,t;
    tie(y,x,t)=que.front();
    que.pop();
    if( chmin(cost[y][x],t) ){
      rep(i,4){
        ll nx=x+dx[i],ny=y+dy[i],nt=t+1;
        if(nx==-1||nx==w||ny==-1||ny==h)continue;
        que.emplace(ny,nx,nt);
      }
    }
  }

  ll ans=0;
  rep(i,h)rep(j,w)chmax(ans,cost[i][j]);
  cout<<(ans)<<endl;


}


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

int main() {

  string b; cin >> b;
  if (b == "A") {
    cout << "T" << endl;
  }
  else if (b == "C") {
    cout << "G" << endl;
  }
  else if (b == "G") {
    cout << "C" << endl;
  }
  else {
    cout << "A" << endl;
  }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
	#include <ext/pb_ds/assoc_container.hpp> 
	#include <ext/pb_ds/tree_policy.hpp> 
	#define ll long long
	#define MP make_pair
	#define PB push_back
	#define PF push_front
	#define F first
	#define S second
	#define endl "\n"
	#define pi 3.14159265358979323846264338327950288
	#define MOD 1000000
	#define INF -100000000000000
	#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	using namespace std;
	#define lld long double
	using namespace __gnu_pbds;
	ll int setbits(ll int n) 
	{ 
	    ll int count = 0; 
	    while (n) { 
	        count += n & 1; 
	        n >>= 1; 
	    } 
	    return count; 
	} 
	int main()
	{
	    fast;
	   // #ifndef ONLINE_JUDGE
	   // freopen("input.txt", "r", stdin);
	   // freopen("output.txt", "w", stdout);
	   // #endif
	  	ll int n;
	  	cin>>n;ll int i,j,k,z;map<ll int,ll int> mp;
	  	for(i=1;i<=n;i++)
	  	{
	  		for(j=1;j<=n;j++)
	  		{
	  			for(k=1;k<=n;k++)
	  			{
	  				z=i*i+j*j+k*k+i*j+j*k+k*i;
	  				if(z>n)
	  					break;
	  				else
	  					mp[z]++;
	  			}
	  		}
	  	}
	  	for(i=1;i<=n;i++)
	  		cout<<mp[i]<<endl;
	  }


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


struct BIT{
  vll tree;
  ll n;

  BIT(ll n_):tree(n_+1,0),n(n_){
  }

  ll cumulativeSum(ll i){
    ll s=0;
    while(i>0){
      s += tree[i];
      i -= i&-i;
    }
    return s;
  }

  //[l, r)
  ll sum(ll l, ll r){
    ll res = cumulativeSum(r) - cumulativeSum(l);
    return res;
  }

  void add(ll i, ll x){
    i++;
    while(i<=n){
      tree[i] += x;
      i += i&-i;
    }
  }
};




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

  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll q;
  cin>>q;

  vector<BIT> bit(26, BIT(n));
  REP(i,n){
    ll x=s[i]-'a';
    bit[x].add(i,1);
  }

  REP(i,q){
    ll query;
    cin>>query;
    if(query==1){
      ll iq;
      char cq;
      cin>>iq>>cq;
      iq--;

      ll x=s[iq]-'a';
      s[iq]=cq;
      bit[x].add(iq,-1);
      bit[cq-'a'].add(iq,1);
    }
    else{
      ll l, r;
      cin>>l>>r;
      l--;
      r--;

      ll ans=0;
      REP(j,26){
        ll sum=bit[j].sum(l,r+1);
        if(sum!=0)
          ans++;
      }
      cout<<ans<<endl;
    }
  }


}


Measured memory_bytes: 106524
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n, m, x;
	cin >> n >> m >> x;
	Vec c(n);
	Vec2<ll> a(n, Vec(m));

	rep(i, n){
		cin >> c[i];
		rep(j, m) cin >> a[i][j];
	}

	ll ans = LINF;
	Vec bits(n + 1);
	rep(i, n + 1) bits[i] = pow2(i);
	rep(bit, bits[n]){
		Vec s(m);
		ll sum = 0;
		rep(i, n) if(bit & bits[i]){
			sum += c[i];
			rep(j, m) s[j] += a[i][j];
		}

		bool flg = true;
		rep(i, m) flg &= s[i] >= x;
		if(flg) chmin(ans, sum);
	}
	if(ans == LINF) co(-1);
	else co(ans);

	return 0;
}


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

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = (b-a+1) - (b/c-(a-1)/c) - (b/d-(a-1)/d) + (b/(c*d/__gcd(c,d))-(a-1)/(c*d/__gcd(c,d)));
    cout << ans << endl;
}

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

int atk[100005], datk[100005];

int main() { 
    int N, H, cnt = 0, maks = 0;
    cin >> N >> H;
    for(int i=1; i<=N; i++){
        cin >> atk[i] >> datk[i];
        if(atk[i] > maks){
            maks = atk[i];
        }
    }
    sort(datk, datk + N);
    for(int i=N; i>=1; i--){
        if(datk[i] > maks){
            cnt++;
            H-= datk[i];
            if(H <= 0) break;
        }
    }

    if(H < 0){
        cout << cnt << endl;
    } else if(H % maks == 0){
        cout << cnt + H/maks << endl;
    } else{
        cout << cnt + H/maks + 1 << endl;
    }
}

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

int n,ans=1,x,y,t,tx,ty,tt;

int main(){
	cin>>n;
	for(int i=1,d;i<=n;++i)
	{
		scanf("%d%d%d",&tt,&tx,&ty);
		d=fabs(tx-x)+fabs(ty-y);
		if(!(tt-t>=d&&(tt-t-d)%2==0)) {ans=0; break;}
		x=tx; y=ty; t=tt;
	}
	if(ans) cout<<"Yes"; else cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

const int maxn = 200000 + 5;
int a[maxn];
int n, k;
inline void work() {
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = k + 1, j = 1; i <= n; ++i, ++j) {
        if (a[i] <= a[j]) {
            cout << "No" << endl;
        } 
        else {
            cout << "Yes" << endl;
        }
    } 
}

int main() {
    // freopen(".txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 4424
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

}

Measured memory_bytes: 256
N, M = map(int, input().split())
p = [int(i) for i in input().split()]

v = [[] for _ in range(N)]
for _ in range(M) :
    x, y = map(int, input().split())
    v[x-1].append(y-1)
    v[y-1].append(x-1)
    
ret = 0
visited = [False] * N
for i in range(N) :
    if visited[i] :
        continue
    
    q = [i]
    visited[i] = True
    a = [i+1]
    b = [p[i]]
    
    while q :
        cur = q.pop()
        for nex in v[cur] :
            if visited[nex] :
                continue
            q.append(nex)
            a.append(nex+1)
            b.append(p[nex])
            visited[nex] = True
    ret += len(set(a) & set(b))
print(ret)

Measured memory_bytes: 99436
using System;
using System.Linq;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int H = int.Parse(input[0]);
    int W = int.Parse(input[1]);
    
    Console.WriteLine(new string('#', W + 2));
    for (int i = 0; i < H; i++) {
      Console.WriteLine('#' + Console.ReadLine() + '#');
    }
    Console.WriteLine(new string('#', W + 2));
  }
}


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

int N;
LL A,B,X[100005];
LL DP[100005];

void solve()
{
    LL ans = 0;
    for(int i=2;i<=N;i++)
    {
        LL cnt = X[i] - X[i-1];
        //printf("%lld\n", cnt);
        ans += min(cnt*A,B);
    }
    printf("%lld\n",ans);
}
int main()
{
    scanf("%d%lld%lld", &N, &A, &B);
    for(int i=1;i<=N;i++) scanf("%lld", &X[i]);
    solve();
    //system("pause");
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		scan.close();
		System.out.println(a*b/2);
	}
}


Measured memory_bytes: 21844
from itertools import groupby, accumulate, product, permutations, combinations
def calc(x,X):
  n = len(x)
  if n==0:
    return 10**10
  ans = abs(sum(x)-X)+(n-1)*10
  return ans

def solve():
  ans = 10**10
  N, A, B, C = map(int, input().split())
  L = [int(input()) for _ in range(N)]
  for p in product(['A','B','C','D'],repeat=N):
    a,b,c = [],[],[]
    cnt = 0
    for i in range(N):
      if p[i]=='A':
        a.append(L[i])
      elif p[i]=='B':
        b.append(L[i])
      elif p[i]=='C':
        c.append(L[i])
    cnt += calc(a,A)+calc(b,B)+calc(c,C)
    ans = min(ans,cnt)
  return ans
print(solve())

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

class BIT:
    """ 区間加算BIT(区間加算・区間合計取得) """
 
    def __init__(self, N):
        # 添字0が使えないので、内部的には全て1-indexedとして扱う
        N += 1
        self.N = N
        self.data0 = [0] * N
        self.data1 = [0] * N
 
    def _add(self, data, k, x):
        k += 1
        while k < self.N:
            data[k] += x
            k += k & -k
 
    def _get(self, data, k):
        k += 1
        s = 0
        while k:
            s += data[k]
            k -= k & -k
        return s
 
    def add(self, l, r, x):
        """ 区間[l,r)に値xを追加 """
 
        self._add(self.data0, l, -x*(l-1))
        self._add(self.data0, r, x*(r-1))
        self._add(self.data1, l, x)
        self._add(self.data1, r, -x)
 
    def query(self, l, r):
        """ 区間[l,r)の和を取得 """
 
        return self._get(self.data1, r-1) * (r-1) + self._get(self.data0, r-1) \
             - self._get(self.data1, l-1) * (l-1) - self._get(self.data0, l-1)

def main():
    N, D, A = map(int, input().split())
    B = []

    for i in range(N):
        x, h = map(int, input().split())
        B.append((x,h))

    B.sort()
    X = [0] * N
    H = [0] * N
    for i in range(N):
        X[i], H[i] = B[i]

    bit = BIT(N)
    ans = 0
    for i in range(N):
        H[i] -= bit.query(i, i+1)
        if H[i] <= 0:
            continue
        cnt = H[i] // A if H[i] % A == 0 else H[i] // A + 1
        index = bisect_right(X, X[i] + 2 * D)
        bit.add(i, index, cnt * A)
        ans += cnt

    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 74460
import itertools

n, m = map(int, input().split())
switches = []
for i in range(m):
  switches.append(input())
lights = list(map(int, input().split()))

switch = [0, 1]
lists = list(itertools.product(switch, repeat=n))
count = 0
for l in lists:
  for i in range(m):
    on = 0
    switches_list = list(map(int, switches[i].split()))
    switch_num = lights[i]
    repeat_num = switches_list[0] + 1
    for j in range(1, repeat_num):
      switch_pos = switches_list[j] - 1
      on += l[switch_pos]
    if on % 2 != switch_num:
      break
    if i == m - 1:
      count += 1
print(count)

Measured memory_bytes: 9304
#include <bits/stdc++.h> 
using namespace std; 
const int MAX_N = 2e5 + 5;
int n, a[3];
char s[MAX_N][10];
int ans[MAX_N]; 
int main() {
	scanf("%d", &n); 
	for (int i = 0; i < 3; i++) scanf("%d", a + i); 
    bool flag = 0; 
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    for (int i = 1; i <= n; i++) {
        int x = s[i][1] - 'A', y = s[i][2] - 'A';
        if (a[x] < a[y]) a[x]++, a[y]--, ans[i] = x;
        else if (a[y] < a[x]) a[x]--, a[y]++, ans[i] = y; 
        else { 
            if (a[x] == 1 && !a[3 - x - y]) { 
                if (i == n || (s[i + 1][1] != 3 - x - y + 'A' && s[i + 1][2] != 3 - x - y + 'A')) { 
                    a[x]--, a[y]++, ans[i] = y; 
                } else {
                    int x1 = s[i + 1][1] - 'A', x2 = s[i + 1][2] - 'A';
                    if (x1 == x || x2 == x) ans[i] = x, a[x]++, a[y]--;
				    else ans[i] = y, a[x]--, a[y]++;
				}
			}
			else a[x]--, a[y]++, ans[i] = y; 
		} 
		if (a[x] < 0 || a[y] < 0) { flag = 1; break; }
    } 
	if (!flag) { 
		puts("Yes"); 
		for (int i = 1; i <= n; i++) printf("%c\n", ans[i] + 'A'); 
	} else puts("No"); 
	return 0;
}

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

#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end());
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int K, T;
int a[110];
signed main() {
    cin >> K >> T;
    int ans = 0;
    rep(i, T) {
        cin >> a[i];
        chmax(ans, (a[i] - 1) - (K - a[i]));
    }
    cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    int h[N];
    for(int i = 0; i < N; i++){
        cin >> h[i];
    }
    int count = 0;
    int m = 0;
    for(int i = 0; i < N; i++){
        if(m <= h[i]){
            count++;
        }
        m = max(m,h[i]);
    }
    cout << count << endl;

}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n, f= 0;
    cin>> n;
    string s, p;
    set < string > uni;

    cin>> p;
    uni.insert(p);
    for(int i=1; i<n; i++)
    {
        cin>> s;
        uni.insert(s);

        if (s[0]!= p[p.size()-1])
            f= -1;

        p= s;
    }


    if( f== -1 || uni.size()!= n)
        cout << "No\n";
    else
        cout << "Yes\n";

    return 0;
}




Measured memory_bytes: 3628
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
using lint = long long;

int main()
{

    lint n;
    scanf("%lld", &n);

    std::vector<lint> a(n);
    std::vector<lint> b(n);

    std::vector<std::pair<lint, lint>> ab(n);

    for (int i = 0; i < n; ++i)
    {
        lint a_e, b_e;
        scanf("%lld", &a_e);
        scanf("%lld", &b_e);

        a[i] = a_e;
        b[i] = b_e;
        ab[i] = std::make_pair(-a_e - b_e, i);
    }

    std::sort(ab.begin(), ab.end());

    lint ans_a = 0;
    lint ans_b = 0;
    for (int i = 0; i < n; ++i)
    {
        lint idx = ab[i].second;
        if (i % 2 == 0)
        {
            ans_a += a[idx];
        }
        else
        {
            ans_b += b[idx];
        }
    }

    printf("%lld", ans_a - ans_b);

    return 0;
}


Measured memory_bytes: 3328
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-05-17 21:05:31 +0900
# LastModified: 2020-05-17 21:12:00 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    k = int(input())
    s = input()
    if k<len(s):
        print("{}...".format(s[:k]))
    else:
        print(s)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9172
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MaxN = 2e5, MaxM = 4e6;
int X, all, tot;
int pre[MaxM + 5], last[MaxN + 5], other[MaxM + 5], cost[MaxM + 5];
int dis_1[MaxN + 5], dis_2[MaxN + 5];
int seq[MaxM + 5];
bool Inseq[MaxN + 5];
struct EDGE {
	int u, v, w;
}edge[MaxM + 5];

void Build(int x, int y, int w)
{
	pre[++all] = last[x];
	last[x] = all;
	other[all] = y;
	cost[all] = w;
}

void Init()
{
	all = -1; memset(last, -1, sizeof(last));
	tot = 0;
	for (int i = 0; i < X; i++) {
		for (int d = 0; d <= 9; d++) {
			int now = (i * 10 + d) % X;
			Build(i, now, d);
			edge[++tot].u = i;
			edge[tot].v = now;
			edge[tot].w = d;
		}
	}
}

void Spfa(int s, int dis[])
{
	for (int i = 0; i <= X; i++) dis[i] = 1 << 30; 
	dis[s] = 0; memset(Inseq, 0, sizeof(Inseq));
	int head = 1, tail = 0;
	seq[++tail] = s; Inseq[s] = true;
	while (head <= tail) {
		int now = seq[head];
		int ed = last[now], dr;
		while (ed != -1) {
			dr = other[ed];
			if (dis[now] + cost[ed] < dis[dr]) {
				dis[dr] = dis[now] + cost[ed];
				if (!Inseq[dr]) {
					seq[++tail] = dr;
					Inseq[dr] = true;
				}
			}
			ed = pre[ed];
		}
		head++;
		Inseq[now] = false;
	}
}

void Solve()
{
	Spfa(0, dis_1);
	all = -1; memset(last, -1, sizeof(last));
	for (int i = 1; i <= tot; i++) Build(edge[i].v, edge[i].u, edge[i].w);
	Spfa(0, dis_2);
	int ans = 1 << 30;
	for (int i = 1; i <= X - 1; i++) ans = min(ans, dis_1[i] + dis_2[i]);
	printf("%d\n", ans);
}

int main()
{
	while (~scanf("%d", &X)) {
		Init();
		Solve();
	}
	return 0;
}

Measured memory_bytes: 39040
n, k = map(int, input().split())
d = list(map(int, input().split()))

s = set(d)

N = str(n)
flag = 1
for i in N:
    if int(i) in s:
        flag = 0

if flag:
    print(n)
else:
    while True:
        n += 1
        N = str(n)
        flag = 1
        for i in N:
            if int(i) in s:
                flag = 0
        if flag:
            print(n)
            break

Measured memory_bytes: 3064
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(ll __x = __start; __x < __end; __x++)

const ll MOD = 1000000007;
int main() {
  int n, k; cin >> n >> k;
  ll ans = 0;
  vector<ll> acc(n+2, 0);
  loop(i,0,n+1) acc[i+1] = acc[i] + i;
  
  loop(i,k,n+2) {
    ll min_ = acc[i];
    ll max_ = (acc[n+1] - acc[n-i+1]);
    ans += max_ - min_ + 1;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           var l1 = Console.ReadLine().ToArray();
           var l2 = Console.ReadLine().ToArray();
           var l3 = Console.ReadLine().ToArray();

            var result = l1[0].ToString() + l2[1].ToString() + l3[2].ToString();
            Console.WriteLine(result);

        }
    }
}


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

int main(){
  string s="lll";
  rep(i,3){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  if(s == "abc"){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}
      
  
        
        
        
    
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;


template <class Abel> struct BIT {
    vector<Abel> dat;
    Abel UNITY_SUM = 0;                        // to be set

    /* [1, n] */
    BIT(int n) : dat(n + 1, UNITY_SUM) { }
    void init(int n) { dat.sssign(n + 1, UNITY_SUM); }

    /* a is 1-indexed */
    inline void add(int a, Abel x) {
        for (int i = a; i < (int)dat.size(); i += i & -i)
            dat[i] = dat[i] + x;
    }

    /* [1, a], a is 1-indexed */
    inline Abel sum(int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[i];
        return res;
    }

    /* [a, b), a and b are 1-indexed */
    inline Abel sum(int a, int b) {
        return sum(b - 1) - sum(a - 1);
    }

    /* debug */
    void print() {
        for (int i = 1; i < (int)dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};


int N, M, Q;
typedef pair<int, int> pint;
typedef pair<pint, int> ipint;
vector<ipint> ins;
vector<int> alts;

bool cmp(ipint a, ipint b) {
    return make_pair(a.first.second, a.second) < make_pair(b.first.second, b.second);
}

int main() {
    cin >> N >> M >> Q;
    ins.resize(M+Q);
    alts.clear();
    for(int i = 0; i < M + Q; ++i) {
        cin >> ins[i].first.first >> ins[i].first.second;
        ++ins[i].first.second;
        if (i < M) ins[i].second = -1; else ins[i].second = i - M;
        alts.push_back(ins[i].first.first), alts.push_back(ins[i].first.second);

    }

    sort(alts.begin(), alts.end());
    alts.erase(unique(alts.begin(), alts.end()), alts.end());
    sort(ins.begin(), ins.end(), cmp);

    for (int i = 0; i < M + Q; ++i) {
        int left = lower_bound(alts.begin(), alts.end(), ins[i].first.first) - alts.begin();
        int right = lower_bound(alts.begin(), alts.end(), ins[i].first.second) - alts.begin();
        ins[i].first.first = left + 1;
        ins[i].first.second = right + 1;

    }

    BIT<int> bit( (M+Q)*2 + 10 );
    vector<int> res(Q);
    for (int i = 0; i < M + Q; ++i) {
        if (ins[i].second == -1) bit.add(ins[i].first.first, 1);
        else res[ins[i].second] = bit.sum(ins[i].first.first, ins[i].first.second);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;

}


Measured memory_bytes: 10988
// @Author :- Gaurav Bharti
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define jaldibazi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007


int main(){
	jaldibazi;

	ll ans =0;
	string s; cin >> s;

	for(ll i = 0 ; i< s.length() ; ++i) {
		ans += (s[i]-'0');
	}

	if(ans%9==0) {
		cout << "Yes\n";
	}
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 3740
#include <cstdio>

int main()
{
    int i, j, k;
    int n, x;
    int sum;
    int c = 0;
    while (1)
    {
        c = 0;
        scanf("%d %d", &n, &x);
        if (n == 0 && x == 0)
        {
            break;
        }
        for (i = 1; i <= n; i++)
        {
            for (j = i + 1; j <= n; j++)
            {
                for (k = j + 1; k <= n; k++)
                {
                    sum = (i + j + k);
                    if (sum == x)
                    {

                        c += 1;
                    }
                }
            }
        }
        printf("%d\n", c);
    }
}


Measured memory_bytes: 2704
#include<iostream>
#include<vector>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
    string S, T;
    int N = 0;
    cin >> S >> T;
    for (int i = 0; i < 3; i++) {
        if (S.at(i) == T.at(i)) {
            N++;
        }
    }
    cout << N << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    LL H,N;cin >> H >> N;
    vector<LL> A(N);
    rep(i,N)cin >> A[i];
    LL res = 0;
    rep(i,N)res += A[i];
    if(H > res)cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

int main()
{
    int n,m,X,Y;
    cin >> n >> m >> X >> Y;
    int x[n],y[m],flag = 1;
    for(int i = 0; i < n; i++)
        cin >> x[i];
    for(int i = 0; i < m; i++)
        cin >> y[i];

    sort(x,x+n),sort(y,y+m);

    for(int i = X + 1; i <= Y; i++)
        if(x[n-1] < i && y[0] >= i) flag = 0;

    cout << (flag == 0 ? "No War" : "War") << endl;
    
    return 0;
}

Measured memory_bytes: 256
/*
 * Author       : YangDavid
 * Created Time : 2019年08月25日 星期日 22时41分33秒
 */

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int maxn = 222222;
int n, h, w, fa[maxn], vis[maxn];
struct item {
    int r, c, w;
    bool operator < (const item& rhs) const { return w > rhs.w; }
} a[maxn];
int find(int x) { return x==fa[x] ? x : fa[x] = find(fa[x]); }

int main() {
    scanf("%d%d%d", &n, &h, &w);
    rep(i, h + w) fa[i] = i;

    ll ans = 0;
    rep(i, n) scanf("%d%d%d", &a[i].r, &a[i].c, &a[i].w);
    sort(a + 1, a + n + 1);
    rep(i, n) {
        int p1 = find(a[i].r), p2 = find(a[i].c + h);
        if(vis[p1] && vis[p2]) continue;
        ans += a[i].w;
        if(p1 == p2) vis[p1] = true;
        else {
            if(vis[p1]) vis[p2] = true;
            else if(vis[p2]) vis[p1] = true;
            else fa[p2] = p1;
        }
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 4224
N = str(input())

def Main(N):
    c = N[-1]
    n = int(c)
    if n in [2,4,5,7,9]:
        return 'hon'
    elif n in [0,1,6,8]:
        return 'pon'
    else:
        return 'bon' 

print(Main(N))


Measured memory_bytes: 9196
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	a := nextInt()
	b := nextInt()
	c := nextInt()
	if a+b >= c && a <= c {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int main(){
    ll A;
    string B;
    cin>>A>>B;
    B.erase(B.find('.'),1);
    ll B2 = stoi(B);

    cout<<(A*B2)/100;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
 
int main() {
    int c,i,alphabet_num[26]={0};
    char alphabet[26] = "abcdefghijklmnopqrstuvwxyz";
     
    while((c = getchar()) != EOF) {
        if(c >= 'A' && c <= 'Z') {
            c = c - 'A' + 'a';
        }
        if(c >= 'a' && c <= 'z') {
            for(i = 0;i < 26;i++) {
                if(c == 'a' + i) {
                    alphabet_num[i] += 1;
                    break;
                }
            }
        }
    }
    for(i = 0; i< 26; i++) {
        printf("%c : %d\n", alphabet[i], alphabet_num[i]);
    }
    return 0;
}


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

vector<ll> Path(200001);
ll Max = 0;
ll idx = 0;
bool grid[200001];

ll N;
vector<vector<ll>> G;

int dfs(ll x, ll cnt){
    bool flag = true;
    for(auto v : G[x]){
        if(!grid[v]){
            grid[v] = true;
            flag = false;
            dfs(v, cnt+1);
        }
    }
    if(flag) {
        if(Max < cnt){
            Max = cnt;
            idx = x;

        }
    }
    return 0;

}

int main(){
    cin >> N;
    G.resize(N); 
    for(int i = 0;i < N-1; i++){
        ll a, b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    // 最長パス
    vector<bool> DP(N);
    DP[1] = DP[4] = false;
    DP[2] = DP[3] = true;
    for(int i = 5; i < N; i++){
         if(i % 3 == 1) DP[i] = false;
         else DP[i] = true;
    }
    if(N <= 4){
        if(N == 2) cout << "second" << endl;
        else cout << "First" << endl;
        return 0;
    }

    
    memset(grid, false, sizeof(grid)); grid[0] = true;
    dfs(0, 0);
    memset(grid, false, sizeof(grid)); grid[idx] = true;
    dfs(idx, 0);
    if(DP[Max]) cout << "First" << endl;
    else cout << "Second" << endl;


}

Measured memory_bytes: 22400
N, M = [int(i) for i in input().split()]

if N == 1 and M == 1:
    print(1)
elif N == 1:
    print(M - 2)
elif M == 1:
    print(N - 2)
else:
    print(N * M - ((N - 2) * 2 + (M - 2) * 2) - 4)



Measured memory_bytes: 2940
using System;
using System.Linq;

namespace ITP1_1_E
{
    class Program
    {
        public static void Main()
        {
            int[] val = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            string str = "a == b";

            if (val[0] < val[1])
                str = "a < b";
            else if (val[0] > val[1])
                str = "a > b";

            Console.WriteLine(str);
        }
    }
}



Measured memory_bytes: 16368
#include <stdio.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

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

  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  ll tot = accumulate(a.begin(), a.end(), 0);
  if (a[m - 1] * 4 * m < tot) {
    cout << "No";
  } else {
    cout << "Yes";
  }
}


Measured memory_bytes: 256