akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	int OFS = 540, MAX = 1260 - OFS + 4;

	void run() {
		Scanner sc = new Scanner(System.in);
		for (;;) {
			int N = sc.nextInt(), M = sc.nextInt();
			if ((N|M) == 0) break;
			int[][] use = new int[M][MAX];
			int r = sc.nextInt();
			for (int i = 0; i < r; i++) {
				int t = sc.nextInt() - OFS + 1, n = sc.nextInt(), m = sc.nextInt() - 1, s = sc.nextInt();
//				t += s;
				use[m][t] += s == 1 ? 1 : -1;
			}
			for (int j = 0; j < M; j++) {
				int cnt = use[j][0];
				for (int i = 1; i < MAX; i++) {
//					debug(i, cnt);
					cnt += use[j][i];
//					debug(i, cnt);
					if (cnt > 0) {
						use[j][i] = use[j][i - 1] + 1;
					} else {
						use[j][i] = use[j][i - 1];
					}
				}
			}
//			for (int[] a : use) debug(a);
			int q = sc.nextInt();
			for (int i = 0; i < q; i++) {
				int s = sc.nextInt() - OFS, e = sc.nextInt() - OFS, tar = sc.nextInt() - 1;
				System.out.println(use[tar][e] - use[tar][s]);
			}
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 163132
#include<iostream>

using namespace std;
using ll = long long;

int main(void){
    ll K;
    cin >> K;
    const ll N = 50;
    cout << N << endl;
    for(ll  i=0; i < N; i++) {
        cout << i + (N+1)*(K/N) + (i < K%N ? N+1 : 0) - K << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

template<typename T>
map<T, ll> factorize(T x) {
	map<T, ll> res;
	for (int i = 2; i * i <= x; i++) {
		while (x % i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1) res[x]++;
	return res;
}

int modPow(long long a, long long n, long long p) {//0でバグる
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}

ll comb(ll n, ll p) {
	if (p * 2 > n) p = n - p;
	if (p > n - p) p = n - p;
	ll a = 1, b = 1;
	rrep(i, p + 1) {
		a = (a * (n - i + 1)) % mod;
		b = (b * i) % mod;
	}
	return a * (modPow(b, mod - 2, mod)) % mod;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	map<int, ll> mp = factorize(m);
	ll ans = 1;
	for (auto& c : mp) {
		(ans *= comb(c.second + n - 1, c.second)) %= mod;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int ans = pow(10,9);
  if(X>=Y){
    rep(i,2*X+1){
      if(i<2*Y) ans = min(ans, A*(X-i/2)+B*(Y-i/2)+C*i);
      else ans = min(ans, A*(X-i/2)+C*i);
    }
  }
  else{//X<Y
    rep(i,2*Y+1){
      if(i<2*X) ans = min(ans, A*(X-i/2)+B*(Y-i/2)+C*i);
      else ans = min(ans, B*(Y-i/2)+C*i);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func main() {
	solve()
}

func solve() {
	n, k, q := nextInt(), nextInt(), nextInt()
	a := make([]int, q)
	p := make([]int, n)
	for i := 0; i < q; i++ {
		a[i] = nextInt()
		p[a[i]-1]++
	}
	for i := 0; i < n; i++ {
		if q-p[i] < k {
			fmt.Fprintln(writer, "Yes")
		} else {
			fmt.Fprintln(writer, "No")
		}
	}
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}


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

a_num = 97

def dfs(s): #s: 現在の文字列, n: 残りの文字数, cnt: 現在の文字列の最大の値
    if len(s) == N:
        print(s)
        return
    for i in range(ord("a"), ord(max(s))+2):
        dfs(s+chr(i))

dfs("a")


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

typedef long long LL;

int main()
{
    string s;
    cin>>s;
    if(s.size()<26)
    {
        for(int i=0;i<26;i++)
        {
            bool flag=1;
            for(int j=0;j<s.size();j++)
            {
                if(s[j]=='a'+i)flag=0;
            }
            if(flag)
            {
                s.push_back('a'+i);
                cout<<s<<endl;
                return 0;
            }
        }
    }
    if(s=="zyxwvutsrqponmlkjihgfedcba")
    {
        cout<<-1<<endl;
        return 0;
    }
    string s1=s;
    next_permutation(s.begin(),s.end());
    for(int i=0;i<s.size();i++)
    {
        if(s1[i]==s[i])continue;
        for(int j=i+1;j<s1.size();j++)s.pop_back();
        break;
    }
    cout<<s<<endl;
    return 0;
}


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

string s;
int oc[26];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> s;
    for (int i = 0; i < 26; ++i) oc[i] = -1;

    for (int i = 0; i < (int)s.size(); ++i) {
        int ci = s[i] - 'a';
        if (oc[ci] == -1) oc[ci] = i;
        else {
            if (i - oc[ci] <= 2) {
                cout << oc[ci] + 1 << ' ' << i + 1;
                return 0;
            } else oc[ci] = i;
        }
    }
    cout << "-1 -1";
}


Measured memory_bytes: 3768
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

int n,m,c;
string a[55],b[55];
int main() {
    cin >> n >> m;
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, m) cin >> b[i];
    for (int i = 0; i <= n - m; i++)
        for (int j = 0; j <= n - m; j++) {
            c = 0;
            rep(k, 0, m) rep(l, 0, m)if (a[i + k][j + l] == b[k][l]) c++;
            if (c == m * m) {
                cout << "Yes";
                return 0;
            }
        }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
def examA():
    N = I()
    ans = N//2 + N%2
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 5844
#include<iostream>
using namespace std;
int i, p, r, q, cnt = 0;
int c[7];
int main() {
    c[1] = 500; c[2] = 100; c[3] = 50;
    c[4] = 10;  c[5] = 5;   c[6] = 1;
    while(cin >> p) {
        if(p == 0) { break; }
        r = 1000 -p;
        while(r > 0) {
            for (i=1; i<=6; i++) {
                q = r / c[i];
                cnt = cnt + q;
                r -= c[i] * q;
                if(r==0) {break;}
            }
        }
        cout << cnt << endl;
        cnt = 0;
    }
    return 0;
}

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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main(void){
    int n; cin >> n;
    int tmp[1000][3];
    
    vector<int> p(3);

    REP( i, n ){
        cin >> p[0] >> p[1] >> p[2];
        sort( ALL(p) );
        
        tmp[i][0] = p[0];
        tmp[i][1] = p[1];
        tmp[i][2] = p[2];
        
    }
    
    int cnt = 0;
    REP( i, n - 1){
        FOR( j, i + 1, n ){
            if( tmp[i][0] == tmp[j][0] && tmp[i][1] == tmp[j][1] && tmp[i][2] == tmp[j][2] && tmp[i][0] != 0){
                tmp[j][0] = 0;
                cnt++;
            }
        }
    }
    
    cout << cnt << endl;

}


Measured memory_bytes: 3176
import Control.Applicative

main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine :: IO [Integer]


  print $ sum $ map (\a -> (lcm' as - 1) `mod` a) as

  where
    gcd' (x:[]) = x
    gcd' (x:xs) = gcd x (gcd' xs)

    lcm' xs = (foldl (*) 1 xs) `div` (gcd' xs)


Measured memory_bytes: 5756
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
//const lint MOD = pow(10, 9) + 7;

int main() {
	string S;
	int M;
	while (1) {
		cin >> S;
		if (S == "-") {
			return 0;
		}
		else {
			cin >> M;
			vector<int>H(M);
			rep(i, M) {
				cin >> H[i];
			}
			int sum = 0;
			rep(i, M) {
				sum += H[i];
			}
			int Z = S.size();
			rep(i, Z) {
				cout << S[(i + sum) % Z];
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 3144
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<numeric>
using namespace std;

const double PI = 3.14159265358979;
const double EPS = 1e-9;

class Point {
public:
    double x, y;
    Point(double x = 0.0, double y = 0.0) :x(x), y(y) {}
};

class Wind {
public:
    double w, a;
};

bool include(double angle, double low, double high) {
    if(low < 0 + EPS) {
        double l = low + 2.0 * PI;
        if(l <= angle + EPS) return true;
    }
    if(high > 2.0 * PI + EPS) {
        double h = high - 2.0 * PI;
        if(angle <= h + EPS) return true;
    }
    return low <= angle + EPS && angle <= high + EPS;
}

bool savor(const Point &home, const Wind &wind, const vector<Point> &blossom, double d) {
    d /= 2.0;
    for(const auto &b: blossom) {
        Point dif(home.x - b.x, home.y - b.y);
        double angle = atan2(dif.y, dif.x);
        double dist = hypot(dif.y, dif.x);
        if(angle < 0) angle = angle + 2 * PI;
        if(dist <= wind.a + EPS && include(angle, wind.w - d, wind.w + d)) return true;
    }
    return false;
}

double toRadian(double d) {
    return d * PI / 180.0;
}

int main() {
    int H, R;
    while(cin >> H >> R, H | R) {
        vector<Point> home(H);
        for(auto &i: home) cin >> i.x >> i.y;

        int U, M, S;
        double du, dm, ds;
        cin >> U >> M >> S >> du >> dm >> ds;

        du = toRadian(du);
        dm = toRadian(dm);
        ds = toRadian(ds);

        vector<Point> plum(U), peach(M), cherry(S);
        for(auto &i: plum) cin >> i.x >> i.y;
        for(auto &i: peach) cin >> i.x >> i.y;
        for(auto &i: cherry) cin >> i.x >> i.y;

        vector<Wind> wind(R);
        for(auto &i: wind) cin >> i.w >> i.a;
        for(auto &i: wind) i.w = toRadian(i.w);

        // solve
        vector<int> number(H, 0);
        int maxNumber = 0;

        for(int i = 0; i < H; ++i) {
            for(int day = 0; day < R; ++day) {
                bool ok = savor(home[i], wind[day], {Point(0.0, 0.0)}, du);
                bool ng = false;
                ng |= savor(home[i], wind[day], plum, du);
                ng |= savor(home[i], wind[day], peach, dm);
                ng |= savor(home[i], wind[day], cherry, ds);

                if(!ok || ng) continue;

                ++number[i];
                maxNumber = max(maxNumber, number[i]);
            }
        }

        if(maxNumber) {
            bool first = true;
            for(int i = 0; i < H; ++i) if(number[i] == maxNumber) {
                if(!first) cout << " ";
                first = false;
                cout << i + 1;
            }
            cout << endl;
        } else {
            cout << "NA" << endl;
        }
    }
}

Measured memory_bytes: 1340
// 巨大ナップサック問題  N <= 40の代わりにv, wが巨大
// 蟻本p148と同じ

#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <cassert>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair

// N: 品物の個数
// W: ナップサックの容量
// v: 品物の価値
// w: 品物の重さ
ll knapsack(ll N, ll W, vector<ll>& v, vector<ll>& w) {
    ll INF = 1e18;
    // 前半部の全列挙
    vector<pair<ll,ll>> wv;
    ll N2 = N / 2;
    REP(i, (1 << N2)) {
        ll sw = 0, sv = 0;
        REP(j, N2) {
            if ((i >> j) & 1) {
                sw += w[j];
                sv += v[j];
            }
        }
        wv.pb(mp(sw, sv));
    }
    // 無駄な要素を削除（重さが重いのに価値が少ないようなものを捨てる）
    sort(wv.begin(), wv.end());
    int m = 1;
    FOR(i, 1, (1 << N2)) {
        if (wv[m-1].second < wv[i].second) {
            wv[m++] = wv[i];
        }
    }
    wv.resize(m); // 無駄な要素を捨てる

    // 後半部の全列挙
    ll ans = 0;
    REP(i, (1 << (N - N2))) {
        ll sw = 0, sv = 0;
        REP(j, N - N2) {
            if ((i >> j) & 1) {
                sw += w[N2 + j];
                sv += v[N2 + j];
            }
        }
        if (sw <= W) {
            auto t = (lower_bound(wv.begin(), wv.end(), make_pair(W - sw, INF)) - 1);
            ll tw = t->first;
            ll tv = t->second;
            // cout << "sw " << sw << " + tw " << tw << " = " << (sw + tw) << ". value = " << (sv + tv) <<  endl;
            ans = max(ans, sv + tv);
        }
    }
    return ans;
}

int main(){
    ll N, W;
    cin >> N >> W;
    vector<ll> v(N);
    vector<ll> w(N);
    REP(n, N) cin >> v[n] >> w[n];
    auto ans = knapsack(N, W, v, w);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 19464
using System;

namespace CF2017F
{
    class B
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int[] alphaCount = new int[3];
            for (int i = 0; i < s.Length; i++)
            {
                alphaCount[s[i] - 'a']++;
            }

            while (0 < alphaCount[0] && 0 < alphaCount[1] && 0 < alphaCount[2])
            {
                alphaCount[0]--;
                alphaCount[1]--;
                alphaCount[2]--;
            }

            for (int i = 0; i < alphaCount.Length; i++)
            {
                if (1 < alphaCount[i]) { Console.WriteLine("NO"); return; }
            }

            Console.WriteLine("YES");
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>

int main()
{
    int n, n1;
    scanf("%d", &n);
    n1 = n % 10;
    if (n1 == 2 || n1 == 4 || n1 == 5 || n1 == 7 || n1 == 9)
    {
        printf("hon");
    }
    else if (n1 == 0 || n1 == 1 || n1 == 6 || n1 == 8)
    {
        printf("pon");
    }
    else if (n1 == 3)
    {
        printf("bon");
    }

    return 0;
}

Measured memory_bytes: 1708
#include <iostream>

using namespace std;

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

  if (a == 'H')
    cout << b << endl;
  else if (b == 'H')
    cout << 'D' << endl;
  else
    cout << 'H' << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define x first
#define y second
#define pb push_back
#define PB pop_back()
#define iOS ios_base::sync_with_stdio(false)
#define sqr(a) (((a) * (a)))
#define all(a) a.begin() , a.end()
#define error(x) cerr << #x << " = " << (x) <<endl
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)+1)
#define umap unordered_map
#define double long double
typedef long long ll;
typedef pair<int,int>pii;
typedef vector<int> vi;
typedef complex<double> point;
template <typename T> using os =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>  inline void smax(T &x,T y){ x = max((x), (y));}
template <class T>  inline void smin(T &x,T y){ x = min((x), (y));}
int main(){
	iOS;
	string s;
	cin >> s;
	int n = s.size();
	int k;
	cin >> k;
	For(i,0,n){
		int hm = 'z' - s[i] + 1;
		if(s[i] == 'a')
			hm = 0;
		if(hm <= k){
			k -= hm;
			s[i] = 'a';
		}
	}
	k %= 26;
	s[n-1] += k;
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 592
N, M = map(int, input().split())

ans = [1] + [0]*(N - 1) 
already = []

a = 0

for m in range(M):
    s, c = map(int, input().split())
    if (s in already):
        if ans[s - 1] != c:
            
            a = -1
            break

    if (s == 1 and N != 1) and (c == 0) :
        a = -1
        break

    ans[s - 1] = c
    already.append(s)

if a != -1:

    for i, C in zip(range(N), reversed(ans)):
        a += C*(10 ** i)

    if N == 1 and not 1 in already:
        a = 0

print(a)





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

typedef struct Node{
  int key;
  struct Node *right;
  struct Node *left;
  struct Node *parent;
} node;

node *root;
node *nil;

void insert(int k){
  node *x=root;
  node *y=nil;
  node *z;
  z=(node *)malloc(sizeof(node));
  z->key=k;
  z->left=nil;
  z->right=nil;
  while(x!=nil){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==nil){
    root=z;
  }else{
    if(z->key<y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(node *u){
  if(u==nil)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(node *u){
  if(u==nil)return;
  printf(" %d",u->key );
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char c[100];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",c);
    if(strcmp(c,"insert")==0){
      scanf("%d",&x);
        insert(x);
    }else if(strcmp(c,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n" );
    }
  }
  return 0;
}


Measured memory_bytes: 25156
//abc114_d.cpp
//Sat May 11 18:17:38 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int num[100];
	fill(num,num+100,0);

	for (int i=2;i<=n;i++){
		int a = 2;
		int temp = i;
		while (i>=a*a){ //iの素因数分解ここから
			if (temp%a == 0){
				num[a]++;
				temp = temp/a;
			}else {
				a++;
			}
		}
		num[temp]++; //最後の割り算の余りの処理を忘れない
	}

	int seventyfours = 0;
	int twentyfours = 0;
	int fourteens = 0;
	int fours = 0;
	int twos = 0;
	for (int i=2;i<100;i++){
		if (num[i]>=74){
			seventyfours++;
		}
		if (num[i]>=24){
			twentyfours++;
		}
		if (num[i]>=14){
			fourteens++;
		}
		if (num[i]>=4){
			fours++;
		}
		if (num[i]>=2){
			twos++;
		}
	}

	cout << seventyfours+(twentyfours*(twos-1))+(fourteens*(fours-1))+(fours*(fours-1)/2)*(twos-2)<< endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
import java.util.*;

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


    	if(a==1){
    		System.out.println("Hello World");
    	}else{
    		int b = sc.nextInt();
			int c = sc.nextInt();
    		int ans = b+c;
    		 System.out.println(ans);
    	}
      
    }
}

Measured memory_bytes: 23124
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("O3") 
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") 
#define __USE_MINGW_ANSI_STDIO 0
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include<stdio.h>
#include<iomanip>
#include<set>
#include<string>
#include<map>
#include <math.h>
#include<queue>
#include<complex>
#include<ctime>
#include<list>
#include<stack>
#define ll  long long
#define lll __int128
#define fi first
#define ld long double
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<vector<int>>
using namespace std;
ll a;
int n;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
    cin >> n;
    ll ans = 1;
    int g= 0 ;
    for(int i =0 ;i < n;i++){
        cin >> a;
        if(!a){
            cout <<"0";
            return 0;
        }
        if(ans > ((ll)1e18+a-1)/a){
            g =-1;
        }
        ans*=a;
    }
    if(ans > (ll)(1e18) || g ==-1)
        cout <<"-1";
    else
        cout << ans;
  return  0;    
}

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

const int N = 1e5 + 10;

char s[N];
int n;

bool check(int x){
	for (int i = n - x + 1; i <= x - 1; i++){
		if (s[i] != s[i + 1]) return false;
	}
	return true;
}

int main(){
	int l, r, mid;
	scanf("%s", s + 1);
	n = strlen(s + 1);
	l = -1; r = n + 1;
	while (r - l > 1){
		mid = (l + r) >> 1;
		if (check(mid)) l = mid;
		else r = mid;
	}
	printf("%d\n", l);
	return 0;
}

Measured memory_bytes: 384
N = int(input())
A = list(map(int,input().split()))
flag=True
for i in range(N):
    if A[i]%2==0:
        if A[i]%3!=0 and A[i]%5!=0:
            flag=False

if flag:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007LL
//#define MOD 998244353LL
//#define MOD 1000000009LL
const long long INF = 1LL << 60;
typedef long long ll;

int main(){
    ll X;
    scanf("%lld",&X);
    ll A, B;
    for(A = 0;A<10000;A++){
        for(B=A-1;B>(-10000);B--) if((A*A*A*A*A)-(B*B*B*B*B) == X) break;
        if((A*A*A*A*A)-(B*B*B*B*B) == X) break;
    }
    printf("%lld %lld\n",A,B);
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define testcase int t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
typedef long long int ll;
typedef unsigned long long int ull;
#define M 1000000007
using namespace std;
int main()
{
    fast
  ll n;
  cin>>n;
  string str;
  map<string,ll> cnt;
  for(ll i=0;i<n;i++)
  {
  	cin>>str;
  	cnt[str]++;
  }
  string p1;ll p2,max=0;vector<string> vect;
  for(pair<string,ll> pp:cnt)
  {
  	p1=pp.first;p2=pp.second;
  	if(p2>=max)
    {
        max=p2;
    }
  }
  for(pair<string,ll> pp:cnt)
  {
  	p1=pp.first;p2=pp.second;
  	if(p2==max)
    {
        vect.pb(p1);
    }
  }sort(all(vect));
  for(string s:vect)
  cout<<s<<endl;
return 0;
}






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

int main() {
  int N, K;
  cin >> N >> K;

  int ans = 1;
  N /= K;

  while(N > 0) {
    N /= K;
    ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
MOD = 10**9+7

# 二分累積法による a^n mod の計算
def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


N = int(input())
ans = modpow(10, N, MOD) - 2*modpow(9, N, MOD) + modpow(8, N, MOD)
print(ans%MOD)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int MOD = 1000003;
array<Int, MOD> FACT;
Int powmod(Int x, Int y) {
    if (y == 0) return 1;
    if (y % 2 == 0) return powmod(x*x%MOD, y/2);
    return x*powmod(x*x%MOD, y/2)%MOD;
}
Int inv(Int x) { return powmod(x, MOD-2); }
int main()
{
    FACT[0] = 1;
    for (int i = 1; i < MOD; i++) {
        FACT[i] = FACT[i-1] * i % MOD;
    }
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++) {
        int X, D, N; cin >> X >> D >> N;
        int Y = X * inv(D) % MOD;
        if (D == 0) {
            cout << powmod(X, N) << '\n';
        } else if (X == 0) {
            cout << 0 << '\n';
        } else if (Y+N-1 >= MOD) {
            cout << 0 << '\n';
        } else {
            cout << FACT[Y+N-1] * inv(FACT[Y-1]) % MOD * powmod(D, N) % MOD << '\n';
        }
    }
    return 0;
}

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

int solve(int n, int a, int b, int c, int x, vector<int> &y, vector<int> &z) {
  int head = 0;
  rep (t, 10000+1) {
    if (y[head] == z[t]) head++;
    if (head == n) return t;
  }
  return -1;
}

int main() {
  int n, a, b, c, x;
  vector<int> z;
  vector<int> y;

  while(cin >> n >> a >> b >> c >> x, n) {
    y.resize(n);
    rep (i, n) cin >> y[i];

    // z.resize(10000+1);
    z.resize(10000);
    z[0] = x;
    // for (int i=1; i<=10000+1; i++) z[i] = (a*z[i-1] + b) % c;
    for (int i=1; i<=10000; i++) z[i] = (a*z[i-1] + b) % c;

    cout << solve(n, a, b, c, x, y, z) << endl;
  }
  return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll  = long long;
#define int ll

const int N = 2e5 + 10;
int n;
int k;
int a[N];
int p[N];

void print() {
	for (int i = 0; i < n; ++i) {
		cout << a[i] << " ";
	}
	cout << "\n";
}

signed main() {
#ifdef LC
    assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0), cin.tie(0);
	
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	k = min(k, 100LL);
	while (k--) {
		fill_n(p, n, 0);
		for (int i = 0; i < n; ++i) {
			int l = max(0LL, i - a[i]);
			int r = min(n, i + a[i] + 1);
			++p[l];
			--p[r];
		}
		fill_n(a, n, 0);
		a[0] = p[0];
		for (int i = 1; i < n; ++i) {
			a[i] = a[i - 1] + p[i];
		}
	}
	print();
    return 0;
}


Measured memory_bytes: 6768
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
#include <cstring>

struct Node{
    int key;
    Node *prev, *next;
};
Node *nil;
void init(){
    nil = new Node[sizeof(Node)];
    nil->next = nil;
    nil->prev = nil;
}
void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    //番兵の直後に要素を追加
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}
Node* listSearch(int key){
    Node *cur = nil->next;//番兵の次の要素から辿る
    while(cur != nil && cur->key != key){
        cur = cur->next;
    }
    // if(cur == nil) cout << "yes\n";
    return cur;
}
void deleteNode(Node *t){
    if(t == nil)return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}
void deleteFirst(){
    deleteNode(nil->next);
}
void deleteLast(){
    deleteNode(nil->prev);
}
void deleteKey(int key){
    deleteNode(listSearch(key));
}
void printNode(){
    Node *cur = nil->next;//番兵の次の要素から辿る
    int isf = 0;
    while(1){
        if(cur == nil) break;
        if(isf++ >0){printf(" ");}
        printf("%d", cur->key);
        cur = cur->next;
        deleteNode(cur->prev);
    }
    printf("\n");
}

//main処理
int main(){
    int n, key, size=0;
    char cmd[10];
    scanf("%d", &n);
    init();
    for(int i=0; i<n; i++){
        scanf("%s", cmd);
        if(cmd[0] == 'i'){
            scanf("%d", &key);
            insert(key);
        }
        else if(cmd[0] == 'd'){
            if(strlen(cmd) > 6){
                if(cmd[6] == 'F') deleteFirst();
                else if(cmd[6] == 'L') deleteLast();
            }
            else{
                scanf("%d", &key);
                // cout << key << endl;
                deleteKey(key);
            }
        }
    }
    printNode();

    return 0;
}


Measured memory_bytes: 34432
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <numeric>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define Icin(s) ll (s);cin>>(s);
#define Scin(s) ll (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;
int N;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,x;
    cin>>a>>b>>x;
  	if(b==0){
      cout<<1<<endl;
      return 0;
    }
    if(a==0){
        cout<<b/x+1<<endl;
        return 0;
    }
  	
    cout<<b/x-(a-1)/x<<endl;
}

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

using namespace std;

#define int 		long long
#define endl		"\n"
#define mod			1000000007
#define inf			1e12
#define IOS			ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int32_t main() {

	IOS;

	int n, ans = 0;
	cin >> n;
	string s;
	cin >> s;

	int left = 0, right = n - 1;

	while (left < right) {
		while (left < n && s[left] == 'R')
			left++;
		while (right >= 0 && s[right] == 'W')
			right--;

		if (left < right) {
			swap(s[left], s[right]);
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define MOD 1000000007
using namespace std;
const long long INF = 3*1e18;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll A, B;
    cin >> A >> B;
    ll low1 = ((25 * A) + 1)/2;
    ll num = 25 * (A + 1);
    ll hi1;
    if(num % 2 == 0) hi1 = (num / 2) - 1;
    else hi1 = (num / 2); 
    ll low2 = 10 * B;
    ll hi2 = (10 * (B + 1)) - 1;
    if(hi1 < low2 || hi2 < low1) {
        cout << "-1\n";
        return 0;
    }
    cout << max(low1, low2) << "\n";
}

Measured memory_bytes: 256
# Python3 TLE, PyPy3 AC

import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n, t = ril()
ls = rils(n)

dp = [[0] * t for _ in range(n + 1)]
for i in range(n + 1):
    for t0 in range(t):
        a, b = ls[i - 1]
        if i == 0 or t0 == 0:
            continue
        elif a <= t0:
            dp[i][t0] = max(dp[i - 1][t0], dp[i - 1][t0 - a] + b)
        else:
            dp[i][t0] = dp[i - 1][t0]

res = set()
val = dp[n][t - 1]
t0 = t - 1
for i in reversed(range(n)):
    a, b = ls[i]
    if val <= 0:
        break
    if val == dp[i][t0]:
        continue
    else:
        res.add(i)
        val -= b
        t0 -= a

m = 0
for i, (_, v) in enumerate(ls):
    if i not in res:
        m = max(m, v)
print(dp[n][t - 1] + m)

Measured memory_bytes: 115804
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    nk = input().split(" ")

    d = []
    a = []
    for i in range(int(nk[1])):
        d.append(int(input()))
        a.append(input().split(" "))
        a[i] = [int(s) for s in a[i]]

    l = [0] * (int(nk[0]) + 1)
    
    for i in range(int(nk[1])):
        for j in range(d[i]):
            z = a[i][j]
            l[z] += 1

    count = 0
    for i in l:
        if i == 0:
            count += 1

    print(count - 1)
    return

if __name__ == '__main__':
    main()


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

int main()
{
	string s;
	cin >> s;
	int day = 0;
	if (s == "SUN") {
		day = 7;
	}
	if (s == "MON") {
		day = 6;
	}
	if (s == "TUE") {
		day = 5;
	}
	if (s == "WED") {
		day = 4;
	}
	if (s == "THU") {
		day = 3;
	}
	if (s == "FRI") {
		day = 2;
	}
	if (s == "SAT") {
		day = 1;
	}
	cout << day << endl;
}

Measured memory_bytes: 888
#include <algorithm>
#include <iostream>
#include <vector>
 
typedef long long int ll;


int main(void){
	int N, M, K;
	std::cin >> N >> M >> K;
	std::vector<int> A(N, 0), B(M, 0);
	std::vector<ll> sum_a(N+1, 0), sum_b(M+1, 0);
	for(int i = 0; i < N; i++) std::cin >> A[i];
	for(int i = 0; i < M; i++) std::cin >> B[i];

	sum_a[0] = 0;
	sum_b[0] = 0;
	for(int i = 0; i < N; i++) sum_a[i+1] = sum_a[i] + A[i];
	for(int i = 0; i < M; i++) sum_b[i+1] = sum_b[i] + B[i];

	int ans = 0, j = M;
	// std::cout << sum_b[M] << std::endl;
	for(int i = 0; i <= N; i++){
		if(sum_a[i] > K) break;
		while(sum_b[j] > (K - sum_a[i])){ 
			j--;
			// std::cout << j << std::endl;
		}
		// std::cout << ans << " " << i << j << std::endl;
		ans = std::max(ans, i + j);
	}

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


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

int main(){
  int n,x;
  cin>>n>>x;
  if(n==2&&x==2){
    cout<<"Yes"<<endl;
    cout<<1<<endl;
    cout<<2<<endl;
    cout<<3<<endl;
    return 0;
  }
  if(x==2){
    cout<<"Yes"<<endl;
    int a=0;
    for(int i=0;i<2*n-1;i++){
      if(i<n-2||i>n+1){
        cout<<a+5<<endl;
        a++;
      }
      if(i==n-2){
        cout<<3<<endl;
      }
      if(i==n-1){
        cout<<2<<endl;
      }
      if(i==n){
        cout<<1<<endl;
      }
      if(i==n+1){
        cout<<4<<endl;
      }
    }
    return 0;
  }
  if(x+1>2*n-1||x-2<1){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  int vec[2*n-1],vecb[2*n]={0},a=0;
  vec[n-2]=x-2;
  vec[n-1]=x;
  vec[n]=x+1;
  vec[n+1]=x-1;
  vecb[x-2]++;
  vecb[x]++;
  vecb[x+1]++;
  vecb[x-1]++;
  for(int i=0;i<2*n-1;i++){
    if(i<n-2||i>n+1){
      if(vecb[a+1]==0){
        vec[i]=a+1;
        vecb[a+1]++;
        a++;
        continue;
      }
      while(vecb[a+1]>0){
        a++;
      }
      vecb[a+1]++;
      vec[i]=a+1;
    }
  }
  for(int i=0;i<2*n-1;i++){
    cout<<vec[i]<<endl;
  }
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
typedef long long ll;
using namespace std;
const int inf=1e9;
int drdp[(1<<16)];
int main(){
	int N,M,K;
	cin>>N>>M>>K;
	int D[16];
	int isD[101]={};
	REP(i,0,M) {
		cin>>D[i];
		D[i]--;
		isD[D[i]]=(1<<i);
	}
	vector<int> root[110];
	int a;
	REP(i,0,N){
		REP(j,0,K){
			cin>>a;
			a--;
			root[i].push_back(a);
		}
	}
	REP(i,0,(1<<M)) drdp[i]=inf;
	drdp[(1<<M)-1]=0;
	queue<int> q;
	q.push((1<<M)-1);
	//bfs
	while(!q.empty()){
		int now=q.front();	q.pop();
		if(drdp[0] != inf) break;
		REP(j,0,K){
			int ns=0;
			REP(i,0,M){
				if(now&(1<<i)) {
					//next room is dark or not
					int next = root[D[i]][j];
					if(isD[next]>0)
						ns |= isD[next];
				}
			}
			if(drdp[ns]==inf) {
				drdp[ns] = drdp[now]+1;
				q.push(ns);
			}
		}
	}
	p(drdp[0]);
	return 0;
}

Measured memory_bytes: 3540
# AOJ 0067 The Number of Island
# Python3 2018.6.16 bal4u

# UNION-FIND library
MAX = 12*12

id, size = [0]*MAX, [0]*MAX

def init(n):
	for i in range(n): id[i], size[i] = i, 1
	
def root(i):
	while i != id[i]:
		id[i] = id[id[i]]
		i = id[i]
	return i
	
def connected(p, q):
	return root(p) == root(q)
	
def unite(p, q):
	i, j = root(p), root(q)
	if i == j: return
	if size[i] < size[j]:
		id[i] = j
		size[j] += size[i]
	else:
		id[j] = i
		size[i] += size[j]
# UNION-FIND library

arr = [[0 for r in range(12)] for c in range(12)]
dr = [-1, 0, 1, 0]
dc = [ 0, 1, 0,-1]

while True:
	init(12*12)
	for r in range(12): arr[r] = list(map(int, input()))

	for r in range(12):
		for c in range(12):
			if arr[r][c] == 0: continue
			for i in range(4):
				nr, nc = r + dr[i], c + dc[i]
				if nr >= 0 and nr < 12 and nc >= 0 and nc < 12:
					if arr[nr][nc] == 1:
						unite(r*12+c, nr*12+nc)
	
	ans = 0
	for r in range(12):
		for c in range(12):
			if arr[r][c] == 1 and root(r*12+c) == r*12+c: ans += 1

	print(ans)
	try: input()
	except: break


Measured memory_bytes: 5608
#include<stdio.h>
int n,k;
int a[100000];
int r,l;
int m,t;
int i,j;

int max(int a,int b){
	if(a>=b)return a;
	else return b;
}

int main(){
	while(1){
		scanf("%d %d",&n,&k);
		if(n==0&&k==0)return 0;
		for(i=0;i<n;i++)scanf("%d",&a[i]);
		r=0;l=k-1;
		m=0;
		for(i=0;i<k;i++){
			m+=a[i];
			t=m;
		}
		while(l<n-1){	
			t+=a[++l];
			t-=a[r++];
			m=max(m,t);
		}
		printf("%d\n",m);
	}
}
		

Measured memory_bytes: 1416
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	abc = LI()
	if abc.count(5) == 2 and abc.count(7) == 1:
		print('YES')
	else:
		print('NO')





if __name__ == '__main__':
    main()

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

void solve() {
	int n;
	cin >> n;
	vector<int> v(n + 1);
	for (int i = 0; i <= n; i++) {
		cin >> v[i];
	}
	vector<long long> lim(n + 1);
	long long sum = 0;
	for (int i = n; i >= 0; i--) {
		sum += v[i];
		lim[i] = sum;
	}
	long long vert = 1, bot = 1, dep = 0;
	for (int i = 0; i <= n; i++) {
		int x = v[i];
		if (x <= bot) {
			bot -= x;
			bot = min(lim[++dep], bot * 2);
			vert += bot;
		} else {
			cout << "-1\n";
			return;
		}
	}
	cout << vert << "\n";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int a,b,t;
    cin >>  a >> b >> t;
    cout << floor((t+0.5)/a)*b << "\n";
}


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

    using namespace std;
    typedef long long ll;
    typedef vector<ll> vl ;

    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
    #define all(v) (v).begin(),(v).end()


    const int MOD = 1000000007;
    const int N = 1000005;
    const double PI =4*atan(1);
    const double eps = 1e-7;
    
    ll a,b,t;

    int main(){
        ios::sync_with_stdio(0);
        //freopen("easy.txt","r",stdin);
        cin >> a >> b >> t;
        cout << b*(t/a);
        
        return 0;
    }
        
    

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

typedef long long ll;
const int MAXN = 1100000;
const int MOD = 1e9 + 7;
ll dp[MAXN], sumv;

int main(){
	ll n; scanf("%lld", &n);
	dp[1] = n; dp[2] = (n * n) % MOD;
	for(int i = 3; i <= n; ++ i){
		sumv += dp[i - 3];
		sumv %= MOD;
		dp[i] += dp[i - 1];
		dp[i] += (n - 1) * (n - 1) % MOD;
		dp[i] += sumv + n - i + 2;
		dp[i] %= MOD;
	}
	printf("%lld\n", dp[n]);
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main()
{
    int n, k;
    cin >> n >> k;
    vector<lli> x(n);
    rep(i, n) cin >> x[i];
    if (x[n - 1] <= 0) {
        cout << abs(x[n - k]) << endl;
    } else if (x[0] >= 0) {
        cout << abs(x[k - 1]) << endl;
    } else {
        vector<lli> neg;
        vector<lli> pos;
        int cnt = n;
        lli ans = 1e18;
        rep(i, n)
        {
            if (x[i] < 0) {
                neg.push_back(x[i]);
            } else if (x[i] > 0) {
                pos.push_back(x[i]);
            }
        }
        cnt = n - lli(neg.size() + pos.size());
        cnt = k - cnt;
        if (cnt == 0) {
            cout << 0 << endl;
            return 0;
        }
        reverse(neg.begin(), neg.end());
        rep(i, neg.size())
        {
            if (i + 1 + pos.size() >= cnt and cnt - i - 2 >= 0 and cnt - i - 2 < pos.size()) {
                ans = min(-2 * neg[i] + pos[cnt - i - 2], ans);
            }
        }
        rep(i, pos.size())
        {
            if (i + 1 + neg.size() >= cnt and cnt - i - 2 >= 0 and cnt - i - 2 < neg.size()) {

                ans = min(2 * pos[i] - neg[cnt - i - 2], ans);
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 2424
#include <iostream>

using namespace std;

const int N = 102;
int dp[N][N], r[N], c[N];

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d %d", &r[i], &c[i]);
    }
    for (int k = 2; k <= n; k++)
    {
        for (int i = 0; i <= n - k; i++)
        {
            int mn = 2e9;
            for (int j = i; j < i + k - 1; j++)
            {
                mn = min(mn, dp[i][j] + dp[j+1][i+k-1] + r[i]*c[j]*c[i+k-1]);
            }
            dp[i][i+k-1] = mn;
        }
    }
    printf("%d\n", dp[0][n-1]);
    return 0;
}



Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-9, PI = acos(-1);
const int N = 4e2 + 9, M = 1e5 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

int n, arr[21][21];
ll mem[(1 << 21)][21];


ll solve(int idx, int mask) {
  if(idx == n)
    return __builtin_popcount(mask) == n ? 1 : 0;
  ll& ret = mem[mask][idx];
  if(~ret)
    return ret;
  ret = 0;
  for (int i = 0; i < n; ++i)
    if(!(mask & (1 << i)) && arr[idx][i])
      ret = (ret + solve(idx + 1, mask | (1 << i))) % MOD;
  return ret;
}

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  memset(mem, -1, sizeof mem);
  cin >> n;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      cin >> arr[i][j];
  cout << solve(0, 0);
  return 0;
}


Measured memory_bytes: 344448
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] Republican = new Integer[m];
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a-b*2<=0) {
			System.out.println(0);
		}
		else {
			System.out.println(a-b*2);
		}
	}
}



Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int dp[100005], h[100005], n, k;
int solve(int idx) {
	if (idx < 0)
		return 1e9;
	if (idx == 0)
		return 0;
	if (dp[idx] != -1)
		return dp[idx];

	dp[idx] = 1e9;
	for (int i = 1; i <= k; i++) {
		if (idx - i >= 0)
			dp[idx] = min(abs(h[idx] - h[idx - i]) + solve(idx - i), dp[idx]);
	}
	return dp[idx];
}
int main() {
	IO
	cin >> n >> k;
	memset(dp, -1, sizeof dp);
	for (int i = 0; i < n; i++){
		cin >> h[i];
	}
	cout << solve(n-1);
	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL<<60;
#define rev(s) (string((s).rbegin(), (s).rend()))

int main () {

    int n;cin>>n;
    int h[100010];
    rep(i,n) {
        cin>>h[i];
    }

    int dp[100010];
    rep(i,n) {
        dp[i]=10000;
    }

    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);

    for(int i=2;i<n;i++) {
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }

    cout<<dp[n-1]<<endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define MOD 1000000007
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	
	int n;
	cin >> n;
	
	vector<ll> v(n);
	
	rep(i, n) cin >> v[i];
	
	vector<ll> sorted(v);
	
	SORT(sorted);
	
	map<ll, bool> mp;
	
	rep(i, n){
		mp[sorted[i]] = (i % 2 == 0);
	}
	
	int cnt = 0;
	rep(i, n){
		if(mp[v[i]] != (i % 2 == 0)) cnt++;
	}
	
	cout << (cnt / 2) << endl;
	
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>

using namespace std;
int main()
{
	int n, d[100000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	sort(d, d + n);
	int a, b;
	a = n / 2 - 1;
	b = n / 2;
	cout << d[b] - d[a] << endl;
    return 0;
}

Measured memory_bytes: 640