akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

int prime_factorization(ll n){
    vector<ll> v;
    ll num = n;
    for(ll i=2; i*i<=n; i++){
        while(num % i == 0){
            num /= i;
            v.emplace_back(i);
        }
    }

    if(num != 1){
        v.emplace_back(num);
    }

    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());

    return v.size();
}

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

    ll a, b; cin>>a>>b;
    ll ab_gcd = __gcd(a, b);

    int ans = prime_factorization(ab_gcd) + 1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import itertools
n,*abc=map(int,input().split())
l=[int(input()) for i in range(n)]
inf=100000000000000
mi=inf
for i in list(itertools.product([i for i in range(3)],repeat=n)):
    sub=[[] for j in range(3)]
    for j in range(n):
        sub[i[j]].append(j)
    mi_sub=0
    for j in range(3):
        l_sub=len(sub[j])
        if l_sub==0:
            mi_sub=inf
            break
        mi_subsub=inf
        for k in range(2**l_sub):
            mi_subsubsub=[0,0]
            for l_subsub in range(l_sub):
                if ((k>>l_subsub) &1):
                    mi_subsubsub[0]+=1
                    mi_subsubsub[1]+=l[sub[j][l_subsub]]
            if mi_subsubsub[0]!=0:
                mi_subsub=min(mi_subsub,abs(mi_subsubsub[1]-abc[j])+mi_subsubsub[0]*10-10)
        mi_sub+=mi_subsub
    mi=min(mi,mi_sub)
print(mi)


Measured memory_bytes: 3828
#include<stdio.h>
int main(void)
{
  int i,good=0,need=0;
  char str[8];
  
  fgets(str,sizeof(str),stdin);
  
  for(i=0;i<3;i++)
  {
    if(str[i] == str[i+1])
    {
      good++;
    }
  }
  if(str[1] == str[2])
  {
    need++;
  }

  if((need != 0)&&(good > 1))
  {
    puts("Yes");
  }else
  {
    puts("No");
  }
  
  return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

ll dfs(ll now, ll par, Graph &G, vector<ll> &A){

  if((int)G[now].size()==1 and par != -1){
    return A[now];
  }

  vector<ll> C;
  ll ma = 0;
  ll P = 0;
  for(auto next: G[now]){
    if(next == par) continue;
    ll val = dfs(next, now, G, A);
    C.push_back(val);
    P += val;
    chmax(ma, val);
  }

  if(par == -1){
    if(P!=A[now]){
      cout << "NO" << endl;
      exit(0);
    }
    return 1;
  }

  ll t = P - A[now];
  ll s = 2*A[now] - P;

  // dump(now)
  // dump(P)
  // dump(t)
  // dump(s)

  if(t<0 or s<0){
    cout << "NO" << endl;
    exit(0);
  }

  ll pos;
  if(ma>=P/2) pos = P-ma;
  else pos = P/2;

  if(pos<t){
    cout << "NO" << endl;
    exit(0);
  }

  // for(auto c: C){
  //   if(t>0 and c>t){
  //     cout << "NO" << endl;
  //     exit(0);
  //   }
  // }

  return s;
}

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

  ll N;
  cin >> N;
  Graph G(N);
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  REP(i, N-1){
    ll a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  ll r = -1;
  REP(i, N){
    if((int)G[i].size()==1) r = i;
  } 

  dfs(r, -1, G, A);

  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 23500
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

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

        int N = scanner.nextInt();
        int D = scanner.nextInt();
        int X = scanner.nextInt();
        ArrayList<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(scanner.nextInt());
        }
        scanner.close();

        int count = 0;
        for (int a : A) {
            for (int i = 0; i < D; i++) {
                if ((a * i + 1) > D) {
                    break;
                }
                count++;
            }
        }

        System.out.println(count + X);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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; }



void solve(long long N, std::vector<long long> B){
	ll ans = B[0]+B[N-2];
	REP(i, N-2) {
		ans += min(B[i], B[i+1]);
	}
	cout << ans << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> B(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(B));
    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

ll gcd(ll a,ll b){
	if(a<b){
		swap(a,b);
	}

	while(ll r=(a%b)){
		a = b;
		b = r;
	}
	return b;
}

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

	int N=in();
	vector<int> A(N);
	REP(i,N){
		A[i] = in();
	}
	vector<int> L(N),R(N);
	L[0] = A[0],R[N-1] = A[N-1];
	for(int i=1;i<N;i++){
		L[i] = gcd(L[i-1],A[i]);
		R[N-1-i] = gcd(R[N-i],A[N-1-i]);
	}
	int maxG = 0;
	for(int i=0;i<N;i++){
		if(i==0) maxG = max(maxG,R[1]);
		else if(i==N-1) maxG = max(maxG,L[N-2]);
		else maxG = max(maxG,(int)gcd(L[i-1],R[i+1]));
	}

	cout << maxG << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>

int main()
{
	int input_a, input_b, input_c;
	int count_divisers = 0;

	std::cin >> input_a >> input_b >> input_c;

	for (int i = input_a; i <= input_b; i++)
	{
		if (input_c % i == 0)
		{
			count_divisers++;
		}
	}
	
	std::cout << count_divisers << std::endl;

	return 0;
}


Measured memory_bytes: 3104
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

def comb(n,r):
  return math.factorial(n)//math.factorial(r)//math.factorial(max(1,n-r))

def con(t):
  ans = ""
  for i in t:
    ans+=i[0]+str(i[1])
  return ans

n = readInt()
d = defaultdict(int)
for i in [input() for i in range(n)]:
  t = defaultdict(int)
  for j in i:
    t[j]+=1
  d[con(sorted(t.items()))]+=1
ans = 0
for i in d:
  ans+=comb(d[i],2)

print(ans)

Measured memory_bytes: 30536
#include<stdio.h>

int main(){
    int H, W;
    while(1){
        scanf("%d %d", &H, &W);
        if ((H && W) == 0){
            break;
        }for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(i == 0 || (i + 1) == H){
                    printf("#");
                }else{
                    if(j == 0 || (j + 1) == W){
                        printf("#");
                    }else{
                        printf(".");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



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

int main(){
    int N,Y;
    cin >> N >> Y;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N-i;j++){
            if(Y == 10000*i + 5000*j + 1000*(N-i-j)){
                cout << i <<' '<<j << ' '<<N-i-j << endl;
                return 0;
            }
        }
    }
    cout << -1 << ' '<<-1 << ' '<< -1<<endl;
}


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

int n, m, x, mn=1e9, c[15], a[15][15];
int main() {
	int i, j, k;
	cin >> n >> m >> x;
	for(i=0; i<n; i++) {
		cin >> c[i];
		for(j=0; j<m; j++) cin >> a[i][j];
	}
	for(k=0; k<1<<n; k++) {
		int sc=0, sa[15]={};
		for(i=0; i<n; i++) {
			if(k>>i & 1) {
				sc += c[i];
				for(j=0; j<m; j++) sa[j] += a[i][j];
			}
		}
		for(j=0; j<m; j++) if(sa[j] < x) break;
		if(j==m) mn = min(mn, sc);
	}
	cout << (mn==1e9 ? -1 : mn);
	return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int h[] = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = in.nextInt();
        }
        
        for (int i = 0; i < n - 1; i++) {
            if (h[i + 1] < h[i]) {
                System.out.println("No");
                return;
            }

            if (h[i + 1] > h[i]) {
                h[i + 1]--;
            }
        }

        System.out.println("Yes");
    }
}

Measured memory_bytes: 50344
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    ll A,B,N;
    cin >> A >> B >> N;
    
    ll x = min(B-1,N);
    ll ans = (A*x)/B - A*(x/B);
    cout << ans << endl; 
}


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


using namespace std;


int main(void){
    string s;
    int a,b;
    
    cin>>a>>b;
    cin>>s;
    
    for(int i=0;i<a;i++){
        if(s[i]>='0'&&s[i]<='9'){
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s[a]=='-'){
    }else{
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=a+1;i<a+b+1;i++){
        if(s[i]>='0'&&s[i]<='9'){
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

mod = 1000000007
INF = 110110110

N = int(input())
A = list(map(int, input().split()))
PA = []
for i in range(N):
    PA.append((A[i], i))
PA.sort(reverse=True)

dp = [[0 for j in range(N+1)] for i in range(N+1)]

for i in range(N+1):
    for j in range(N+1):
        dp[i][j] = -INF * INF

dp[0][0] = 0

for i in range(N):
    for j in range(N):
        if i+j >= N:
            continue
        w = PA[i+j][0]
        at = PA[i+j][1]
        dp[i+1][j] = max(dp[i+1][j], dp[i][j] + w * abs(at - i))
        dp[i][j+1] = max(dp[i][j+1], dp[i][j] + w * abs(at - (N-1-j)))
ans = 0
for i in range(N+1):
    for j in range(N+1):
        ans = max(ans, dp[i][j]);
print(ans)


Measured memory_bytes: 101760
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
long long a[100005]={0,1,2,3,4,5,6,7,8,9};
int main()
{
	int k;
	cin >> k;
	int tot=9;
	int p1=0,p2=1;
	while(tot<=k){
		if(abs(a[p2]%10-a[p1])<=1)
		  a[++tot]=a[p2]*10+a[p1];
		p1++;
		if(p1==10) p2++,p1=0;
	}
	cout<<a[k];
	// system("pause");
	return 0;
}


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

typedef long long ll;

const int Maxn = 100005;

int n;
int a[Maxn], b[Maxn];
ll suma, sumb;
int res;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        suma += a[i];
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &b[i]);
        sumb += b[i];
        a[i] -= b[i];
    }
    if (sumb > suma) { printf("-1\n"); return 0; }
    sort(a, a + n);
    int j = n - 1, cur = 0;
    for (int i = 0; i < n; i++) if (a[i] < 0) {
        res++;
        while (a[i] < 0) {
            if (cur == 0) { cur = a[j]; res++; j--; }
            int tk = min(cur, -a[i]);
            cur -= tk; a[i] += tk;
        }
    }
    printf("%d\n", res);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
int gcd(int a, int b){ return (a%b ? gcd(b,a%b) : b); }

int main(){
    string S;
    cin >> S;
    int n = 0;
    int r = 0;
    char flag = S.at(0);
    for(char c : S){
        if(flag == c){
            r++;
        }else{
            n++;
        }
        if(flag == '1'){
            flag = '0';
        }else{
            flag = '1';
        }
    }
    cout << min(n,r) << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n;
    cin >> n;
    int mn=mod;
    int cnt=0;
    rep(i,n){
        int x;
        cin >> x;
        if(chmin(mn,x))cnt++;
    }
    cout << cnt;


}

/*



 */



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
string s, t;
int dp[2][2010][2010];
int main()
{
	cin >> n >> m >> s >> t;
	memset(dp[1], -1, sizeof(dp[1]));
	for(int i = 0; i <= n; ++i)
	{
		for(int j = 0; j <= m; ++j)
		{
			bool get;
			if(i != n)
			{
				get = (s[i] == 'I');
				dp[get][i + 1][j] = max(dp[get][i + 1][j], dp[get ^ 1][i][j] + 1);
			}
			if(j != m)
			{
				get = (t[j] == 'I');
				dp[get][i][j + 1] = max(dp[get][i][j + 1], dp[get ^ 1][i][j] + 1);
			}	
			ans = max(ans, dp[1][i][j]);
		}
	}
		cout << ans << endl;
}

Measured memory_bytes: 34720
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    set<int> a;
    for( int i = 0 ; i < n ; i++ ) {
        int d;
        cin >> d;
        a.insert(d);
    } 
    cout << a.size();
}


Measured memory_bytes: 3632
#include <iostream>

void funcA() {
  int n, m;
  std::cin >> n >> m;
  int sum = 0;
  if (n >= 2) sum += n * (n - 1) / 2;
  if (m >= 2) sum += m * (m - 1) / 2;
  std::cout << sum;
}

int main(void) {
  funcA();
  return 0;
}

Measured memory_bytes: 256
n, k, *a = map(int, open(0).read().split())


def c(x):
    res = 0
    for b in a:
        # bを最大がxになるように、できるだけ少ない回数で
        # だいたいb/x等分？
        res += 0 - - b // x - 1
    return res <= k


ng = 0
ok = 10 ** 10
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if c(mid):
        ok = mid
    else:
        ng = mid
print(ok)


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define long long long
#define db double
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template <class T> inline void chmin(T &a, const T& val) { if (a > val) a = val; }
template <class T> inline void chmax(T &a, const T& val) { if (a < val) a = val; }
template <class T> long sqr(T a) { return 1ll * a * a; }
template <class T> void compress(T &a){
  sort(all(a)); a.resize(unique(all(a)) - a.begin());  
}

const db pi = acos(-1.00);
const db eps = 1e-6;
const int INF = 1e9;
const int MOD = 1e9+7;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

int main()
{
  fastio;
  int a, b; cin >> a >> b;
  cout << a * b;
  return 0;
}

Measured memory_bytes: 3656
def main():
    N = int(input())
    A = [int(input()) for i in range(N)]
    ans = 0
    pre = 0
    for a in A[::-1]:
        if a >= pre:
            ans += a
        elif a+2 <= pre:
            return print(-1)
        pre = a
    if A[0] != 0:
        return print(-1)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 59204
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

const int n_max = 200005;
int dat[4 * n_max];
int dat_size = 0;


void update(int i,int x){
    i = dat_size - 1 + i;
    dat[i] = x;
    while(i>0){
        i = (i - 1 ) / 2;
        dat[i] = dat[2 * i + 1] + dat[2 * i + 2];
    } 
}

int query(int l,int r,int i,int a, int b){
    if(r<= a or b <= l) return 0;
    else if(a<= l and r <= b) return dat[i];
    else{
        return query(l,(l+r)/2,2 * i + 1,a,b)  + query((l+r)/2,r,2 * i + 2,a,b);
    }
}



signed main(){
    int n,k;
    cin >> n >> k;
    n += 1;
    dat_size = 1;
    while(dat_size < n) dat_size *= 2;
    int A[n+1];
    REP(i,n-1) cin >> A[i+1],A[i+1]-=k;
    A[0] = 0;
    FOR(i,1,n) A[i] += A[i-1];
    set< pair<int,int> > S;
    REP(i,n) S.insert( mp(A[i],i));
    int B[n];
    int id = 0;
    itrfor(itr,S){
        B[itr->se] = id;
        id ++;
    }


    REP(i,2* dat_size) dat[i] = 0;
    int ans = 0;
    REP(i,n){
        update(B[i],1);
        ans += query(0,dat_size,0,0,B[i]);
    }
    cout << ans << endl;

    

}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int add[101010] = {};
  for(int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    add[--l]++;
    add[r]--;
  }
  int ret = 0, sum = 0;
  for(int i = 0; i < 101010; i++) {
    sum += add[i];
    if(sum > 0) ++ret;
  }
  cout << ret << endl;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  vector<bool> cnt(26);
  for(char c: s) cnt[c-'a'] = true;
  rep(i, 26) {
    if(!cnt[i]) {
      cout << char('a'+i) << endk;
      return 0;
    }
  }
  cout << "None" << endk;
  return 0;
}


Measured memory_bytes: 3772
#include<bits/stdc++.h>
using namespace std;
string s;
int x=0,y=0,ans=0;
int main()
{
    cin>>s;
    for (int i=0;i<s.size();i++)
     if (x==y){x++; if(s[i]=='p') ans--;}
     else{y++; if(s[i]=='g') ans++;}
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void){
	int a, b, c, n=0, e;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	for (;a<=b;a++){
		e = c%a;
	
		if (e==0){
			n++;
		
		}
		
	}
	printf("%d\n", n);
	return 0;
}

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

int drow[]={-1,0,1,0};
int dcol[]={0,-1,0,1};

int main(){
    int h,w;
    cin>>h>>w;
    int ch,cw;
    cin>>ch>>cw;
    int dh,dw;
    cin>>dh>>dw;
    ch--;cw--;dh--;dw--;


    vector<string> map(h);
    rep(i,h)cin>>map[i];

    vector<vector<int>> dist(h,vector<int>(w,1e9));
    deque<p> que;
    dist[ch][cw]=0;
    que.emplace_back(ch,cw);

    while(!que.empty()){
        int row=que.front().first;
        int col=que.front().second;
        que.pop_front();
        int cd=dist[row][col];
        rep(i,4){
            int nr=row+drow[i];
            int nc=col+dcol[i];
            if(nr<0 || nr>=h || nc<0 || nc>=w)continue;
            if(map[nr][nc]=='#')continue;
            if(dist[nr][nc]<=cd)continue;
            dist[nr][nc]=cd;
            que.emplace_front(nr,nc);

        }

        for(int difr=-2;difr<=2;++difr){
            for(int difc=-2;difc<=2;++difc){
                int nr=row+difr;
                int nc=col+difc;
                if(nr<0 || nr>=h || nc<0 || nc>=w)continue;
                if(map[nr][nc]=='#')continue;
                if(dist[nr][nc]<=cd+1)continue;
                dist[nr][nc]=cd+1;
                que.emplace_back(nr,nc);
            }
        }
         
    }
    int ans=dist[dh][dw];
    if(ans==1e9)ans=-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9536
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// ========== debug ==========
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// ===========================

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

int main() {
  int D;
  ins(D);

  vi c(26);
  vector<vi> s(D, vi(26));
  rep(i, 26) cin >> c[i];

  rep(i, D) {
    rep(j, 26)
      cin >> s[i][j];
  }

  rep(i, D) {
    int tmp = 0;
    int max_j = 0;
    rep(j, 26)
      if (chmax(tmp, s[i][j]))
        max_j = j;
    cout << max_j + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7

struct UnionFind{
    vl p;
    vl rank;
    vl cnt;

    UnionFind(ll n){
        rank.resize(n,0);
        p.resize(n,0);
        cnt.resize(n,0);
        rep(i,n){
            p[i] = i;
            rank[i] = 0;
            cnt[i] = 1;
        }
    }

    ll find(ll x){
        if(x != p[x]) p[x] = find(p[x]);
        return p[x];
    }

    bool same(ll x, ll y){
        return find(x) == find(y);
    }

    void unite(ll x, ll y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rank[x] > rank[y]){
            p[y] = x;
            cnt[x] += cnt[y];
        }else{
            p[x] = y;
            cnt[y] += cnt[x];
            if(rank[x] == rank[y]) rank[y]++;
        }
    }

    ll size(ll x){
        return cnt[find(x)];
    }
};

int main(){
    ll n,m; cin >> n >> m;
    vl a(n);
    rep(i,n) cin >> a[i];
    UnionFind uf(n);
    rep(i,m){
        ll x,y; cin >> x >> y;
        uf.unite(x,y);
    }
    rep(i,n){
        if(uf.size(i)==n){
            cout << 0 << endl;
            return 0;
        }
    }
    vvl v(n);
    rep(i,n){
        ll par = uf.find(i);
        v[par].push_back(a[i]);
        //cout << par << endl;
    }
    rep(i,n) sort(rall(v[i]));
    vl second;
    ll ans = 0;
    ll trees = 0;
    rep(i,n){
        if(v[i].empty()) continue;
        ans += v[i].back();
        v[i].pop_back();
        trees++;
        while(!v[i].empty()) {
            second.push_back(v[i].back());
            v[i].pop_back();
        }
    }
    sort(rall(second));
    rep(z,trees-2){
        if(second.empty()){
            puts("Impossible");
            return 0;
        }
        ans += second.back(); second.pop_back();
    }
    cout << ans << endl;
}

Measured memory_bytes: 8832
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define add +
#define minus -
#define squer(a) sqrt(a)
#define mod % 
 
using namespace std;

int main () {
	string s1, s2;
	cin >> s1 >> s2;
	cout << s2 << s1;
	return 0;
}

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

using namespace std;

struct Cell {
    int e;
    int a;
};

double solve(const vector<Cell>& cel, int pos,const vector<int>& vs, int money,
             vector<vector<double> >& memo){
    double retval = 0;
    int vl = vs.size();
    int cl = cel.size();
    if(pos >= cl) return money;
    if(memo[pos][money] >= 0) return memo[pos][money];

    for(int i=0; i<vl; ++i){
        int v = vs[i];
        if(pos+v >= cl) { retval += money; continue; }
        Cell cur = cel[pos+v];
        if(cur.e == 0) {
            retval += solve(cel, pos+v, vs, money,memo);
        } else if(cur.e == 1) {
            retval += solve(cel, pos+v+cur.a, vs, money,memo);
        } else if(cur.e == 2) {
            retval += solve(cel, pos+v, vs, money+cur.a,memo);
        } else if(cur.e == 3){
            retval += solve(cel, pos+v, vs, (money>cur.a) ? money-cur.a : 0,memo);
        }
    }
    return memo[pos][money] = retval/vl;
}

int main(){
    while(1){
        int x,y,z;
        int i;
        cin >> x >> y >> z;
        if(x == 0 && y == 0 && z == 0) break;
        vector<int> vs(x);
        vector<Cell> cells(y);
        for(i=0;i<x;++i){
            cin >> vs[i];
        }
        for(i=0;i<z;++i){
            int n;
            cin >> n;
            cin >> cells[n].e;
            cin >> cells[n].a;
        }
        vector<vector<double> > memo(51,vector<double>(5001,-1));
        cout << (int)solve(cells,0,vs,0,memo) << endl;
    }
    return 0;
}

Measured memory_bytes: 3180
#include <stdio.h>
#include <stdlib.h>

struct node{
	struct node *n[26];
	int g;
};

struct node *new(){
	struct node *n = (struct node *)malloc(sizeof(struct node));
	for(int i = 0; i < 26; i++){
		n->n[i] = NULL;
	}
	n->g = 0;
	return n;
}

struct node *find(char c, struct node *n){
	if(n->n[c-'a']!=NULL) {/*printf("found %c at %d\n",c,c-'a');*/ return n->n[c-'a'];}
	else{
		//printf("didn't find %c\n", c);
		n->n[c-'a'] = new();
		return n->n[c-'a'];
	}
}

int main(void){
	
	int n;
	scanf("%d",&n);
	char temp[11];
	int count = 0;
	struct node *nod = new();
	struct node *now = NULL;
	
	for(int i = 0; i < n; i++){
		scanf("%s",temp);
		now = nod;
		for(int j = 0; temp[j]!='\0'; j++){
			now = find(temp[j],now);
		}
		if(now->g == 0) {count++; now->g = 1;}
	}
	printf("%d",count);
}

Measured memory_bytes: 301468
#include<bits/stdc++.h>//万能库
/*That "ios" maybe is "#include<iostream>"'s iostream*/
using  namespace  std;
char a[101];
int i;
bool ok=false;
int main() {
	ios::sync_with_stdio(false);
	cin>>a;
	i=strlen(a);
	for(int j=0; j<=i; ++j) {
		if(a[j]=='C')ok=true;
		if(ok&&a[j]=='F') {
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No"<<endl;
//getchar()=system("pause");
	return  0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = readLn >>= print . foldl1 modMul . flip take [ 1 .. ]

modMul :: Integer -> Integer -> Integer
modMul x y = x * y `mod` 1000000007

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

typedef long long int ll;
using namespace std;

const ll MOD = 1e9 + 7;

ll gcd(ll x,ll y){
	if(y==0)return x;
	return gcd(y,x%y);
}

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

	string a,b; cin>>a>>b;

	ll lcm = (n*m)/gcd(n,m);

	if(a[0] != b[0]) {cout<<"-1"; return 0;}

	ll inc1 = lcm/n; 
	ll inc2 = lcm/m;
	for(ll i=1;i<n;i++){
		ll no = i*inc1;

		if(no % inc2 != 0) continue;

		ll pos = no/inc2;

		if(a[i] != b[pos]) {cout<<"-1"; return 0;}
	}

	cout<<lcm<<endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    ll K;
    cin >> K;
    queue<ll> que;
    REPi(i,1,10) que.push(i);

    ll ans;
    REP(i,K){
        ll x = que.front();
        ans = x;
        que.pop();

        //ll keta = 1;
        //ll n = x;
        //while(n > 0){
        //    keta *= 10LL;
        //    n /= 10;
        //}

        //cout << x << " " << keta << endl;
        //cout << x << endl;
        //if(x != 1) que.push((x-1)*keta + x);
        //que.push(x*keta + x);
        //if(x != 9) que.push((x+1)*keta + x);
        int t = x%10;
        if(t != 0) que.push(x*10 + (t-1));
        que.push(x*10 + t);
        if(t != 9) que.push(x*10 + (t+1));
    }

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


Measured memory_bytes: 1792
// https://atcoder.jp/contests/

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int x, t;

  cin >> x >> t;

  cout << max(0, x - t) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
constexpr int MOD = 998244353;
constexpr int MAX = 200010;
using ll = long long;
using namespace std;

ll f[MAX];
void init() {
    f[0] = 1;
    for (int i = 1; i < MAX; i++)
        f[i] = (f[i - 1] * i) % MOD;
}

ll inv(ll x) {
    ll res = 1;
    ll k = MOD - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}

ll C(int n, int k) {
    ll a = f[n];
    ll b = f[n-k];
    ll c = f[k];
    ll bc = (b * c) % MOD;
    return (a * inv(bc)) % MOD;
}

ll powmod(ll a, ll n, ll m) {
    ll ret = 1;
    for (; n > 0; n >>= 1, a = a * a % m) {
        if (n % 2 == 1) {
          ret = ret * a % m;
        }
    }
    return ret;
}

int main() {
    init();
    int n, m, k;
    cin >> n >> m >> k;
    
    ll ans = 0;
    for (int i = 0; i <= k; i++) {
        ll s = m * powmod(m - 1, n - i - 1, MOD);
        //cout << "C(" << n-1 << ", " << i << ") = " << C(n-1, i) << endl;
        s %= MOD;
        s *= C(n-1, i);
        s %= MOD;
        ans += s;
        ans %= MOD;
        //cout << "K = " << i << ", s = " << s << endl;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 5140
#include <iostream>
#include <stdio.h>
#include <string>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;
string w = "YAKI";

bool check(string s){

	if (s.size() < w.size())
		return false;
	for (int i = 0; i < w.size(); ++i){
		
		if (s[i] != w[i])
			return false;
	}

	return true;
}
int main(){

	//freopen("Text.txt","r",stdin);
	string s;

	cin >> s;

	if (check(s)){
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b, max;

    cin >> a >> b;

    max = a+b;

    if((a-b) > max){
        max = a-b;
    }
    if((a*b) > max){
        max = a*b;
    }   


    cout << max << endl;

    return 0;
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        double a = in.nextInt();
        double b = in.nextInt();
        double h = in.nextInt();
        int ans = (int)(((a+b)/2)*h);
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  


void solve(void)
{
  int H,W;
  cin>>H>>W;
  vector<vector<char> > DATA(H,vector<char>(W));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cin>>DATA[i][j];
    }
  }
  int ANS = 1;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if(DATA[i][j] == '#')
      {
      bool check = 0;
      if(i != 0)
      {
        if(DATA[i][j] == DATA[i-1][j])check = 1;
      }
      if( i != H-1) if(DATA[i][j] == DATA[i+1][j])check = 1;
      if( j != 0) if(DATA[i][j] == DATA[i][j-1])check = 1;
      if( j != W-1) if(DATA[i][j] == DATA[i][j+1])check = 1;
      if(check == 0)ANS = 0;
      // DEBUG(i,j);
      }
    }
  }

  if(ANS == 1)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int A[100];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    if (A[i] % 2 == 1) continue;
    if (A[i] % 3 != 0 && A[i] % 5 != 0) {
        cout << "DENIED" << endl;
        return 0;
    }
  }

    cout << "APPROVED" << endl;
    
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		int d = stdIn.nextInt();
		int e = stdIn.nextInt();
		int minPasta = a;
		if(minPasta > b)
		{
			minPasta = b;
		}
		if(minPasta > c)
		{
			minPasta = c;
		}
		int minJuice = d;
		if(minJuice > e)
		{
			minJuice = e;
		}
		System.out.println(minPasta + minJuice - 50);
	}
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main(){
  int n,p; cin >> n >> p;
  vi a(n); rep(i, n) cin >> a[i];

  vvi dp(n + 1, vi(2));
  dp[0][0] = 1;
  rep(i, n){
    rep(j, 2) dp[i + 1][j] = dp[i][j];
    if(a[i] % 2 == 0) rep(j, 2) dp[i + 1][j] += dp[i][j];
    else rep(j, 2) dp[i + 1][!j] += dp[i][j];
  }

  dump(dp);
  cout << dp[n][p] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
	ll H,N;
	cin>>H>>N;
	pair<ll,ll> ar[N];
	for(ll i=0;i<N;i++)
	{
	    cin>>ar[i].ff>>ar[i].ss;
	}
	s(ar,N);
	ll dp[400000]={};
	ll hj=0;
	for(ll i=ar[0].ff;i<400000;i++)
	{
	    for(ll j=0;j<N;j++)
	    {
	        if(ar[j].ff>i)
	            break;
	        if(dp[i-ar[j].ff]!=0||i==ar[j].ff)
	        {
	            if(dp[i]==0)
	                dp[i]=dp[i-ar[j].ff]+ar[j].ss;
	            else
	                dp[i]=min(dp[i-ar[j].ff]+ar[j].ss,dp[i]);
	            hj=dp[i];
	        }
	    }
	}
	for(ll i=400000-1;i>=0;i--)
	{
	    if(dp[i]==0)
	        dp[i]=hj;
	    else
	    {
	        hj=min(hj,dp[i]);
	        dp[i]=hj;
	    }
	}
	cout<<dp[H]<<endl;
}

Measured memory_bytes: 3584
#include <stdio.h>

int main(void) {
	int n, m;
	int i, j;
	int A[100][100];
	int B[100];
	int C[100];
	
	for(i = 0; i < 100; i++) {
		C[i] = 0;
	}

	scanf("%d %d", &n, &m);
	
	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			scanf("%d", &A[i][j]);
		}
	}
	
	for(j = 0; j < m; j++) {
		scanf("%d", &B[j]);
	}
	
	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			C[i] += A[i][j] * B[j];
		}
		
		printf("%d\n", C[i]);
	}
	
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char s[101];

int main() {
    int n, ans = 1e9, i, j, k;
    
    scanf("%s", s);
    
    n = strlen(s);
    
    for (i = 0; i < 26; i++) {
        int c = 0;
        
        for (j = 0; j < n; j++) {
            for (k = 0; j + k < n; k++) {
                if (s[j + k] - 'a' == i) {
                    c = max(c, k);
                    break;
                }
            }
            
            if (j + k == n) c = max(c, k);
        }
        
        ans = min(ans, c);
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define INF 1e9
typedef long long ll;
typedef pair<int,int> P;

vector<vector<P> >G;

P tddfs(int v, int par){
  P ret = {0,v};
  int i;REP(i,G[v].size()){
    int w = G[v][i].first, cost = G[v][i].second;
    if(w==par) continue;
    P r = tddfs(w,v);
    ret = max(ret, {cost+r.first,r.second});
  }
  return ret;
}

int tree_diameter(){
  P v = tddfs(0,-1);
  P w = tddfs(v.second,-1);
  return w.first;
}

int main(void){
  int N;cin >> N;
  G.resize(N);
  int i;REP(i,N-1){
    int x,y;cin >> x >> y;
    x--;y--;
    G[x].push_back({y,1});
    G[y].push_back({x,1});
  }
  int ret = tree_diameter();
  if(ret%3!=1) cout << "First" << endl;
  else cout << "Second" << endl;
  return 0;
}


Measured memory_bytes: 23680
#include<stdio.h>
int main()
{
	int a,b,c,d,e=0,f,g,h,i,j,k;
	for(d=1;d<=100;d++)
	{
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a==-1&&b==-1&&c==-1)
	{
		break;
	}
	if(a==-1||b==-1)
	{
		printf("F\n");
		continue;
	}
	
	e=a+b;
	if(e>=80)
	{
		printf("A\n");
		continue;
	}
	else if(e>=65)
	{
		printf("B\n");
		continue;
	}
	else if(e>=50||c>=50)
	{
		printf("C\n");
		continue;
	}
	else if(e>=30)
	{
		printf("D\n");
		continue;
	}
	else if(e<30)
	{
		printf("F\n");
		continue;
	}	
	}
}


Measured memory_bytes: 2052
#include <iostream>
#include <stdio.h>
#include <map>
#include <queue>
using namespace std;
 
 int main() {
  int i=0,j,k=0,m,n,t=0,s[17],ad[200],len[200],ans[200];
  multimap<int,int> mp;
  queue<int> qu; ans[99]=-1;
  for (k=0;k<17;k++) s[k]=0;
  while(true) {
  if (!mp.empty()) {  
      if ((*mp.begin()).first==t) {
         while(!mp.empty() && (*mp.begin()).first == t) {
	     m=(*mp.begin()).second;
	     for (j=ad[m]; j<ad[m]+len[m]; j++) s[j]=0;
		 mp.erase(mp.begin()); }
	    }
  }
  if (t % 5==0) { i=t/5; qu.push(i); len[i]=i % 5==1 ? 5 : 2;}
  while(!qu.empty()) {
	  i=qu.front(); 
	  for (j=0;j<18-len[i];j++) {
		  for (k=0;k<len[i];k++) if (s[j+k]>0) break;
		  if (k==len[i]) {for (k=0;k<len[i];k++) s[j+k]=i+1;
		                 ans[i]=t-5*i; ad[i]=j;
						 qu.pop(); mp.insert(multimap<int,int>::value_type(t+17*(i % 2)+3*(i % 3)+19,i)); break;}
	  }
      if (j==18-len[i]) break;
  }
  t++;
  if (ans[99]>=0) break;
  }
  while(cin >> n) cout << ans[n] << endl;
  return 0;
 }

Measured memory_bytes: 1200