akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
 
int main(void){
  int N = 0;//数
  int D = 0;//次元
  scanf("%d %d", &N, &D);
  
  int x[10][10];//最大10*10
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++){
      scanf("%d ", &x[i][j]);
    }
  }
  
  int cnt = 0;
  double rlt_1 = 0.0;
  double rlt_2 = 0.0;
  // 1 2 ・・・1 5,  2 3 ・・・ 2 5,・・・, 4 5
  for(int i = 0; i < N - 1; i++){
    for(int j = i + 1; j < N; j++){
      //rintf("i = %d, j = %d\n", i, j);
      rlt_1 = 0.0;
      rlt_2 = 0.0;
      for(int k = 0; k < D; k++){
        rlt_2 += pow( abs(x[i][k] - x[j][k]), 2 );
        //printf("%lf ", rlt_2);
      }
      //printf("\n");
      rlt_1 = sqrt(  rlt_2 );
      //printf("rlt_1 = %lf\n", rlt_1);
      //printf("rlt_1^2 = %lf\n",pow(rlt_1, 2) );
      double tmp = 0.0;
      //printf("modlf = %lf, %lf", modf(rlt_1 , &tmp), modf(pow(rlt_1, 2) , &tmp));
      if( modf(rlt_1 , &tmp) == 0.000000 && modf(pow(rlt_1, 2), &tmp) == 0.000000){
      	cnt++;
        //printf("cnt = %d\n", cnt);
      }
    }
  }
  
  printf("%d", cnt);
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF (1e9)
#define N 1005
using namespace std;

int n,w,a[N],dp[N];

int main(){

  int T=1;
  
  while(1){
    
    cin>>n>>w;
    if(!n&&!w) break;

    for(int i=0;i<n;i++) cin>>a[i];
    
    for(int i=0;i<=n;i++) dp[i]=INF;
    
    dp[0]=0;
    
    for(int i=0;i<n;i++){

      int s=0;

      for(int j=i;j<n;j++){

	s+=a[j];
	
	if(j==n-1) dp[j+1]=min(dp[j+1],dp[i]+max(0,s-w));
	else dp[j+1]=min(dp[j+1],dp[i]+abs(s-w));
      }
      
    }

    cout<<"Case "<<T<<": "<<dp[n]<<endl;
    
    T++;
  }
  
  return 0;
}

Measured memory_bytes: 3020
#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 main(){
    string s;
    cin >> s;
    int k=0;
    if(s=="A" or s=="B" or s=="C" or s=="D" or s=="E" or s=="F" or s=="G" or s=="H" or s=="I" or s=="J" or s=="K" or s=="L" or s=="M"){
        k=1;
    }
    else if(s=="N" or s=="O" or s=="P" or s=="Q" or s=="R" or s=="S" or s=="T" or s=="U" or s=="V"){
        k=1;
    }
    else if(s=="W" or s=="X" or s=="Y" or s=="Z"){
        k=1;
    }


    if(k==1){
        cout << "A" << endl;
    }
    else{
        cout << "a" << endl;
    }
    

    return 0;
}

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

string str;
char st[15],c;

int main()
{
    bool T=false;
    cin >> str;
    int t=str.size();
    for (int i=0;i<t;i++)
    {
        cin >> st[i];
        if (st[i]!=str[i])
            T=true;
    }
    cin >> c;
    if (T)
        cout << "No\n";
    else
        cout << "Yes\n";

}


Measured memory_bytes: 3652
#include <stdio.h>

int
main(void)
{
	auto deg = [](double ax, double ay, double bx, double by,
				  double cx, double cy)  -> double {
		    double abx = bx - ax;
		    double aby = by - ay;
		    double acx = cx - ax;
		    double acy = cy - ay;
		 
		    return (abx * acy  -acx * aby);
		};

	char line[80];

	double xa, ya, xb, yb, xc, yc, xd, yd;

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			break;
		}
		if (sscanf(line, "%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,",
				   &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != 8) {
			break;
		}

		double d0 = deg(xa, ya, xb, yb, xd, yd);
		double d1 = deg(xb, yb, xc, yc, xa, ya);
		double d2 = deg(xc, yc, xd, yd, xb, yb);
		double d3 = deg(xd, yd, xa, ya, xc, yc);

        if ((d0 < 0 && d1 < 0 && d2 < 0 && d3 < 0) ||
	        (d0 > 0 && d1 > 0 && d2 > 0 && d3 > 0)) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
	}

	return 0;
}

Measured memory_bytes: 1044
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		long[] num = new long[200010];
		for(int i = 0 ; i < n ; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			num[a] += b;
		}
		for(int i = 0 ; i <= 200009 ; i++) {
			k -= num[i];
			if(k <= 0) {
				System.out.println(i);
				return;
			}
		}
	}
}


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

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[],int n,int g){
for(int i=g;i<n;i++){
int v=A[i];
int j=i-g;
while(j>=0 && A[j] >v){
A[j+g]=A[j];
j-=g;
cnt++;
}
A[j+g]=v;
}
}

void shellSort(int A[],int n){
for(int h=1; ;){
if(h>n) break;
G.push_back(h);
h=3*h+1;
}

for(int i=G.size()-1;i>=0;i--){
insertionSort(A,n,G[i]);
}
}


int main(){
cin >> n;
for(int i=0;i<n;i++) scanf("%d",&A[i]);
cnt=0;

shellSort(A,n);

cout << G.size() << endl;
for(int i=G.size()-1;i>=0;i--){
printf("%d",G[i]);
if(i) printf(" ");
}
printf("\n");
printf("%d\n",cnt);
for(int i=0;i<n;i++) printf("%d\n",A[i]);


return 0;
}

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

using namespace std;

int cnt[100010];

int main(void) {
    int n, t, l, r;
    cin >> n >> t;
    for (int i = 0; i < n; i++) {
        cin >> l >> r;
        cnt[l]++;
        cnt[r]--;
    }

    int ans = 0, sum = 0;
    for (int i = 0; i <= t; i++) {
        sum += cnt[i];
        ans = max(ans, sum);
    }
    
    cout << ans << endl;

    return 0;
}


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

int main(){
    int N, X;
    cin >> N >> X;
    int m[N], min=1000, sum=0, donuts;
    for(int i=0; i<N; i++) cin >> m[i];
    for(int i=0; i<N; i++){
        sum += m[i];
        if(min > m[i]) min = m[i];
    }
    donuts = N + (X-sum) / min;
    cout << donuts << endl;
}

Measured memory_bytes: 256
def scc(E, n_vertex):
    # 強連結成分分解  # E は [[a1, b1], [a2, b2], ... ] の形
    # 返り値は 強連結成分の数 と 各頂点がどの強連結成分に属しているか
    # numpy いらないのは https://tjkendev.github.io/procon-library/python/graph/scc.html
    import numpy as np
    from scipy.sparse import csr_matrix, csgraph
    A, B = np.array(E).T
    graph = csr_matrix((np.ones(len(E)), (A, B)), (n_vertex, n_vertex))
    n_components, labels = csgraph.connected_components(graph, connection='strong')
    return n_components, labels

N, M = map(int, input().split())
S = "_" + input()
E = []
for _ in range(M):
    a, b = map(int, input().split())
    if S[a]==S[b]:
        E.append([a, N+b])
        E.append([b, N+a])
    else:
        E.append([N+a, b])
        E.append([N+b, a])

n_components, _ = scc(E, 2*N+1)
if n_components == 2*N+1:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 96800
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    string s;cin>>s;
    if(s[0]==s[1]||s[1]==s[2]||s[0]==s[2])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream> 
using namespace std;
int main() {
    int n, maxValue = 0, count = 0, h;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> h;
        if (h >= maxValue) {
            maxValue = h;
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
# ABC045B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
from collections import deque


def main():
    S = [deque(list(input().rstrip())) for _ in range(3)]
    abc = {"a": 0, "b": 1, "c": 2}
    cur = S[0].popleft()
    while True:  # search greedily
        idx = abc[cur]
        if not S[idx]:
            print(cur.upper())
            break
        cur = S[idx].popleft()


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<stack>
#include<iomanip>
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define Rep(i,n0,n) for(int i=n0;i<((int)n);i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<((int)n);j++)
#define W(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
#define INF2 (long long)8*(long long)INF*(long long)INF
#define mod 1000000007
typedef long long ll;

using namespace std;


int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){if(y>x)return y;else return x;}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
long long fact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i;}
int gcd(int x, int y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}
ll gcd(ll x, ll y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}
ll a[100001];
int main()
{
    
    int n;
    cin>>n;
    ll ans=-n,s;
    rep(i,n)
    {
        cin>>s;
        ans+=s;
    }
    W(ans)
    return 0;
}

Measured memory_bytes: 256
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    string s;
    cin>>s;

    if(s[2]==s[3] && s[4]==s[5]){

        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int t, n, s, a, b, c, i;
	for (i = 1; i < 5; i++) {
		scanf("%d", &t);
		scanf("%d", &n);
		switch (t) {
		case 1:
			s = n * 6000;
			printf("%d\n", s);
			break;
		case 2:
			a = n * 4000;
			printf("%d\n", a);
			break;
		case 3:
			b = n * 3000;
			printf("%d\n", b);
			break;
		case 4:
			c = n * 2000;
			printf("%d\n", c);
		}
	}
	return 0;
}


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

using namespace std;

#define LL long long 
#define ULL unsigned LL
#define LD long double 

const LL MOD = 1e9 + 7;

long long inv(long long a, long long b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	LL a[n];
	LL ans = 0;
	LL suma = 0;
	for(int i=0; i<n; i++) {
		cin>>a[i];
		suma+=a[i];
	}
	for(int i=0; i<n; i++) {
		LL x = suma - a[i];
		x %= MOD;
		LL y = a[i] * x;
		y %= MOD;
		ans += y;
		ans %= MOD;
	}
	LL dziel = inv(2, MOD);
	ans *= dziel;
	ans %= MOD;
	cout<<ans;
}


Measured memory_bytes: 5176
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define loop(x) for(int i=0;i<x;i++)
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define dd fflush(stdout)
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mt make_tuple //use tie
#define eb emplace_back
typedef tuple<int,int,int> State;//use in dijkstra
 
// ll power(ll x,ll y,ll mod){
//  ll ans=1;
//  while(y>0){
//   if(y&1){
//     ans=ans*x;
//   }
//   x=x*x;
//   y=y/2;
//  }
//  return ans;
// }
  int n,m;
   vector<int>v[100002];
   int dp[100003];
int solve(int st){
  if(dp[st]!=-1)
    return dp[st];
  int ans=0;
  for(int i=0;i<v[st].size();i++){
    ans=max(ans,1+solve(v[st][i]));
  }
  return dp[st]=ans;
}
int main(){
    IOS;
   
    cin>>n>>m;
    int x,y;
   memset(dp,-1,sizeof dp);
    loop(m){
      cin>>x>>y;
      v[x].pb(y);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
      ans=max(ans,solve(i));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8192
#include<stdio.h>
#include<string.h>
int main()
{
  char s[19];
  char *ptr;
  
  scanf("%s",s);
  
  ptr = strtok(s, ",");
  printf("%s", ptr);
  
  while(ptr != NULL) {
    ptr = strtok(NULL, ",");
    if(ptr != NULL) {
      printf(" %s", ptr);
    }
  }
   
  return 0;
}

Measured memory_bytes: 128
import std.stdio,std.string,std.conv,std.math;

int main()
{
	int[4] a,b;
	int count,count_2;
	string s,s2;
	while((s = readln.chomp).length != 0 )
	{
		s2 = readln.chomp;
		string[] input = split(s);
		string[] input2 = split(s2);

		foreach(i;0..4)
		{
			a[i] = input[i].to!int;
			b[i] = input2[i].to!int;
		}

		count = 0;
		count_2 = 0;

		foreach(i;0..4)
		{
			foreach(j;0..4)
			{
				if(a[i] == b[j]) 
				{
					if(i == j) count++;
					else count_2++;
				}
			}
		}
		writeln(count," ",count_2);

	}
	return 0;
}

Measured memory_bytes: 1048
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        mut xl: [(i64, i64); n],
    }

    xl.sort_by_key(|r| r.0 + r.1);

    // use std::io::Write;
    // write!(&mut std::io::stderr(), "{:?}\n", &xl);

    let mut ans = 1;
    let mut right = xl[0].0 + xl[0].1;

    for &(x, l) in xl[1..].iter() {
        let left = x - l;

        if left >= right {
            ans += 1;
            right = x + l;
        }
    }

    println!("{}", ans);
}


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

int main(){
  int N; cin >> N;
  multiset<int> A;
  int Amax=0;
  for(int i=0; i<N; i++){
    int d; cin >> d;
    A.insert(d);
    if(Amax<d) Amax=d;
  }
  
  int icount=0;
  while(!A.empty()){
    int af=*A.begin();
    if(A.count(af)==1) icount++;
    for(int d=af; d<=Amax; d+=af){
      A.erase(d);
    }
  }
  cout << icount << endl;
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#define inf 2e18
#define pi acos(-1)
using namespace std;
typedef long long ll;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    string a;
  cin>>a;
  int b=0,c;
  for(int i=0;i<a.size();i=i){
    c=0;
    if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G'){
      while(1){
        if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G'){
          c++;
          i++;
        }
        else
          break;
      }
      b=max<int>(b,c);
    }
    else
      i++;
  }
  cout<<b<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
  int num;
  cin >> num;

  printf("%d\n", (int)pow( num, 3 ));
  return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

int main() {
    int n,m;
    cin>>n>>m;
    int a[m],b[m];
    for(int i=0;i<m;++i) cin>>a[i]>>b[i];
    
    int num[51]={0};
    for(int i=0;i<m;++i){
        ++num[a[i]-1];
        ++num[b[i]-1];
    }
    for(int i=0;i<n;++i){
        cout<<num[i]<<endl;
    }
   
    return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let s = s.trim_end().to_string();
    let mut iter = s.split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    println!("{}", a * b);
}

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

using namespace std;

const int maxn = 21;
const int mod = 1e9+7;

int n, a[maxn][maxn], s[1<<maxn];
long long int dp[1<<maxn];

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cin >> a[i][j];
		}
	}

	for (int i = 1; i < (1<<n); i++){
		s[i] = s[i-(i&(-i))] + 1;
	}

	dp[0] = 1;
	for (int mask = 1; mask < (1<<n); mask++){
		for (int i = 0; i < n; i++){
			if (((1<<i) & mask) && a[i][s[mask]-1])
				dp[mask] = (dp[mask] + dp[mask^(1<<i)]) % mod;
		}
	}

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


Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
	
	int a,b; cin>>a>>b;
	if(a==b) cout<<a*2<<endl;
	else cout<<max(a,b)*2-1<<endl;
	
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define PI 3.14159265358979323846264338327950L
int main()
{
    int a,b,h,m;
   scanf("%d %d %d %d",&a,&b,&h,&m);
   long double rad=2*PI*((long double)(h/12.0)+((long double)m/60.0)/12.0-(long double)m/60.0);
   long double rsq=(long double)(a*a+b*b)-(long double)(2*a*b)*cosl(rad);
printf("%20.20Lf\n",sqrtl(rsq));
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define MAX (int)(1e6)+1
#define MOD 1000000007

using namespace std;

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pwi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector< vector<pair<int,lli > > > wGraph;
typedef vector<vector<int> > graph;
//typedef vector<vector<int> > matrix;

vlli arr;

vlli conquer(vlli a,vlli b){
    vlli res(3);
    res[0] = max(__gcd(a[0],b[2]),__gcd(a[1],b[2]));
    res[1] = max(__gcd(b[0],a[2]),__gcd(b[1],a[2]));
    res[2] = __gcd(a[2],b[2]);
    return res;
}

vlli divide(int l,int r){

    int mid = (l+r)/2;

    if(r == mid){
        vlli v;
        v.pb(0);
        v.pb(0);
        v.pb(arr[mid]);
        return v;
    }

    return conquer(divide(l,mid),divide(mid+1,r));
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<std::fixed;
    cout<<std::setprecision(6);

    int n;
    cin>>n;
    rep(i,n){
        lli v;
        cin>>v;
        arr.pb(v);
    }

    vlli res = divide(0,n-1);

    cout<<max(res[0],max(res[1],res[2]))<<endl;

    return 0;

}


Measured memory_bytes: 1400
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long int lli;
const long long int MaxN=300005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli arr[MaxN];
	lli pre[MaxN];
	void solve(){
		lli N,i,j,p,q,res=1e16,s;
		cin>>N;		
		for(i=1;i<=N;i++){
			cin>>arr[i];
		}
		//sort(arr+1,arr+N+1);
		for(i=1;i<=N;i++){
			pre[i]=pre[i-1]+arr[i];
		}
		s=arr[N];
		for(i=N-1;i>=1;i--){
			res=min(res,abs(pre[i]-s));
			s+=arr[i];
		}
		cout<<res;
	}
int main(){
	cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
}

Measured memory_bytes: 3840
import itertools
N,M=map(int,input().split())
kslist=[(list(map(int,input().split()))) for i in range(M)]
plist=list(map(int,input().split()))
ls=list((itertools.product(range(2),repeat=N)))
n=0
for tup in ls:
    n+=1
    for j in range(M):
        sum1=0
        for k in range(1,kslist[j][0]+1):
            sum1+=tup[kslist[j][k]-1]
        if sum1%2!=plist[j]:
            n=n-1
            break
print(n)            
    

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

int main(){
	int n,m;
	cin >> n >> m;
	cout << (n-1)*(m-1) << endl;
	return 0;
}



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

int main()
{
  string s;
  int q;
  cin >> s >> q;
  int f = 1;
  string t, u;
  for (int i = 0; i < q; i++) {
    int a, b;
    char c;
    cin >> a;
    if (a == 1) {
      f = f == 1 ? 2 : 1;
      continue;
    }
    cin >> b >> c;
    ((f + b) % 2 == 0 ? t : u) += c;
  }
  reverse(begin(t), end(t));
  string ans = t + s + u;
  if (f == 2) reverse(begin(ans), end(ans));
  cout << ans << endl;
}


Measured memory_bytes: 1348
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
 
int main() {
    int n;
    string s;
    cin >> n >> s;
 
    int white = 0, black = 0;
    rep(i, n) {
        if(s[i] == '.') {
            white++;
        }
    }
 
    int ans = white;
    rep(i, n) {
        if(s[i] == '.'){
            white--;
        }
        else {
            black++;
        }
        int now = white + black;
        ans = min(ans, now);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#define ll long long
using namespace std;
int main()
{
	ll a,b,k;
	cin>>a>>b;
	if((a+b)%2==0)
	{
		k=(a+b)/2;
		cout<<k<<endl;
	}
	else
		cout<<"IMPOSSIBLE"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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



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

    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;

    vector<int> box(N);
    FORR(i, N, 0) {
        int parity = 0;
        for (int k = i; k < N; k += i + 1) {
            parity += box[k];
            parity %= 2;
        }
        if (parity != A[i]) {
            box[i]++;
        }
    }

    cout << count_if(ALL(box), [](int a) {return a == 1; }) << endl;
    REP(i, N) {
        if (box[i] == 1) {
            cout << i + 1 << " ";
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
class ConvexHullTrick{
  public:
  struct Line_Struct{
    long long a,b;
  };
  deque<Line_Struct> s;
  bool CompatibleLines(Line_Struct l1,Line_Struct l2,Line_Struct l3){
    return 1LL*(l2.a-l3.a)*(l2.b-l1.b)<=(l3.b-l2.b)*(l1.a-l2.a);
  }
  void ins(Line_Struct l){
    while(s.size()>1 && !CompatibleLines(s.end()[-2],s.end()[-1],l))
      s.pop_back();
    s.push_back(l);
  }
  long long query(long long x){  // merge doar daca queryurile sunt in ordine crescatoare
    while(s.size()>1 && (double)x>=(double)(s[0].b-s[1].b)/(s[1].a-s[0].a))
      s.pop_front();
    return s[0].a*x+s[0].b;
  }
};
const int N=2*1e5+5;
int h[N];
long long dp[N];
int main()
{
  int n;
  long long c;
  cin>>n>>c;
  for(int i=1;i<=n;i++)
    cin>>h[i];
  dp[1]=0;
  ConvexHullTrick cht;
  for(int i=2;i<=n;i++){
    cht.ins({-2LL*h[i-1],1LL*h[i-1]*h[i-1]+dp[i-1]});
    dp[i]=1LL*h[i]*h[i]+c;
    dp[i]+=cht.query(h[i]);
  }
  cout<<dp[n];
  return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<iomanip>
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) loop(i,0,n)
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<pii> vp;
typedef vector<vi> vvi;
typedef vector<string> vs;
Def inf = sizeof(Def) == sizeof(ll) ? 2e18:1e9+10;
int main(){
	int n;
	while(cin>>n,n){
		vs in(5,"");
		rep(i,n)rep(j,5){
			string s;cin>>s;
			in[j]=s+in[j];
		}
		int out=0;
		while(1){
			int sum=0;
			rep(i,n){
				int l=2,r=2;
				while(l>=0&&i<in[l].size()&&in[2][i]==in[l][i])l--;
				while(r<5&&i<in[r].size()&&in[2][i]==in[r][i])r++;
				l++;r--;
				if(r-l+1>=3){
					sum+=(in[2][i]-'0')*(r-l+1);
					loop(j,l,r+1)in[j][i]='!';
				}
//			rep(q,5)cout<<in[q]<<endl;
//			cout<<endl;
			}
			if(sum==0)break;
			rep(i,5)rep(j,in[i].size())if(in[i][j]=='!'){
				in[i].erase(in[i].begin()+j);
				j--;
			}
			out+=sum;
		}
		cout<<out<<endl;
	}
}


Measured memory_bytes: 3112
// Remeber Choose Compiler: GCC9
#include <bits/stdc++.h>

using namespace std;

// Debug Output Utility
#ifdef LOCAL
#define dbg(args...)             \
    do {                         \
        cout << #args << " -> "; \
        err(args);               \
    } while (0)
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
    std::cout << a << ' ';
    err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &... args) {
    for (auto &v : arg)
        std::cout << v << ' ';
    err(args...);
}
#else
#define dbg(...)
#endif

// Macro Definitions:
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

// Type Alias:
using int64 = long long;
using PII   = pair<int, int>;

// Global Const Variable
const int64 INF = 0x3f3f3f3f3f3f3f3f;
const int MOD   = 1000000007;
const int MAXN  = 200005;

int64 a[MAXN], b[MAXN];
int64 n, m, k;


void run() {
    int n;
    cin >> n;
    if(n%1000==0) cout << 0 << endl;
    else cout << 1000 - (n%1000) << endl;
}

// Debug Input Redirection
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    run();
}


Measured memory_bytes: 3644
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	deque<int> deq;
	rep(i,n){
		int a;
		cin >> a;
		if(i%2 == 0) deq.push_back(a);
		else deq.push_front(a);
	}
	rep(i,n){
		if(n%2 == 0){
			cout << deq.front() << " ";
			deq.pop_front();
		}
		else{
			cout << deq.back() << " ";
			deq.pop_back();
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <algorithm>

int main()
{
  std::string small, tall;
  std::cin >> small >> tall;
  
  std::sort(small.begin(), small.end());
  std::sort(tall.begin(), tall.end(), std::greater<int>());
  
  if ( small < tall ) std::cout << "Yes\n";
  else std::cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
n,q = gets.split.map(&:to_i)

obs = []
n.times{ obs << gets.split.map(&:to_i) }

sds = []
q.times{ sds << gets.split.map(&:to_f) }

sds.each do |sd|
  s,d = [sd[0,3], sd[3,3]]
  puts obs.select{ |ob|
    vsd = d.zip(s).map{|d,s| d-s}
    vob = ob[0,3].zip(s).map{|x,y| x-y}
    co = vob.zip(vsd).map{|x,y|x*y}.inject(&:+)/vsd.map{|x|x*x}.inject(&:+)
    next false unless 0.0 <= co && co <= 1.0
    proj = vsd.map{|x| x*co}
    dis = vob.zip(proj).map{|x,y| x-y}.map{|x| x**2}.inject(&:+)
    ob[3]**2 + 0.0001 >= dis
  }.map{|x,y,z,r,l| l}.inject(0,&:+)
end

Measured memory_bytes: 8920
n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 1000000007

right = []

for i in range(n):
    count = 0
    for j in range(n-i-1):
        if(a[i]>a[i+j+1]):
            count+=1
    right.append(count)
    


miman = [0 for i in range(2002)]

for i in range(2001):
    count = 0
    for j in range(n):
        if(i+1>a[j]):
            count+=1
    miman[i+1]=count

#print(right)
#print(miman[:6])

ans=0
for i in range(n):
    ans += (right[i]*k)%mod
    ans += (miman[a[i]]*(k-1)*k//2)%mod
    ans %= mod
        
print(ans)

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

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define NCK_MAX 510000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second


int main(int argc, char const *argv[]) {
  double a, b, x; cin >> a >> b >> x;
  bool flag = (a * a * b / 2 < x);
  double rad;
  if (flag) {
    double diff = a * a * b - x;
    rad = atan2(2 * diff/pow(a,2),a);
  } else {
    rad = atan2(b,2 * x / (a * b));
  }
  double ans = rad/ (2 * acos(-1)) * 360;
  printf("%.10f\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 200050;
int N;
long long L, X[MAX_N];
long long ac[MAX_N] = {};
long long tmp[MAX_N];

long long ret = 0;

long long range_sum(int id1, int id2) {
    assert(1 <= id1);
    assert(id1 <= id2);
    return ac[id2] - ac[id1-1];
}

void solve() {
    for (int i = 1; i <= N; i++) {
        ac[i] = ac[i-1] + X[i];
    }

    ret = std::max(ret, X[N]);

    for (int i = 1; i <= N; i++) {
        int num = std::min(i-1, N-i);
        if (1 <= num) {
            ret = std::max(ret, range_sum(i-num, i-1) * 2 + X[i] - range_sum(i+1, i+num) * 2 + L * 2 * num);
        }
        //std::cout << i << " " << ret << std::endl;
    }

    for (int i = 1; i <= N; i++) {
        int num = std::min(i-1, N-i+1);
        if (1 <= num) {
            ret = std::max(ret, range_sum(i-num, i-1) * 2 + L * 2 * num - range_sum(i, i+num-1) * 2 - (L - X[i]));
        }
        //std::cout << i << " " << ret << std::endl;
    }
}

int main(int argc, char **argv) {
    std::cin >> L >> N;
    
    for (int i = 1; i <= N; i++) {
        std::cin >> X[i];
    }

    solve();

    for (int i = 1; i <= N; i++) {
        tmp[i] = L - X[N-i+1];
    }

    for (int i = 1; i <= N; i++) {
        X[i] = tmp[i];
    }

    solve();

    std::cout << ret << std::endl;

    return 0;
}



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

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

typedef long long int ll;
#define endl '\n'
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define point pair <double, double>
#define debug(x) cerr << #x << " is " << x << endl;

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 2e5 + 5;

int fre[N];

int C(int n){
  return (n*(n-1))/2;
}

signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  // #ifndef ONLINE_JUDGE
	//   freopen("input.txt", "r", stdin);
	//   freopen("output.txt", "w", stdout);
  // #endif
  int n; cin >> n;
  int data[n];
  for(int i = 1; i <= n; i++){
    cin >> data[i]; fre[data[i]]++;
  }
  int cur = 0;
  for(int i = 1; i <= n; i++){
    if(fre[i] > 1){
        cur += C(fre[i]);
    } 
  }
  for(int i = 1; i <= n; i++){
    if(fre[data[i]] == 1){
       cout << cur << '\n'; continue;
    }
    int ans = cur - C(fre[data[i]]) + C(fre[data[i]]-1);
    cout << ans << '\n';
  }
}



Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

bool used[9];
int T,n[9],c[3][10],C[3];
char cc;

int main(){
	cin>>T;
	while(T--){
		rep(i,3)fill(c[i],c[i]+10,0);
		fill(C,C+3,0);
		rep(i,9)cin>>n[i];
		rep(i,9){
			cin>>cc;
			if(cc=='R'){c[0][n[i]]++;C[0]++;}
			if(cc=='G'){c[1][n[i]]++;C[1]++;}
			if(cc=='B'){c[2][n[i]]++;C[2]++;}
		}
		int f=1;
		if(C[0]%3+C[1]%3+C[2]%3)f=0;
		rep(i,3){
			if(!C[i])continue;
			int cur=0;
			while(C[i]){
				if(!c[i][cur])cur++;
				else{
					if(c[i][cur]>=3){c[i][cur]-=3;C[i]-=3;}
					else{
						if(!c[i][cur+1]||!c[i][cur+2]){f=0;break;}
						c[i][cur]-=1;c[i][cur+1]-=1;c[i][cur+2]-=1;
						C[i]-=3;
					}
				}
			}
			if(!f)break;
		}
		cout<<(f?1:0)<<endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin>>s;
    int len=s.length();
    int sum1=len/2;
    int sum2=0;
    for(int i=0;i<len;i++)if(s[i]=='p')sum2++;
    cout<<sum1-sum2<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <sstream>
using namespace std;

int main() {
	
	string s,s1,test="";
	cin>>s>>s1;
	test+=s;
	test+=s1;
	
	stringstream geek(test); 
    double x = 0; 
    geek >> x; 
    
    double a=fmod(sqrt(x),1);
    
    if(a==0)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
using namespace std;
#define dlwlrma ios::sync_with_stdio(0); cin.tie(0);
#define ll long long
const int mod = 1e9+7;

int pow(int a, int b){
    int ans = 1;
    for(int i = 0; i < b; i++){
        ans = (1LL* ans * a) % mod;
    }
    return ans;
}
int main(){
    dlwlrma
    int n;
    cin >> n;
    ll ans = pow(10,n);
    ans-= 2LL*pow(9,n);
    ans+=pow(8,n);
    ans%=mod;
    if(ans<0)
        ans+=mod;
    cout << ans << "\n";
}


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

int main(){
	int A, B, K;
	cin >> A >> B >> K;
	vector<int> vec;
	for(int i = 1; i <= A && i <= B; i++)
		if(A % i == 0 && B % i == 0) vec.push_back(i);
	cout << vec[vec.size() - K] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
const int N=200005,M=N*2;
int a[N];
int en=0,to[M],nxt[M],h[N];
void addedge(int u,int v)
	{
	to[++en]=v,nxt[en]=h[u],h[u]=en;
	}
int du[2][N];
int n,m;
int iff[N],cnt=0;
queue<int> q;

int main()
{
//freopen("input.txt","r",stdin);
cin >>n>>m;
char ch=getchar();
while(ch!='A'&&ch!='B')
	{
	ch=getchar();
	}
a[1]=ch=='A';
for(int i=2;i<=n;i++)
	{
	a[i]=getchar()=='A';
	}
for(int i=1;i<=m;i++)
	{
	int u,v;
	scanf("%d%d",&u,&v);
		du[a[v]][u]++;
		du[a[u]][v]++;
	addedge(u,v);
	addedge(v,u);
	}
for(int i=1;i<=n;i++)
	{
	if(!du[0][i]||!du[1][i])
		q.push(i),
		iff[i]=1,
		cnt++;
	}
while(!q.empty())
	{
	int u=q.front();q.pop();
	for(int i=h[u];i;i=nxt[i])
		{
		int v=to[i];
		du[a[u]][v]--;
		if(iff[v])continue;
		if(!du[a[u]][v]&&!iff[v])
			{
			q.push(v);
			iff[v]=1;
			cnt++;
			}
		}
	}
if(cnt<n)
	{
	cout <<"Yes";
	}
else cout <<"No";
return 0;
}


Measured memory_bytes: 7552
#include<iostream>
#include<cstring>

using namespace std;

int n, a[2000009], b[2000009];

int main(){
  cin >> n;
  for(int i=0;i<n;i++)cin >> a[i];
  int c[10009];
  memset(c, 0, sizeof(c));
  for(int i=0;i<n;i++)c[a[i]]++;
  for(int i=1;i<=10000;i++){
    c[i] += c[i-1];
  }
  for(int i=n-1;i>=0;i--){
    b[c[a[i]]-1] = a[i];
    c[a[i]]--;
  }
  for(int i=0;i<n;i++)cout << b[i] << (i<n-1?' ': '\n');
}


Measured memory_bytes: 18756
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main(){
	int N, A, B,S;
	cin >> N >> A >> B;
	S = N * A;
	if (S > B) {
		cout << B << endl;
	}
	else {
		cout << S << endl;
	}
}

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

using namespace std;

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

int main(){
  int n;
  cin >> n;
  if(n < 3 || (n & (n - 1)) == 0){
    cout << "No" << endl;
    return 0;
  }else{
    cout << "Yes" << endl;
  }
  int k = (n + 1) / 4;
  REP(i, 4 * k - 2){
    cout << i + 1 << " " << i + 2 << endl;
  }
  cout << 4 * k - 1 << " " << n + 1 << endl;
  REP(i, 4 * k - 2){
    cout << n + i + 1 << " " << n + i + 2 << endl;
  }
  if(n % 4 == 1 || n % 4 == 2){
    int m = n / 4 * 4 + 1;
    cout << n + m - 2 << " " << n + m << endl;
    cout << n + m << " " << n + m - 1 << endl;
    cout << n + m - 3 << " " << m - 1 << endl;
    cout << m - 1 << " " << m << endl;
  }
  if(n % 4 == 2){
    cout << 3 << " " << n << endl;
    cout << 2 * n - 1 << " " << 2 * n << endl;
  }
  if(n % 4 == 0){
    int m = n & (n - 1);
    int l = n - m;
    cout << m + 1 << " " << n << endl;
    cout << n + l << " " << 2 * n << endl;
  }
  return 0;
}

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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  if(n % 2)
  {
    cout << "No" << endl;
    return 0;
  }
  
  cout << (s.substr(0, n / 2) == s.substr(n / 2) ? "Yes" : "No") << endl;
}

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

ll pot(ll a, ll b, ll mod) {
	if(a<0)
		a = a + mod;
	ll akta = a;
	ll aktres = 1;
	while(b) {
		if(b%2==1) {
			aktres *= akta;
			aktres %= mod;
		}
		akta *= akta;
		akta %= mod;
		b/=2;
	}
	return aktres;
}

ll suma_geo(ll a, ll x, ll p, ll mod) {
	//cout << "biore geometryczny z a: " << a << " x : " << x << " p : " << p << " mod: " << mod << endl;
	return ((a%mod * (pot(x,p+1,mod)-1)%mod * pot(x-1, mod-2, mod)%mod)+mod-a)%mod ;
}

const int N = 1000+7;
bool s[N][N];
bool ns[N][N];

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

	ll h,w,k;
	cin >> h >> w >> k;

	char c;
	ll m = 0;
	for(int i=1;i<=h;i++) 
		for(int j=1;j<=w;j++) {
			cin >> c;
			s[i][j] = c == '#' ? 1 : 0;
			m += s[i][j];
		}

	ll jestgoradol = 0, jestprawolewo = 0;
	ll sasiedzikol = 0, sasiedziwie = 0;

	for(int i=1;i<=h;i++) {
		if(s[i][1] == s[i][w] and s[i][1])
			jestprawolewo++;

		if(i < h) for(int j=1;j<=w;j++) {
			if(s[i][j] and s[i+1][j])
				sasiedzikol++;		
		}
	}

	for(int i=1;i<=w;i++) {
		if(s[1][i] == s[h][i] and s[1][i])
			jestgoradol++;

		if(i < w) for(int j=1;j<=h;j++) {
			if(s[j][i] and s[j][i+1])
				sasiedziwie++;
		}
	}

	if((jestgoradol and jestprawolewo) or k == 0) {
		//cout << "I am here " << endl;
		cout << 1 << endl;
		return 0;
	}


	ll u = jestprawolewo ? sasiedziwie : sasiedzikol;
	//cout << "m : " << m << endl;
	//cout << "u : " << u << endl;
	ll realw  = jestprawolewo ? jestprawolewo : jestgoradol;
	//cout << "w : " << realw << endl;

	ll mod = 1000000007;
	ll res = pot(m, k-1, mod);
	//cout << "pocz " << res << endl;
	
	if(k > 1) {
		ll cnt_zle = 0;
		ll odwrm = pot(m,mod-2,mod);
		//cout << "odwrm: " << odwrm << endl;
		//cnt_zle = suma_geo(u, realw*apot(m,m
		cnt_zle = suma_geo(u, realw*odwrm%mod, k-1, mod);
		//cout << "pierwsza " << cnt_zle << endl;
		cnt_zle *= pot(m, k-1, mod);
		cnt_zle %= mod;
		cnt_zle *= pot(realw, mod-2, mod);
		cnt_zle %= mod;
		res += mod;
		res -= cnt_zle;
		res %= mod;
	}
	res += mod;
	res %= mod;

	cout << res << endl;
}	


Measured memory_bytes: 1280
#include <iostream>
using namespace std;
long long n;
long long sumof(long long x)
{
	long long sum=0;
	while (x)
	{
		sum+=(x%10);
		x/=10;
	}
	return sum;
}
int main()
{
	cin>>n;
	long long d=1,ans=1;
	cout<<1<<endl;
	for (long long i=1;i<n;i++)
	{
		if ((ans+10*d)*sumof(ans+d)<(ans+d)*sumof(ans+10*d)) d*=10;
		ans+=d;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
char s[MAXN];
void Solve() {
    scanf("%s",s + 1);
    N = strlen(s + 1);
    int cnt = 0;
    for(int i = 2 ; i <= N ; ++i) {
	if(s[i] != s[i - 1]) ++cnt;
    }
    out(cnt);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 384
while 1:
	n=input()
	if n==0:break
	for i in range(n):
		m,e,j=map(int, raw_input().split())
		if 100 in [m,e,j] or m+e>=180 or m+e+j>=240:print "A"
		elif m+e+j>=210 or (m+e+j>=150 and max(m,e)>=80):print "B"
		else:print"C"

Measured memory_bytes: 4224
require 'matrix'

n = gets.to_i
a = gets.split.map(&:to_i)
ans = [0] * n
a.each_with_index do |x, i|
  if i.even?
    ans[0] += x
  else
    ans[0] -= x
  end
end
1.upto(n - 1) do |i|
  ans[i] = 2 * a[i - 1] - ans[i - 1]
end
puts ans * ' '

Measured memory_bytes: 14980
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
int main(){
    int h, w, n;
    cin >> h >> w >> n;
    cout << n / max(h, w) + ((n % max(h, w) == 0)?0:1) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;

public class Main{
 public static void main(String[] args){
  Scanner sc=new Scanner(System.in);
  sc.useDelimiter(".");
  String passage;
  char[] ch;
  Deque<Integer> ad=new ArrayDeque<Integer>();
  int judge;
  do{
  judge=0;
  passage = sc.nextLine();
  for(int i=0;i<passage.length();i++){
    if(passage.charAt(i)=='(')
    ad.offerFirst(1);
    else if(passage.charAt(i)==')'){
    if(ad.peekLast()!=null&&ad.peekFirst()==1) ad.pollFirst();
    else if(ad.peekLast()==null||ad.peekFirst()!=1) judge=1;}
    else if(passage.charAt(i)=='[')
    ad.offerFirst(2);
    else if(passage.charAt(i)==']'){
    if(ad.peekLast()!=null&&ad.peekFirst()==2) ad.pollFirst();
    else if(ad.peekLast()==null||ad.peekFirst()!=2) judge=1;}
  }

  if(!passage.equals(".")) {
  if(ad.peekFirst()==null&&judge==0) System.out.println("yes");
  else System.out.println("no");
  }

  ad.clear();
  }while(!passage.equals("."));

}
}

Measured memory_bytes: 43720
n,k=map(int,input().split())
S=list(input())
A=[]
a=1
for i in range(n-1):
  if S[i]==S[i+1]:
    a=a+1
  else:
    A.append(a)
    a=1
A.append(a)
b=len(A)
if S[0]=="0":
  if k>=(b+1)//2:
    print(n)
  else:
    A.insert(0,0)
    ans=0
    d=0
    for i in range(2*k+1):
      d=d+A[i]
      ans=d
    for i in range((b-2*k)//2):
      d=d-A[2*i]-A[2*i+1]+A[(k+i)*2+1]+A[(k+i+1)*2]
      if d>ans:
        ans=d
    if S[-1]=="0":
      d=d-A[b-(k+1)*2+1]-A[b-(k+1)*2+2]+A[b]
      if d>ans:
        ans=d
    print(ans)  
else:
  if k>=len(A)//2:
    print(n)
  else:
    ans=0
    d=0
    for i in range(2*k+1):
      d=d+A[i]
      ans=d
    for i in range((b-2*k-1)//2):
      d=d-A[2*i]-A[2*i+1]+A[(k+i)*2+1]+A[(k+i+1)*2]
      if d>ans:
        ans=d
    if S[-1]=="0":
      d=d-A[b-(k+1)*2]-A[b-(k+1)*2+1]+A[b-1]
      if d>ans:
        ans=d
    print(ans)

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

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> a(n),b(n);
    vector<pair<int,int>> ab(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    for(int i = 0; i < n; i++){
        ab[i] = make_pair(a[i], b[i]);
    }
    
    sort(ab.begin(),ab.end());
    ll ans = 0;
    
    for(int i = 0; i < n; i++){
        int buy = min(m,ab[i].second);
        ans += (ll) buy * ab[i].first;
        m -= buy;
    }
    cout << ans;
}



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

int main() {
  int N;
  cin >> N;

  int ans = 1e9;

  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    int cnt = 0;
    while (A > 0 && A % 2 == 0) A /= 2, cnt++;
    ans = min(ans, cnt);
  }

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

Measured memory_bytes: 256
//
// Created by karth on 8/2/2020.
//
// BDTSL
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vpii = vector<pii>;
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define INF 1e18
#define MOD 1e9+7

//void setIO(string s) {
//    ios_base::sync_with_stdio(0); cin.tie(0);
//    freopen((s+".in").c_str(),"r",stdin);
//    freopen((s+".out").c_str(),"w",stdout);
//}
int factorial(int n) {
    if (n == 1)
        return 1;
    return n * factorial(n - 1);
}

int nCr(int n, int r) {
    return factorial(n) / (factorial(r) * factorial(n - r));
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x;
    cin >> x;
    if(x>=30){
        cout << "Yes" << "\n";
    }
    else{
        cout << "No" << "\n";
    }
    return 0;
}




Measured memory_bytes: 3648