akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;




const int mod = 1e9 + 7;

inline void add_self(int& x, int y) {
    x += y;
    if (x >= mod) x -= mod;
    if (x < 0) x += mod;
}

inline void add_range(vector<int>& v, int x, int l, int r) {
    add_self(v[l], x);
    add_self(v[r+1], -x);
}

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    vector<int> curr(K+2, 0);
    curr[K] = 1;
    for (int i = 0; i < N; ++i) {
        // make difference array for easy range updates
        vector<int> diff(K+2, 0);
        add_range(diff, curr[0], 0, 0);
        for (int rem = 1; rem <= K; ++rem) {
            add_range(diff, curr[rem], rem - min(rem, a[i]), rem);
        }
        // make real array from difference array
        // this would be the "next" array, and i would set curr = next later,
        // but i can just set it directly
        curr[0] = diff[0];
        for (int rem = 1; rem <= K; ++rem) {
            curr[rem] = curr[rem-1];
            add_self(curr[rem], diff[rem]);
        }
    }
    // O(N*K^2)
//    for (int i = 0; i < N; ++i) {
//        vector<int> next(K+1, 0);
//        add_self(next[0], curr[0]);
//        for (int rem = 1; rem <= K; ++rem) {
//            for (int give = 0; give <= min(rem, a[i]); ++give) {
//                add_self(next[rem - give], curr[rem]);
//            }
//        }
//        curr = next;
//    }
    cout << curr[0] << '\n';
}

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


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

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

    int p[N];
    for(int i=0;i<N;i++){
        cin >> p[i];
    }
    int total=p[0];
    int temp;
    for(int i=1;i<N;i++){
        total += p[i];
        if(p[i]>p[0]){temp=p[i];p[i]=p[0];p[0]=temp;}
    }
    total -= p[0]/2;

    cout << total << endl;
}

Measured memory_bytes: 256
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,m,k=gsmi
a=gsmi
b=gsmi
rui_a=rui a
rui_b=rui b
max=0

(n+1).times do |i|
  a_sum=rui_a[i]
  break if k-a_sum<0

  idx=rui_b.bsearch_index{|x|x>k-a_sum}
  idx=rui_b.size if idx.nil?
  c=i+(idx-1)
  max=c if max<c
end

puts max


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

template<typename T> void print(const T & v);


int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];

    sort(L.begin(), L.end());
    ll cnt = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            int a = L[i];
            int b = L[j];
            int idx = lower_bound(L.begin() + j, L.end(), a+b) - (L.begin() + j);
            cnt += (idx - 1);
        }
    }
    cout << cnt << endl;
    return 0;
}


// Use For Debug
template <typename T>
void print(T const & v){
    for(int i = 0; i < v.size(); i++){
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 2000000000
typedef long long ll;

int gcd(int a,int b){
    if(b>a) swap(a,b);
    int tmp;
    while(a%b!=0){
        tmp = b;
        b = a%b;
        a = tmp;
    }
    return b;
}


int main(){
    int K;
    cin >> K;
    vector<int> C(K+1,0);
    REP(i,K){
        REP(j,K){
            C.at(gcd(i+1,j+1))++;
        }
    }
    int ans = 0;
    REP(i,K){
        REP(j,K){
            ans += C.at(i+1)*gcd(i+1,j+1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3192
#include <iostream>
using namespace std;
typedef struct {
    int top;
    int S;
    int E;
    int W;
    int N;
    int bottom;
} dice;
void swap4(int *a, int *b, int *c, int *d) {
    int tmp = *a;
    *a = *b;
    *b = *c;
    *c = *d;
    *d = tmp;
}
void roll(dice *dp, char dir) {
    if (dir == 'E') {
        swap4(&(dp->top), &(dp->W), &(dp->bottom), &(dp->E));
    } else if (dir == 'N') {
        swap4(&(dp->top), &(dp->S), &(dp->bottom), &(dp->N));
    } else if (dir == 'S') {
        swap4(&(dp->top), &(dp->N), &(dp->bottom), &(dp->S));
    } else {
        swap4(&(dp->top), &(dp->E), &(dp->bottom), &(dp->W));
    }
}
int main(void){
    dice d;
    dice *dp = &d;
    cin >> dp->top >> dp->S >> dp->E >> dp->W >> dp->N >> dp->bottom;
    string str;
    cin >> str;
    for (int i = 0; i < str.size(); i++) {
        roll(dp, str[i]);
    }
    cout << dp->top << endl;
}

Measured memory_bytes: 3152
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func mainFn() {
	_ = getInt()
	s := []rune(getString())

	ans := 0
	var now rune
	for _, r := range s {
		if now != r {
			ans++
			now = r
		}
	}

	puts(ans)
}

// -----------------------------------------

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
)

func main() {
	buf := 200001
	scanner.Buffer(make([]byte, buf), buf)
	scanner.Split(bufio.ScanWords)
	mainFn()
	writer.Flush()
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}

func puts(a ...interface{}) {
	if _, err := fmt.Fprintln(writer, a...); err != nil {
		panic(err)
	}
}


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

int main(void) {
   int N;
   cin>>N;
   vector<long> A;
   vector<long> B[3];
   A.resize(N);
   for (int i = 0; i < N;i++) cin>>A[i];
   long max = *max_element(A.begin(),A.end());
   long ord = log2(max);
   for (int i = 0; i < N;i++) {
      if (A[i] < pow(2,ord)) B[2].push_back(A[i]);
      else if (A[i] == max) B[0].push_back(A[i]);
      else B[1].push_back(A[i]);
   }
   if (max == 0) {
      cout<<"Yes"<<endl;
      return 0;
   }
   if (N%3!=0) {
      cout<<"No"<<endl;
      return 0;
   }
   if (B[2].size() != N/3) {
      cout<<"No"<<endl;
      return 0;
   }
   if (B[0].size() != N/3 && B[0].size() != 2*N/3) {
      cout<<"No"<<endl;
      return 0;
   }
   if (B[0].size() == 2*N/3 && B[2][0] != 0) {
      cout<<"No"<<endl;
      return 0;
   }
   if (B[0].size() == N/3) {
      for (int i = 0; i < ord;i++) {
         int num = (B[0][0]/(int)pow(2,i))%2 + (B[1][0]/(int)pow(2,i))%2 + (B[2][0]/(int)pow(2,i))%2;
         if (num%2 == 1) {
            cout<<"No"<<endl;
            return 0;
         }
      }
   }
   cout<<"Yes"<<endl;
   return 0;
}

Measured memory_bytes: 2552
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  vector<Int> t(n);
  for(Int i=0;i<n;i++) cin>>t[i];
  Int ans=n;
  priority_queue<Int,vector<Int>,greater<Int> > pq;
  for(Int i=1;i<n;i++) pq.emplace(t[i]-t[i-1]-1);
  for(Int i=0;i<n-k;i++){
    ans+=pq.top();
    pq.pop();
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 4676
#include <stdio.h>

int main()
{
	long long n,m,ansi;
	double t,ans=0,o,dp,i,x;
	scanf("%lld%lld",&n,&m);
	x=m*1900+(n-m)*100,t=(double)(1<<m),o=t-1;
	for(i=1,dp=x/t;dp>1e-30;i=i+1,dp=dp*i/(i-1)*o/t)
		ans+=dp;
	ansi=(long long)ans;
	if(ansi%10==9) ansi++;
	printf("%lld\n",ansi);
}

Measured memory_bytes: 128
# すめけくんは現在のレートが 1200 未満ならば AtCoder Beginner Contest (ABC) に、
# そうでなければ AtCoder Regular Contest (ARC) に参加することにしました。 
# すめけくんの現在のレート x が与えられます。
# すめけくんが参加するコンテストが ABC ならば ABC と、そうでなければ ARC と出力してください。

x = gets.to_i
if x < 1200
    puts "ABC"
else
    puts "ARC"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define double long double
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
    int n;
    cin>>n;int ans=0;
    for(int i=1;i<=n;i++)
    {   int x;cin>>x;
        if(i%2==1&&x%2==1)ans++;
    }
    cout<<ans<<endl;
}


return 0;
}





Measured memory_bytes: 3636
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', (x) => {
    lines.push(x);
});

rl.on('close', () => {

    var D = Number(lines[0].split(" ")[0]);
    var N = Number(lines[0].split(" ")[1]);

    if (N === 100) { N++; }
    console.log(Math.pow(100, D) * N);

});

Measured memory_bytes: 21320
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using boost::multiprecision::cpp_int;
using namespace std;
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl;
#define pb push_back
#define ull unsigned long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define mod 100000007
#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 
bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
    return false;
}

//me
ll const mod = 1e9+7;//998244353;
ll const inf = 2e5+1;

void solve()
{
    
    ll sum ; cin >> sum; 

    ll dp[sum+1];
    fill(dp, dp+sum+1, 0);
    dp[0]=1;
    for(ll i = 1; i<=sum; i++){
        for(ll j=3; j <= sum; j++){

            if(i-j>=0)
                dp[i] = (dp[i] + dp[i-j])% mod;

        }
    }

    cout << dp[sum];
   
}
int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
        
        ll t;
        /**/t=1;
        /*/cin>>t;/**/
        f(testcases,0,t){
            solve();
        }
 
 
    return 0;
}

Measured memory_bytes: 3644
use std::io::*;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn main() {
    let a = read::<usize>();
    let b = read::<usize>();
    let c = read::<usize>();
    let d = read::<usize>();
    println!("{}",cmp::min(a,b)+cmp::min(c,d));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define pb push_back
#define mp make_pair
#define inff 100000
#define ff first
#define ss second
#define sz(x) ((int) (x).size())
#define fast cin.sync_with_stdio(0);cin.tie(0)
#define rep(i,N) for(int i = 0;i < N;i++)
#define frep(i,a,b) for(int i = a;i <= b;i++)
#define pii pair<int , int>
#define pll pair<ll , ll>
#define vii vector<int>
#define vpii vector< pii >
#define fill(A,v) memset(A,v,sizeof(A))
#define setbits(x) __builtin_popcountll(x)
#define print(A,j,k) for(int ii=j;ii<k;ii++)cout<<A[ii]<<" ";cout<<"\n"
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
#define CASES int t;cin>>t;while(t--)
#define FILE freopen("inp.txt" , "r" , stdin);
#define ld long double

const int MOD = 1e9 + 7;
const int N = 2e6 + 5;
const int K = (1 << 17) + 10;
const ll INF = 2e18 + 500;
const int inf = 0x7fffffff;
const int SQRT = 500;
const int lgN = 20;

int A[N] , C[N];

int main(int argc, char const *argv[])
{
	fast;

	int n;
	cin >> n;

	frep(i , 1 , n) {
		cin >> A[i];
		C[A[i]]++;
	}

	set<int> one , two;
	for(int i = 1;i <= 1e5;i++) {
		if (C[i] >= 3) {
			if (C[i] % 2 == 0) {
				C[i] = 2;
			}
			else {
				C[i] = 1;
			}
		}
		if (C[i] == 1)
			one.insert(i);
		else if (C[i] >= 2)
			two.insert(i);
	}

	while (two.size()) {
		if (two.size() >= 2) {
			auto x = two.begin();
			two.erase(two.begin());
			auto y = two.begin();
			two.erase(two.begin());
			one.insert(*(y));
			one.insert(*(x));
		}
		else {
			if (one.size() == 0) {
				assert(false);
			}
			two.clear();
			break;
		}
	}
	cout << one.size() << endl;




	return 0;
}

Measured memory_bytes: 5760
#include <iostream>

using namespace std;

int main(){
  int n, a, b;
  std::cin >> n >> a >> b;

  if((b - a - 1) % 2 == 1){
    std::cout << "Alice" << '\n';
  }else{
    std::cout << "Borys" << '\n';
  }
  return 0;
}


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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;
typedef map<char,int>   mci;

vector<mci> g;
vector<int> d;

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

    int n;  cin >> n;
    ll  L;  cin >> L;

    g.push_back({});
    d.push_back(0);

    for(int i = 0 ; i < n ; ++i)    {
        string S;   cin >> S;
        int R = 0;

        for(char c : S) {
            if(!g[R].count(c))
                g[R][c] = sz(g),
                g.push_back({}),
                d.push_back(d[R] + 1);
            
            R = g[R][c];
        }
    }
    ll  ans = 0;

    for(int i = 0 ; i < sz(g) ; ++i)
        if (sz(g[i]) == 1)  {
            int dep = d[i];
            ll  len = L - dep;

            if (len)
                ans ^= (len & -len);
        }
    if (ans)    cout << "Alice";
    else        cout << "Bob";
}

Measured memory_bytes: 11648
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

bool a[4] = { 0,1,1,1 };
int main() {
	int A, B;
	cin >> A >> B;
	a[A] = a[B] = 0;
	for (int i = 1; i < 4; i++) {
		if (a[i])cout << i << endl;
	}
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

void solve() {
    //const i64 mod = 1'000'000'007;
    
    string S;
    cin >> S;
    
    vector<char> stk;
    rep(i,0,S.size()){
        if(stk.empty()){
            stk.push_back(S[i]);
            continue;
        }
        if(stk.back()!=S[i]){
            stk.pop_back();
            continue;
        }
        stk.push_back(S[i]);
    }
    
    cout << S.size()-stk.size() << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
ll mod=1e9+7;
#define input_from_file  freopen("input.txt", "r", stdin);
int main()
{
    // input_from_file;
  // int t; cin>>t;
  // while(t--){
    ll n;cin>>n;
    vector<ll> vec(n,0),dp(n,0);
    for(int i=0;i<n;i++)  cin>>vec[i];
    dp[0]=0;if(n>1) dp[1]=abs(vec[0]-vec[1]);
    for(int i=2;i<n;i++)  
      dp[i]=min(dp[i-1]+abs(vec[i-1]-vec[i]),dp[i-2]+abs(vec[i-2]-vec[i]));
    cout<<dp[n-1];
  // }  
	return 0;
}

Measured memory_bytes: 1920
n,m,x,y=map(int,input().split())
x,y=[x],[y]
x.extend(list(map(int,input().split())))
y.extend(list(map(int,input().split())))
x.sort()
y.sort()
if x[-1]>=y[0]:
  print('War')
else:
  print('No War')

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

int main() {
  ll x;
  cin >> x;
  ll ans = (x-1)/11 * 2;
  if ((x-1)%11<=5)
    ans++;
  else
    ans += 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()

if s ==  "SUN":
  print(7)
elif s ==  "MON":
  print(6)
elif s ==  "TUE":
  print(5)
elif s ==  "WED":
  print(4)
elif s ==  "THU":
  print(3)
elif s ==  "FRI":
  print(2)
else:
  print(1)

Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n=int(input())
if n%2==0:
    print(n)
else:
    print(n*2)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
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 pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }


int main(){
    ld a,b;
    cin>>a>>b;
  b*=100;
  b+=0.5;
    b=(ll)b;
    ld c=a*b/100;
    cout<<(ll)c;
   
}


Measured memory_bytes: 3732
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
A = []
for i in range(len(a)):
    A += [i + 1] * a[i]

ans = [[0] * W for _ in range(H)]

for i in range(len(A)):
    h = i // W
    w = i % W
    if h % 2 == 0:
        ans[h][w] = A[i]
    else:
        ans[h][W - w - 1] = A[i]


for i in range(H):
    print(*ans[i])


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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	while(b != a)
	{
		c-=1;
		b+=1;
		if(c == 0)
		{
			break;
		}
	}
	cout << c; 
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
//by NeighThorn
using namespace std;
const int maxn=100000+5;
int n,q,hd[maxn],to[maxn*2],nxt[maxn*2],cnt,vis[maxn],fa[maxn],ans[maxn];
struct M{
    int y,id;
    M(int a=0,int b=0){
        y=a,id=b;
    }
};
vector<M> v[maxn];
inline int find(int x){
    return fa[x]==x?x:fa[x]=find(fa[x]);    
}
inline void add(int x,int y){
    to[cnt]=y;nxt[cnt]=hd[x];hd[x]=cnt++;   
}
inline void tarjan(int root){
    vis[root]=1;
    for(int i=0;i<(int)v[root].size();i++)
        if(vis[v[root][i].y])
            ans[v[root][i].id]=find(v[root][i].y);
    for(int i=hd[root];i!=-1;i=nxt[i])
        if(!vis[to[i]])
            tarjan(to[i]),fa[to[i]]=root;
}
signed main(void){
    scanf("%d",&n);cnt=0;
    memset(hd,-1,sizeof(hd));
    for(int i=0,k;i<n;i++){
        scanf("%d",&k);
        for(int j=1,x;j<=k;j++)
            scanf("%d",&x),add(i,x),add(x,i);
    }scanf("%d",&q);
    for(int i=0;i<n;i++)
        fa[i]=i,vis[i]=0;
    for(int i=1,x,y;i<=q;i++)
        scanf("%d%d",&x,&y),v[x].push_back(M(y,i)),v[y].push_back(M(x,i));
    tarjan(0);
    for(int i=1;i<=q;i++)
        printf("%d\n",ans[i]);
    return 0;   
}


Measured memory_bytes: 15052
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
DT = []
tmp = [[] for i in range(N)]
for i in range(N):
    t, d = MAP()
    DT.append((d, t))
DT.sort(reverse=1)

A = []
D = {}
dcnt = 0
# ポイント上位K個をまず取る
for i in range(K):
    d, t = DT[i]
    dcnt += d
    # 種類tが1つ目なら、確定で残す
    if t not in D:
        D[t] = d
    # 2つ目以降なら、最大のものを残して他は交換候補へ
    else:
        if D[t] < d:
            D[t], d = d, D[t]
        A.append(d)
A.sort(reverse=1)
tcnt = len(D)

ans = dcnt + tcnt**2
for i in range(K, N):
    d2, t2 = DT[i]
    # 既に持っている種類ならスキップ
    if t2 in D:
        continue
    D[t2] = d2
    # 全部1種類ずつ(交換候補がもうない)なら、もう種類数を増やせないので終了
    if not A:
        break
    d = A.pop()
    # この候補と交換してみる
    dcnt -= d
    dcnt += d2
    tcnt += 1
    ans = max(ans, dcnt + tcnt**2)
print(ans)


Measured memory_bytes: 28404
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int K, N; cin >> K >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<int> diffs(N);
    int max_ad = 0;
    rep(i, N-1) {
        max_ad = max(max_ad, A[i+1] - A[i]);
    }
    max_ad = max(max_ad, K- A[N-1] + A[0]);
    cout << K - max_ad << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N ;
    cin >> N ;
    vector<int> A(N);
    vector<double> B(N-1);
    for (int i = 0 ; i < N ; i++) {
        cin >> A.at(i) ;
    }
    //いつもの入力パターン
    sort(A.begin(),A.end());
    
     B.at(0) = ( A.at(0) + A.at(1) ) / 2.0 ;
    
    for (int i = 1 ; i < N - 1 ; i++) {
      B.at(i)  =  ( B.at(i-1) + A.at(i+1) ) / 2 ;
    }
    cout << fixed << setprecision(15) << B.at(N-2);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N;
  cin>>N;
  cout<<N<<":";
  for(int i=2;i*i<=N;i++){
    while(N%i==0){
      cout<<" "<<i;
      N/=i;
    }
  }
  if(N!=1){
    cout<<" "<<N;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3096
require "numo/narray"

n = gets.to_i
m = 10**6
a = gets.split.map(&:to_i).sort
num = Numo::Int32.zeros(m+1)
seen = Numo::Int32.zeros(m+1)

a.each do |a|
  num[a] += 1
end

ans = 0
a.each do |i|
  next if seen[i] != 0
  ans += 1 if num[i] == 1

  i.step(m, i) do |j|
    seen[j] = 1
  end
end
puts ans



Measured memory_bytes: 39584
using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] In = Console.ReadLine().Split(' ');
        ulong sum = 1, temp=0;
        bool flag = true;
        bool HasZero = false;
        for(int i=0; i<n; i++)
        {
            if (long.Parse(In[i]) == 0) HasZero = true;
        }
        if (!HasZero)
        {
            try
            {
                checked
                {
                    for (int i = 0; i < n; i++)
                    {
                        temp = ulong.Parse(In[i]);
                        sum *= temp;
                        if (temp == (ulong)Math.Pow(10, 18) || sum > (ulong)Math.Pow(10, 18))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag) Console.WriteLine(sum);
                    else Console.WriteLine(-1);
                }
            }
            catch
            {
                Console.WriteLine(-1);
            }
            
        }
        else
        {
            Console.WriteLine(0);
        }
    }
}


Measured memory_bytes: 41492
n, m = map(int, input().split())
import math
def divisor(n):
    a = set()
    for i in range(1, math.ceil(n**0.5) + 1):
        if n % i == 0:
            a.add(i)
            a.add(n // i)
    return a
d = list(divisor(m))
d.sort(reverse=True)
for di in d:
    if di * n <= m:
        print(di)
        exit()
print(1)

Measured memory_bytes: 9392
import sys
def main():
    input = sys.stdin.readline
    N,C=map(int, input().split())
    D=[tuple(map(int, input().split())) for _ in range(C)]
    c=[tuple(map(int, input().split())) for _ in range(N)]

    c0=[c[i][j]-1 for i in range(N) for j in range(N) if (i+j)%3==0]
    c1=[c[i][j]-1 for i in range(N) for j in range(N) if (i+j)%3==1]
    c2=[c[i][j]-1 for i in range(N) for j in range(N) if (i+j)%3==2]

    from collections import Counter
    cc=[Counter(c0), Counter(c1), Counter(c2)]

    ans = 10**10
    from itertools import permutations
    for colors in permutations(range(C), 3):
        tmp = 0
        for i,cci in enumerate(cc):
            for k,v in cci.items():
                tmp += D[k][colors[i]] * v
        ans = min(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()

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

int main() {
  string first;
  string second;
  cin >> first >> second;
  int diff = 0;
  int size = first.size();
  rep(i, size) {
  	if(first.at(i) != second.at(i)) diff++; 
  }
  cout << diff << endl;
  return 0;
}

Measured memory_bytes: 3920
from math import ceil
N,K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
def check(m):
    used = 0
    for i in range(N):
        b = ceil(A[i]-m/F[i])
        if b < 0:
            b = 0
        if A[i]-b < 0:
            return False
        used += b
        if used > K:
            return False 
    return True
left = -1
right = A[-1]*F[0]
while right-left > 1:
    mid = (right+left)//2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)


Measured memory_bytes: 121164
#include<iostream>
#include<string>
#include<iomanip>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<unistd.h>
using namespace std;
#define MAX 110

//ものすごくアホだった(3回目)


int dxy[4] = {-1, 1, 0, 0};
int dd[] = {0,1};
int N, a, b, ans[MAX][MAX] = {};
vector<int> R[MAX*MAX];


template<typename T>
void remove(vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

inline bool is_out_of_range(int z){
	return (z <= 0 || N < z) ;
}

inline void hoge(int y, int x){
	 //cout<<y<<" "<<x<<endl; 
	// sleep(2);
	//string hogehoge;
	//cin>>hogehoge;
	if(y == 1){
		for(int z : R[ans[y][x-1]]){
			// cout<<z<<" -----"<<endl;
			if(R[z].size() == 4)continue;
			ans[y][x] = z;
		}
	} else {
		for(int z : R[ans[y-1][x]]){
			// cout<<z<<" -----"<<endl;
			ans[y][x] = z;
		}
	}
	// cout<<ans[y][x]<<" ans "<<endl;
	
	for(int i = 0; i < 4; i++){
		int ny = y + dxy[i], nx = x + dxy[3-i];
		if(is_out_of_range(ny)||is_out_of_range(nx)) continue;
		if(ans[ny][nx] == 0)continue;
		for(int i = 0; i < R[ans[ny][nx]].size(); i++){
			if(R[ans[ny][nx]][i] == ans[y][x]) remove(R[ans[ny][nx]],i);
		}
		for(int i = 0; i < R[ans[y][x]].size(); i++){
			if(R[ans[y][x]][i] == ans[ny][nx]) remove(R[ans[y][x]],i);
		}
		
		// R[ans[ny][nx]].erase(ans[y][x]);
		// R[ans[y][x]].erase(ans[ny][nx]);
	}
}

int huga(){
	queue<pair<int,int>> Q;
	
	Q.push(make_pair(1,1));
	
	while(!Q.empty()){
		pair<int,int> P = Q.front();Q.pop();//string hogehoge; cin>>hogehoge;
		int y = P.first, x = P.second;
		for(int i = 0; i < 2; i++){
			int ny = y + dd[i], nx = x + dd[1-i];
			if(is_out_of_range(ny)||is_out_of_range(nx)) continue;
			if(ans[ny][nx]) continue;
			Q.push(make_pair(ny,nx));
			hoge(ny,nx);
		}
	}
}

signed main(){

	
	cin>>N;
	
	for(int i = 1; i <= 2*N*N-2*N; i++){
		cin>>a>>b;
		R[a].push_back(b);
		R[b].push_back(a);
		
		// if(a==950) cout<<"a "<<b<<endl;
		// if(b==950) cout<<"b "<<a<<endl;
	}
	for(int i = 1; i <= N*N; i++){
		if(R[i].size() == 2) ans[1][1] = i;
	}
	
	// cout<<ans[1][1]<<" "<<R[ans[1][1]].size()<<endl;
	huga();
	
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			if(j!=1)cout<<" ";
			cout<<ans[i][j];
		}cout<<endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 3792
require 'pp'

N,d=gets.chomp.split(' ').map{|n| n.to_i}
D,X=gets.chomp.split(' ').map{|n| n.to_i}
A = Array.new(N+1)
1.upto(N){|d|
	A[d],dum=gets.chomp.split(' ').map{|n| n.to_i}
}

sum = 0
1.upto(N){|d|
	sum += (D-1)/A[d] + 1
}
sum += X
puts sum



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

#define ll long long
#define ld long louble
using namespace std;

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

Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=a;i<n;i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
int a[100];
int main(void)
{
	int n,i;
	scanf("%d",&n);
	FOR(i,0,n) scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),comp);
	printf("%d\n",a[n-1]-a[0]);
	return 0;
}


Measured memory_bytes: 128
// ~maqsat~
/*    
**	  “Anyone who has never made a mistake has never tried anything new.”
**    © Albert Einstein
*/

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 2e5 + 345;
const ll MOD = 998244353;
const ll INF = 1e10 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int was[310][310];

int main() {
    fre("");
    ACCELERATE;

    int n, m, k;
    cin >> n >> m >> k;

    char a[310][310];
    vector<int> r[310];
    for(int i = 0; i < n; i++) {
    	for(int j = 0; j < m; j++) {
    		cin >> a[i][j];
    		if(a[i][j] == '#') {
    			r[i].pb(j);
    		}
    	}
    }

    int last = 0;
    for(int i = 0; i < n; i++) {
    	int x = 0;
    	for(int j = 0; j < m; j++) {
    		if(a[i][j] == '#') x = last + 1, last = x;
    		was[i][j] = x;
    	}
    }
    
    for(int i = 0; i < n; i++) {
    	for(int j = 0; j < m; j++) {
    		if(was[i][j]) continue;
    		if(!r[i].empty()) {
    			int x = was[i][r[i].front()];
    			for(int ii = r[i].front() - 1; ii >= 0; ii--) was[i][ii] = x;
    		}
    	}
    }

    for(int i = 0; i < n; i++) {
    	for(int j = 0; j < m; j++) {
    		if(was[i][j] == 0) {
    			int x = 0;
    			for(int ii = i - 1; ii >= 0; ii--) {
    				if(was[ii][j] != 0) {
    					x = was[ii][j];
    					break;
    				}
    			}
    			if(x) {
    				was[i][j] = x;
    			}
    			else {
    				for(int ii = i + 1; ii < n; ii++) {
    					if(was[ii][j] != 0) {
    						x = was[ii][j];
    						break;
    					}
    				}
    				if(x) {
    				was[i][j] = x;
    				}
    			}
    		}
    	}
    }
    
    for(int i = 0; i < n; i++) {
    	for(int j = 0; j < m; j++) {
    		cout << was[i][j] << ' ';
    	}
    	cout << '\n';
    }

    return 0;
}
/*
 
*/


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	double ans = 0;
	cin >> n;
	while (n--)
	{
		int a;
		cin >> a;
		ans += 1. / a;
	}
	cout << fixed << setprecision(10) << 1 / ans;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
mod = 10 ** 9 + 7
A = [[0] * (W + 2) for i in range(H + 1)]
A[0][1] = 1
def multiple(N):
    temp = [1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
    return (temp[N + 1])


for i in range(1, H + 1):
    for j in range(1, W + 2):
        if j < 1 or j > W:
            A[i][j] = 0
        else:
            A[i][j] = (A[i - 1][j - 1] * (multiple(j - 2) * multiple(W - j)) +
                       A[i - 1][j] * (multiple(j - 1) * multiple(W - j)) +
                       A[i - 1][j + 1] * (multiple(j - 1) * multiple(W - j - 1))) % mod
print(A[H][K])


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  string S; cin >> S;
  ll K; cin >> K;

  ll l = S.length();
  vector<ll> num;
  ll count = 1;
  repr(i,1,l) {
    if (S[i]==S[i-1]) count++;
    else { num.push_back(count); count = 1; }
  }
  num.push_back(count);
  // debug(num.begin(),num.end());

  ll result = 0;
  if (num.size()==1) result = l*K/2;
  else if (S[0]==S[l-1]) {
    for (int i=0; i<num.size(); i++) {
      if (i!=0&&i!=num.size()-1) result += num[i]/2;
    }
    result *= K;
    result += *(num.begin())/2 + *(num.end()-1)/2;
    result += (*(num.begin())+*(num.end()-1))/2*(K-1);
  }
  else {
    for (auto x: num) result += x/2;
    result *= K;
  }
  cout << result << endl;
  return 0;
}

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

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

  vector<int> F(50);
  F.at(0) = 1;
  F.at(1) = 1;
  for (int i = 2; i <= n; i++) {
    F.at(i) = F.at(i - 2) + F.at(i - 1);
  }

  cout << F.at(n) << endl;
  return 0;
}


Measured memory_bytes: 3100
#Z[i]:length of the longest list starting from S[i] which is also a prefix of S
#O(|S|)
def Z_algorithm(s):
    N = len(s)
    Z_alg = [0]*N

    Z_alg[0] = N
    i = 1
    j = 0
    while i < N:
        while i+j < N and s[j] == s[i+j]:
            j += 1
        Z_alg[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < N and k + Z_alg[k]<j:
            Z_alg[i+k] = Z_alg[k]
            k += 1
        i += k
        j -= k
    return Z_alg

N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[a[i]^a[i-1] for i in range(0,N)]
B=[b[i]^b[i-1] for i in range(0,N)]

data=B+['?']+A+A
s=Z_algorithm(data)
for i in range(N+1,2*N+1):
    if s[i]>=N:
        print(i-N-1,a[i-N-1]^b[0])

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

int main() {
	int n, a[100];
	cin >> n;
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	for (int k = 0; k < n; k++){
	    cout << a[k];
		if (k < n - 1){
			cout << " "; 
	    } else{
			cout << endl;
		}
	}
	    
	for(int i = 1; i< n; i++){
		int v = a[i];
		int j = i -1;
		while (j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
	
	    for(int k = 0; k < n; k++){
		   cout << a[k];
		   if (k < n - 1){
			   cout << " "; 
		   } else{
			   cout << endl;
		   }
	    }
	}
	return 0;
}


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

int main(){
  int n,m;

  while(cin>>n>>m&&n!=0&&m!=0){
    vector<int> taro, hanako;
    taro = vector<int>(n);
    hanako = vector<int>(m);
    for(int i=0;i<n;i++) cin >> taro[i];
    for(int i=0;i<m;i++) cin >> hanako[i];

    int taro_score, hana_score;
    taro_score = accumulate(taro.begin(), taro.end(), 0);
    hana_score = accumulate(hanako.begin(), hanako.end(), 0);

    int sum = 201;
    int ans1,ans2;
    int flag=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
        if(taro_score-taro[i]+hanako[j] == hana_score-hanako[j]+taro[i]){
          if(sum>taro[i]+hanako[j]){
            ans1 = taro[i];
            ans2 = hanako[j];
            sum = taro[i]+hanako[j];
            flag=1;
          }
        }
      }
    }
    if(flag==0) cout << -1 <<  endl;
    else cout << ans1 << " " << ans2 <<  endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAX=200005;
ll a[MAX],s[MAX],sum,n;
map<ll,ll> u;
int main(){
    scanf("%lld",&n);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    for(int i=1;i<=n;i++) s[i]=a[i-1]+s[i-1];
    for(int i=0;i<=n;i++) u[s[i]]++;
    for(int i=0;i<=n;i++){
        sum+=u[s[i]]*(u[s[i]]-1)/2;
        u[s[i]]=0;
    }
    printf("%lld\n",sum);
}


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

int main(){
  int x, n;
  cin >> x >> n;
  if(n == 0){
    cout << x << endl;
    return 0;
  }
  vector<int> a(n);
  int i;
  bool judge = false;
  for(i = 0; i < n; i++){
    cin >> a[i];
    if(a[i] == x){ judge = true;}
  }
  if(!judge){
    cout << x << endl;
    return 0;
  }
  sort(a.begin(), a.end());
  int c_min = x, c_max = x;
  for(i = 0; a[i] < x; i++){
    if(c_min == x){ c_min = a[i] - 1;}
    else if(a[i] - a[i-1] > 1){ c_min = a[i] -1;}
  }
  if(x - a[i-1] > 1){ c_min = x-1;}
  for(i = n-1; a[i] > x; i -= 1){
    if(c_max == x){ c_max = a[i] + 1;}
    else if(a[i+1] - a[i] > 1){ c_max = a[i] + 1;}
  }
  if(a[i+1] - x > 1){ c_max = x+1;}
  if(c_min == x){
    cout << x-1 << endl;
    return 0;
  }
  if(c_max == x){
    if(c_min == x-1){ cout << c_min << endl;}
    else{ cout << x+1 << endl;}
    return 0;
  }
  int b = x - c_min, c = c_max - x;
  if(b == c){ cout << c_min << endl;}
  else if(b < c){ cout << c_min << endl;}
  else{ cout << c_max << endl;}
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 987654321
#define PI 3.1415926535

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

    ll n;
    cin >> n;
    
    if(n%2) cout << 0;
    else {
        ll ans=0;
        n/=2;
        while(n!=0) {
            ans+=(n/5);
            n/=5;
        }
        cout << ans;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int X, Y, Z;

	cin >> X >> Y >> Z;
	cout << (X - Z) / (Y + Z) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

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

ll gcd(ll a, ll b){
    if(a%b == 0) return b;
    else return gcd(b, a%b);
}

vector<ll> prime;
map<ll, int> q;

// void div_func(ll num){
//     prime.push_back(1);
//     q[1]++;
//     //ll tmp = num;
//     for(int i = 2; i*i <= num; i++){
//         if(num % i != 0) continue;
//         prime.push_back(i);
//         while(1){
//             if(num % i == 0){
//                 num = num / i;
//                 q[i]++;
//             }else break;
//         }
//     }
//     if(num != 1){
//         prime.push_back(num);
//         q[num]++;
//     }
// }

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main()
{
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);
    //cout << "g: " << g << endl;
    //div_func(g);
    auto pf = prime_factorize(g);
    cout << pf.size()+1 << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<set>

using namespace std;

int main(){
    int N;
    cin>>N;
    set<int> mochi;

    for(int i=0;i<N;++i){
        int tyn;
        cin>>tyn;
        mochi.insert(tyn);
    }

    cout<<mochi.size()<<endl;
}



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

const int mod=1e9+7;

long long fast_power(int a,int b,int mod)
{
    long long ans=1,base=a;
    while(b)
    {
        if(b&1)
            ans=ans*base%mod;
        base=base*base%mod;
        b>>=1;
    }
    return ans%mod;
}


int phi(int n)
{ //返回φ(n)   
     int res=n,a=n;  
     for(int i=2;i*i<=a;i++)
     {  
         if(a%i==0)
         {  
             res=res/i*(i-1);//先进行除法是为了防止中间数据的溢出   
             while(a%i==0) a/=i;  
         }  
     }  
     if(a>1) res=res/a*(a-1);  
     return res;  
}  


int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,k;
    cin>>n>>k;

    long long ans=0;
    for (int i=1;i<=k;i++)
    {
        ans+=fast_power(k/i,n,mod)*phi(i);
        ans%=mod;
    }

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string s1,s2;
	cin >> s1 >> s2;
	ll ans = 0;
	vector<int> v;
	for(int i=0;i<N;i++){
		if(s1[i] == s2[i])v.push_back(0);
		else {
			v.push_back(1);
			i++;
		}
	}
	if(v[0] == 0) ans = 3;
	else ans = 6;
	for(int i=1;i<v.size();i++){
		if(v[i-1]==0 && v[i] == 0)ans *= 2;
		else if(v[i-1] == 0 && v[i] == 1)ans *= 2;
		else if(v[i-1] == 1 && v[i] == 0)ans *= 1;
		else ans*= 3;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <numeric>

using namespace std;
int a[5]={0};
int b[7]={0};

int main(){
   for(int i=0;i<6;i++){
      cin>>b[i];
      a[b[i]]++;
   }
   for(int i=1;i<5;i++){
      if(a[i]==0 || a[i]>2){
         cout<<"NO"<<endl;
         return 0;
      }
   }
   cout<<"YES"<<endl;


   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    int res = 0;

    for (int i = 0; i < n; i++) {
        while (i+1 < n && a[i] == a[i+1]) i++;

        if (i+1 < n && a[i] < a[i+1]) {
            while (i+1 < n && a[i] <= a[i+1]) i++;
        }
        else if (i+1 < n && a[i] > a[i+1]) {
            while (i+1 < n && a[i] >= a[i+1]) i++;
        }

        res++;
    }

    cout << res << endl;
    return 0;
}

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

int main(){
    long double a, b, c;

    cin >> a >> b >> c;

    long double delta = c - a - b;

    long double sqrt_ab = (long double)2*sqrt(a*b);
    //long double sqrt_a = (long double)sqrt(a);
    //long double sqrt_b = (long double)sqrt(b);

    if(delta < 0){
        printf("No\n");
    }
    else{
        if(delta > sqrt_ab){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }

    return 0;
}

Measured memory_bytes: 256