akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int bc = 0,wc = 0;
  rep(i,n){
    if(s.at(i) == '.'){
      ++ wc;
    }
  }
  int ans = wc;
  rep(i,n){
    if(s.at(i) =='#'){
      ++ bc;
    }
    if(s.at(i)=='.'){
      -- wc;
    }
    ans = min(ans,bc+wc);
  }
  cout << ans << endl;
}
   

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	int n, ma, mb;
	cin >> n >> ma >> mb;
	map<tuple<int, int>, int> map = {}, nmap = {};
	map[make_tuple(0, 0)] = 0;
	for (size_t i = 0; i < n ; i++) {
		nmap = {};
		int a, b, c;
		cin >> a >> b >> c;
		for (const auto& itr: map) {
			int ao = get<0>(itr.first);
			int bo = get<1>(itr.first);
			if (nmap[make_tuple(ao, bo)] == 0 || itr.second < nmap[make_tuple(ao, bo)]) {
				nmap[make_tuple(ao, bo)] = itr.second;
			}
			int tn = nmap[make_tuple(ao + a, bo + b)];
			if (tn == 0 || tn > itr.second + c) {
				nmap[make_tuple(ao + a, bo + b)] = itr.second + c;
			}
		}
		map = nmap;
	}
	int m = -1;
	for (const auto& itr: map) {
		int ao = get<0>(itr.first);
		int bo = get<1>(itr.first);
		if (ao + bo == 0) {
			continue;
		}
		if (ao * mb == bo * ma) {
			if (m == -1) {
				m = itr.second;
			}
			m = m == -1 ? itr.second : min(m, itr.second);
		}
		// printf("%d, %d = %d\n", ao, bo, itr.second);
	}
	cout << m << endl;
}


Measured memory_bytes: 2944
s = list(input())

if len(s) >= 9 and "".join(s) != "AKIHABARA":
    print("NO")
elif "".join(s) == "AKIHABARA":
    print("YES")
else:
    for i in range(2**(len(s)+1)):
        lst = [""]*50
        for j in range(len(s)+1):
            if i&(1<<j):
                lst[j] = "A"
        #print(lst)
        
        result = ""               
        for k1,k2 in zip(lst,s+["",""]):
            result += k1+k2
        #print(result)
        if result == "AKIHABARA":
            print("YES")
            exit()
        else:
            continue
    else:
        print("NO")

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

int main() {
  int a,b,s,t;
  
  
  cin >> a;
  cin >> b;
  
  s = a *b;
  
  t = s % 2;
  
 if( t==1){
   cout << "Odd" ;
   }
 else{
   cout << "Even" ;
   }
  
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;
	ll d;
	cin>>n>>d;
	int ans = 0;
	for(int i=0;i<n;i++){
		ll x, y;
		cin>>x>>y;
		if(x*x+y*y<=d*d){
			ans++;
		}
	}
	cout<<ans;
}



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


int main(){
    int64_t A,V,B,W,T;
    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    if(V <= W){
        cout << "NO" << endl;
    }else{
        if(abs(B-A) <= T*(V-W)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    if (n > a+b){
        ll c = n/(a+b);
        n%=(a+b);
        cout << (c*a) + min(a, n);
    }
    else{
        cout<<min(a, n);
    }
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <cmath>
typedef long long LL;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(){
  LL N;
  cin >> N;
  vector<LL> p(N);
  vector<LL> p_bak(N);
  rep(i,N){
    cin>>p[i];
    p_bak[i]=p[i];
  }
  sort(p.begin(),p.end());
  
  LL cnt =0;
  rep(i,N){
    if(p[i]!=p_bak[i]){
      cnt++;
    }
  }
  if(cnt<=2){
    cout <<"YES";
  }else{
    cout<<"NO";
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
   		Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
      	int b = sc.nextInt();
    	int c = sc.nextInt();
    	int total = a + b + c;
    	if(total == 17){
      		System.out.println("YES");
    	}else{
	      System.out.println("NO");
    	}
   	}  
}  

Measured memory_bytes: 27008
#include <iostream>

int main() {
	long long n, a, b;

	std::cin >> n >> a >> b;

	if (b < a) {
		std::cout << 0 << std::endl;
		return 0;
	}

	if (n == 1) {
		if (a == b) {
			std::cout << 1 << std::endl;
		} else {
			std::cout << 0 << std::endl;
		}
		return 0;
	}

	if (a == b) {
		std::cout << 1 << std::endl;
		return 0;
	}

	long long min = a * (n - 1) + b;
	long long max = a + b * (n - 1);

	std::cout << max - min + 1 << std::endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
N = len(S)
K = int(input())



dp = [[[0 for _ in range(5)] for _ in range(2)] for _ in range(N+1)]
dp[0][0][0] = 1
"""
遷移
dp[i][1][j] -> dp[i+1][1][j] : i-1桁目までに0以外の数字がj個あり、i桁目に0を入れた
dp[i][1][j] -> dp[i+1][1][j+1] : i-1桁目までに0以外の数字がj個あり、i桁目に0以外を入れた
dp[i][0][j] -> dp[i+1][1][j] : i-1桁目がSと一致していて、i-1桁目までに0以外の数字がj個あり、までに0以外の数字がj個あり、i桁目に0を入れた
dp[i][0][j] -> dp[i+1][1][j] : i-1桁目がSと一致していて、i-1桁目までに0以外の数字がj個あり、までに0以外の数字がj個あり、i桁目に0以外を入れた
dp[i][0][j] -> dp[i+1][0][j+?] : i桁目までSと一致。i桁目が0以外なら、?=1

"""

for i in range(N):
    for k in range(4):
        for j in range(10):
        


            if j == 0:
                 # i桁目に0をあてた
                dp[i+1][1][k] += dp[i][1][k]
            else:
                # i桁目に0以外をあてた
                dp[i+1][1][k+1] += dp[i][1][k]


            if j < int(S[i]):
                if j == 0:
                    dp[i+1][1][k] += dp[i][0][k]
                else:
                    dp[i+1][1][k+1] += dp[i][0][k]
            elif j == int(S[i]):
                if j == 0:
                    dp[i+1][0][k] += dp[i][0][k]
                else:
                    dp[i+1][0][k+1] += dp[i][0][k]


print(dp[-1][0][K] + dp[-1][1][K])


Measured memory_bytes: 40304
N = int(input())
A = list(map(int, input().split()))
B= list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
bef = -1
for i in A:
    ans += B[i-1]
    if i == bef+1:
        ans += C[i-2]
    bef = i

print(ans)

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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=2e5+10;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

i64 N,K,Cnt;
vector<i32> Vis;
i32 A[MAXN],Turn[MAXN];

inline void pre(){
    N=read();
    K=read();
    f(i,1,I,N) A[i]=read();
    i32 Pos=1;
    while(!Turn[Pos]){
        Vis.push_back(Pos);
        Turn[Pos]=++Cnt;
        Pos=A[Pos];
    }
    Cnt=Turn[Pos];
}

inline i32 ans(){
    if(K<Cnt) return Vis[K];
    i32 Round=Vis.size()-Cnt+1;
    K=(K-Cnt+1)%Round+Cnt-1;
    return Vis[K];
}

int main(){
    pre();
    print( ans() );
    output();
    return 0;
}

Measured memory_bytes: 5724
import sys

def main():
    input = sys.stdin.readline
    R, G, B, N = map(int, input().split())
    ans = 0
    for i in range(N//R+1):
        for j in range(N//G+1):
            rest = N - R*i - G*j
            if rest >= 0 and rest % B == 0:
                ans += 1

    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;


int main() {
	//cout << fixed << setprecision(10);
	long long int n, m, k, res = 1, a, b, ok[40] = {};
	string str;
	cin >> n>>str;
	for (int i = 0; i < n; i++) {
		ok[str[i] - 'a']++;
	}
	for (int i = 0; i < 30; i++) {
		res*=ok[i]+1;
		res %= 1000000007;
	}
	cout << (res-1)%1000000007;


	

}

Measured memory_bytes: 512
import sys
A,B,C,D=map(int,input().split())
T=[A,B]
K=[C,D]
N_1=(T[0]/K[1])
N_2=K[0]/T[1]
while N_2>0 or N_1>0:
    N_2-=1
    if not N_2>0:
        print('Yes')
        sys.exit()
    N_1-=1
    if not N_1>0:
        print('No')
        sys.exit()

Measured memory_bytes: 9200
mod = 10**9+7
n = int(input())

res = 1
l = [0]*(n+1)
l[0] = 3
for a in list(map(int, input().split())):
    if l[a]<l[a+1]:
        print(0)
        exit()
    res = (res*(l[a] - l[a+1]))%mod
    l[a+1] += 1
print(res)

Measured memory_bytes: 15164
#include <iostream>

using namespace std;

int main()
{
    int K,A,B;
    cin>>K;
    cin>>A>>B;
    for(int i=A;i<=B;i++){
        if(i%K==0){
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";
    return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    cout << max({a1, a2, a3}) - min({a1, a2, a3}) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	a--; b--; c--; d--;

	char ar[n+1];
	cin>>ar;
	if(c>d){
		int f=0;
		for(i=b;i<=d;i++){
			if(ar[i]=='.'&&ar[i-1]=='.'&&ar[i+1]=='.'){
				f=1;
				break;
			}
		}
		if(f==0){
			cout<<"No";
			return 0;
		}
		swap(c,d);
	}
	ar[a]='A'; ar[b]='B';
	
	while(a!=c||b!=d){
		//cout<<ar<<endl;
		if(b!=d){
			if(b+2<=d&&ar[b+2]=='.'){
				ar[b]='.';
				ar[b+2]='B';
				b+=2;
			}
			else if(b+1<=d&&ar[b+1]=='.'){
				ar[b]='.';
				ar[b+1]='B';
				b+=1;
			}
			else if(a+1<=c&&ar[a+1]=='.'){
				ar[a]='.';
				ar[a+1]='A';
				a+=1;
			}
			else if(a+2<=c&&ar[a+2]=='.'){
				ar[a]='.';
				ar[a+2]='A';
				a+=2;
			}
			else break;
		}
		else {
			if(a+2<=c&&ar[a+2]=='.'){
				ar[a]='.';
				ar[a+2]='A';
				a+=2;
			}
			else if(a+1<=c&&ar[a+1]=='.'){
				ar[a]='.';
				ar[a+1]='A';
				a+=1;
			}
			else break;
		}
		//cout<<a<<" "<<b<<" "<<d<<" "<<ar[b+2]<<endl;
	}
	if(a!=c||b!=d){
		cout<<"No";
	}
	else{
		cout<<"Yes";
	}
	return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
inline void solve(void){
  int N;
  in(N);
  map<string,int>cnt;
  rep(i,N){
    string S;
    in(S);
    cnt[S]++;
  }
  out(cnt.size());
}
int main(void){
  BEGIN;
  solve();
  END;
}


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

long long gcd(long long m, long long n){
  if(n>m)return gcd(n, m);
  if(m%n==0)return n;
  return gcd(n, m%n);
}

int main(){
  long long a,b,c,d; cin>>a>>b>>c>>d;

  long long gc=gcd(d,c);

  cout<<(b-a+1)-(b/d-(a-1)/d)-(b/c-(a-1)/c)+(b/(c*d/gc)-(a-1)/(c*d/gc))<<endl;
  
}


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

using namespace std;

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll, ll>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main()
{
    ll tt = 1, n, m, k = 0, i, j, p, q;
    ll a, b, c, d, h, u, v, x, y, t = 0;
    ll ans = 0;

    ll l = 0, r = 0;
    bool poss = true;

    boost;
    string s; 

    time_t tic, toc;
    tic = clock();

    // cin >> tt;
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        cin >> x >> y;
        if(y&1) poss = false;

        b = y / 2 - x;
        a = 2*x - y / 2;

        if(a < 0 or b < 0) poss = false;
        if(poss) cout << "Yes" << nl;
        else cout << "No" << nl;
    }   
    // cerr << (clock() - tic*1.0) / CLOCKS_PER_SEC << nl;
    return 0;
}

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

int main(){
	int N;
	cin >> N;
	int four;
	four=N/4;
	int amari;
	for(int i=0;i<=four;i++){
		amari=N-(4*i);
		int judge=amari%7;
		if(judge==0){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	

	return 0;
}

Measured memory_bytes: 256
letters = input()
num = int(input())
for i in range(num):
    order = input().split()
    a = int(order[1])
    b = int(order[2])
    if order[0] == 'print':
        print(letters[a:b+1])
    if order[0] == 'reverse':
        p = letters[a:b+1]
        p = p[::-1]
        letters = letters[:a] + p + letters[b+1:]
    if order[0] == 'replace':
        letters = letters[:a] + order[3] + letters[b+1:]


Measured memory_bytes: 5616
#include <stdio.h>
int main(int argc, const char * argv[]){
    int i=1;
    int t;
    int x[10001]={};
    while(1){
        scanf("%d", &x[i]);
        if (x[i]==0) {
            break;
        }
        i++;
    }
    for(t=1;t<i;t++){
        printf("Case %d: %d\n", t,x[t]);
    }
    return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INF = 1LL << 60;
const int MAX = 1000000000;
const ll MOD = 1000000007;

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
//------------------------------------------------------------------------------------------------------------------------------

int main(void) { 
    ll N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll ans = 0;
    for (int i = 0; i <= 60; i++) {
        ll s = 0;
        ll d = 1LL << i;
        for (int j = 0; j < N; j++) {
            if(A[j] & d){
                s++;
            }
        }
        d %= MOD;
        ll x = (s * (N - s)) % MOD;
        ans += (d * x) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2688
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main argv =
    let n = read int
    let ls = reads int
    let x :: xs = Array.toList ls |> List.sortDescending
    if x < List.sum xs then "Yes" else "No"
    |> printfn "%s"
    0

Measured memory_bytes: 14940
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <math.h>
#include<map>
using namespace std;
#define debug freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PI acos(-1)
typedef long long ll;
const int maxn=2e6+10;


map<ll,int> mp;
int main()
{
	ios;
	ll x;
	int N;
	bool bl=0;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>x;
		if(bl==1)
			continue;
		mp[x]++;
		if(mp[x]>=2)
			bl=1;
	}
	if(bl==1) cout<<"NO";
	else cout<<"YES";
	return 0;
}

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

ll mod=(ll)1e18+9, bas=1e9+7, inv;

ll mul(ll x,ll y){
    ll t=0;
    for (;y;y>>=3,x=x*8%mod)
        t=(t+x*(y&7))%mod;
    return t;
}

ll K(ll x,ll y=mod-2){
    if (y<0) return K(K(x),-y);
    ll t=1;
    for (;y;y>>=1,x=mul(x,x))
        if (y&1) t=mul(t,x);
    return t;
}

ll n, ans, p[505000], f[505000];
char s[505000];
map<ll,ll>mp;

int main(){
    cin>>n>>s+1;
    p[0]=1; inv=K(bas);
    for (int i=1;i<=n;++i){
        p[i]=p[i-1]; f[i]=f[i-1];
        if (s[i]=='<') p[i]=mul(p[i],inv);
        if (s[i]=='>') p[i]=mul(p[i],bas);
        if (s[i]=='+') f[i]=(f[i]+p[i])%mod;
        if (s[i]=='-') f[i]=(f[i]-p[i]+mod)%mod;
        ++mp[f[i]];
    }
    for (int i=0;i<n;++i){
        ans+=mp[(mul(f[n],p[i]) + f[i])%mod];
        --mp[f[i+1]];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 39424
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

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

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y;
    cin >> x >> y;
    cout << x+y/2 << endl;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT

using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;

template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }

int n;
int m;

vi res;
int was[30001];

int main () {
	scanf ("%d", &n);
	m = 0;
	ll sum = 0;
	for (int i = 2, j = 0; i <= 30000 && j + 1 < n; i++)
		if (i % 2 == 0 || i % 3 == 0) {	
			was[i] = 1;
			res.pb (i);
			j++;
			sum += i;
		}
	for (int i = 2; i <= 30000; i++)
		if (!was[i] && (sum + i) % 2 == 0 && (sum + i) % 3 == 0 && gcd ((ll)i, sum) != 1) {
			res.pb (i);
			sum += i;
			break;
		}
	assert (sz (res) == n);
	for (int i = 0; i < n; i++) printf ("%d ", res[i]);
	printf ("\n");
	re 0;
	sort (all (res));
	for (int i = 0; i + 1 < n; i++) assert (res[i] != res[i + 1]);
	cout << sum << endl;
	for (int i = 0; i < n; i++) assert (gcd ((ll)res[i], sum - res[i]) != 1);
	int cur = 0;
	for (int i = 0; i < n; i++) cur = gcd (cur, res[i]);
	assert (cur == 1);
	return 0;
}

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


int main(void)
{
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1; i <= B; i++) {
		if ((A*i%B)==C) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


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

using lint = long long;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int k, x;
	cin >> k >> x;
	int lx = x - k + 1;
	while(lx <= x + k - 1) {
		cout << lx <<  ' ';
		++lx;
	}
}



Measured memory_bytes: 384
#input
N, K = map(int, input().split())

#output
#サイコロの目がi(0 <= i <= K-1)の時、iがKを超えるまで2倍していく。
#サイコロの目がi(>K)の時、ゲームは終了する。

answer = 0
if N < K :
    for i in range(1, N+1):
        temp = i
        cnt_temp = 0
        while temp < K:
            temp *= 2
            cnt_temp += 1
        answer += (1/N)*(1/2)**(cnt_temp)
else:
    for i in range(1, K):
        temp = i
        cnt_temp = 0
        while temp < K:
            temp *= 2
            cnt_temp += 1
        answer += (1/N)*(1/2)**(cnt_temp)
    for i in range(K, N+1):
        answer += (1/N)
print(answer)

Measured memory_bytes: 3064
K,N=map(int,input().split())
A=list(map(int,input().split()))

dis=A[0]+K-A[N-1]

for i in range(N-1):
    if A[i+1]-A[i]>=dis:
        dis=A[i+1]-A[i]
    else:
        pass

print(K-dis)


Measured memory_bytes: 25580
#include <iostream>

using namespace std;

int main() {

    int N;
    cin >> N;
    
    int A[2][100];

    int x;
    for (int i=0; i<N; i++) {
        cin >> x;
        A[0][i] = x;
    }

    for (int i=0; i<N; i++) {
        cin >> x;
        A[1][i] = x;
    }

    int answer = 0;

    for (int i=0; i<N; i++) {
        int sum = 0;
        for (int j=0; j<=i; j++) {
            sum += A[0][j];
        }
        for (int j=i; j<N; j++) {
            sum += A[1][j];
        }

        if (sum > answer) answer = sum;
    }

    cout << answer << endl;

}

Measured memory_bytes: 256
N, M = map(int, input().split())
xyz = [list(map(int, input().split())) for i in range(N)]
sings = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [-1, 1, 1], [1, -1, -1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]
candidates = [0 for _ in range(len(sings))]

for i in range(len(sings)):
    sum_xyz = [0 for _ in range(N)]

    j = 0
    for x, y, z in xyz:
        sum_xyz[j] = (x * sings[i][0]) + (y * sings[i][1]) + (z * sings[i][2])
        j += 1

    candidate = sorted(sum_xyz, reverse=True)
    candidates[i] = sum(candidate[:M])

print(max(candidates))

Measured memory_bytes: 3404
// Aizu Vol-1 0189: Convenient Location
// 2017.8.9

#include <stdio.h>
#include <string.h>

#define INF 100000
#define MAX 10
int d[MAX + 2][MAX + 2];
int m;

int main(void)
{
	int n, a, b, c;
	int i, sum, id, min;

	while (1) {
		scanf("%d", &n); if (n == 0) return 0;
		m = 0;
		for (a = 0; a <= MAX; a++) for (b = 0; b <= MAX; b++) d[a][b] = INF;
		for (i = 0; i < n; i++) {
			scanf("%d%d%d", &a, &b, &c);
			if (a > m) m = a;
			if (b > m) m = b;
			d[a][b] = d[b][a] = c;
		}
		for (i = 0; i <= m; i++) {
			for (a = 0; a <= m; a++) for (b = 0; b <= m; b++) {
				if (b != a) {
					int x = d[a][i] + d[i][b];
					if (d[a][b] > x) d[a][b] = x;
				}
			}
		}
		min = -1;
		for (a = 0; a <= m; a++) {
			for (sum = 0, b = 0; b <= m; b++) {
				if (b != a) sum += d[a][b];
			}
			if (min < 0 || min > sum) id = a, min = sum;
		}
		printf("%d %d\n", id, min);
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> a(N);
    REP(i,N) cin >> a[i];

    int right = 0;
    ll sum = 0;
    ll ans = 0;
    for(int left=0;left<N;++left){
        while(right < N && (sum ^ a[right]) == (sum + a[right])){
            sum += a[right];
            right++;
        }
        ans += right - left;
        if(right == left) ++right;
        else sum -= a[left];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
    int n, h, m, s, start, stop;
    while (true) {
        cin >> n;
        int table[60*60*24] = {};
        if (n == 0) {
            break;
        }
        for (int i=0; i<n; i++) {
            scanf("%d:%d:%d", &h, &m, &s);
            start = 3600*h+60*m+s;
            scanf("%d:%d:%d", &h, &m, &s);
            stop = 3600*h+60*m+s;
            for (int t=start; t<stop; t++) {
                table[t]++;
            }
        }
        int most_trains = 0;
        for (int t=0; t<60*60*24; t++) {
            if (table[t] > most_trains) {
                most_trains = table[t];
            }
        }
        cout << most_trains << endl;
    }
    return 0;
}

Measured memory_bytes: 1584
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
using namespace std;

int main(void){
	string gankou,ohn,mezikara,tokuteigai;
	int p,n,i,o,m,z,a,b;
	cin>>mezikara>>p;
	for(;p>0;p=p-1){
		cin>>ohn>>i>>o;
		z=o-i+1;
		if(ohn=="replace"){
			cin>>gankou;
			mezikara=mezikara.replace(i,o-i+1,gankou);
		}
		if(ohn=="reverse"){
			char pop;
			for(a=0;a<z/2;a++){
				pop=mezikara[i+a];
				mezikara[i+a]=mezikara[o-a];
				mezikara[o-a]=pop;
			}
		}
		if(ohn=="print"){
			cout<<mezikara.substr(i,z)<<endl;
		}

	}
	return 0;
}



Measured memory_bytes: 3212
s = list(input())
t = list(input())
a = ""
status = 0

if s == t:
    print("Yes")
    status = 1
else:
    for i in range(len(s)):
        a = s.pop()
        s.insert(0,a)
        if s == t:
            print("Yes")
            status = 1
        else:
            pass

if status == 0:
    print("No")


Measured memory_bytes: 3060
def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    M = int(buflist[1])
    K = []
    A = []
    for i in range(N):
        buf = input()
        buflist = buf.split()
        K.append(int(buflist[0]))
        A.append(list(map(int, buflist[1:])))
    liked = []
    for i in range(M):
        liked.append(0)
    for i in range(N):
        for j in range(K[i]):
            liked[A[i][j]-1] += 1
    liked_count = 0
    for i in range(M):
        if liked[i] == N:
            liked_count += 1
    print(liked_count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
int main(){
    vector<int> x (5);
    rep(i, 5){
        cin >> x[i];
    }
    int ans ;
    rep(i, 5){
        if (x[i] == 0){
            ans = i + 1;
            break;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 2000000;


int  main() {
    double w,h,x,y;
    cin >> w >> h >> x >> y;
    bool can =false;
    if(2*x==w && 2*y ==h)
        can =true;
    cout << w*h/2 << " " << can << endl;
    return 0;
}


Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define ld long double
#define all(v) v.begin(), v.end()
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define vll vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define hell 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; 
if (m == 1) {return 0;} 
while (a > 1) { ll q = a / m; ll t = m;  m = a % m, a = t; t = y; y = x - q * y; x = t; } 
if (x < 0) {x += m0;} return x; } 
inline ll add(ll a, ll b) { return (((a >= hell) ? a % hell : a) + ((b >= hell) ? b % hell : b) + hell) % hell; }
inline ll subt(ll a, ll b) { return (a - b + hell) % hell; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= hell) ? a % hell : a) * ((b >= hell) ? b % hell : b)) % hell; }
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 compare(const pair<ll,ll> &a,const pair<ll,ll> &b){
if (a.first == b.first)
{return a.second<b.second;} 
return a.first<b.first;
}
bool comparerev(const pair<ll,ll> &a,const pair<ll,ll> &b){
if(a.first == b.first)
{return a.second>b.second;}
return a.first>b.first;
}
int main()
{
    fast
    ll t = 1;
  //  cin>>t;
    while(t--){
    ll n;
    cin>>n;
    ll arr[n];
    vector<pair<ll,ll> >p;
    f(n)
    {
        cin>>arr[i];
        p.pb(mp(arr[i],i+1));
    }
    sort(p.begin(),p.end());
    ll ans[n+1];
    f(p.size())
    {
        cout<<p[i].second<<" ";
    }
    cout<<"\n";
    }
    return 0;
}

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

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using si = set<int>;
using sll = set<ll>;


const int nax = 1e5 + 5;
const ll mod = 1e9 + 7;
vector<vi> adj(nax);

pair<ll, ll> dfs(int v, int parent){
	ll white_ways = 1, black_ways = 1;
	for (int i = 0; i < adj[v].size(); i++){
		if (adj[v][i] != parent){
			pair<ll, ll> c = dfs(adj[v][i], v);
			white_ways = (white_ways * (c.first + c.second)) % mod;
			black_ways = (black_ways * c.first) % mod;
		}
	}
	
	return {white_ways, black_ways};
	
}



int main(){
	int n; cin >> n;
	for (int i = 0; i < n - 1; i++){
		int x, y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}	
	pair<ll, ll> ans = dfs(1, -1);
	cout << (ans.first + ans.second) % mod << endl;
	
	
	
	return 0;
}


Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << "\n\n"
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      cout << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  vector<double> a(N);
  rep(i, N) {
    cin >> a[i];
  }

  double ave = 0.0;
  rep(i, N) {
    ave += a[i];
  }

  ave /= N;

  vector<double> diff(N);
  rep(i, N) {
    diff[i] = abs(a[i] - ave);
  }

  double mn = INF;
  rep(i, N) {
    chmin(mn, diff[i]);
  }

  rep(i, N) {
    if (diff[i] == mn) {
      cout << i << "\n";
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> P;
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; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n;cin>>n;
  vector<int> a(n);
  vector<vector<P>> p(n);
  rep(i,n){
    cin>>a[i];
    rep(j,a[i]){
      int x,y;
      cin>>x>>y;
      x--;
      p[i].push_back(P(x,y));
    }
  }
  int m=0;
  rep(bit,(1<<n)){
    vector<vector<P>> q=p;
    vector<int> d(n,-1);
    int c=0;
    bool f=true;
    rep(i,n){
      if(bit&(1<<i)){
        c++;
        if(d[i]==-1)d[i]=1;
        else if(d[i]==0){
          f=false;break;
        }
        for(auto au:p[i]){
          int fi=au.first,se=au.second;
          if(d[fi]==-1)d[fi]=se;
          else if(d[fi]!=se){
            f=false;break;
          }
        }
        if(!f)break;
      }else{
        if(d[i]==-1)d[i]=0;
        else if(d[i]==1){
          f=false;break;
        }
      }
    }
    if(f){
      chmax(m,c);
    }
  }
  cout<<m;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a,b,r,temp;
	int count = 0;
	while(scanf("%d %d",&a,&b)){
		if(a == 0 && b == 0){
			break;
		}
		if(a < b){
			temp = a;
			a = b;
			b = temp;
		}
		while( count++, (r = a % b) != 0){
			a = b;
			b = r;
		}
		printf("%d %d\n",b,count);
		count = 0;
	}
	return 0;
}

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

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    int g = a.at(0);
    rep(i,n) g = gcd(g, a.at(i));
    cout << g << endl;
    return 0;
}

Measured memory_bytes: 3728
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = list(input())
k = int(input())
for i in range(k):
    if n[i] != '1':
        print(n[i])
        sys.exit()
print(1)

Measured memory_bytes: 6480
A, B = map(int , input().split())
res = 0
for n in range(A, B+1):
    l = []
    while(n > 0):
        l.append(n%10)
        n //= 10
    if (l[0]==l[4] and l[1]==l[3]):
        res += 1
print(res)

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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define Push_back(p, a, b) (p).push_back( make_pair( (a), (b) ) )

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;  } return 0;  }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;  } return 0;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

// π M_PI
// deg = rad*180/M_PI

int main() {
    long double n, m;
    cin >> n >> m;
    cout << (int64_t)(n*m) << endl;
    return 0;
}


Measured memory_bytes: 3728
#include<stdio.h>

int main(void){

  int i,j;
  int paper[10][10];
  int x,y,size;
  int h[12]={1,0,-1,0,1,1,-1,-1,2,0,-2,0};
  int w[12]={0,1,0,-1,1,-1,1,-1,0,2,0,-2};
  int max,cnt;

  for(i=0;i<10;i++){
    for(j=0;j<10;j++){
      paper[i][j] = 0;
    }
  }

  while(scanf("%d,%d,%d ",&x,&y,&size)!=EOF){
    paper[x][y]++;
    for(i=0;i<4*size;i++){
      if( x+w[i]>=0 && x+w[i]<10 && y+h[i]>=0 && y+h[i]<10){
	paper[x+w[i]][y+h[i]]++;
      }
    }
    
  }

  max = 0;
  cnt = 0;
  for(i=0;i<10;i++){
    for(j=0;j<10;j++){
      if(paper[i][j]){
	if(max < paper[i][j])max = paper[i][j];
      }else{
	cnt++;
      }
    }
  }

  printf("%d\n%d\n",cnt,max);

  return 0;
}

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

def m_dis(x1, y1, x2, y2):
	return abs(x2 - x1) + abs(y2 - y1)

points = []
for _ in range(N):
	x, y = map(int, input().split())
	points.append((x, y))

x, y = points[0]

maxvalue_p = x + y
minvalue_p = x + y
maxvalue_m = x - y
minvalue_m = x - y
maxvalue_p_p = points[0]
minvalue_p_p = points[0]
maxvalue_m_p = points[0]
minvalue_m_p = points[0]

for x, y in points:
	p = x + y
	m = x - y
	if maxvalue_p == None or maxvalue_p < p:
		maxvalue_p = p
		maxvalue_p_p = (x, y)
	if minvalue_p == None or minvalue_p > p:
		minvalue_p = p
		minvalue_p_p = (x, y)
	if maxvalue_m == None or maxvalue_m < m:
		maxvalue_m = m
		maxvalue_m_p = (x, y)
	if minvalue_m == None or minvalue_m > m:
		minvalue_m = m
		minvalue_m_p = (x, y)

topvalue = 0

for x, y in points:
	topvalue = max(topvalue, 
		m_dis(x, y, maxvalue_p_p[0], maxvalue_p_p[1]),
		m_dis(x, y, minvalue_p_p[0], minvalue_p_p[1]),
		m_dis(x, y, maxvalue_m_p[0], maxvalue_m_p[1]),
		m_dis(x, y, minvalue_m_p[0], minvalue_m_p[1]))

print(topvalue)


Measured memory_bytes: 36080
from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
 
M = 10**9+7

@lru_cache(maxsize=None)
def mod_inv(a):
  b, x, y = M, 1, 0
  while a != 1:
    (d, a), b = divmod(b, a), a
    x, y = y-d*x, x
  return x%M

@lru_cache(maxsize=None)
def calc_subtree(v):
  ret = 1
  size = 1
  for child in Edge[v]:
    Edge[child].remove(v)
    r, s = calc_subtree(child)
    ret = ret * r % M
    size += s
      
  ret = ret * size % M
  return ret, size

ans = {}
def set_ans(v, a):
  ans[v] = a
  for child in Edge[v]:
    n = calc_subtree(child)[1]
    set_ans(child, ans[v] * n * mod_inv(N-n) % M)

N = int(input())
Edge = defaultdict(set)
fact = N
for i in range(1, N):
  fact = fact * i % M
  a, b = map(int, input().split())
  Edge[a].add(b)
  Edge[b].add(a)

set_ans(1, mod_inv(calc_subtree(1)[0]) * fact % M)
for i in range(1, N+1):
  print(ans[i])



Measured memory_bytes: 153052
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
x = [True] * (N+1)  # 1-indexed
for i in range(K):
    d = ir()
    A = lr()
    for a in A:
        x[a] = False

answer = sum(x) - 1
print(answer)


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

ll solve() {
    ll N;
    cin >> N;
    ll ans = 0;
    for ( int i = 1; i <= N; i++ ) {
        ans += (N-1)/i;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3632
def func(n):
    count = 1
    while(n!=4):
        if n%2==0:
            n = n // 2
        else:
            n = 3*n + 1
        count += 1
    return count + 3


s = int(input())
if s==1:
    print(4)
elif s==2:
    print(4)
elif 3<=s and s<=100:
    print(func(s))
else:
    print(0)

Measured memory_bytes: 3060
import sys

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


def main():
    N, M = map(int, input().split())
    time = 1900 * M + 100 * (N - M)
    ans = time * 2 ** M
    print(ans)


if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int a, b; cin>>a>>b;
	for(int n = 1; n <= 10000; n++){
		if(n*2/25 == a && n/10 == b){
			cout<<n<<endl;
			exit(0);
		}
	}
	cout<<-1<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 5 * 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

int n, m, res;
bool mk[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    in("input.txt");

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int k;
        cin >> k;
        while (k--) {
            int x;
            cin >> x;
            x--;
            mk[x] = 1;
        }
    }

    for (int i = 0; i < n; i++)
        res += !mk[i];

    cout << res;
}


Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cmath>
//#define _0219nice 
using namespace std;

int main() {
#ifdef _0219nice
    freopen("1.in", "r", stdin);
#endif
    double l;
    while (~scanf("%lf", &l)) {
        printf("%.7lf\n", pow(l / 3, 3));
    }
    return 0;
}


Measured memory_bytes: 256