akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  ll a=n%10;
  if(a==2||a==4||a==5||a==7||a==9){
    COUT("hon");
  }
  else if(a==3){
    COUT("bon");
  }
  else{
    COUT("pon");
  }
}

Measured memory_bytes: 3592
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 3000;

int dp[MAX_N + 1][MAX_N + 1];

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

    string s, t;

    cin >> s >> t;

    /*
    bool canm = false;
    for (int j = 0; j < t.size(); j++) {
        if (s[0] == t[j] || canm) {
            dp[0][j] = 1;
            canm = true;
        }
    }
    */

    for (int i = 1; i <= s.size(); i++) {
        for (int j = 1; j <= t.size(); j++) {
            if (j >= 1) {
                int res = max(dp[i][j - 1], dp[i - 1][j]);
                if (s[i - 1] == t[j - 1]) {
                    res = max(res, dp[i - 1][j - 1] + 1);
                }
                dp[i][j] = res;
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    int lmax = dp[s.size()][t.size()];
    string ans;
    int si = s.size();
    int tj = t.size();

    while (si > 0 && tj > 0) {
        if (dp[si][tj] == dp[si][tj - 1]) {
            tj--;
        } else if (dp[si][tj] == dp[si - 1][tj]) {
            si--;
        } else {
            ans = s[si - 1] + ans;
            si--;
            tj--;
        }

    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 38868
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		String ans = "Yay!";
		
		if (a + b > 16 || a > 8 || b > 8) {
			ans = ":(";
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22604
#include<iostream>
using namespace std;
long long h[2019],a[200005];
int main() {
	long long ans=0;
	string st;
	cin >> st;
	a[0] = st[0] - 48;

	for (int i = 1; i < st.length(); i++) {
		a[i] = (a[i - 1] * 10 + st[i] - 48) % 2019;
	}
	int x = 1;
	for (int i = st.length() - 1; i >= 0; i--) {
		a[i] = (a[i] * x) % 2019;
		h[a[i]]++;
		x = x*10 % 2019;
	}

	for (int i = 0; i <= 2018; i++) {
		if (h[i] > 0)ans = ans + h[i]*(h[i]-1)/2;
	}
	cout << ans+h[0] << endl;
	return 0;
}

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

void ReplaceStr(char str[])
{
    for (int i = 0; str[i] != 0; i++)
    {
        for (int j = i + 1; str[j] != 0; j++)
        {
            if (str[i] > str[j])
            {
                char tmp = str[i];
                str[i] = str[j];
                str[j] = tmp;
            }
        }
    }
}

int main()
{
    int n;
    cin >> n;
    char str[20];
    map<string, long> m;
    for (int i = 0; i < n; i++)
    {
        cin >> str;
        ReplaceStr(str);
        string s(str);
        auto itr = m.find(s);
        if(itr != m.end()) {
            m[str] = m[str] + 1;
        } else {
            m[str] = 1;
        }
    }

    long long counter = 0;
    for (auto x : m) {
        if(x.second >1) {
            long num = x.second;
            counter += num*(num-1)/2;
        }
    }
    cout << counter << endl;;
}


Measured memory_bytes: 11136
n, m, q = map(int, input().split())
mlist = [list(map(int, input().split())) for _ in range(m)]
qlist = [list(map(int, input().split())) for _ in range(q)]

result = [[0] * n for _ in range(n)]
for i in range(m):
    result[0][mlist[i][1] - 1] += 1
    if mlist[i][0] < n:
        result[mlist[i][0]][mlist[i][1] - 1] -= 1

for i in range(n):
    for j in range(1,n):
        result[i][j] += result[i][j - 1]
for i in range(1,n):
    for j in range(n):
        result[i][j] += result[i-1][j]

for i in range(q):
    print(result[qlist[i][0] - 1][qlist[i][1] - 1])

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

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		long ans = 0;
		for(int i = 0; i < n; i++) {
			long num = sc.nextLong();
			ans += func(num);
		}
		out.println(ans);
	
		out.close();
	}
	static int func(long n) {
		int cnt = 0;
		long num = n;
		while (num % 2 == 0) {
			num /= 2;
			cnt++;
		}
		return cnt;
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}



Measured memory_bytes: 21960
fn check(num: u64) -> u64 {
    match num {
        1|3|5|7|8|10|12 => 1,
        4|6|9|11 => 2,
        2 => 3,
        _ => 0
    }
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut ws = s.trim().split_whitespace();
    let x: u64 = ws.next().unwrap().parse().unwrap();
    let y: u64 = ws.next().unwrap().parse().unwrap();
    if check(x) == check(y) {
        println!("Yes");
    } else {
        println!("No");       
    }
}

Measured memory_bytes: 4352
n,k = list(map(int,input().split()))
point = list(map(int,input().split()))
rsp = ['r', 's', 'p']
t = input()
m = [rsp[rsp.index(i)-1] for i in t]
ans = 0
for i in range(n):
    if i<k :
        ans += point[rsp.index(m[i])]
    else:
        if m[i]!=m[i-k]:
            ans += point[rsp.index(m[i])]
        else:
            try:
                m[i] = rsp[rsp.index(m[i+k])-1]
            except:
                pass
    # print(ans)
print(ans)

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

int main() {
  int64_t n, k; cin >> n >> k;
  
  int64_t ans = n % k;
  int64_t t = abs(k-ans);
  ans = min (ans,t);
  cout << ans << endl; 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A + B + C >= 22) {
		puts("bust");
	}
	else {
		puts("win");
	}
}

Measured memory_bytes: 764
#include<stdio.h>
int main(void){
    
    int x,a,b;
    while(1)
    {
   
        scanf("%d%d", &a ,&b);
        if(a==0 && b==0)
            break;
 
    if(a>b){
            printf("%d %d\n",b,a);
        }
        else{
             printf("%d %d\n",a,b);
        }
    }


    return 0;
}


Measured memory_bytes: 2040
# -*- coding: utf-8 -*-
# 整数の入力

n, ｄ = map(int, input().split())


cnt = 0

for i in range(n):
    x, y = map(int, input().split())
    if (x * x) + (y * y) <= d * d:
        cnt += 1


print("{}".format(cnt))


Measured memory_bytes: 70028
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N, W;
  int w[110], v[110];
  int res=0;
  cin >> N >> W;
  rep(i,N) cin >> w[i] >> v[i];

  //long int dp[110][10000];
  long int dp[110][100001];                                                   
  memset(dp, 0, sizeof(dp));

  FOR(i,0,N-1){
    rep(j,W+1){
      if( j-w[i] < 0) dp[i+1][j] = dp[i][j];
      else dp[i+1][j] = max(dp[i][j], dp[i][ j - w[i] ] + v[i]);
    }
  }

  cout << dp[N][W] << endl;
}

Measured memory_bytes: 86144
#include<bits/stdc++.h>
using namespace std;
int n,x,a[10001],ans;
int main()
{
	cin>>n>>x;
	for (int i=1; i<=n; ++i)
		cin>>a[i];
	sort(a+1,a+n+1);
	for (int i=1; i<=n; ++i)
		if (x>=a[i])
		{
			if (i==n)
			{
				if (x==a[i])
					ans++;
				break;
			}
			x-=a[i],ans++;
		}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
    const int MAX =200002;
const int MOD = 1000000007;

     signed main(){
   int n,k;
   cin>>n>>k;
   int  a[n];
   for(int i=0;i<n;i++)cin>>a[i];
   int ng =0,ok=MOD,mid;
   while(abs(ok-ng)>1){
       mid=(ok+ng)/2;
       int t=0;
       for(int i=0;i<n;i++)t+=(a[i]-1)/mid;
      // cerr<<t<<' ';
       if(t<=k)ok=mid;
       else ng=mid;
   }
   cout<<ok<<endl;

     }


 


 






    





      

        


Measured memory_bytes: 5084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i,N) cin >> X[i];
    ll ans = INF;;
    for(int i=1;i<100;i++){
        ll tmp=0;
        for(int j=0;j<N;j++){
            tmp+=(X[j]-i)*(X[j]-i);
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static int maxn=(int)(55);
	static long mod=(long)(1e9+7);
	static boolean[][] v;
	
	static void build()
	{
		v=new boolean[10][10];
		
		int[] a=new int[9],b=new int[9];
		
		for(int i=0;i<3;i++)
		{
			a[i]=b[i]=i;
		}
		
		a[3]=a[4]=0;a[5]=a[6]=1;a[7]=a[8]=2;
		
		b[5]=b[7]=0;b[3]=b[8]=1;b[4]=b[6]=2;
		
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)	
			{
				if(a[i]!=a[j] && b[i]!=b[j])
				{
					v[i][j]=true;
				}
			}
		}
	}
	
    public static void main(String args[]) throws Exception
    {
		build();int n=sc.nextInt();char[][] a=new char[2][n];
		
		for(int i=0;i<2;i++)
		{
			a[i]=sc.next().toCharArray();
		}
		
		int[] size=new int[maxn];int ctr=0;
		
		for(int i=0;i<n;)
		{
			if(a[0][i]==a[1][i])
			{	
				size[ctr++]=1;
				
				i++;
			}
			
			else
			{
				size[ctr++]=2;
				
				i+=2;
			}
		}
		
		long[][] dp=new long[9][ctr];
		
		for(int i=0;i<9;i++)
		{
			if(size[0]==1 && i<3)
			{
				dp[i][0]=1;
			}
			
			else if(size[0]==2 && i>=3)
			{
				dp[i][0]=1;
			}
		}
		
		int[] s=new int[ctr],e=new int[ctr];
		
		for(int i=0;i<ctr;i++)
		{
			if(size[i]==1)
			{
				s[i]=0;e[i]=3;
			}
			else
			{
				s[i]=3;e[i]=9;
			}
		}
		
		/*
		
		for(int i=0;i<9;i++)
		{
			out.println(dp[i][0]);
		}
		
		*/
		
		for(int i=1;i<ctr;i++)
		{
			for(int k=s[i];k<e[i];k++)	
			{
				for(int j=s[i-1];j<e[i-1];j++)
				{
					if(v[j][k])
					{
						dp[k][i]=(dp[k][i]+dp[j][i-1])%mod;
					}
				}		
			}
		}
		
		long res=0;
		
		for(int i=0;i<9;i++)
		{
			res=(res+dp[i][ctr-1])%mod;
		}
		
		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

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

int main(){
    int x,y;
    cin >> x >> y;

    for(int i=0; i<=x; i++){
        for(int j=0; j<=x; j++){
            if( (i+j == x) && (2*i+4*j == y)){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
ll mark[N];
vector<ll> v[N];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    for(ll i=0; i<n; i++) {
        ll a,b;
        cin>>a>>b;
        if(k-a+1 > 0)
            v[k-a+1].push_back(b);
    }

    priority_queue<ll> pq;
    ll i = k, ans = 0;
    while(i) {

        for(auto val: v[i])
            pq.push(val);

        if(!pq.empty()) {
            ans += pq.top();
            pq.pop();
        }

        i--;
    }

    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 27904
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int[][] nums1=new int[m][2],nums2=new int[m][2];
    for(int i=0;i<m;i++){
      nums1[i][0]=sc.nextInt();
      nums2[i][0]=sc.nextInt();
      nums1[i][1]=nums2[i][1]=i;
    }
    boolean[] done=new boolean[m];
    Comp comp=new Comp();
    Arrays.sort(nums1,comp);
    Arrays.sort(nums2,comp);
    int ind1=0;
    int ind2=0;
    int tmp;
    int ans=0;
    while(ind1<m&&ind2<m){
        while(ind2<m&&done[nums2[ind2][1]]){
            ind2++;
        }
        ans++;
        tmp=nums2[ind2][0];
        while(ind1<m&&nums1[ind1][0]<tmp){
            done[nums1[ind1][1]]=true;
            ind1++;
        }
    }
    System.out.println(ans);
  }
}
class Comp implements Comparator {

    int index = 0;

    void set_index (int i) {
        index = i;
    }

    public int compare (Object a, Object b) {
        int[] int_a = (int[]) a;
        int[] int_b = (int[]) b;
        return (int_a[index] - int_b[index]);
    }

}

Measured memory_bytes: 98836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
const int INF=1e5+100;
int f[INF];
int main()
{
    int n,a;
    cin>>n;
    memset(f,0,sizeof(f));
    for(int i=2; i<=n; i++){
        a=i;
        for(int j=2; j<=a; j++){
            while(a%j==0){
                f[j]++;
                a=a/j;
            }
        }
        if(a!=1)  f[a]++;
    }
    ll ans=1;
    for(int i=1; i<=n; i++){
        if(f[i]!=0) ans=(ans*(f[i]+1))%MOD;
    }
    cout<<ans%MOD<<endl;
    return 0;
}


Measured memory_bytes: 640
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
n = int(input())
a = sorted(list(map(int,input().split())))
d = a[0]
for i in range(n):
    d = gcd(d,a[i])
print(d)

Measured memory_bytes: 14612
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1e5+5;
const int mod=1e9+7;
int n,p1,p2,val[N],fac[N],ifac[N],pos[N];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x>y?x=y:0;}
	template <class T> inline void apx(T &x,const T y){x<y?x=y:0;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

template <class T>
inline int fpow(int x,T t){
	int ans=1;
	for(; t; x=(lint)x*x%mod,t>>=1){
		if(t&1) ans=(lint)ans*x%mod;
	}
	return ans;
}

void init(){
	fac[0]=1;
	for(int i=1; i<=n+1; ++i){
		fac[i]=(lint)fac[i-1]*i%mod;
	}
	ifac[n+1]=fpow(fac[n+1],mod-2);
	for(int i=n+1; i>=1; --i){
		ifac[i-1]=(lint)ifac[i]*i%mod;
	}
}

inline int C(const int x,const int y){
	if(x<y||y<0) return 0;
	return (lint)fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}

int main(){
	n=nxi();
	init();
	for(int i=1; i<=n+1; ++i){
		val[i]=nxi();
		if(pos[val[i]]) p1=pos[val[i]],p2=i;
		else pos[val[i]]=i;
	}
	for(int i=1; i<=n+1; ++i){
		printf("%d\n",(C(n+1,i)-C(n-p2+p1,i-1)+mod)%mod);
	}
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  int k;
  cin>>k;
  int n=s.size();
  int as=min(k,5);
  vector<string>a;
  rep(i,n){
    string e="";
    rep2(j,i,n){
      e+=s.at(j);
      if(as>0){
        bool ch=true;
        rep(l,a.size()){
          if(a.at(l)==e){
            ch=false;
          }
        }
        if(ch){ 
          a.push_back(e);
        }
      }
      else{
        sort(a.begin(),a.end());
        if(a.at(a.size()-1)>e){
          bool ch=true;
          rep(l,a.size()){
            if(a.at(l)==e){
              ch=false;
            }
          }
          if(ch){ 
            a.at(a.size()-1)=e;
          }
        }
      }
      as--;
    }
  }
  sort(a.begin(),a.end());
  cout<<a.at(k-1)<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<double> p(N);
    rep(i,N) cin >> p[i];

    vector<vector<double>> dp(N+1, vector<double>(N+1));
    dp[0][0] = 1.0;
    rep(i,N) {
        rep(j,i+2) {
           if (j == 0) dp[i+1][0] = dp[i][0]*(1.0-p[i]);
           else if (j == i+1) dp[i+1][j] = dp[i][j-1]*p[i];
           else dp[i+1][j] = dp[i][j-1]*p[i] + dp[i][j]*(1.0-p[i]);
        }
    }
    double ans = 0.0;
    for (int i = (N+1)/2; i < N+1; i++) ans += dp[N][i];

    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 70784
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute12_1();
	}
	
	private static void execute12_1() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			long[] a = new long[n]; 
			
			
			for(int i=0; i<n ;i++) {
				a[i] = sc.nextLong();
			}
			
			long ans = rr(a);
			
			System.out.println(ans);
			
		}
	}
	
	private static long rr(long[] a) {
		Arrays.sort(a);
		long INF = 100100100100L;
		if(a[1]==INF) return a[0];
		for(int i=1;i<a.length;i++) {
			if(a[i]==INF) break;
			a[i] = a[i]%a[0];
			if(a[i]==0) a[i] = INF;
		}
		return rr(a);
	}
}

Measured memory_bytes: 61588
#include <iostream>

using namespace std;

int main()
{
    int h1, h2, k1, k2, a, b, c, d;
    int hi, ke;
    cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
    hi = h1*a+h2*b+(h1/10)*c+(h2/20)*d;
    ke = k1*a+k2*b+(k1/10)*c+(k2/20)*d;
    if (hi > ke)
    {
        cout << "hiroshi" << endl;
    }
    else if (hi < ke)
    {
        cout << "kenjiro" << endl;
    }
    else
    {
        cout << "even" << endl;
    }
}


Measured memory_bytes: 3104
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
int cnt(int x,int y)
{
	if(x < y) swap(x,y);
	if(y == 0) return 0;
	return cnt(y,x%y)+1;
}
int main()
{
	while(1)
	{
		int x,y;
		cin >> x >> y;
		if(x == 0 && y == 0) return 0;
		cout << __gcd(x,y) << " " << cnt(x,y) << endl;
	}
}

Measured memory_bytes: 1160
N=int(input())
L=[[10**9]for i in range(N+1)]
for i in range(N):
    l=list(map(int,input().split()))
    for j in range(l[1]):
        L[i+1].append(l[2+j])
#print(L)
for i in range(N+1):
    L[i].sort(reverse=True)
    
#print(L)
ans=[]
for i in range(N+1):
    ans.append([0,0])


from collections import deque 

Q=deque()
cnt=1
for i in range(N):
    Q.append([0,N-i])
for i in range(10**7):

    if len(Q)==0:
        break
    q0,q1=Q.pop()
    #print(q0,q1)
    if q1!=10**9:
        if ans[q1][0]==0:
            ans[q1][0]=cnt
            cnt+=1
            for j in L[q1]:
                Q.append([q1,j])
    else:
        ans[q0][1]=cnt
        cnt+=1
    #print(ans,Q)
for i in range(1,N+1):
    print(i,ans[i][0],ans[i][1])


Measured memory_bytes: 6056
import itertools

N,M,Q = map(int,input().split())
num = [[0 for i in range(4)] for j in range(Q)]
test = list()

k = 1
for i in range(M):
    test.append(k)
    k += 1

k = 0
for i in range(Q):
    num[k][0], num[k][1], num[k][2], num[k][3] = map(int,input().split())
    k += 1

k = 0
score = 0
maxscore = 0
for list in itertools.combinations_with_replacement(test, N):
    for i in range(Q):
        if list[num[k][1]-1] - list[num[k][0]-1] == num[k][2]:
            score += num[k][3]
        k += 1
        if score > maxscore:
            maxscore = score
    score = 0
    k = 0

print(maxscore)


Measured memory_bytes: 9180
N,M=map(int,input().split())
L = [[] for i in range(N)]
ans = [0 for i in range(M) ]

for i in range(M):
  P,Y=map(int,input().split())
  P-=1
  L[P].append([i,Y])

for i in range(N):
  L[i]=sorted(L[i], reverse=False, key=lambda x: x[1])
  for j in range(len(L[i])):
    ans[L[i][j][0]]=[i,j]
    
for i in range(M):
  a = str(ans[i][0]+1).zfill(6)+str(ans[i][1]+1).zfill(6)
  print(a)

Measured memory_bytes: 86704
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)
  __gcd(a,b)は最大公約数を取ってくれる、aとb
  の大きい方をNとしたとき、計算量は√N
 */
const int mod = 1e9 + 7;
//ここから書き始める


//関数の定義はここ
#define MAX 100000
int A[MAX] , n;

int pertition(int p, int r){
	int x, i, j, t;
	x = A[r];

	i = p - 1;
	for(j = p ; j < r ; j ++){
		if( A[j] <= x){
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
		t = A[i + 1]; A[i + 1] = A[r] ; A[r] = t;
		return i + 1;
}




int main(){

	int i , q, n;
	cin >> n;

	for( i = 0 ; i < n ; i ++){
		cin >> A[i];
	}
	q = pertition(0, n - 1 );

	rep(i,n){
		if(i==q) cout<<"["<<A[i]<<"]"<<" ";
		else if(i!=n-1){
		cout << A[i]<<" ";
		}
		else cout <<A[i] <<endl;
	}
}




Measured memory_bytes: 3376
N = int(input())
S = [str(input()) for i in range(N)]
dic = {}
for a in S:
    if a not in dic:
        dic[a] = 1
    else:
        dic[a] += 1
m = max(dic.values())
max_list = [kv[0] for kv in dic.items() if kv[1] == m]
max_list.sort()
for a in max_list:
    print(a)

Measured memory_bytes: 35332
#include <iostream>
#include <vector> //可変長配列
#include <queue> //キュー
#include <unordered_map> //ハッシュ連想配列
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    int c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin>>c[i][j];
        }
    }
    int count = 0;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            if(c[i][j]-c[i+1][j]==c[i][j+1]-c[i+1][j+1]) count++;
        }
    }
    cout<<(count==4?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
 *  Created on: 21 / 5 / 2020
 *  Author:     Eslam Waheed
 */
#include <bits/stdc++.h>
#include <cmath>
//#include <bits/BIGINT.h>
//#include <bits/Int128.h>
using namespace std;

//#define _CRT_SECURE_NO_WARNINGS
//#define __USE_MINGW_ANSI_STDIO
#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)

ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }

const ld PI = acos(-1);
//const ll mod = 1e15 + 7;
//__int128
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    stp(20)
    Eslam__Waheed
    ld a, b, h, m; cin >> a >> b >> h >> m;
    //m /= 5;
    /*if (m > h)
    {
        swap(m, h);
    }*/
    //cout << h << ' ' << m << endl;
    //ll x = (12 - h) + m;
    //ll y = h - m;
    dd z = (h * 30) - (m * (11 / 2.0));
    ld ans = sqrt((a * a) + (b * b) - (2 * a * b * cos((z / 180) * PI)));
    cout << ans;   
}

Measured memory_bytes: 4116
#include <iostream>

using namespace std;
#define MAX 2000000
#define NIL -1
int n=0;
int T[MAX+1];
void increase(int i,int key){
    T[n] = key;
    while(i>1&&T[i/2]<T[i]){
        swap(T[i/2],T[i]);
        i = i/2;
    }
}
void insertk(int key){
    n++;
    increase(n,key);
}
void maxHeapify(int i){
    int l = 2*i;
    int r = 2*i+1;
    int largest;
    //选出左右子节点及他自己中的最大值
    if(l<=n&&T[l]>T[i]) largest = l;
    else largest = i;
    if(r<=n&&T[r]>T[largest]) largest = r;

    if(largest!=i){
        swap(T[i],T[largest]);
        maxHeapify(largest);
    }
}
int extractMax(){
    if(n<1){
        return NIL;
    }
    int max = T[1];
    swap(T[1],T[n]);
    n--;
    maxHeapify(1);
    return max;
}
int main()
{
    string s;
    cin>>s;
    int key;
    while(s!="end"){
        if(s=="insert"){
            cin>>key;
            insertk(key);
        }
        if(s=="extract"){
            cout<<extractMax()<<endl;
        }
        cin>>s;
    }
    return 0;
}



Measured memory_bytes: 6924
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  string s, t; cin >> s >> t;
  int n = s.size(); int m = t.size();
  int ans = inf;
  rep(i, n-m+1){
    int cnt = 0;
    rep(j, m){
      if(s[i+j]==t[j]) continue;
      else cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {

    unsigned long long N,A,B;
    cin >> N >> A >> B;

    unsigned long long ans = 0;
//    for(unsigned long i = 0; i < N; i += (A+B)) {
//        ans += A;
//      if (i + A >= N) {
//        ans += N - (i + A);
//        break;
//      }
//    }
  
  ans = (N / (A + B)) * A;
  unsigned long long ans2;
  ans2 = min (N % (A+B), A);
    cout << ans + ans2 << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
#define MOD 1000000007
using namespace std;

int gcd(int a, int b) {
	if (b == 0)
		return a;
	else {
		int p = a, q = b, r = a % b;

		while (r > 0) {
			p = q;
			q = r;
			r = p % q;
		}
		return q;
	}
}

int main() {
	int n;
	cin >> n;
	vector<int>a(n),l(n+1),r(n+1);
	l[0] = 0, r[n] = 0;
	REP(i, n) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		l[i + 1] = gcd(a[i], l[i]);
	}
	for (int i = n-1; i >= 0; i--) {
		r[i] = gcd(a[i], r[i+1]);
	}
	int ans = 1;
	REP(i, n) {
		ans = max(ans, gcd(l[i],r[i + 1]));
	}
	cout << ans << endl;
	return 0;
}

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

namespace AtCoder
{
	class Program
	{
		public static void Main()
		{
			var intArray = IO.ReadIntArray();
			var lakeDistance = intArray[0];
			var buildNum = intArray[1];
			var positions = IO.ReadIntArray().ToList();
			positions.Add(positions[0] + lakeDistance);

			var distances = new List<int>();
			for(var iIndex = 0 ; iIndex < buildNum ; ++ iIndex)
			{
				distances.Add(positions[iIndex + 1] - positions[iIndex]);
			}
			IO.Write(lakeDistance - distances.Max());
		}
	}

	public static class IO
	{
		public static string   Read()							   { return Console.ReadLine(); }
		public static string[] ReadArray(char iSplitter = ' ')	   { return Read().Split(iSplitter); }
		public static int	   ReadInt()						   { return int.Parse(Read()); }
		public static int[]	   ReadIntArray(char iSplitter = ' ')  { return ReadArray().Select(iText => int.Parse(iText)).ToArray(); }
		public static long	   ReadLong()						   { return int.Parse(Read()); }
		public static long[]   ReadLongArray(char iSplitter = ' ') { return ReadArray().Select(iText => long.Parse(iText)).ToArray(); }
		public static char[]   ReadCharArray()					   { return Read().ToCharArray(); }

		public static void Write(string iValue)			  { Console.WriteLine(iValue); }
		public static void Write(int iValue)			  { Console.WriteLine(iValue); }
		public static void Write(IEnumerable<int> iValue) { Console.WriteLine(string.Join(" " , iValue)); }
		public static void Write(long iValue)			  { Console.WriteLine(iValue); }
		public static void Write(decimal iValue)		  { Console.WriteLine(iValue); }
		public static void Write(bool iValue)			  { Console.WriteLine(iValue ? "Yes" : "No"); }
	}

	public static class Util
	{
		public static long Gcd(long i0 , long i1) { return (i0 > i1) ? _Gcd(i0 , i1) : _Gcd(i1 , i0); }
		public static long Lcm(long i0 , long i1) { return (i0 * i1) / Gcd(i0 , i1); }
		public static long ModPow(long iBaseNumber , long iPow , long iModNumber)
		{
			var num = 1L;
			while(iPow != 0)
			{
				if((iPow & 0x1) != 0)
				{
					num = (num * iBaseNumber) % iModNumber;
				}
				iBaseNumber = (iBaseNumber * iBaseNumber) % iModNumber;
				iPow >>= 1;
			}
			return num;
		}

		private static long _Gcd(long i0 , long i1)	{ return (i1 == 0) ? i0 : _Gcd(i1 , i0 % i1); }
	}
}


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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;



int main() {
  ll a,b,c;
  	ci(a>>b>>c);
  co((a-b)%c)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> A(Q);
    for(int i = 0; i < Q; i++) {
        cin >> A[i];A[i]--;
    }  
    vector<int> c(N, 0);
    for (int i = 0; i < Q; i++) {
        c[A[i]]++;
    }
    for (int i = 0; i < N; i++) {
        if(Q - c[i] >= K){
            No();
        }
        else{
            Yes();
        }
    }


}

Measured memory_bytes: 4016
import java.util.Scanner;

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();

		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}



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

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> s(M);
  vector<int> p(M);

  for (int i = 0; i < M; i++) {
    int k; // 繋がっているスイッチの個数
    cin >> k;
    s.at(i).resize(k); // リサイズ
    for (int j = 0; j < k; j++) {
      cin >> s.at(i).at(j); // 電球iに繋がっているスイッチ
      s.at(i).at(j)--; // 電球iを0から数えているのでスイッチも0から数える
    }
  }
  for (int i = 0; i < M; i++) cin >> p.at(i);

  int ans = 0;
  for (int a = 0; a < (1 << N); a++) { // スイッチon,offのパターンを回す
    bool lightUp = true;
    for (int b = 0; b < M; b++) {
      int c = 0;
      for (int id : s[b]) {
        if ((a >> id) & 1) {
          c++;
        }
      }
      if (c % 2 != p[b]) {
        lightUp = false;
      }
    }
    if (lightUp) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int n;
ll s;
ll memo[220][220];

ll gcd(ll a, ll b) { 
  if(memo[a][b] == 0){
    memo[a][b] =  b == 0 ? a : gcd(b, a % b);
  }
  
  return memo[a][b]; 
}

ll gcd(ll a, ll b, ll c) {
	return gcd(gcd(a, b), c);
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				s += gcd(i, j, k);
			}
		}
	}
	cout << s;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
#define MOD 1000000007;
using namespace std;
typedef long long ll;

long long pow_mod(long long n, long long p) {
  long long ret = 1;
  while (p > 0) {
    if (p & 1) ret = (ret * n) % MOD;
    n = (n * n) % MOD;
    p >>= 1;
  }
  return ret;
}

int main() {
  ll N;
  cin >> N;
  ll A[N];
  REP(i, N) { cin >> A[i]; }
  sort(A, A + N);

  if (N % 2 == 0) {
    for (int i = 0; i < N; i = i + 2) {
      if (A[i] == i + 1 && A[i + 1] == i + 1) {
        continue;
      } else {
        cout << 0;
        return 0;
      }
    }
    cout << pow_mod(2, N / 2);
  } else {
    if (A[0] != 0) {
      cout << 0;
      return 0;
    }
    for (int i = 1; i < N; i = i + 2) {
      if (A[i] == i + 1 && A[i + 1] == i + 1) {
        continue;
      } else {
        cout << 0;
        return 0;
      }
    }
    cout << pow_mod(2, (N - 1) / 2);
  }

  return 0;
}

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

int main() {
  string s; cin >> s;
  string::size_type a = s.find('A');
  string::size_type z = s.rfind('Z');
  if (a != string::npos && z != string::npos && a < z) {
    cout << z - a + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(...) cout << " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " << endl

using ld = long double;
using ll = long long;
using pii = pair <int,int>;
using pll = pair <ll,ll>;
using vi = vector <int>;
using vll = vector <ll>;
using vpii = vector <pii>;
using vpll = vector<pll>;
using vs = vector <string>;


int main(){
  fastio;

  ld d,t,s;
  cin >> d >> t >> s;

  ld arrive = d/s;

  if(arrive <= t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3744
#include <stdio.h>

int main(void) {
  int D, N;
  scanf("%d%d", &D, &N);

  int X;
  if(D == 0) {
    X = 1;
  } else if(D == 1) {
    X = 100;
  } else {
    X = 10000;
  }

  if(N != 100)
    X *= N;
  else
    X *= (N+1);
  printf("%d\n", X);

  return 0;
}


Measured memory_bytes: 128
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    ll w,h,x,y,k;
    string str;
	cin>>str;
    rep(i,str.length()-1){
        if(str[i]!=str[i+1]) sum++;
    }
    cout<<sum<<endl;
    
    return 0;
}



Measured memory_bytes: 3752
import sys
import math
A, B, H, M = list(map(int, input().split()))


a = abs((H + M/60) / 12 * 360 - (M / 60) * 360)
if a > 180:
    a = 360 - a

ans = A*A + B*B - 2 * A*B * math.cos(math.radians(a))
print(math.sqrt(ans))


Measured memory_bytes: 9448
#include <bits/stdc++.h>
using namespace std;
#define itn int
void dfs(itn u,vector<vector<int> > &e,vector<int> &p,vector<int> &sz){
	sz[u]=1;
	for(itn j=0;j<e[u].size();j++){
		if(p[u]!=e[u][j]){
			p[e[u][j]]=u;
			dfs(e[u][j],e,p,sz);
			sz[u]+=sz[e[u][j]];
		}
	}
}
int main(){
	int n;
	cin>>n;
	vector<vector<int> > e(n,vector<int>());
	for(int i=0;i+1<n;i++){
		itn a,b;
		cin>>a>>b;
		--a;--b;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	vector<int> p(n,-1),sz(n,0);
	dfs(0,e,p,sz);
	vector<int> path;
	itn c=n-1,psz=0;
	while(c>=0){
		path.push_back(sz[c]-psz);
		psz=sz[c];
		c=p[c];
	}
	reverse(path.begin(),path.end());
	long long ls=0,rs=0;
	int i=0,j=(int)path.size()-1;
	while(i<=j){
		ls+=path[i++];
		if(i<=j)	rs+=path[j--];
	}
	cout<<(ls>rs?"Fennec":"Snuke")<<endl;
	return 0;
}


Measured memory_bytes: 14972
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

vector<int> g[200010];
int in[200010];
int out[200010];
int imos[200010];
int ans[200010];
int k=0;
vector<int> jun;

void dfs(int v,int p=-1){
  jun.pb(v);
  in[v]=k;
  k++;
  for(int w:g[v]){
    if(w!=p){
      dfs(w,v);
    }
  }
  out[v]=k;
}
signed main(){
  int n,q;
  cin>>n>>q;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  
  dfs(0);

  rep(i,q){
    int p,x;
    cin>>p>>x;p--;
    imos[in[p]]+=x;
    imos[out[p]]-=x;
  }
  rep(i,n){
    if(i==0)ans[0]=imos[0];
    else ans[i]=ans[i-1]+imos[i];
    
  }
  rep(i,n){
    cout<<ans[in[i]]<<endl;
  }
    
  return 0;
}

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

using namespace std;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1;
    for (size_t i = 0; i < size; ++i) {
        vec1.push_back(cin2var<T>());
    }
    return vec1;
}

struct Team
{
    int id;
    int group;
    int answer;
    int penalty;
};

int main()
{
    vec1<Team>              teams;
    vec1<Team>              winner;
    unordered_map<int, int> map_group_wins;
    while (true) {
        const auto N(cin2var<int>());
        if (!N) break;
        teams.clear();
        winner.clear();
        map_group_wins.clear();
        for (int i = 0; i < N; ++i) {
            const auto Ns(cin2vec<int>(4));
            auto       ite(Ns.cbegin());
            Team       team{};
            team.id      = *ite++;
            team.group   = *ite++;
            team.answer  = *ite++;
            team.penalty = *ite++;
            teams.push_back(move(team));
        }
        sort(teams.begin(), teams.end(), [](const Team& l, const Team& r) {
            if (l.answer < r.answer) return false;
            if (l.answer > r.answer) return true;
            if (l.penalty < r.penalty) return true;
            if (l.penalty > r.penalty) return false;
            return l.id < r.id;
        });
        for (const auto& team : teams) {
            const bool is_win = [&] {
                const auto winner_size(winner.size());
                const auto group_wins(map_group_wins[team.group]);
                if (winner_size < 10 && group_wins < 3) {
                    return true;
                }
                if (winner_size < 20 && group_wins < 2) {
                    return true;
                }
                if (winner_size < 26 && group_wins == 0) {
                    return true;
                }
                return false;
            }();
            if (is_win) {
                cout << team.id << endl;
                ++map_group_wins[team.group];
                winner.push_back(team);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3052
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
    int a;
    string s;
    vector<string> str;
    cin >> a;
    while (a) {
        cin >> s;
        str.push_back(s);
        a--;
    }
    
    sort(str.begin(), str.end());
    str.erase(unique(str.begin(), str.end()), str.end());
    
    cout << str.size() << endl;
}

Measured memory_bytes: 11584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
vector<ll> V;
ll pre[maxn];
ll dp[55][5005];
int main() {
    dp[0][0]=1;
    int n,a;cin>>n>>a;
    for(int i=1;i<=n;i++) cin>>pre[i];
    for(int i=1;i<=n;i++) {
    	for(int j=i;j>=1;j--) {
    		for(int k=5000;k>=pre[i];k--) {
    			dp[j][k]+=dp[j-1][k-pre[i]];
    		}
    	}
    }
    ll ans=0;
    for(int j=1;j<=n;j++) {
	    for(int i=0;i<=5000;i++) {
	    	if(a*j==i) ans+=dp[j][i];
	    }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5460
//AtCoder 
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<ll> cn(N); //時間
    vector<ll> sn(N); //開始
    vector<ll> fn(N); //間隔
    for(ll i=0;i<N-1;++i){
        cin>>cn[i]>>sn[i]>>fn[i];
    }
    vector<ll> ans(N,0);
    for(ll s=0;s<N;++s){
        auto& av=ans[s];
        for(ll i=s;i<N-1;++i){
            if(av<=sn[i]) av=sn[i];
            else if (av%fn[i]!=0) {
                av = av+fn[i] - av%fn[i];
            }
            av += cn[i];
        }
    }
    for(const auto& a:ans){
        cout<<a<<endl;
    }
    return 0;
}

Measured memory_bytes: 256