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

int main(){
    long long n, ans=0;
    cin>>n;

    for(int i=1; i<=n; i++){
        if( i%3!=0)
        {
            if(i%5!=0)
            {
                ans=ans + i;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double[] d = new double[N];
		Queue<Double> queue = new PriorityQueue<>();
		for(int i = 0 ;i < N; i++) {
			queue.add(sc.nextDouble());
		}
		sc.close();
		
		for(int i = 0; i < N - 1; i++) {
			double d1 = queue.poll();
			double d2 = queue.poll();
			queue.add((d1+d2)/2);
		}
		System.out.println(queue.poll());
	}
}

Measured memory_bytes: 25300
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const ll size=1e5+10;
struct node{
	ll x,y,v;
}a[size];
ll n,t,ht,cx,cy,hx,hy,h,maxh;
int main(){
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++) scanf("%lld%lld%lld",&a[i].x,&a[i].y,&a[i].v);
	for(cx=0;cx<=100;cx++){
		for(cy=0;cy<=100;cy++){
			ll first=0,id=0,flag=1,maxh=1e18;
			for(ll i=1;i<=n;i=i%n+1){
				if(first==0){
					if(a[i].v>0){
						first=abs(cx-a[i].x)+abs(cy-a[i].y)+a[i].v;id=i;
					}
				}
				else{
					if(i==id){
						break;
					}
					if(!a[i].v){
						ll t=abs(cx-a[i].x)+abs(cy-a[i].y);
						maxh=min(maxh,t);
						if(first>maxh){
							flag=0;break;
						}
					}
					else{
						ll t=abs(cx-a[i].x)+abs(cy-a[i].y);
						t+=a[i].v;
						if(t>maxh||t!=first){
							flag=0;break;
						}
					}
				}
			}
			if(flag==1){
				printf("%lld %lld %lld\n",cx,cy,first);return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   int a,b,c;
   cin>>a;
   if(a==1)
   {
      cout<<"Hello World"<<endl;
      system ("pause");
      return 0;
   }
   if(a==2)
   {
      cin>>b>>c;
      cout<<b+c<<endl;
      system ("pause");
      return 0;
   }
   system ("pause");
   return 0;
}

Measured memory_bytes: 504
use whiteread::parse_line;

fn main() {
    let (n, y): (usize, usize) = parse_line().unwrap();

    for i in 0..=n {
        for k in 0..=n - i {
            if i * 10000 + k * 5000 + (n - i - k) * 1000 == y {
                println!("{} {} {}", i, k, n - i - k);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}


Measured memory_bytes: 2184
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int dish[5];
    for(int i=0;i<5;i++) cin >> dish[i];
    vector<pair<int, int>> rec(5);
    for(int i=0;i<5;i++){
        rec[i].first = dish[i];
        rec[i].second = 10 - dish[i] % 10;
        if(dish[i] % 10 == 0){
            rec[i].second = 0;
        }
    }
    sort(rec.begin(), rec.end(), [](const auto& a, const auto& b){return a.second < b.second;});
    int ans = 0;
    for(int i=0;i<4;i++){
        ans += rec[i].first + rec[i].second;
    }
    ans += rec[4].first;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,ctr5=0,ctr7=0;
for(int i=0;i<3;i++){
    cin>>x;
    if(x==5){
        ctr5++;
    }
    else if(x==7){
        ctr7++;
    }
}
if(ctr5==2 && ctr7==1){
    cout<<"YES";
}
else{
    cout<<"NO";
}
}

Measured memory_bytes: 3584
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()

dic = defaultdict(int)

for i in range(1, N+1):
	dic["{},{}".format(str(i)[0], str(i)[-1])] += 1

# print(dic)

ans = 0
for n in dic.copy():
	s, e = n.split(",")
	if s == e:
		ans += dic[n]**2
	else:
		s_o, e_o = e, s
		ans += dic[n] * dic["{},{}".format(s_o, e_o)]
print(ans)


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int[] int_input = new int[input.Length];
            for(int i = 0; i < input.Length; i++)
            {
                int_input[i] = int.Parse(input[i].ToString());
            }
            Console.WriteLine(hantei(int_input[int_input.Length - 1]));
            Console.Read();
        }

        public static string hantei(int x)
        {
            string print = "";
            if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9)
            {
                print = "hon";
            }
            else if(x == 0 || x == 1 || x == 6 || x == 8)
            {
                print = "pon";
            }
            else if(x == 3)
            {
                print = "bon";
            }
            return print;
        }
    }
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> a(m);
    int sum = 0;
    rep(i,m)
    {
        cin >> a[i];
        sum += a[i];
    }

    if (n-sum < 0)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << n-sum << endl;
    return 0;
    
}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)

#define PI 3.14159265358979323846
#define INF 1050000000
#define MOD 1000000007
#define EPS (1e-10)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vp> vvp;

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

/*<ここから>***********************************************************/






int main()
{
	string s, T;
	cin >> s >> T;
	bool UNRESTORABLE = true;

	reprev(i, s.length() - T.length() + 1) {
		int ct = 0;
		rep(j, T.length()) {
			if (s[i + j] == T[j] || s[i + j] == '?') ct++;
		}

		if (ct == T.length()) {
			rep(j, T.length()) s[i + j] = T[j];
			UNRESTORABLE = false;
			break;
		}
	}

	if (!UNRESTORABLE) {
		rep(i, s.length()) if (s[i] == '?') s[i] = 'a';
		cout << s << endl;
	}
	else {
		cout << "UNRESTORABLE" << endl;
	}

	return 0;
}


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

    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846

    void solve(){
        int x;
        cin>>x;
        int total=0;
        for(int i=1;i<=1000;i++){
            total+=x;
            if(total%360==0){
                cout<<i;
                return;
            }
        }
        return;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


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

int main() {

    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);

    if ((a == b) && (b == c)) {
        printf("1");

    } else if ((a == b && a != c )|| (a == c && a != b) || (b == c && b != a)) {
        printf("2");

    } else {
        printf("3");
    }

}


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

int main(){
  vector<int> num = {1, 2, 4, 8, 16, 32, 64};
  int N;
  cin >> N;
  int ans = 0;
  for(int i = 0; i < num.size(); i++){
    if(N >= num[i]){
      ans = num[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((LL)998244353) 
#define INF ((int)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
using namespace std;

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	string s, t;
	cin >> s >> t;
	int ans = 0;
	map<char, vector<int>> m;
	REP(i, s.size()){
		m[s[i]].push_back(i);
	}
	foreach(i, m){
		i.second.push_back(INF);
	}
	int place = 0;
	foreach(i, t){
		if(m.count(i)==0){
			cout << -1 << endl;
			return 0;
		}
		int p = *lower_bound(ALL(m[i]), place);
		if(p==INF){
			++ans;
			place = *m[i].begin() + 1;
		}else{
			place = p + 1;
		}
	}
	cout << (LL)s.size() * ans + place << endl;
	return 0;
}


Measured memory_bytes: 1216
#ifndef LOCAL
#pragma GCC optimize ("Ofast")
#endif

#include "bits/stdc++.h"

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

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

constexpr int nax = 1000 * 1000 + 105;
constexpr int infty = 1000 * 1000 * 1000 + 5;
constexpr int mod = 1000 * 1000 * 1000 + 7;

void Ogarnij(ll& l, ll& r, ll a) {
  l = (l + a - 1) / a;
  r = r / a;
  l *= a;
  r *= a;
  r += a - 1;
  if (l > r) throw 1;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<ll> as;
  int n;
  cin >> n;
  while (n--) {
    ll x;
    cin >> x;
    as.push_back(x);
  }
  reverse(as.begin(), as.end());
  try {
    ll l = 2, r = 2;
    for (ll a : as) Ogarnij(l, r, a);
    cout << l << " " << r << endl;
  } catch (int x) {
    cout << -1 << endl;
  }
  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll, ll>
#define pb push_back
#define ll long long
#define ld long double	
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e18
ll power(ll num, ll g, ll mod) {
	if (g == 0)return 1;
	if (g % 2 == 1)return (num * power((num * num) % mod, g / 2, mod)) % mod;
	return power( (num * num) % mod, g / 2, mod);
}


int main(){
	int x, n;
	cin >> x >> n;
	int a[n];
	set<int> st;
	FOR0(i, n) {
		cin >> a[i];
		st.insert(a[i]);
	}
	sort(a, a + n);
	int y = x - 1, z = x + 1;
	if (st.find(x) == st.end()){
		cout << x;
		return 0;
	}
	while(1){
		if (st.find(y) == st.end()){
			cout << y;
			return 0;
		}
		else y--;
		if (st.find(z) == st.end()){
			cout << z;
			return 0;
		}
		else z++;
	}
}

Measured memory_bytes: 3628
from sys import stdin, stdout
import math as m
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	x = int(rl())
	c = 100
	y = 0
	while c < x:
		c = m.floor(1.01 * c)
		y += 1
	stdout.write(str(y));stdout.write("\n")
	stdout.close()

if __name__ == "__main__":
	main()

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

int main() {
  char I;
  cin >> I;
  if (I == 'A')
    cout << 'T' << endl;
  if (I == 'T')
    cout << 'A' << endl;
  if (I == 'C')
    cout << 'G' << endl;
  if (I == 'G')
    cout << 'C' << endl;
}

Measured memory_bytes: 3572
// https://atcoder.jp/contests/dp/tasks/dp_a

#include <iostream>
#include <climits>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;

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

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

    ll dp[n];

    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        ll minCost = LLONG_MAX;

        for (int j = 1; j <= k; ++j) {
            if (i - j < 0) continue;
            ll cost = dp[i - j] + abs(h[i] - h[i - j]);
            if (cost < minCost) minCost = cost;
        }

        dp[i] = minCost;
    }

    cout << dp[n - 1] << endl;
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	assert(N >= 2);
	string A; cin >> A;

	N--; // number of iterations instead

	int ans2 = 0;
	for (int i = 0; i <= N; i++) {
		if ((N & i) == i) {
			ans2 += A[i]; ans2 %= 2;
		}
	}

	if (ans2) {
		cout << 1 << '\n';
		exit(0);
	} else {
		int ans4 = 0;
		for (int i = 0; i <= N; i++) {
			if (A[i] == '2') {
				cout << 0 << '\n';
				exit(0);
			}
			if ((N & i) == i) {
				ans4 += A[i]-1; ans4 %= 4;
			}
		}
		cout << ans4 << '\n';
	}

	return 0;
}


Measured memory_bytes: 1948
#include <stdio.h>
#include<iostream>
#include <algorithm>
#include <math.h>

using namespace std;
int main(){
	char str[101]={0};
	int count=0;
	scanf("%s",str);
	for(int i=0;i<100;i++){
		if(str[i]==0){
			break;
		}
		count++;
	}
	printf("%c%d%c",str[0],count-2,str[count-1]);
	return 0;
}


Measured memory_bytes: 256
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
static int desc(const void *a, const void *b);
static int asc(const void *a, const void *b);
 
int main (void){
    int n,k,i,j;
    int x,y,z;
    int a,b,m;
    int min = 2000000000;
    int mina = 2000000000;
    int minb = 2000000000;
    a = b = m = 0;
    int count = 0;
    double dx;
    int box_a[200001]={};
    int box_b[200001]={};
    char text[200001]={};
    char s[200001]={};
    char t[200001]={};
    char alf[256] = {"abcdefghijklmnopqrstuvwxyz"};
    char alfb[256] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    char sample_text[256];

    // Input Area //
    scanf("%d %d %d",&a,&b,&m);
    for (i = 0; i < a; i++){
        scanf("%d",&box_a[i]);
        if (mina > box_a[i]){
            mina = box_a[i];
        }
    }
    for (i = 0; i < b; i++){
        scanf("%d",&box_b[i]);
        if (minb > box_b[i]){
            minb = box_b[i];
        }
    }
    for (i = 0; i < m; i++){
        scanf("%d %d %d",&x,&y,&z);
        if (min > box_a[x - 1] + box_b[y - 1] - z){
            min = box_a[x - 1] + box_b[y - 1] - z;
        }
    }
    if (min > mina + minb){
        printf("%d",mina + minb);
    }else{
        printf("%d",min);
    }
    //scanf("%s %s",s,t);
    //scanf("%d %d",&x,&y);
    //scanf("%s",text);
 
    /*
    if(strcmp(text,s)==0){
        x--;
    }else if(strcmp(text,t)==0){
        y--;
    }
    */
    //printf("%d %d",x,y);
    //scanf("%s",&sample_text);
    //scanf("%s",&text);
 
    /*
    scanf("%d",&n);
    for(i = 0; i < n; i++){
        scanf("%d",&box[i]);
    }
    for(i = 0; i < n; i++){
        printf("%d",box[i]);
    }
    printf("\n");
    qsort(box,n,sizeof(int),desc);
    
    */
    // Output Area //
    
    /*
    for(i = 0; i < n; i++){
        printf("%d",box[i]);
    }
    */
 
}
 
static int desc(const void *a, const void *b){
    return *(int *) b - *(int *) a;
}
 
static int asc(const void *a, const void *b){
    return *(int *) a - *(int *) b;
}
 
 
/* KonoLvBANK
 
配列降順ソート
qsort(box,n,sizeof(int),desc);
配列昇順ソート
qsort(box,n,sizeof(int),asc);
 
アルファベットを次の単語に変えるやつ
    while(1){
        if (text[i] == '\0'){
            break;
        }
        for(j = 0; j < 26; j++){
            if (text[i] == alf[j]){
                if (j != 25){
                    text[i] = alf[j + 1];
                }else{
                    text[i] = alf[0];
                }
                break;
            }
        }
        i++;
    }
    */

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

int main(int argc, const char * argv[]) {
    string s;
    cin >> s;
    char c = s[s.size() - 1];
    if(c == 's'){
        cout << s << "es" << endl;
    }else{
        cout << s << "s" << endl;
    }
    return 0;
}

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

int32_t main(){
       int a,b,c,d,a1,b1;
       cin>>a>>b>>c>>d;
       a1=max(a*c,a*d);
       b1=max(b*c,b*d);
       cout<<max(a1,b1)<<endl;

}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

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

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll n;cin>>n;
  ll ans=1;
  ll m=1000000000000000000;
  ll next=m;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(all(a));
  for(int i=0;i<n;i++){
    ll val=a[i];
    if(val==0){
      ans=0;
      break;
    }
    if(val>next){
      ans=-1;
      break;
    }
    ans*=val;
    next/=val;
  }
  cout<<ans<<endl;
  return 0;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    set<int> vis;
    vis.insert(n);
    while (true) {
      if (n % 2) {
        n = n * 3 + 1;
      } else {
        n = n / 2;
      }
      if (vis.count(n)) break;
      vis.insert(n);
    }
    cout << vis.size() + 1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
set<int> s;
int32_t main()
{
	int n=in();int x=in();int m=in();
	vector<int> a;
	a.push_back(x);s.insert(x);
	int cycel=-1;
	for(int i=1;i<n;i++)
	{
		int cur=(a[i-1]*a[i-1])%m;
		if(s.find(cur)!=s.end())
		{
			cycel=cur;break;
		}	
		else a.push_back(cur),s.insert(cur);
	}
	if(cycel==-1)
	{
		int ans=accumulate(all(a),0LL);
		cout<<ans;return 0;
	}
	//cout<<cycel;
	int start=-1,i=0;
	for(i=0;i<a.size();i++)if(a[i]==cycel){start=i;break;}
	assert(start!=-1);
	int en=a.size()-1;
	//cout<<start<<" "<<en<<" ";
	
	int sum=0;for(int i=0;i<start;i++)sum+=a[i];
	int len=(en-start+1);n-=start;//cout<<len<<"\n";
	int full=n/len;
	int rem=n%len;
	//cout<<full<<" "<<rem<<"\n";
	int fulls=accumulate(a.begin()+start,a.begin()+en+1,0LL);fulls*=full;
	int rems=accumulate(a.begin()+start,a.begin()+start+rem,0LL);
	cout<<sum+fulls+rems;
	
	
	
}


Measured memory_bytes: 6004
#!ruby -pl
h={I:1,V:5,X:10,L:50,C:100,D:500,M:1000}
$_=($_+?I).chars.map{|i|h[:"#{i}"]}.each_cons(2).inject(0){|s,(a,b)|;a<b ?s-a :s+a}

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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;

//atcoder
//begineer contest 139
//a

int main()
{
	long curr=0, maximum=0;

	long n, hcurr, hpre;
	long h;

	cin>>n;

	cin>>h;

	hpre = h;

	// if(n==1)
	// {
	// 	cout<<0<<endl;
	// 	return 0;
	// }

	for (long i = 1; i < n; ++i)
	{
		cin>>h;

		hcurr = h;

		if(hcurr>hpre)
			curr = 0;
		else
			curr++;

		maximum = max(maximum, curr);

		hpre = hcurr;

	}

	cout<<maximum<<endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MAX 500005
int bit[MAX], n, q;
map<int, int> mp;
struct Query
{
    int l, r, id;
    bool operator<(const Query &a) const
    {
        return r < a.r;
    }
} b[MAX];
int gsum(int i)
{
    int s = 0;
    while (i > 0)
    {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}
void add(int i, int k)
{
    while (i <= n)
    {
        bit[i] += k;
        i += i & -i;
    }
}
int main()
{
    scanf("%d %d", &n, &q);
    mp.clear();
    vector<int> a(n + 10), ans(q);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < q; i++)
    {
        int l, r;
        scanf("%d %d", &l, &r);
        b[i].l = l;
        b[i].r = r;
        b[i].id = i;
    }
    sort(b, b + q);
    int pre = 1;
    for (int i = 0; i < q; i++)
    {
        for (int j = pre; j <= b[i].r; j++)
        {
            if (mp[a[j]])
            {
                add(mp[a[j]], -1);
            }
            add(j, 1);
            mp[a[j]] = j;
        }
        pre = b[i].r + 1;
        ans[b[i].id] = gsum(b[i].r) - gsum(b[i].l - 1);
    }
    for (int i = 0; i < q; i++)
    {
        printf("%d\n", ans[i]);
    }
}

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

typedef long long ll;

const int MAX_N = 200001;
int par[MAX_N];
int rnk[MAX_N];

void init(int n) {
    rep(i,n) {
        par[i] = i;
        rnk[i] = 0;
    }
}

int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rnk[x] < rnk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
}

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

void solve() {
    int N, K, L, p, q;
    cin >> N >> K >> L;
    init(N);
    rep(i,K) {
        cin >> p >> q;
        unite(p - 1, q - 1);
    }
    int roads[N];
    rep(i,N) roads[i] = find(i);
    init(N);
    rep(i,L) {
        cin >> p >> q;
        unite(p - 1, q - 1);
    }
    map<pair<int, int>, int> d;
    rep(i,N) d[make_pair(roads[i], find(i))]++;
    rep(i,N) cout << d[make_pair(roads[i], find(i))] << " ";
    cout << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 14336
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001;
#define LLINF 1001001001001001001001;

int main(){
    int N;int X[200002],XS[200002];
    scanf("%d",&N);
    rep(i,N){
        int x;
        scanf("%d",&x);
        X[i]=x;XS[i]=x;
    }

    sort(XS,XS+N);
    int M1=XS[(N/2)-1];
    int M2=XS[(N/2)];
    rep(i,N){
        if(X[i]<=M1)printf("%d\n",M2);
        else printf("%d\n",M1);
    }
    
}

Measured memory_bytes: 3712
#094d
import math

N = int(input()) #N<10**5
a_list = list(int(e) for e in input().split())
a_tuple = tuple(a_list)

comb_n = max(a_tuple)

a_list.remove(comb_n)
diff = min([abs(comb_n/2 - a) for a in a_list])
a_tuple = tuple(a_list)
if int(comb_n/2 + diff) in a_tuple:
    comb_r = comb_n/2 + diff
elif int(comb_n/2 - diff) in a_tuple:
    comb_r = comb_n/2 - diff  
    
print(int(comb_n),int(comb_r))

Measured memory_bytes: 14440
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


//nCr,nPr,modの逆元
class Combination {
public:
	Array fact;//n！
	Array inv;//n!の逆元
	ll mod;
	Combination(ll n, ll _mod) {
		mod = _mod;
		fact.resize(n + 1);
		fact[0] = 1;
		REP(i, n) {
			fact[i + 1] = (fact[i] * (i + 1LL)) % mod;
		}
		inv.resize(n + 1);
		inv[n] = mod_inv(fact[n]);
		for (int i = n; i > 0; i--) {
			inv[i - 1] = inv[i] * i % mod;
		}
	}
	//modの逆元
	ll mod_inv(ll x) {
		ll n = mod - 2;
		ll res = 1LL;
		while (n > 0) {
			if (n & 1) res = res * x % mod;
			x = x * x % mod;
			n >>= 1;
		}
		return res;
	}
	ll nCr(ll n, ll r) {
		return ((fact[n] * inv[r] % mod) * inv[n - r]) % mod;
	}
	ll nPr(ll n, ll r) {
		return (fact[n] * inv[n - r]) % mod;
	}
	ll nHr(ll n, ll r) {
		//重複組み合わせ：n種類のものからr個取り出す組み合わせ
		return nCr(r + n - 1, r);
	}
};


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

	ll n;
	cin >> n;
	Array a(n, 0);
	REP(i, n) cin >> a[i];

	Combination com(n, MOD);

	Array sum(n+1, 0);
	for (int i = 2; i <= n;i++) {
		(sum[i] = sum[i - 1] + com.mod_inv(i))%=MOD;
	}

	ll ans = 0;
	REP(i, n) {
		(ans += sum[i+1] * a[i] % MOD) %= MOD;
		(ans += sum[n-i] * a[i] % MOD) %= MOD;
		(ans += a[i]) %= MOD;
	}

	cout << (ans * com.fact[n])%MOD << endl;

	return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using ll = long long;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second


int main()
{
    int n,c;
    std::cin >> n >> c;
    std::vector<std::vector<int>> dist(c,std::vector<int>(c)), map(n + 1, std::vector<int>(n + 1));
    for(int i = 0; i < c; i++){
        for(int j = 0; j < c; j++){
            std::cin >> dist[i][j];
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            std::cin >> map[i][j];
            map[i][j]--;
        }
    }

    std::vector<std::map<int,int>> col_cnt(3);
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            col_cnt[(i + j) % 3][map[i][j]]++;
        }
    }
    int min = 1000000000;
    for(int i = 0; i < c; i++){
        for(int j = 0; j < c; j++){
            for(int k = 0; k < c; k++){
                if(i == j || j == k || k == i)continue;
                //col_cnt[0]で色iの時
                int cur = 0;
                for(auto t : col_cnt[0]){
                    cur += dist[t.first][i] * t.second;
                }
                for(auto t : col_cnt[1]){
                    cur += dist[t.first][j] * t.second;
                }
                for(auto t : col_cnt[2]){
                    cur += dist[t.first][k] * t.second;
                }
                min = std::min(min,cur);
            }
        }
    }
    std::cout << min << std::endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
char s[12],t[12];
int main()
{ cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin>>s>>t;
  t[strlen(s)]='\0';
  if(strcmp(t,s)==0)
     cout<<"Yes\n";
  else
     cout<<"No\n";
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define maxn 200005
using namespace std;

int A[3][3],d[3][3];
map<int, int> mp;

int main() {

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> d[i][j];
        }
    }
    int n;
    cin >> n;
    while(n--){
        int x;
        cin >> x;
        mp[x] = 1;
    }
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            A[i][j] = mp [d[i][j]];
        }
    }
    if(A[0][0] + A[0][1] + A[0][2] == 3)cout <<"Yes" << endl;
    else if(A[1][0] + A[1][1] + A[1][2] == 3)cout <<"Yes" << endl;
    else if(A[2][0] + A[2][1] + A[2][2] == 3)cout <<"Yes" << endl;
    else if(A[0][0] + A[1][0] + A[2][0] == 3)cout <<"Yes" << endl;
    else if(A[0][1] + A[1][1] + A[2][1] == 3)cout <<"Yes" << endl;
    else if(A[0][2] + A[1][2] + A[2][2] == 3)cout <<"Yes" << endl;
    else if(A[0][0] + A[1][1] + A[2][2] == 3)cout <<"Yes" << endl;
    else if(A[0][2] + A[1][1] + A[2][0] == 3)cout <<"Yes" << endl;
    else cout << "No" << endl;



    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,m;
	cin>>n>>m;
	if(n%2){
		for(ll i=0;i<m;i++){
			cout<<i+1<<" "<<n-i<<"\n";
		}
	}
	else {
		for(ll i=0;i<m;i++){
			if(i<(m+1)/2) cout<<i+1<<" "<<n-i<<"\n";
			else cout<<i+1<<" "<<n-i-1<<"\n";
		}
	}
	
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 998244353 
#define int long long
#define ll long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000005
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define PI M_PI
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
int add(int a, int b) {a=(a%mod + b%mod)%mod;return a;}
int sub(int a, int b) {a =(a%mod - b%mod + mod)%mod ;return a;}
int mul(int a, int b) {return (a%mod * b%mod) % mod;}


void solve()
{ 
  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
}

signed main()
{ boost
  int test=0,t;
    //cin >> t ;
    t=1;
   while(test++ <t){
	  //cout<<"Case #"<<test<<": ";
	   solve();}
  
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}



int main() {
	int a, b, c,d; cin >> a>>b>>c;
	//string s,t,u; cin >> s>>t>>u;
	if (a + b == c || a + c == b || b + c == a)cout << "Yes";
	else cout << "No";

	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char ip;
	bool c=0,f=0;
	while(cin>>ip)
	{
		if(ip=='C') c=1;
		if(c and ip=='F') f=1;
	}
	if(c and f) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

#define ll long long
const int MOD = 1e9 + 7;
int main() {
	
	int n;
	cin >> n;
	ll ans = 1;
	map<int, ll> cnt;
	for (int i=1; i<=n; i++) {
		int val = i;
		while (val % 2 == 0) {
			cnt[2]++;
			val >>= 1;
		}
		for (int j=3; j*j<=val; j+=2) {
			while (val % j == 0) {
				cnt[j]++;
				val /= j;
			}
		}
		if (val != 1)
			cnt[val]++;
	}
	
	for (auto& e:cnt) {
		ans = ((ans % MOD) * ((e.second + 1) % MOD)) % MOD;
	}
	
	cout << ans << '\n';
	
	
	return 0;
}


Measured memory_bytes: 3568
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
 

public class Main{
          
     
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{
             String line;
             boolean first=true;
            while((line=br.readLine())!= null){if(line.isEmpty())break;
             int x = Integer.parseInt(line); line=br.readLine();
             int h=Integer.parseInt(line);
             if(x==0&&h==0)break;
             double s = x*x;
             double half_x = (double) x/2;
              //  System.out.println(half_x);
             double syamen = Math.sqrt((half_x*half_x+h*h));
             s+= 2*(syamen*x);
                System.out.println(s);
            }br.close();
       
         }catch(Exception e){e.printStackTrace();}         
     }
     
}
  

Measured memory_bytes: 15072
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
d = [-1, 1]
res = 0
for i in range(2):
  for j in range(2):
    for k in range(2):
      temp = []
      for l in range(N):
        temp.append(A[l][0] * d[i] + A[l][1] * d[j] + A[l][2] * d[k])
      temp.sort(reverse = True)
      res = max(res, sum(temp[: M]))
print(res)

Measured memory_bytes: 41072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
void solve()
{
	ll x1,y1,x2,y2,i;
	string s1="",s2="",f1="",f2="",f="";
	cin>>x1>>y1>>x2>>y2;
	for(i=0;i<(y2-y1);i++)
	{
		s1=s1+"U";
		s2=s2+"D";
	}
	for(i=0;i<(x2-x1);i++)
	{
		s1=s1+"R";
		s2=s2+"L";
	}
	
	f1=s1+s2;
	s1="LU"+s1+"RD";
	s2="RD"+s2+"LU";
	f2=s1+s2;
	f=f1+f2;
	cout<<f<<endl;
}

	int main()
	{
//#ifndef ONLINE_JUDGE
//		freopen("input.txt", "r", stdin);
//		freopen("output1.txt", "w", stdout);
//#endif
		ll t = 1;
		//cin >> t;
		while (t--)
		{
			solve();
		}
	}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from math import acos

def ccw(p1,p2,p3):
    return (p2[0]-p1[0])*(p3[1]-p1[1]) - (p2[1]-p1[1])*(p3[0]-p1[0])

def ConvexHull(points):
    u = []
    l = []
    points.sort()
    
    for p in points:
        while len(u)>1 and ccw(u[-2], u[-1], p)>=0:
            u.pop()
        while len(l)>1 and ccw(l[-2], l[-1], p)<=0:
            l.pop()
            
        u.append(p)
        l.append(p)
        
    return u + l[-2:0:-1]


def angle(v1, v2):
    inner = v1[0]*v2[0] + v1[1]*v2[1]
    normv1 = (v1[0]**2 + v1[1]**2) ** 0.5
    normv2 = (v2[0]**2 + v2[1]**2) ** 0.5
    
    return acos(inner / (normv1*normv2))

n = ni()
if n == 1:
    print(1)

elif n == 2:
    print(0.5)
    print(0.5)
    
else:
    points = [list(li()) + [i] for i in range(n)]    
    ch = ConvexHull(points)    
    bsc = []
    
    for i in range(len(ch)):
        x1,y1,i1 = ch[i]
        x2,y2,i2 = ch[i-1]
        
        bsc.append((y1-y2, x2-x1))
        
    if len(ch) == 2:
        angles = [1,1]
        
    else:
        angles = [angle(bsc[i], bsc[i-1]) for i in range(len(ch))]
    
    sm = sum(angles)
        
    ans = [0]*n
    for i in range(len(ch)):
        x,y,ind = ch[i-1]
        ans[ind] = angles[i] / sm
        
    for x in ans:
        print(x)

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

ll b,c,d,n,m,k;
ll ans=100000000000;

string s;

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  
  cin>>n>>k;
  vector<int> v(n,0);
  rep(i,k){
    cin>>d;
    rep(j,d){
      ll p;
      cin>>p;
      v[p-1] = 1;
    }
  }
  cout<<count(v.begin(), v.end(), 0);
  



  

  return 0;
}



Measured memory_bytes: 3656
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

dic = Counter(S)

tmp = max(dic.values())
ans = [key for key, value in dic.items() if value == tmp]

# もうちょいかっこいい書き方があるはず。リストを1行1str出力 and 最後に改行しないように
for key in sorted(ans):
    print(key, end="")
    print("")


Measured memory_bytes: 105824
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 105
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll X, Y, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

int main() {
	go;
    cin >> X >> Y;
    fei(i, 0, X, 1) {
    	if(4 * i + 2 * (X - i) == Y) {
    		cout << "Yes\n";
    		quit;
    	}
    }
    cout << "No\n";
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3648
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N, H;
	scanf("%d%d", &N, &H);
	char Ss[100][16]; int Ts[100];
	rep(i, N)
		scanf("%s%d", Ss[i], &Ts[i]);
	int hp = H;
	int success = 0, total = 0;
	rep(i, N) {
		char *S = Ss[i]; int T = Ts[i];
		int len = strlen(S);
		int pos = 0, misses = 0;
		while(1) {
			printf("? %s\n", S); fflush(stdout);
			char c[2];
			scanf("%s", c);
			++ total;
			if(tolower(S[pos]) == tolower(*c)) {
				S[pos] = '_';
				++ pos;
				++ success;
				if(pos == len)
					break;
			}else {
				++ misses;
				if(misses > T) {
					-- hp;
					break;
				}
			}
		}
		if(hp == 0) {
			printf("! Game Over\n"); fflush(stdout);
			return 0;
		}
	}
	int rate = success * 1000 / total;
	printf("! Game Clear %d.%d\n", rate / 10, rate % 10); fflush(stdout);
	return 0;
}

Measured memory_bytes: 1300