akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
	int64_t n, k;
	cin >> n >> k;
	set<int64_t> s;
	s.emplace(1);
	for (int i = 0; i < n; i++) {
		set<int64_t> next;
		for (auto i : s) {
			next.insert(2 * i);
			next.insert(i + k);
		}
		s = next;
	}
	cout << *s.begin() << endl;
	return 0;
}

Measured memory_bytes: 256
/** Bismillahir Rahmanir Rahim **/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define endl '\n'
#define fi first
#define se second
#define ull unsigned ll
#define Fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define debug(x) cerr << #x << " "<< x << endl

int main()
{
   Fastio;
   int n, temp = 0, cnt = 0;
   cin >> n;
   for (int i = 0; i <= 5000000; i++) {
      temp = (temp * 10 + 7);
      cnt++;
      temp %= n;
      if (temp == 0) {
         cout << cnt << endl;
         return 0;
      }
   }
   cout << "-1" << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <math.h>
#include <vector>

void calc(int n){
std::vector<double> vec; 
double m=0,ans=0;
for(int i=0;i<n;i++){
	double s;
	scanf("%lf",&s);
	vec.push_back(s);
	m+=s;
}
m/=n;
for(int i=0;i<n;i++){
	ans+=(vec[i]-m)*(vec[i]-m);
}
ans/=n;
printf("%lf\n",sqrt(ans));
}

int main() {
int n;
while(1){
	scanf("%d",&n);
	if(n==0)break;
	calc(n);
}

}


Measured memory_bytes: 2760
n = int(input())
a = list(map(int, input().split()))
aset = set(a)
d = {i:0 for i in aset}
for i in range(n):
    d[a[i]] += 1

res = 0
for k, i in sorted(d.items(), reverse = True):
    if i >= 4 and res == 0:
        print(k*k)
        exit()
    elif i >= 2 and res == 0:
        res = k
    elif i >= 2:
        print(res * k)
        exit()
print(res)


Measured memory_bytes: 26660
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, k = list(map(int, readline().split()))
    a = list(map(int, readline().split()))

    from collections import Counter

    counter = Counter(a)
    u = len(counter)
    lcc = counter.most_common()[::-1]
    x = u - k

    ans = 0
    for i in range(x):
        ans += lcc[i][1]

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 97736
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t N, K, h[(int)1e5];
    intmax_t ans = 0;

    scanf("%jd%jd", &N, &K);
    for(size_t i = 0; i < N; i++) {
        scanf("%jd", &h[i]);
    }

    for(size_t i = 0; i < N; i++) {
        if (h[i] >= K) ans++;
    }

    printf("%jd\n", ans);

    return 0;
}


Measured memory_bytes: 896
N, L = map(int, input().split())

taste_n = N * L + N * (N + 1) // 2 - N

# 1番目のりんごを食べる
if L >= 0:
    print(taste_n - L)
# 味が0にりんごを食べる
elif L < 0 and abs(L) < N:
    print(taste_n)
# n番目のりんごを食べる
else:
    print(taste_n - (L + N - 1))


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, i, a, b = 0;
	cin >> num;
	vector<ll> dp(num + 1, 0), d(200000, 0);
	dp[0] = 1;
	rep(i, num) {
		cin >> a;
		if (a == b) {
			dp[i + 1] = dp[i];
			continue;
		}
		dp[i + 1] = (dp[i] + d[a]) % MOD;
		d[a] += dp[i];
		d[a] %= MOD;
		b = a;
	}
	cout << dp[num] << "\n";
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  string x,  y;
  cin >> x >> y;
  sort(x.begin(), x.end());
  sort(y.begin(), y.end(), greater<char>());
  
  int f = 0;
  for(int i = 0; i < min(x.size(), y.size()); i++){
    if(x[i] - 'a' == y[i] - 'a') continue;
    else if(x[i] - 'a' > y[i] - 'a'){
      f = -1;
      break;
    }
    else if(x[i] - 'a' < y[i] - 'a'){
      f = 1;
      break;
    }
  }
  if(f == 0 && x.size() < y.size()) cout << "Yes"; 
  else if(f == 0 && x.size() >= y.size()) cout << "No";
  else if(f == -1) cout << "No";
  else if(f == 1) cout  << "Yes";
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextLong();
		long d = sc.nextLong();
		long k =0;

		if(d == 0) {
			k = 1;
		}else {
			k = 2;
		}

		double ans = (double)(k * (n-d) * (m-1)) / (n*n);


		System.out.println(ans);
	}
}

Measured memory_bytes: 24788
n = gets.to_i
u = n.times.map{[-1]*n}
n.times{|i|
  a = gets.to_i
  a.times{
    x,y = gets.split.map(&:to_i)
    u[i][x-1] = y
  }
}

def check(n,s,u)
  v = [0]*n
  n.times{|j|
    v[j] = s[j] if s[j]==1
  }
  n.times{|j|
    next if s[j]==0
    n.times{|k|
      next if u[j][k] == -1
      if v[k] !=  u[j][k]
        return false
      end
    }
  }
  return true
end

ans = 0
(2**n).times{|i|
  s = (2**n+i).to_s(2)[1..-1].split('').map(&:to_i)
  cnt = s.count(1)
  ans = cnt if check(n,s,u) && ans < cnt
}

p ans


Measured memory_bytes: 2044
NN =input().split()
N =int(NN[0])
A = int(NN[1])
B = int(NN[2])
X =A+B
Y =N//X
Z = N%X

if Z >=A:
  ans = A
else:
  ans = Z
ans1 = Y*A + ans
print(ans1)

Measured memory_bytes: 9124
m, n = map(int, input().split())
sheet = [ list(map(int, input().split())) for i in range(m)]
for i in range(m):
    sheet[i].append(sum(sheet[i]))
    if i == 0:
        sheet.append(list(sheet[i]))
    else :
        for j in range(n):
            sheet[-1][j] += sheet[i][j]
sheet[-1][-1] = sum(sheet[-1]) - sheet[0][-1]
for tmp_list in sheet:
    print(" ".join(str(x) for x in tmp_list))

Measured memory_bytes: 7880
_, m = gets.split.map(&:to_i)
geo_data = []
1.upto m do |i|
  p_id, established_year = gets.split.map(&:to_i)
  geo_data.push({ idx: i, p_id:  p_id, established_year: established_year })
end
geo_data = geo_data.group_by { |h| h[:p_id] }
geo_data.map do |_, v|
  v.sort_by { |h| h[:established_year] }.map.with_index 1 do |h, i|
    { idx: h[:idx], id: "#{ "%#06d" % h[:p_id]}#{"%#06d" % i}" }
  end
end.flatten.sort_by { |a| a[:idx] }.each { |a| puts a[:id] }


Measured memory_bytes: 95584
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<ll, ll>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
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;}
ll INF = 1e+18;
int iINF = 1e9;

int main()
{
  int N; cin >> N;
  int half = 0;
  vector<P> arr(N);
  rep(i, 0, N) cin >> arr[i].first >> arr[i].second;

  if(N % 2 == 0){
    half = N / 2 - 1;

    sort(arr.begin(), arr.end(), [](P a, P b){
      return a.first < b.first;
    });
    ll lowlimit1 = arr[half].first;
    ll lowlimit2 = arr[half + 1].first;

    sort(arr.begin(), arr.end(), [](P a, P b){
      return a.second < b.second;
    });
    ll highlimit2 = arr[half + 1].second;
    ll highlimit1 = arr[half].second;

   cout << (highlimit2 + highlimit1) - (lowlimit2 + lowlimit1) + 1 << endl;

  } else {
    half = N / 2;
    sort(arr.begin(), arr.end(), [](P a, P b){
      return a.first < b.first;
    });
    ll lowlimit1 = arr[half].first;
    sort(arr.begin() + half + 1, arr.end(), [](P a, P b){
      return a.second < b.second;
    });
    ll lowlimit2 = 0;
    if(arr[half].second < arr[half + 1].second) lowlimit2 = arr[half].second;
    else lowlimit2 = arr[half + 1].second;

    sort(arr.begin(), arr.end(), [](P a, P b){
      return a.second < b.second;
    });
    ll highlimit2 = arr[half].second;
    sort(arr.begin(), arr.begin() + half, [](P a, P b){
      return a.first < b.first;
    });
    ll highlimit1 = 0;
    if(arr[half].first < arr[half - 1].second) highlimit1 = arr[half - 1].second; 
    else highlimit1 = arr[half].first;

    cout << highlimit2 - lowlimit1 + 1 << endl;
  }

}



Measured memory_bytes: 6424
import java.util.*;

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

        int n = sc.nextInt();

        double x = 0.0;
        for (int i = 0; i < n; i++) {
            x += 1.0 / sc.nextInt();
        }

        System.out.println(1.0 / x);
    }
}

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


int main() {
  int max =0;
  vector<int> ns;
  vector<int> nums;
  while(!cin.eof()){
    int n=0;
    cin >> n;
    // 求める数の最大値を出す
    max = max > n ? max : n;
    // nsには入力が一覧で入る
    ns.push_back(n);
  }
  for(int i =0 ;i <= max;i++) {
    // 0-maxまで1をいれる。
    nums.push_back(1);
  }

  // 素数の可能性が無いものについては0を入れていく (n >=2)
  for(int i =2 ;i <= max;i++) {
    if(nums[i]==0) {
      continue;
    }
    // 素数の 2～倍はすべて素数ではないのでnを入れる
    for(int ii=i*2 ; ii<=max ; ii+=i) {
      nums[ii] = 0;
    }
  }

  for(int i=0;i<ns.size()-1;i++) {
    int count = 0;
    // 素数の数を数え上げ
    for(int ii=2 ; ii <= ns[i] ; ii++) {
      if(nums[ii]==1) count++;
    }
    cout<<count<<endl;
  }
}


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

int main(void) {
    
    int a,b,c;
    cin >> a >> b >> c;
    
    bool x = false;
    if (a == 5) {
        if (((b == 5) && (c == 7)) || ((b == 7) && (c == 5))) x = true;
    } else if (b == 5) {
        if (c == 5) x = true;
    }

    if (x) cout << "YES" << endl;
    else cout << "NO" << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define int long long
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string
int digitsum(int a){
  int b=0;
  while(a){
    b+=a%10;
    a/=10;
  }
  return b;
}
signed main(){
  int N,M,O,P=0,c=0,co=1,cou=0,minN=mod;
  double D,Do;
  char C,Ca;
  str S,T,U;
  cin>>S;
  rep(0,S.size())cout<<'x';
  cout<<endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	int n;
	cin >> n;
	int arr[n];

	for(int i=0 ; i<n ; i++)
		cin >> arr[i];

	cout << *max_element(arr , arr+n) - *min_element(arr , arr+n);
	return 0;
}

Measured memory_bytes: 256
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_A
// Graph I - Graph

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const ui64 MAX_N = 100;
// dp[i][j] [i, j]までの行列をかけたときの最小コスト

int adj[MAX_N][MAX_N];

int main() {
    memset(adj, 0, sizeof(adj));

    int n;
    cin >> n;

    int u, degree;
    for (int i = 0; i < n; ++i) {
        cin >> u >> degree;
        u--; // 0-origin

        int v;
        for (int j = 0; j < degree; ++j) {
            cin >> v;
            v--; //0-origin
            adj[u][v] = 1;
        }
    }

    for (int y = 0; y < n; ++y) {
        for (int x = 0; x < n; ++x) {
            cout << adj[y][x];
            if (x != n -1) cout << " ";
            else cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3144
import itertools
import math

N = 3
ARR = [
    [0, 0],
    [1, 0],
    [0, 1]
]


N = 2
ARR = [
    [-879, 981],
    [-866, 890],
]


N = 8
ARR = [
    [-406, 10],
    [512, 859],
    [494, 362],
    [-955, -475],
    [128, 553],
    [-986, -885],
    [763, 77],
    [449, 310]
]

N = int(input())
ARR = []

for i in range(N):
    ARR.append(list(map(int,input().split())))



def calculate(n, arr):
    result = 0
    s = 0
    for comb in itertools.permutations(range(n), n):
        s = s + 1
        comb = list(comb)
        d = 0
        for index in range(n - 1):
            d = d + distance(arr[comb[index]][0], arr[comb[index]][1], arr[comb[index+1]][0], arr[comb[index+1]][1])

        result = result + d

    print(result / s)


def distance(x1, y1, x2, y2):
    return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)


calculate(N, ARR)


Measured memory_bytes: 3064
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    N = int(input())
    A = li_input()

    C = list(map(lambda x: min(8, x // 400), A))

    if 8 in C:
        free = C.count(8)

        if free == N:
            print(1, free)
        else:
            low = len(set([c for c in C if c != 8]))
            print(low, low + free)
    else:
        ans = len(set(C))
        print(ans, ans)


main()


Measured memory_bytes: 4724
#!/usr/bin/env python3
import sys
rl = sys.stdin.buffer.readline
INF = sys.maxsize

N = int(rl())
PS = [tuple(map(int, rl().split())) for i in range(N)]

def bitcount(n):
  n = n - ((n >> 1) & 0x5555555555555555)
  n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333)
  n = (n + (n >> 4)) & 0x0f0f0f0f0f0f0f0f
  n = n + (n >> 8)
  n = n + (n >> 16)
  n = n + (n >> 32)
  return n & 0x0000007f

def subsets(s):
  t = s
  while t >= 0:
    t &= s
    yield t
    t -= 1

# (x|y)cost[i][j] := 頂点の集合 i に路線が引かれているとき、j 番目の集落から路線までの最小距離
xcost = [[INF] * N for _ in range(1 << N)]
ycost = [[INF] * N for _ in range(1 << N)]
for i in range(1 << N):
  for j in range(N):
    xcost[i][j] = abs(PS[j][0])
    ycost[i][j] = abs(PS[j][1])
    for k in range(N):
      if ((i >> k) & 1) == 1:
        xcost[i][j] = min(xcost[i][j], abs(PS[j][0] - PS[k][0]))
        ycost[i][j] = min(ycost[i][j], abs(PS[j][1] - PS[k][1]))

# 計算結果の距離を歩行距離(= 距離 * 人口)にする
for i in range(1 << N):
  for j in range(N):
    xcost[i][j] = xcost[i][j] * PS[j][2]
    ycost[i][j] = ycost[i][j] * PS[j][2]

# x, y 座標に引かれた線路の引き方の組み合わせの中から最もコストが小さくなるものを求める
ans = [INF] * (N + 1)
for i in range(1 << N):
  size = bitcount(i)
  for j in subsets(i):
    cost = 0
    for k in range(N):
      # i に含まれていない頂点を合計する(i に含まれている頂点の歩行距離は常に０なので)
      if ((i >> k) & 1) == 0:
        cost += min(xcost[j][k], ycost[i-j][k])

    ans[size] = min(ans[size], cost)

# 結果出力
for a in ans:
  print(a)



Measured memory_bytes: 88640
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int N, K;
    vector<int> A;
    vector<vector<int>> treeone;

    void input() {
        cin >> N >> K;
        A.resize(N);
        treeone.resize(N);
        for (int i = 0; i < N; ++i) {
            cin >> A[i];
            A[i]--;
            if (i == 0) {
                continue;
            } else {
                treeone[A[i]].push_back(i);
            }
        }
    }

    vector<int> memo;

    int dfs(int v, int d) {
//        if (treeone[v].size() == 0) {
//            return memo[v] = d > K;
//        }

        int val = 0;
        for (auto e : treeone[v]) {
            int tmp = dfs(e, d + 1);
            if (tmp < K) {
                chmax(val, tmp);
            }
        }
        if (val == 0) {
            return memo[v] = d > K;
        }
        return memo[v] = val + 1;
    }

    void solve() {
        input();
        if (K == 1) {
            int ans = 0;
            for (auto e : A) {
                ans += e != 0;
            }
            cout << ans << endl;
            return;
        }

        int ans = A[0] != 0;
        memo.resize(N);
        dfs(0, 0);
        for (int i = 1; i < N; ++i) {
            if (memo[i] == K) ans++;
        }

        cout << ans << endl;


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 14336
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args)  {
	Scanner in = new Scanner(System.in);
	    int [] a = new int[3];
	    for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}Arrays.sort(a);
		if((a[0]== 5 && a[1] == 5&& a[2] == 7 )) {
			System.out.println("YES");
		}else System.out.println("NO");
	}
	
}



Measured memory_bytes: 27020
n, m = map(int, input().split())
dp = [0] * (10**5+10)
jud = [True]*(10**5)
for k in range(m):
    a = int(input())
    jud[a] = False

dp[0] = 1
if jud[1]:
    dp[1] = 1
else:
    dp[1] = 0

for i in range(2, n+1):
    if jud[i-1]:
        dp[i] += dp[i-1]
    if jud[i-2]:
        dp[i] += dp[i-2]
print(dp[n] % 1000000007)

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

const long long MAXVAL = (long long) 1e18 + 1;
const long long MOD = 1000000007ll;
//const long long MOD = 998244353ll;
const int INF = 1000000001;

long long poww(int x, long long pow) {
  if (pow == 0ll ) return 1;
  if (pow == 1ll) return x % MOD;
  long long ans = poww(x, pow >> 1) % MOD;
  ans = (ans * ans) % MOD;
  if ((pow & 1) == 1) {
    ans = (ans * x ) % MOD;
  }
  return ans % MOD;
}

int invv(int x) {
  return poww(x, MOD - 2);
}

ll gcd(ll x, ll y) {
  if (x == 0) return y;
  while (y) {
    x %= y;
    swap(x, y);
  }
  return x;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
  //cin >> q;
  while (q-- >0) {
    int n;
    cin >> n;
    int m;
    cin >> m;
    ll res = 1ll;
    ll ans = 1ll;
    for (int i = m; i > (m - n); --i) {
      ans = (ans * i) % MOD;
    }
    res = ans;
//    cout << " ans " << ans << endl;
    ll cur = ans;
    for ( int i =0; i < n; ++i) {
      cur = (MOD -cur) % MOD;
      cur = (cur * invv(m - i)) % MOD;
      cur = (cur * invv(i + 1)) % MOD;
      cur = (cur * (n - i)) % MOD;
//    cout << " cur " << cur << endl;
      ans = (ans + cur) % MOD;
    }
    res = (res * ans) % MOD;
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 3580
<?php
while (true) {
    
    list($height, $width) = getInputExplodeBySpaces();
    
    if ($height == 0 && $width == 0) {
       break;
    }
    
    $rectangle = new Rectangle($height, $width);
    $output = $rectangle->drawRectangle();
    
    echo implode(PHP_EOL, $output), PHP_EOL;
    echo PHP_EOL;
}

function getInputExplodeBySpaces()
{
    return explode(' ', trim(fgets(STDIN)));
}
 
class Rectangle
{
    private $height;
    private $width;
    private $output;
    private $symbolChar  = '#';
    
    public function __construct($height, $width)
    {
        $this->height = $height;
        $this->width  = $width;
    }
    
    public function drawRectangle()
    {
        for ($i = 0; $i < $this->height; $i++) {
            $output[] = $this->drawLine();
        }
        return $output;
    }
    
    public function drawLine()
    {
        return str_repeat($this->symbolChar, $this->width);
    }
}

Measured memory_bytes: 15508
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  int a1=s%2;
  s-=a1;
  int a2=s/10%2;
  s-=10*a2;
  int a3=s/100%2;
  cout<<a1+a2+a3<<endl;
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc150_c
{
    class Program
    {
        static int[] factorial(int n)
        {
            int val = 1;
            int[] fact = new int[n + 1];
            fact[0] = 1;
            for (int i = 1; i < n + 1; i++)
            {
                val *= i;
                fact[i] = val;
            }
            return fact;
        }

        static int position(string[] a, int N, int[] factArray)
        {
            bool[] used = new bool[N];
            int pos = 0;
            for (int j = 0; j < N; j++)
            {
                int notUsedCount = 0;
                for (int k = 0; k < int.Parse(a[j]) - 1; k++)
                {
                    if (!used[k]) {
                        notUsedCount++;
                    }
                }
                pos += (notUsedCount * factArray[N - j - 1]);
                used[int.Parse(a[j]) - 1] = true;
            }
            return pos + 1;
        }

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] P = Console.ReadLine().Split();
            string[] Q = Console.ReadLine().Split();

            int[] factArray = factorial(N);

            Console.WriteLine(Math.Abs(position(P, N, factArray) - position(Q, N, factArray)));
        }
    }
}


Measured memory_bytes: 11092
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 305
#define M 200005
#define seed 23333
#define Mo 1000000007

using namespace std;
int i,j,m,n,p,k,A[N][N],rk,f[N][N][N],pw2[N*N];
void jia(int &x,int y)
{
		x+=y; if (x>=Mo) x-=Mo;
}
int jian(int x,int y)
{
		x-=y; if (x<0) x+=Mo;
		return x;
}
int main()
{
		scanf("%d",&n);
		pw2[0]=1;
		for (i=1;i<N*N;++i) pw2[i]=pw2[i-1]*2%Mo;
		for (i=1;i<=n;++i)
		{
				for (j=1;j<=n;++j) scanf("%d",&A[i][j]);
		}
		rk=0;
		for (i=1;i<=n;++i)
		{
				for (j=rk+1;j<=n;++j) if (A[i][j]) break;
				if (j>n) continue;
				++rk;
				for (k=1;k<=n;++k) swap(A[k][rk],A[k][j]);
				for (j=rk+1;j<=n;++j)
					if (A[i][j])
						for (k=1;k<=n;++k) A[k][j]^=A[k][rk];
		}
		f[0][0][0]=1;
		for (i=0;i<n;++i)
			for (j=0;j<=min(i,rk);++j)
				for (k=0;k<=min(i-j,n-rk);++k)
					if (f[i][j][k])
					{
							jia(f[i+1][j][k],1ll*f[i][j][k]*pw2[j+k]%Mo);
							if (j<rk)
							jia(f[i+1][j+1][k],1ll*f[i][j][k]*jian(pw2[rk+k],pw2[j+k])%Mo);
							if (k<n-rk)
							jia(f[i+1][j][k+1],1ll*f[i][j][k]*jian(pw2[n],pw2[rk+k])%Mo);
					}
		int ans=0;
		for (i=0;i<=n-rk;++i)
			jia(ans,1ll*f[n][rk][i]*pw2[n*(n-i-rk)]%Mo);
		printf("%d\n",ans);
}


Measured memory_bytes: 55936
l = list(map(int, input().split()))
a = l[0]
b = l[1]
c = l[2]
if a == b and b != c:
    print("Yes")
elif a == c and b != c:
    print("Yes")
elif b == c and a != c:
    print("Yes")
else:
    print("No")
    
         

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N;
    cin >> N;
    ll ret = 0;
    for (auto && i: irange(0LL, N)){
        ll a;
        cin >> a;
        ret += a - 1;
    }
    cout << ret;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
 
class Program {
    static void Main(string[] args) {
        var N  = int.Parse(Console.ReadLine());
        var S  = Console.ReadLine();
        var C = new char[]{')','('};
        Array.Sort(C);
        //正しい文字列を作る
        Console.WriteLine(MakeCoreectStr(S));
  }
  
  static string MakeCoreectStr(string str){
    var count = 0;
    var flag = true;
    for(int i = 0; i < str.Length ; i++){
      if(str[i] == ')' && count == 0){
        
        flag = false;
        break;
      }else if(str[i] == ')'){
        count--;
      }
      if(str[i] == '('){
        count++;
      }
    }
    for(int i = 0;i < count;i++){
      str = str+")";
    }
    if(flag){
      return str;
    }else{
      return MakeCoreectStr("("+str);
    }
  }
  

         
}



Measured memory_bytes: 11348
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::collections::HashSet;

fn main() {
    let n: usize = read();
    let mut a: Vec<u32> = (0..n).map(|_| read()).into_iter().collect();
    a.sort_by(|x, y| y.cmp(x));
    let b: HashSet<u32> = a.into_iter().collect();
    println!("{}", b.len());
}

Measured memory_bytes: 4352
N=input()
L=len(N)
ans=[[0 for e in range(2)] for f in range(L)]
k=int(N[L-1])
ans[0][0]=k
ans[0][1]=10-k
if L>1:
 for i in range(1,L):
  k=int(N[L-1-i])
  ans[i][0]=min(ans[i-1][0]+k,ans[i-1][1]+k+1)
  ans[i][1]=min(ans[i-1][0]+10-k,ans[i-1][1]+10-k-1)
print(min(ans[L-1][0],ans[L-1][1]+1))


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

using namespace std;
mt19937_64 rng(58);

int ans(string stones) {
    int n = stones.length();
    int w_count = 0, r_count = 0;
    for (int i=0; i<n; i++) if (stones[i] == 'W') w_count++;
    r_count = n - w_count;
    if (w_count == 0 || r_count == 0) return 0;

    int x = 0;
    for (int i=0; i<r_count; i++) {
        if (stones[i] == 'W') x++;
    }
    return x;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    string stones;
    cin >> n >> stones;
    cout << ans(stones) << endl;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

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


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

    cout << (n * (n -1) / 2 + m * (m - 1) / 2) << endl;
}


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

int main() {
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2);

    for(int i = 0; i < 3; i++) {
        for(int j = i; j < 3; j++) {
            int tmp;
            if(a.at(i) > a.at(j)) {
                tmp = a.at(i);
                a.at(i) = a.at(j);
                a.at(j) = tmp;
            }
        }
    }

    for(int i = 0; i < 3; i++) {
        cout << a.at(i);
        if(i != 2) cout << ' ';
    }
    cout << endl;
}


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

#define n 3
#define n1 9


struct puzz{
  int m[n1];
  int space;
  string path;
  int operator < (const puzz &p)const{
    for(int i=0;i<n1;i++){
      if(m[i]==p.m[i])continue;
      return m[i] > p.m[i];
    }
    return false;
  }
};


static const int x[4]={-1,0,1,0};
static const int y[4]={0,-1,0,1};
static const char c[4]={'u','l','d','r'};

int target(puzz p){
  for(int i=0;i<n1;i++){
    if(p.m[i]!=(i+1))return false;
  }
  return true;
}

string am(puzz p){
  queue<puzz> Q;
  map<puzz, int> V;
  puzz a,b;
  int tmp;
  p.path="";
  Q.push(p);
  V[p]=true;

  while(!Q.empty()){
    a=Q.front();
    Q.pop();
    if(target(a))return a.path;
    int xx=a.space/n;
    int yy=a.space%n;
    for(int k=0;k<4;k++){
      int xc=xx+x[k];
      int yc=yy+y[k];
      if(xc<0||yc<0||xc>=n||yc>=n)continue;
      b=a;
      tmp=b.m[a.space];
      b.m[a.space]=b.m[xc*n+yc];
      b.m[xc*n+yc]=tmp;
      b.space=xc*n+yc;
      if(!V[b]){
	V[b]=true;
	b.path+=c[k];
	Q.push(b);
	
      }
    }
  }
  return "unsolvable";
}

int main(){
  puzz input;
  for(int i=0;i<n1;i++){
    cin>>input.m[i];
    if(input.m[i]==0){
      input.m[i]=n1;
      input.space=i;
    }
  }
  string ans =am(input);
  cout<<ans.size()<<endl;
  return 0;
}



Measured memory_bytes: 30556
# ABC85 D 
import math

def main():
    N, H = list(map(int, input().split()))
    a_max = 0
    b_list = []

    for _ in range(N):
        a,b = list(map(int, input().split()))
        a_max = max(a, a_max)
        b_list.append(b)

    b_list = sorted(b_list)[::-1]
    
    cnt = 0
    for b in b_list:
        if b < a_max:
            break
        if H <= 0:
            break
        H -= b
        cnt += 1
    
    if H > 0:
        print(cnt + math.ceil(H / a_max))
    else:
        print(cnt)

if __name__ == "__main__":
    main()


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

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

    string S, T;
    cin >> S >> T;

    for(int i = 0; i < S.length(); i++) {
        if(S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

/*template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
*/
int main(){
    string s;cin>>s;
    int ans=1;
    string temp=s.substr(0,1);
	string temp1="";
    //cout<<temp<<endl;
    for(int i=1;i<s.length();i++){
    	temp1+=s[i];
    	if(temp1!=temp){
    		temp=temp1;ans++;temp1="";
			}
		}
	
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
modulo = 10 ** 9 + 7
 
S = input()
 
def nleft(S, a, reverse=False):
    """各位置について，それより左の文字列に含まれる文字 a の総数.
       左に'?'が含まれるときは，それらに文字を入れて得られるすべての
       文字列に渡って，文字 a の個数を合計する. """
 
    def rng():
        if reverse: return range(len(S) - 1, -1, -1)
        return range(len(S))

    t = [0] * len(S)

    n = 0      # 'A'の個数
    q = 0      # '?'の個数
    pow3q = 1  # 3 ** q
    for i in rng():
        t[i] = n
        if q > 0:
            t[i] *= pow3q            # ?の埋め方の数だけ増やす
            t[i] += pow3qminus1 * q  # ?に入る'A'の個数
            t[i] %= modulo
        if   S[i] == a:
            n += 1
        elif S[i] == '?':
            q += 1
            pow3qminus1 = pow3q
            pow3q       = pow3q * 3 % modulo
    return t

    # ?に入る'A'の個数は\sum_{i=0}^q i 2^{q-i}\choose{q}{i} = 3^{q-1} q.
 
left  = nleft(S, 'A')
right = nleft(S, 'C', reverse=True)
 
# 各文字が'B'のときのABC数を計算
abc = 0
for i in range(0, len(S)):
    if S[i] in 'B?':
        abc += left[i] * right[i]
 
abc %= modulo
print(abc)


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end(),greater<int>());
  int sum = accumulate(a.begin(),a.end(),0);
  if((double)a.at(M-1)>=((double)sum)/(4*M)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7,MaxN = 5003;
int p[MaxN][MaxN],a,b;

int main() {
	memset(p,0,sizeof(p));
	p[0][0]=1;
	for (int i=1;i<=4000;i++)  {
		p[i][0]=1;
		for (int j=1;j<=i;j++) p[i][j]=(p[i-1][j-1]+p[i-1][j])%MOD;
	}
	scanf("%d%d",&a,&b);
	int ans=0;
	for (int i=1;i<b;i++)
		for (int j=1;j<=b-i;j++)
			if ((b-i)+(b-i-j)<=a) {
				int d=(1LL*p[b-1][i-1]*p[b-i-1][j-1])%MOD;
				d=(1LL*d*p[a-(b-i)-(b-i-j)+2][2])%MOD;
				ans=(ans+d)%MOD;
			}
	ans=(ans+a+1)%MOD;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 98048
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

from math import *

K=k()
ans=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans+=gcd(k,gcd(i,j))
print(ans)


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

namespace _20191224_ATC
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());       
            var b = int.Parse(Console.ReadLine());
            var c = Enumerable.Range(1, 3).Where(x => x != a && x != b).First();
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 13268
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int K = sc.nextInt();
      	Integer a[] = new Integer[N+1];
        for (int i=1; i<=N; i++) {
            a[i] = sc.nextInt();
        }  
    
      /**
      	for (int i=K+1; i<=N; i++) {
          	ans[i] = 1;
          for(int j=i-K+1; j<=i; j++){
            ans[i] = a[j] * ans[i];
            }
          }
        }  **/
      	for (int i=K+1; i<=N; i++) {
          if (a[i] > a[i-K])
            System.out.println("Yes");
      	  else
            System.out.println("No"); 
        } 
    }
}

Measured memory_bytes: 73036
n=int(input())
a=list(map(int,input().strip().split()))[:n]
s=0;
b=[]
b.append(a[0])
for i in range(1,n):
  b.append(a[i]+b[i-1])
for i in range(0,n):
    s=s+a[i]*(b[n-1]-b[i])
    s=s%1000000007
print(s)

Measured memory_bytes: 31540
#include <iostream>
#include <vector>
#include <string>

void Swap( int& a, int& b ){
    int tmp = std::move( a );
    a = std::move( b );
    b = std::move( tmp );
}

class Heap{
public:
    Heap( std::vector<int>& vec ) : arr( vec ){
        //BuildMaxHeap();
    }

    //Getter
    int operator[]( int i ){ // returns i-th elem's key
        return arr[i];
    }

    bool HasLeft( int i ){
        return LeftIndex( i ) < arr.size();
    }

    bool HasRight( int i ){
        return RightIndex( i ) < arr.size();
    }

    int Parent( int i ){
        return arr[ParentIndex( i )];
    }

    int Right( int i ){
        return arr[RightIndex( i )];
    }

    int Left( int i ){
        return arr[LeftIndex( i )];
    }

    //Setter

private:
    int ParentIndex( int i ){ // returns i-th elem's parent's index of arr
        return i/2;
    }

    int LeftIndex( int i ){
        return 2*i;
    }

    int RightIndex( int i ){
        return 2*i+1;
    }

    void MaxHeapify( int i ){
        int left = LeftIndex( i );
        int right = RightIndex( i );
        int largest;
        if( left < arr.size() && arr[left] > arr[i] ){
            largest = left;
        }else{
            largest = i;
        }

        if( right < arr.size() && arr[right] > arr[i] ){
            largest = right;
        }

        if( largest != i ){
            Swap( arr[i], arr[largest] );
            MaxHeapify( largest );
        }
    }

    void BuildMaxHeap(){
        for( int i = ( arr.size()-1 ) / 2; i > 0; --i ){
            MaxHeapify( i );
        }
    }

    //variables
    std::vector<int>& arr;
};

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

    std::vector<int> v = std::vector<int>( n+1 );
    for( int i = 1; i <= n; ++i ){
        std::cin >> v[i];
    }

    Heap maxheap( v );

    for( int i = 1; i <= n; ++i ){
        std::cout 
        << "node " << i
        << ": key = " << maxheap[i] << ", ";
        if( i != 1 ){
            std::cout << "parent key = " << maxheap.Parent( i ) << ", ";
        }
        if( maxheap.HasLeft( i ) ){
            std::cout << "left key = " << maxheap.Left( i ) << ", ";
        }

        if( maxheap.HasRight( i ) ){
            std::cout << "right key = " << maxheap.Right( i ) << ", ";
        }
        std::cout << "\n";
    }
    
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    double a,b,x,ans;
    cin>>a>>b>>x;
    x/=a;
    
    if(x*2<a*b){
        ans=atan(2*x/(b*b));
    }
    else{
        ans=atan(a*a/(2*(a*b-x)));
    }
    ans/=3.14159265358979323846;
    ans*=180;
    ans=90-ans;
    cout<<ketasuu(10)<<ans<<endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int count=0;
    for(int i=0; i<=a; i++){
        for(int j=0; j<=b; j++){
            for(int k=0; k<=c; k++){
                if(x==500*i+100*j+50*k)count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

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

typedef pair<pair<int, int>, int> P;
bool comp(P hl, P hr){
	if(hl.first.first != hr.first.first) return hl.first.first > hr.first.first;
	if(hl.first.second != hr.first.second) return hl.first.second < hr.first.second;
	return hl.second > hr.second;
}

int main(){
while(1){//start

	//init
	int pm[51];
	int solved[51];
	int wa[51][11];
	for(int i = 0; i < 51; i++){
		pm[i] = 0;
		solved[i] = 0;
		for(int j = 0; j < 11; j++) wa[i][j] = 0;
	}


	int M, T, P, R;
	cin >> M >> T >> P >> R;
	if(M == 0 and T == 0 and P == 0 and R == 0) break;

	for(int i = 0; i < R; i++){
		int m, t, p, j;
		cin >> m >> t >> p >> j;

		//ac
		if(j == 0){
			solved[t]++;
			pm[t] += m + wa[t][p] * 20;
		}
		//wa
		else wa[t][p]++;
	}

	vector<pair<pair<int, int>, int> > v;
	for(int i = 1; i <= T; i++){
		v.push_back(make_pair(make_pair(solved[i], pm[i]), i));
	}

	sort(v.begin(), v.end(), comp);


	//debug
	//for(int i = 0; i < (int)v.size(); i++) cout << v[i].first.first << " " << v[i].first.second << " " << v[i].second << endl;

	int tm = v[0].first.second;
	int sol = v[0].first.first;
	cout << v[0].second;
	for(int i = 1; i < (int)v.size(); i++){
		if(sol == v[i].first.first and tm == v[i].first.second) cout << "=";
		else cout << ",";
		cout << v[i].second;
		sol = v[i].first.first;
		tm = v[i].first.second;
	}
	cout << endl;

}//end
	return 0;
}



Measured memory_bytes: 3108
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
import collections
D=collections.defaultdict(int)
ans=0
for i in range(n):
  D[A[i]+i]+=1
for i in range(n):
  ans+=D[i-A[i]]
print(ans)


Measured memory_bytes: 61372
import sys

def main():
    a, b, c, d, e, f = map(int, input().split())
    ans = [-1, 0, 0]
    for i in range(31):
        for j in range(31):
            now_water = i * 100 * a + j * 100 * b
            if now_water == 0:
                continue
            if now_water > f:
                break
            for k in range(10000):
                for l in range(100000):
                    now_sio = k * c + l * d
                    if now_sio > (i * a + j * b) * e:
                        break
                    if now_water + now_sio > f:
                        break
                    noud = 100 * now_sio / (now_water + now_sio)
                    # print(now_water, now_sio)
                    if noud > ans[0]:
                        ans[0] = noud
                        ans[1] = now_water + now_sio
                        ans[2] = now_sio

    print(ans[1], ans[2])



if __name__ == '__main__':
    main()

Measured memory_bytes: 41964
s = gets.strip

high = s[0..1].to_i
low = s[2..3].to_i

can_yymm=false
can_mmyy=false
if high > 0 && high <= 12
  can_mmyy = true
end

if low > 0 && low <= 12
  can_yymm = true
end

if can_yymm && can_mmyy
  puts "AMBIGUOUS"
elsif can_yymm
  puts "YYMM"
elsif can_mmyy
  puts "MMYY"
else
  puts "NA"
end


Measured memory_bytes: 1788
import java.util.*;

public class Main {
    static int MOD = 365;
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        // k: コンテストの種類数
        int k = 26;
        
        // n: 1日目～n日目にコンテストが開催される
        int n = sc.nextInt();
        
        // c[i]: タイプiのコンテストのマイナス係数
        int[] c = new int[k];
        for (int i = 0; i < k; i++) {
            c[i] = sc.nextInt();
        }
        
        // s[d][i]: タイプiをd日目に開催したときに増加する満足度
        int[][] s = new int[n+1][k];
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < k; j++) {
                s[i][j] = sc.nextInt();
            }
        }
        
        // t[i]: i日目に開かれるコンテストのタイプ
        int[] t = new int[n+1];
        // for (int i = 1; i <= n; i++) {
        //     t[i] = sc.nextInt() - 1;
        // }
        
        // last[i]: タイプiのコンテストが最近何日目に開かれたか
        int[] last = new int[k];
        
        // 満足度計算
        int score = 0;
        for (int i = 1; i <= n; i++) {
            int max = -1;
            int choice = -1;
            for (int contest = 0; contest < k; contest++) {
                // int contest = t[i];
                
                int tmp = 0;
                
                // UP
                tmp += s[i][contest];
                // last[contest] = i;
                
                // DOWN
                for (int j = 0; j < k; j++) {
                    tmp -= c[j] * (i-last[j]);
                }
                
                // System.out.println(score);
                
                if (contest == 0 || tmp > max) {
                    choice = contest;
                    max = tmp;
                }
            }
            
            score -= max;
            last[choice] = i;
            t[i] = choice;
        }
        
        for (int i = 1; i <= n; i++) {
            System.out.println(t[i] + 1);
        }
    }
    
    static public class Test {
        Test() {
            System.out.println(MOD);
        }
        
    }
}


Measured memory_bytes: 47024
#include <bits/stdc++.h>
using namespace std;
#define mx 15000000
#define MK 200005
#define pii pair<int,int>
#define tii pair<pii,int>
#define fs first
#define sc second
#define mp make_pair

int main()
{
    int n,x,l;
    vector<int>vc;
    scanf("%d%d",&n,&x);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&l);
        vc.push_back(l);
    }
    sort(vc.begin(),vc.end());
    int cnt=0;
    for(int i=0;i<vc.size();i++)
    {
        if(vc[i]>x){
            x=0;
            break;
        }
        x-=vc[i];
        cnt++;
    }
    if(x)cnt--;
    cout<<cnt<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	void rect(){
		Scanner s = new Scanner(System.in);
		int h = s.nextInt();
		int w = s.nextInt();
		while(h!=0||w!=0){
			for(int i = 0;i<h;i++){
				for(int j = 0;j<w;j++){
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
			h = s.nextInt();
			w = s.nextInt();
		}
	}
	public static void main(String args[]){
		Main m = new Main();
		m.rect();
	}
}

Measured memory_bytes: 33644
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

  int n;

  vector<char> s;

  cin >> n;

  string tmp = "abc";
  cin >> tmp;

  for(int i = 0; i < n; i++){
    char tmp_2 = tmp[i];
    s.push_back(tmp_2);
    
  }
  /*
  for(int i = 0; i < s.size(); i++){
    cout << s[i] << " ";
  }
  cout << "\n";
  */
  int cnt1 = 0;
  int cnt2 = 0;
  
  for(int i = 0; i < n-1; i++){
    if((s[i] == 'O' && s[i+1] == 'X') || (s[i] == 'X' && s[i+1] == 'O')){
      cnt1++;
      i++;
    }
  }for(int i = 0; i < n; i++){
    if((s[n-i-1] == 'O' && s[n-i-1-1] == 'X') || (s[n-i-1] == 'X' && s[n-i-1-1] == 'O')){
      cnt2++;
      i++;
    }
  }

  cout << max(cnt1, cnt2) << '\n';
  
  return 0;
}



Measured memory_bytes: 3332