akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int count_t = 0;
		int count_h = 0;
		
		for(int i = 0; i < n; i++) {
			String str_t = scan.next();
			String str_h = scan.next();
			
			if(str_t.compareTo(str_h) < 0) {
				count_h += 3;
			}else if(str_t.compareTo(str_h) > 0) {
				count_t += 3;
			}else {
				count_h++;
				count_t++;
			}
		}
		
		System.out.println(count_t + " " + count_h);
	}

}



Measured memory_bytes: 30592
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d-1,-1,-1):
      if lst[j]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            ans=min(ans,cnt)         
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    

print(ans)

Measured memory_bytes: 9192
#include<iostream>
#include <iomanip>
#include<algorithm>
using namespace std;
int main()
{
	
	long int n,c=0;
	cin>>n;
	int a[10005];
	for(int i=0;i<n;i++)
		{
			cin>>a[i];
			c=c+a[i];
	}

	sort(a,a+n);
	cout<<a[0]<<" "<<a[n-1]<<" "<<c<<endl;


	




	
}

Measured memory_bytes: 3156
var x = require('fs').readFileSync('/dev/stdin', 'utf-8');
 
function main(input) {
  var temp = parseInt(input);
  var h = Math.floor(temp/(60*60));
  var m = Math.floor((temp - h*60*60)/60);
  var s = Math.floor(temp - h*60*60 - m*60);
  console.log(h + ":" + m + ":" +s);
}

main(x);


Measured memory_bytes: 15124
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  string str;
  cin >> str;

  ll ans =0 ;
  rep(i,str.size()){
    if(str[i] == '2') ans ++ ;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int x, y;
    cin >> x >> y;
    cout << (x + y / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;


namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            checked
            {
                string[] s;
#if true
                int N = int.Parse(Console.ReadLine());
#else
                s = Console.ReadLine().Split(' ');
                int N = int.Parse(s[0]);
                int D = int.Parse(s[1]);
#endif

                int[] v = new int[N];

#if true
                s = Console.ReadLine().Split(' ');
                for (int i = 0; i < N; i++)
                {
                    v[i] = int.Parse(s[i]);

                }
#else
                for (int i = 0; i < N; i++)
                {
                    v[i] = int.Parse(Console.ReadLine());
                }
#endif
                int ans = 0;
                int h = -1;
                for (int i = 0; i < N; i++)
                {
                    if(h <= v[i])
                    {
                        ans++;
                        h = v[i];
                    }
                }

                Console.WriteLine(ans);
            }
        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<cctype>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll X;
    cin >> X;
    ll A[X+1];
    ll i,j;
    for(i=0;i<=X;i++){
        A[i]=0;
    }
    A[0]=1;
    for(i=0;i<X;i++){
        for(j=0;j<6;j++){
            if(100+i+j<=X&&A[i]==1)A[i+100+j]=1;
        }
    }
    cout << (A[X]==1);
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
map<string,vector<string> > mp;
map<string,int> vec;
int func(string s){
	int sum=0;
	if(mp[s].size()==0)
	sum=100000000;
	else
	rep(i,(int)mp[s].size()){
		sum+=func(mp[s][i]);
	}
	return min(vec[s],sum);
}
int main(){
	int n,x;
	string s,a;
	while(cin>>n,n){
		rep(i,n){
			cin>>s>>x;
			vec[s]=x;
		}
		cin>>n;
		while(n--){
			cin>>s;
			cin>>x;
			rep(i,x){
				cin>>a;
				mp[s].push_back(a);
			}
		}
		cin>>s;
		cout<<func(s)<<endl;
		mp.clear();
		vec.clear();
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
using namespace std;

typedef long long ll;

int main() {
	int n; cin >> n;
	int ans = 1e9;
	for (int i = 1; i < n; i++) {
		int a = i, b = n - a, sum = 0;
		for (int t = 0; t <= 6; t++) {
			sum += a % 10 + b % 10;
			a /= 10; b /= 10;
		}
		ans = min(ans, sum);
	}
	cout << ans << 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 = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll n;
    cin >> n;
    ll a[n], b[n + 1];
    rep(i, n+1) b[i] = 0;
    rep(i, n){
        int tmp;
        cin >> tmp;
        a[i] = tmp;
        b[tmp]++;
    }
    ll ans = 0;
    rep(i, n){
        ans += b[i+1] * (b[i+1] - 1) / 2;
    }

    rep(i, n){
        ll Ans = ans;
        ll j = a[i];
        Ans -= b[j] * (b[j] - 1) / 2;
        Ans += (b[j] - 1) * (b[j] - 2) / 2;
        cout << Ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5760
import bisect


def main():
    N = int(input())
    edges = [int(i) for i in input().split()]
    edges.sort()
    ans = 0
    for a in range(N - 2):
        for b in range(a + 1, N - 1):
            ans += bisect.bisect_left(edges, edges[a] + edges[b])-b-1

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a;
  cin >> a;
  double b = double(a)/3;
  double c = b*b*b;
  cout << setprecision(15) << c;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


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

int main()
{
    int n, y;
    cin >> n >> y;
    for (int i = 0; i <= n; i++)
    {
        int iy = y - i * 10000;
        for (int j = 0; j <= n - i; j++)
        {
            int jy = iy - j * 5000;
            int k = n - (i + j);
            if ((jy - k * 1000) == 0)
            {
                printf("%d %d %d\n", i, j, k);
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            char[] S = cin.Read.ToCharArray(); 

            int max_count = 0;
            int count = 0;
            foreach (var s in S)
            {
                if(s == 'A' || s == 'C' || s == 'G' || s == 'T'){
                    count++;
                }else{
                    if(count > max_count) max_count = count;
                    count = 0;
                }
            }

            if(count > max_count) max_count = count;
            WriteLine(max_count);

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}

Measured memory_bytes: 13268
n, m = gets.split.map(&:to_i)

if n > m
  tmp = m
  m = n
  n = tmp
end

ans = 0

# (内陸:9, 辺6, 隅:4), (通路3, 端2), (点1) 
if n == 1 && m == 1 # 点
  ans = 1
elsif n == 1 # 通路
  ans = m - 2
else # 内陸
  ans = (n-2) * (m-2)
end

puts ans

Measured memory_bytes: 1788
def mod_inv(a, MOD):
    """ 前提: aとMODが互いに素であること """
    b = MOD
    u = 1
    v = 0
    while b:
        t = a // b
        a -= t * b
        u -= t * v
        a, b = b, a
        u, v = v, u
    u %= MOD
    return u


def prime_factorize(n):
    i = 2
    res = {}
    while i * i <= n:
        if n % i != 0:
            i += 1
            continue
        res[i] = 0
        while n % i == 0:
            res[i] += 1
            n //= i
        i += 1
    if n != 1:
        res[n] = 1
    return res


def solve(n):
    n *= 2
    pf = prime_factorize(n)
    l = len(pf)
    pfk = []
    for i, p in enumerate(pf):
        pfk.append(p ** pf[p])

    ans = 10 ** 18

    for bit in range(1 << l):
        a = 1
        for d in range(l):
            if bit & (1 << d):
                a *= pfk[d]
        b = n // a

        if a == 1:
            k = n - 1
        elif b == 1:
            k = n
        else:
            m = mod_inv(b, a)
            k = b * m - 1
        ans = min(ans, k)

    return ans


n = int(input())
ans = solve(n)
print(ans)

# import random
#
# for n in range(1, 10000):
#     a = solve(n)
#     i = -1
#     for i in range(1, 2 * n + 1):
#         if i * (i + 1) // 2 % n == 0:
#             break
#     # print(n, a, i)
#     assert a == i


Measured memory_bytes: 68216
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, tot, ans = 1e9, pre;
char s[maxn];
int a[maxn];
int main()
{
	scanf("%d", &n);
	scanf("%s", s + 1);
	for(int i = 1; i <= n; ++i)
	{
		a[i] = s[i] == 'E' ? -1 : 1;
		if(a[i] == -1)
			++tot;
	}
	for(int i = 1; i <= n; ++i)
	{
		ans = min(ans, tot - (a[i] == -1) + pre);
		pre += a[i];
	}
	printf("%d\n", ans);
	return 0;
}
	
	 

Measured memory_bytes: 1664
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    String ans;
    
    if((a==b&&b==c)||(a!=b&&b!=c&&c!=a)) ans = "No";
    else ans = "Yes";


    System.out.println(ans);
    
  }
}

Measured memory_bytes: 35632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#include <set>
#include <bitset>
#include <deque>
#pragma GCC optimize(3 , "Ofast" , "inline")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std ;
#define ios ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
#define x first
#define y second
#define pb push_back
#define ls rt << 1
#define rs rt << 1 | 1
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e6 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
int work()
{
  int n ;
  cin >> n ;
  cout << (n ^ 1) << endl ;
  return 0 ;
}
int main()
{
  //   freopen("C://Users//spnooyseed//Desktop//in.txt" , "r" , stdin) ;
  //   freopen("C://Users//spnooyseed//Desktop//out.txt" , "w" , stdout) ;

  work() ;
  return 0 ;
}
/*
*/


Measured memory_bytes: 3164
import java.util.Scanner;

class Main {

  public static final long INF = Long.MAX_VALUE / 4;

  public static long gcd(long a, long b) {
    if (a < b) {
      long tmp = a;
      a = b;
      b = tmp;
    }
    if (b == 0) {
      return a;
    }
    long r = a % b;
    while (r != 0) {
      a = b;
      b = r;
      r = a % b;
    }
    return b;
  }

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long[] A = new long[N];
    for (int i = 0; i < N; i++) {
      A[i] = scanner.nextLong();
    }
    long[] L = new long[N + 1];
    long[] R = new long[N + 1];
    for (int i = 0; i < N; i++) {
      L[i + 1] = gcd(L[i], A[i]);
    }
    for (int i = N; i > 0; i--) {
      R[i - 1] = gcd(R[i], A[i - 1]);
    }
    long[] ans = new long[N];
    for (int i = 0; i < N; i++) {
      ans[i] = gcd(L[i], R[i + 1]);
    }
    long max = 0;
    for (long m : ans) {
      max = Math.max(max, m);
    }
    System.out.println(max);

  }

}


Measured memory_bytes: 50624
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll x, y, a, b, c;
    cin>>x>>y>>a>>b>>c;
    ll p[a+5], q[b+5], r[c+5];
    priority_queue<ll, vector<ll> , greater<ll> > p1, p2;
    int i;
    FOR0(i, a) cin>>p[i];
    FOR0(i, b) cin>>q[i];
    FOR0(i, c) cin>>r[i];
    sort(p, p+a, greater<ll>() );
    sort(q, q+b, greater<ll>() );
    sort(r, r+c);
    ll ans = 0;
    FOR0(i, x)
    {
        p1.push(p[i]);
        ans += p[i];
    }
    FOR0(i, y)
    {
        p2.push(q[i]);
        ans += q[i];
    }
    FOR0(i, c)
    {
        ll p1t = p1.top(), p2t = p2.top();
        ll d1 = r[i] - p1t, d2 = r[i] - p2t;
        if(d1 <= 0 && d2 <= 0) continue;
        if( d1 > d2) 
        {
            ans += d1;
            p1.pop();
            p1.push(r[i]);
        }
        else 
        {
            ans += d2;
            p2.pop();
            p2.push(r[i]);
        }
    }
    cout<<ans<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 4852
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
x = A.index(m)
m2 = max(A[:x] + A[x + 1:])
ans = [m for _ in range(N)]
ans[x] = m2
for i in range(N):
    print(ans[i])


Measured memory_bytes: 14124
#include <iostream>
using namespace std;
typedef long long ll;

ll inf = 1e9+7;
ll fact[200010] = {0};
ll inv[200010] = {0};

ll mult(ll n, ll m){
	if(m==0) return 1;
	if(m==1) return n%inf;
	else if(m%2==0){
		ll t = mult(n,m/2);
		return (t*t)%inf;
	}else{
		ll t = mult(n,m-1);
		return (t*n)%inf;
	}
}

void factorial(ll N){
	for(ll i=0;i<=N;i++){
		if(i==0){
			fact[i] = 1;
			inv[i] = 1;
		}
		else{
			fact[i] = (i*fact[i-1])%inf;
			inv[i] = mult(fact[i],inf-2);
		}
	}
}

ll comb(ll n,ll k){
	if(n<k) return 0;
	if(n<0 || k<0) return 0;
	else return (((fact[n]*inv[k])%inf)*inv[n-k])%inf;
}


ll N,A,B,C;
ll A_p[200010] = {1},B_p[200010] = {1};
int main(){
    cin >> N >> A >> B >> C;
	factorial(2*N-1);
	for(int i=1;i<=N;i++){
		A_p[i] = A*A_p[i-1]%inf;
		B_p[i] = B*B_p[i-1]%inf;
	}
	ll ans = 0;
	for(ll i=N;i<=2*N-1;i++){
		ll res = comb(i-1,N-1);
		ll bunbo = (A_p[N]*B_p[i-N]%inf+A_p[i-N]*B_p[N]%inf)%inf;
		(bunbo *= 100*i)%=inf;
		ll bunshi = mult(mult(A+B,i),inf-2)*mult(100-C,inf-2)%inf;
		(res *= bunbo*bunshi%inf)%=inf;
		(ans += res)%=inf;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    ll a,b;
    cin>>a>>b;
    if((b-a)%2==0)
    {
        cout<<(b-a)/2<<endl;
    }
    else
    {
        cout<<min(a-1,n-b)+1+(b-a-1)/2<<endl;
    }
    return 0;
}

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

int n;
int x[10], y[10];
int mas[10];

#define POW(x) ((x) * (x))

double solve(){
    double ans = 0;
    for(int i = 0;i < n-1;i++){
        ans += sqrt(POW(x[mas[i]] - x[mas[i+1]]) + POW(y[mas[i]]-y[mas[i+1]]));
    }
    return ans;
}

double dfs(int nu, int bit){
    double ans = 0;

    if(bit == (1 << n) -1){
        return solve();
    }else{
        for(int i = 0;i < n;i++){
            if((bit & (1 << i)) == 0){
                mas[nu] = i;
                ans += dfs(nu+1, bit | (1 << i));
            }
        }
    }
    return ans;
}






int main(){
    cin >> n;

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

    double a1 = dfs(0, 0);

    double a2 = 1;
    for(int i = 2;i <= n;i++) a2 *= i;

    printf("%.12lf\n", a1/a2);

    return 0;
}



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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<ll, ll> P;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 100 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		String yohou = stdin.readLine();
		String jissai = stdin.readLine();
		String[] yohouArr = convertArr(yohou);
		String[] jissaiArr = convertArr(jissai);
		System.out.println(checkTenki(yohouArr, jissaiArr));

	}

	private static String[] convertArr(String str) {
		String[] strArr = new String[str.length()];
		for (int i = 0; i < str.length(); i++) {
			strArr[i] = str.substring(i, i + 1);
		}
		return strArr;
	}

	private static int checkTenki(String[] strArr1, String[] strArr2) {
		int count = 0;
		for (int i = 0; i < strArr1.length; i++) {
			if (strArr1[i].equals(strArr2[i])) {
				count++;
			}
		}
		return count;
	}
}

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

int main(){
    int s;
    cin >> s;
    if(s%100 > 0 && s%100 < 13){
        if(s/100 > 0 && s/100 < 13){
            cout << "AMBIGUOUS";
        }else{
            cout << "YYMM";
        }
    }else{
        if(s/100 > 0 && s/100 < 13){
            cout << "MMYY";
        }else{
            cout << "NA";
        }
    }
    return 0;
}

Measured memory_bytes: 764
float a,b,c,d,p=57.296;main(){for(;~scanf("%f%f%f%f",&a,&b,&c,&d);)a+1&&printf("%.f\n",6378.1*acos(sin(a/p)*sin(c/p)+cos(a/p)*cos(c/p)*cos(b/p-d/p)));}

Measured memory_bytes: 0
a, b, c = [input() for _ in range(3)]
a_count = 1
b_count = 0
c_count = 0


def card_game(card):
    global a_count
    global b_count
    global c_count
    
    if card == 'a':
        a_count += 1
        if a_count > len(a):
            return 'A'
        return a[a_count - 1]
    elif card == 'b':
        b_count += 1
        if b_count > len(b):
            return 'B'
        return b[b_count - 1]
    elif card == 'c':
        c_count += 1
        if c_count > len(c):
            return 'C'
        return c[c_count - 1]
        
card = a[0]

while True:
    card = card_game(card)
    if card == 'A' or card == 'B' or card == 'C':
        print(card)
        break

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  if((b - a) % 2 == 0) cout << "Alice" << endl;
  else cout << "Borys" << endl;

}


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

int main(){
  int n, val, m, i, j, count = 0, v;
  scanf("%d", &n);
  set<int> s;
  for(i = 0; i < n; i++) {
    scanf("%d", &val);
    s.insert(val);
  }
  scanf("%d", &m);

  for(i = 0; i < m; i++){
    scanf("%d", &v);
    if (s.count(v)) count++;   
  }

  printf("%d\n", count);
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long

using namespace std;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar();
  return q*x;
}

int main(){
  RG int n=gi(),ans1=0,ans2=0,ans3=0;
  for (RG int i=1,a;i<=n;++i){
    a=gi();
    if (a%4==0) ++ans1;
    else if (a%2==0) ++ans3;
    if (a%2==1) ++ans2;
  }
  if (ans2-ans1<=0 || (ans2-ans1==1 && !ans3)) puts("Yes"); else puts("No");
  return 0;
}


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

namespace ALDS1_4_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var hs = new HashSet<string>();
            var resultList = new List<string>();
            var n = int.Parse(Console.ReadLine());
            for(int i=0; i<n; i++)
            {
                var c = Console.ReadLine();
                string command = c.Split(' ')[0];
                string str = c.Split(' ')[1];
                if(command == "insert")
                {
                    hs.Add(str);
                }
                if(command == "find")
                {
                    if (hs.Contains(str))
                        resultList.Add("yes");
                    else
                        resultList.Add("no");
                }
            }
            foreach (var r in resultList)
                Console.WriteLine(r);
        }
    }


}



Measured memory_bytes: 48072
h,w=map(int,input().split())
cost=[list(map(int,input().split())) for i in range(10)]
wall=[list(map(int,input().split())) for i in range(h)]

for k in range(10):
  for i in range(10):
    for j in range(10):
      cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j])

tot_cost=0
for i in range(h):
  for j in range(w):
    num=wall[i][j]
    if num!=-1:
      tot_cost+=cost[num][1]
print(tot_cost)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mt make_tuple
#define eb emplace_back
using namespace std;
const int N=2e5+5;
const ll inf=3e18;
int n,ans[N];
vi v[N],a,tail;
void dfs(int s, int p){
    int x=0,y,j;
    if(s>0){
        j=lower_bound(all(tail),a[s])-tail.begin();
        if(j==tail.size()){
            tail.pb(a[s]);
            x=1;
        }
        else{
            if(tail[j]!=a[s]){
                y=tail[j];
                tail[j]=a[s];
                x=2;
            }
        }
    }
    ans[s]=tail.size();
    for(int i : v[s]){
        if(i!=p)
            dfs(i,s);
    }
    if( s>0 && x==2){
        tail[j]=y;
    }
    else if(s>0 && x==1){
        tail.resize(tail.size()-1);
    }
}
void solve(){
    cin>>n;
    for(int i=0;i<n;i++){
        int j;
        cin>>j;
        a.pb(j);
    }
    for(int i=0;i<n-1;i++){
        int j,k;
        cin>>j>>k;
        v[j-1].pb(k-1);
        v[k-1].pb(j-1);
    }
    tail.pb(a[0]);
    dfs(0,-1);
    for(int i=0;i<n;i++)
        cout<<ans[i]<<endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 29956
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

int main()
{
	vector <int> n2;
	for (int i = 1; i <= 10000; i++ ){
		n2.push_back (i*i );
	} // end for
	int n;

	while (cin >> n && n ){
		vector <int> m (n-1, 0 );
		rep (i, n-1 ){
			m[i] = n2[i] % n;
		} // end rep
		sort (ALL (m ) );
		m.erase (unique (ALL(m) ), m.end() );
		int size = m.size();
		vector<int> cnt ((n-1)/2+1, 0 );
		int maxd = 0;
		rep (i, size ){
			rep (j, size ){
				if (i == j )
					continue;
				int d = m[i] - m[j];
				if (d < 0 ){
					d += n;
				}// end if
				if (d > (n-1)/2 ){
					d = n - d;
				} // end if
				cnt[d]++;
				maxd = max (d, maxd );
			} // end for
		} // end for
		for (int i = 1; i <= maxd; i++ ){
			cout << cnt[i] << endl;
		} // end for
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1016
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
#include "debug.h"
#define input \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#else
#define debug(...) 4
#define input 4
#endif

using ll = long long;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
int n, m, k;
long long dp[3005][3005][4];
int idx[3005][3005];
vector<pair<int, long long>> v[3002];
long long solve(int i, int j, int picked) {
    if(i == n + 1) {
        return 0;
    }
    if(~dp[i][j][picked])
        return dp[i][j][picked];

    if(v[i].empty())
        solve(i + 1, j, 0);
    long long ans = 0;
    auto it = lower_bound(v[i].begin(), v[i].end(), make_pair(j, 0ll)) - v[i].begin();
    if(it != v[i].size()) {
        auto x = v[i][it];
        if(x.first >= j and picked < 3) {
            ans = max(ans, x.second + solve(i, x.first + 1, picked + 1));
            ans = max(ans, x.second + solve(i + 1, x.first, 0));
        }
        ans = max(ans, solve(i, x.first + 1, picked));
    }
    ans = max(ans, solve(i + 1, j, 0));
    return dp[i][j][picked] = ans;
}
int32_t main() {
    input;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> k;
    for(int i = 0; i < k; i++) {
        int x, y, price;
        cin >> x >> y >> price;
        v[x].push_back(make_pair(y, price));
    }
    for(int i = 0; i <= 3000; i++) {
        sort(v[i].begin(), v[i].end());
    //     for(int j = 0; j <= 3000; j++) {
    //         auto it = lower_bound(v[i].begin(), v[i].end(), make_pair(j, 0ll)) - v[i].begin();
    //         // if(it == v[i].size())
    //             // break;
    //         idx[i][j] = it;
    //     }
    }
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0, 0);


}


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

using namespace std;

int main()
{
	string s;
	cin >> s;

	if (
		(s.find('a') != string::npos) &&
		(s.find('b') != string::npos) &&
		(s.find('c') != string::npos)
		)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
using namespace std;

const int MOD = 256;
const double EPS = 1e-7;
const int INF = 1<<29;
int n,I[257],R[257],O[257];
vector<int> sharp;

bool equal(double a, double b){
  return fabs(a-b) < EPS;
}

void makeR(int S, int A, int C){
  R[0] = S;
  for(int i=1;i<=n;i++){
    R[i] = (A * R[i-1] + C) % MOD;
  }
}

void makeO(){
  map<int,int> mp;
  sharp.clear();

  for(int i=1;i<=n;i++){
    O[i] = (I[i] + R[i]) % MOD;
    if(mp.find(O[i]) == mp.end()) mp[O[i]] = 1;
    else mp[O[i]]++;
  }

  for(map<int,int>::iterator it = mp.begin(); it != mp.end(); it++)
    sharp.push_back(it->second);
}

double calcH(){
  double H = 0, N = (double)n;
  for(int i=0;i<sharp.size();i++){
    double x = (double)sharp[i];
    H += (x / N) * log(x / N);
  }
  return H * -1.0;
}

void solve(){
  vector<int> sharp;
  double H, ans = (double)INF;
  int sum = INF, as, aa, ac;
  for(int S=0;S<=15;S++){
    for(int A=0;A<=15;A++){
      for(int C=0;C<=15;C++){
        makeR(S,A,C);
        makeO();
        H = calcH();
        if(ans > H && !equal(ans,H) /*|| equal(ans,H) && sum > S+A+C*/){
          ans = H;
          sum = S+A+C;
          as = S;
          aa = A;
          ac = C;
        }
      }
    }
  }
  cout << as << ' ' << aa << ' ' << ac << endl;
}

int main(){
  while(cin >> n && n){
    for(int i=1;i<=n;i++){
      cin >> I[i];
    }
    solve();
  }
}

Measured memory_bytes: 1268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int ll
//#define double ld
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ifstream in("input.txt");ofstream out("output.txt");
const int inf=1e18;
const int mod=1e9+7;
int n,k;
vector<int> vec;
vector<vector<int> > dp;
vector<int> pref;
void calcPref(int ind)
{
    pref.assign(k+1,0);
    pref[0]=dp[ind][0];
    for(int i=1;i<=k;i++)
    {
        pref[i]=pref[i-1]+dp[ind][i];
        pref[i]%=mod;
    }
}
int getPref(int l,int r)
{
    int ff;
    if(r>k)
    {
        ff=pref[k];
    }
    else
        ff=pref[r];
    if(l-1<0)
        return ff;
    return (ff+mod-pref[l-1])%mod;
}
signed main()
{
    cin>>n>>k;
    vec.resize(n);
    pref.resize(k+1);
    for(int i=0;i<n;i++)
        cin>>vec[i];
    dp.resize(n+1,vector<int>(k+1));
    dp[0][k]=1;
    for(int i=1;i<=n;i++)
    {
        calcPref(i-1);
        for(int j=0;j<=k;j++)
        {
            dp[i][j]=getPref(j,j+vec[i-1]);
            dp[i][j]%=mod;
        }
    }
    cout<<dp[n][0];
    return 0;
}





















Measured memory_bytes: 81024
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def is_kaibun(_S):
    if len(_S)==1 or _S[:int((len(_S))/2)]==_S[int((len(_S)+1)/2):][::-1]:
        return True
    else:
        return False

def main():
    _S = S()
    is_tsuyoi1 = is_kaibun(_S)
    is_tsuyoi2 = is_kaibun(_S[:int((len(_S)-1)/2)])
    is_tsuyoi3 = is_kaibun(_S[int((len(_S)+1)/2):])
    print("Yes" if is_tsuyoi1 and is_tsuyoi2 and is_tsuyoi3 else "No")


main()


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int inf = 10e5;

char maze[100][100];
int n,m;
P s,g;
int d[100][100];

P v[4]={P(1,0),P(0,1),P(-1,0),P(0,-1)}; 

int bfs(){
	queue<P> que;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++) d[i][j] = inf;
	}
	que.push(s);
	d[s.first][s.second]=0;

	while(que.size()){
		P p = que.front();
		que.pop();
		if(p.first==g.first&&p.second==g.second) break;
		for(int i=0;i<4;i++){
			int nx = p.first + v[i].first;
			int ny = p.second + v[i].second;
			if(0<=nx&&nx<n&&0<=ny&&ny<m&&maze[nx][ny]!='#'&&d[nx][ny]==inf){
				que.push(P(nx,ny));
				d[nx][ny] = d[p.first][p.second] + 1;

			}
		}
	}
	return d[g.first][g.second];
}

int main(){
	cin >> n >> m;
	for(int i=0;i<n;i++) cin >> maze[i];

	int max = 0;
	for(int x1=0; x1<n; x1++){
		for (int y1=0;y1<m;y1++){
			for (int x2=0;x2<n;x2++){
				for (int y2=0;y2<m;y2++){
					if(maze[x1][y1]=='.' && maze[x2][y2]=='.'){
						s = P(x1, y1);
						g = P(x2, y2);
						int b = bfs();
						if (max < b && b != inf) max = b;
					}
				}
			}
		}
	}

	cout << max << endl;
	
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b){
  return *(int*)a - *(int*)b;
}
int min(int a,int b){
  if(a>b) return b;
  return a;
}

int main(void){
  int n,i,j,s1,s2,tmp,ans=1e9;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  //for(i=0;i<n;i++) printf("%d\n",a[i]);
  for(i=0;i<n-1;i++){
    s1=0;
    s2=0;
    for(j=0;j<=i;j++) s1+=a[j];
    for(j=i+1;j<n;j++) s2+=a[j];
    tmp = abs(s1-s2);
    ans = min(ans,tmp);
  }
  printf("%d\n",ans);
  return 0;
}

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

int main(){
	int A,B,K;
	cin >> A >> B;
  
  	if ((A+B)%2 == 0){
    	cout << (A+B)/2 << endl;
    }
  
  	else{
    	cout << "IMPOSSIBLE" << endl;
    }

	return 0;
}


Measured memory_bytes: 256
// include
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
// prototype
int SortAscendNum(const void *num1, const void *num2);
int SortDescendNum(const void *num1, const void *num2);
 
// main
int main(void)
{
    int N,x;
  	int A[101];
    unsigned int elmt;
  	int i;
    int count=0;
    
  	scanf("%d %d\n",&N,&x);
  	for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    }
     
     
    // 文字列を昇順でソート
    qsort(A,N, sizeof(*A), SortAscendNum);
  	for(i=0;i<N;i++){
    	if(x>=A[i]){
    		x=x-A[i];
    		count++;
    	}
      	else
          break;
    }
  	if(x!=0 && count!=0 &&i==N)
      count=count-1;
  	printf("%d\n",count);
    // 文字列を降順でソート
    //qsort(str, cnt, sizeof(*str), SortDescendStr);
    return 0;
}
 
int SortAscendNum(const void *num1, const void *num2)
{
    return *(int *)num1 - *(int *)num2;
}
 
// =======================================
// @brief  数値を降順でソートする
// @param  num1 [in],比較対象1
// @param  num2 [in],比較対象2
// @return 負 比較対象2の方が小さい
// @return 0  比較対象1と比較対象2が等しい
// @return 正 比較対象2の方が大きい
// @note   無し
// =======================================
int SortDescendNum(const void *num1, const void *num2)
{
    return *(int *)num2 - *(int *)num1;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
using namespace std;
const int N=1e6+10;
const int M=1e9+7;

int n,k,q;
int main(){Accel
	cin>>n>>k>>q;
	vector<int>v(n);
	REP(i,n)
		cin>>v[i];
	int ans=1e9+10;
	REP(i,n){
		int l=v[i];
	
		vector<int>tmp,b;
		for(int j=0;j<=n;j++){
			

			if(j==n||v[j]<l){

				//if(i==3)cout<<l<<endl;
				sort(ALL(tmp));
				
				for(int t=0;t<SZ(tmp)-k+1;t++){
				//	cout<<SZ(tmp)<<" "<<k<<endl;
					b.PB(tmp[t]);
				}
				tmp.clear();
			}
			else tmp.PB(v[j]);
		}
		
		sort(ALL(b));
		if(SZ(b)>=q){
		
			ans=min(ans,b[q-1]-l);
			
		}
	}
	
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
n, m = map(int, raw_input().split())

Matrix = [[0 for j in range(m)]for i in range(n)]
Vector = [0 for i in range(m)]
Ans = [0 for i in range(n)]

for i in range(n):
    M_element = map(int, raw_input().split())
    for j in range(m):
        Matrix[i][j] = M_element[j]

for i in range(m):
    Vector[i] = int(raw_input())

for i in range(n):
    for j in range(m):
        Ans[i] += Matrix[i][j] * Vector[j] 
for i in range(n):
    print Ans[i]

Measured memory_bytes: 6492
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cassert>
#include <ctime>
#include <map>
#include <math.h>
#include <cstdio>
#include <set>
#include <deque>
#include <memory.h>
#include <queue>

#pragma comment(linker, "/STACK:64000000")
typedef long long ll;

using namespace std;

const int MAXN = 1 << 18;
const int MOD =  1000 * 1000 * 1000 + 7;
const int INF = 2e9;
const double PI = acos(-1.0);

void print(pair<int, int> a) {
	cout << a.first << endl << a.second << endl;
}

vector<int> getpr(string s) {
	int n = s.length();
	vector<int> p(n);
	for (int i = 1; i < n; ++i) {
		//int j = p[i - 1];
		p[i] = p[i - 1];
		while (p[i] && s[i] != s[p[i]]) p[i] = p[p[i] - 1];
		if (s[i] == s[p[i]])  ++p[i];
	}
	return p;
}

pair<int, int> fastsolve(string s) {
	int n = s.length();
	vector<int> p = getpr(s);
	reverse(s.begin(), s.end());
	vector<int> p2 = getpr(s);
	reverse(s.begin(), s.end());
	
	int k = n - p[n - 1];
	if (k != n && n % k == 0) {
		if (k == 1) return make_pair(n, 1);
		int cnt = 0;
		for (int i = 1; i <n; i++) {
			bool ok = 1;
			int len = i;
			int per = len - p[len - 1];
			if (len % per == 0 && len != per) {
				ok = 0;
			}
			
			len = n - i;
			per = len - p2[len - 1];
			if (len % per == 0 && len != per) {
				ok = 0;
			}

			if (ok) cnt++;
		}
		return make_pair(2, cnt);
	}
	else {
		return make_pair(1, 1);
	}
}

bool ok(string s) {
	int n = s.length();
	for (int len = 1; len < n; len++) if (n % len == 0) {
		bool ok = 0;
		for (int i = 0; i + len < n; i++) ok |= s[i] != s[i + len];
		if (!ok) return 0;
	}
	return 1;
}

pair<int, int> slowsolve(string s) {
	int n = s.length();
	vector<int> dp(n + 1, INF);
	vector<int> cnt(n + 1, 0);
	dp[0] = 0;
	cnt[0] = 1;
	for (int i = 0; i < n; i++) {
		string cur = "";
		for (int j = i; j < n; j++) {
			cur += s[j];
			if (ok(cur)) {
				if (dp[j + 1] > dp[i] + 1) {
					dp[j + 1] = dp[i] + 1;
					cnt[j + 1] = 0;
				}
				if (dp[j + 1] == dp[i] + 1) {
					cnt[j + 1] = (cnt[j + 1] + cnt[i]) % MOD;
				}
			}
		}
	}
	return make_pair(dp[n], cnt[n]);
}

int main() {
#ifdef _MSC_VER
	freopen("input.txt", "r", stdin);
#endif

	for (int it = 0; it < 0; it++) {
		cerr << it << endl;
		int n = rand() % 10 + 1;
		string s = "";
		for (int i = 0; i < n; i++) s += (char)(rand() % 3 + 'a');
		pair<int, int> ans1 = fastsolve(s);
		pair<int, int> ans2 = slowsolve(s);
		if (ans1 != ans2) {
			cerr << "FAIL" << endl;
			cerr << s << endl;
			cerr << ans1.first << " " << ans1.second << endl;
			cerr << "instead of" << endl;
			cerr << ans2.first << " " << ans2.second << endl;
			return 0;
		}
	}

	string s;
	while (cin >> s) {
		print(fastsolve(s));
	}

	return 0;
}

Measured memory_bytes: 5660
#include <iostream>
using namespace std;
int main(void){
    int n, k; cin>>n>>k;
    if(k>=n) {cout<<1<<endl; return 0;}
    for(int i=1;i<100005;i++){
        if(n>1+(k-1)*i&&n<=1+(k-1)*(i+1)) {
            cout<<i+1<<endl; return 0;
        }
    }
}

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

int main(){

    int N;
    cin >> N;
    set<string> S;
    string a;
    rep (i, N){
        cin >> a;
        S.insert(a);
    }

    cout << S.size() << endl;

    return 0;
}

Measured memory_bytes: 19220
S = int(input())
s_1 = S // 100
s_2 = S % 100

if 1 <= s_1 <= 12 and 1 <= s_2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s_1 <= 12 and (s_2 < 1 or s_2 > 12):
    print('MMYY')
elif 1 <= s_2 <= 12 and (s_1 < 1 or s_1 > 12):
    print('YYMM')
else:
    print('NA')

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

int main()
{
    int N;
    cin >> N;
    bool flag = false;
    for (int i = 0; i < N / 4 + 1; i++)
    {
        for (int j = 0; j < (N - 4 * i) / 7 + 1; j++)
        {
            if (4 * i + 7 * j == N)
                flag = true;
        }
    }

    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
	int a, b;
	char op;
	cin >> a >> op >> b;

	if (op == '+') {
		cout << a + b << "\n";
		return 0;
	}

	cout << a - b << "\n";
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp {
  char name[10];
  int t;
} P;

void enqueue(P );
P dequeue(void);
int min(int, int);

P Q[LEN];
int head, tail, n;

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for( i = 1 ; i <= n ; i++ ){
    scanf("%s", Q[i].name );
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n + 1;

  while( head != tail ){
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if( u.t > 0 ){
      enqueue(u);
    }
    else{
      printf("%s %d\n", u.name, elaps);
    }
  }
}

void enqueue(P x){
  Q[tail] = x;
  tail = ( tail + 1 ) % LEN;
}

P dequeue(){
  P x = Q[head];
  head = ( head + 1 ) % LEN;
  return x;
}

int min(int a, int b){
  return a < b ? a : b;
}



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

int main() {
    int N, K;
    string S;
    cin >> N >> S >> K;
    
    string T = "";
    for (int i = 0; i < N; i++) {
        if(S[i] == S[K - 1]) T += S[i];
        else T += "*";
    }
    
    cout << T << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main () {
  long long a, b, c;
  cin >> a >> b >> c;
  long long k = c - a - b;
  if (k <= 0) {
    cout << "No" << endl;
    return 0;
  }
  long long m = k * k;
  cout << ((m > 4 * a * b) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a=0,b=0,k=0,d=0;
  while(n--){
   string c;
    cin>>c;
    if(c=="AC"){
      a++;}
    else if(c=="WA"){
    b++;
    }
    else if(c=="TLE"){
    k++;
    }
    else if(c=="RE"){
    d++;
    }
  }
  cout<<"AC"<<" "<<'x'<<" "<<a<<endl;
  cout<<"WA"<<" "<<'x'<<" "<<b<<endl;
  cout<<"TLE"<<" "<<'x'<<" "<<k<<endl;
  cout<<"RE"<<" "<<'x'<<" "<<d<<endl;
  return 0;
}

Measured memory_bytes: 3660
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author emli
 */


#include <iostream>
using namespace std;

class BSumo {
public:
	void solve(std::istream& cin, std::ostream& cout) {
		ios::sync_with_stdio(false);
        cin.tie(nullptr);
        string s;
        cin >> s;
        int x = 0;
        for(char x1 : s ) if(x1 == 'o') x++;

       // cout << "x =" << x <<endl;
        if (x >= 8 || x + (15 - s.size()) >= 8){
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
	}
};



int main() {
	BSumo solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256