akhauriyash/Code-Regression huggingface dataset:
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Sun Mar  4 21:02:52 2018
//
package main

import (
	"fmt"
)

const names string = "MARCH"

var N int

func main() {
	fmt.Scan(&N)

	m := map[uint8]int{}
	for i := 0; i < N; i++ {
		var s string
		fmt.Scan(&s)
		m[s[0]]++
	}

	patterns := 0
	for i := 0; i < (1 << uint(len(names))); i++ {
		count := 0
		pattern := 1
		for j := 0; j < len(names); j++ {
			if (i & (1 << uint(j))) != 0 {
				count++
				pattern *= m[names[j]]
			}
		}

		if count == 3 {
			patterns += pattern
		}
	}

	fmt.Println(patterns)
}


Measured memory_bytes: 5504
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  ll N,C,K; cin>>N>>C>>K;
  vector<ll> T(N);
  rep(i,N)
  {
    cin>>T.at(i);
  }
  sort(T.begin(),T.end());
  
  ll ans=0;
  ll judge=T.at(0),hoge=0;
  rep(i,N)
  {
    if(i==N-1) {ans++;}
    if(T.at(i)>judge+K) {judge=T.at(i); hoge=i; ans++; continue;}
    if(i==N-1) {break;}
    if(i-hoge+1==C) {judge=T.at(i+1); hoge=i+1; ans++; continue;}
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4108
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){

  int n;
  int max_two_n = 123456*2;
  vector<int> prime;
  int j;
  prime.push_back(2);
  for(int i=3;i<=max_two_n;i+=2){
    for(j=0;j<prime.size();j++){
      if(i%prime[j]==0)break;
    }
    if(j==prime.size())prime.push_back(i);
  }
	
  
  while(cin>>n){
    if(!n)break;
    int i=0;
    int ct=0;
    while(true){
      if(prime[i]>2*n)break;
      else if(prime[i]>n)ct++;
      i++;
    }
    cout << ct << endl;
  }     
  return 0;
}

Measured memory_bytes: 3180
#include<stdio.h>

long long int max(long long int a,long long int b)
{
	if(a>=b)
	{
		return a;
	}
	else
	{
		return b;
	}
}


int main()
{
	long long int a,b,c,d,x1,x2,x3,x4;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	x1=a*c;
	x2=a*d;
	x3=b*c;
	x4=b*d;
	x1=max(x1,x2);
	x1=max(x1,x3);
	x1=max(x1,x4);
	printf("%lld",x1);
	return 0;
}

Measured memory_bytes: 1736
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

ll cnt[MAXN];

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
   		cnt[i] = readInt();
   	}
	for (int i = 1; i < n; i++) {
		if (cnt[i] % 2 && cnt[i +1]) {
			ans ++;
			cnt[i]--;
			cnt[i + 1] --;
		}
	}
	for (int i = 1; i <= n; i++) {
		ans += (cnt[i] / 2);
	}
	cout << ans;	   	
   	return 0;
}

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

int main(){
    int n;
    while(cin >> n, n){
        int ans = 0;
        for(int i=0; i < n; i++){
            int x, y, h, w;
            cin >> x >> y >>h >> w;

            int s = x+y+h;
            if(160 < s || 25 < w);
            else if(140 < s || 20 < w) ans += 1600;
            else if(120 < s || 15 < w) ans += 1400;
            else if(100 < s || 10 < w) ans += 1200;
            else if(80 < s || 5 < w) ans += 1000;
            else if(60 < s || 2 < w) ans += 800;
            else ans += 600;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 1000000007
using namespace std;
typedef long long ll;

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(M);
  bool exist = false;
  rep(i, 0, N)  cin >> A[i];
  rep(i, 0, M)  cin >> B[i];

  for(int ly=0; ly+M<=N; ly++){
    for(int lx=0; lx+M<=N; lx++){
      bool match = true;
      for(int y=0; y<M; y++){
        for(int x=0; x<M; x++){
          if(A[ly+y][lx+x]!=B[y][x]){
            match = false;
          }
        }
      }
      if(match)  exist=true;
    }
  }

  if(exist) cout << "Yes" << endl;
  else  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n;string s, t;cin>>s>>t;
	n = s.length();
	rep(i, n){
		bool flag = true;
		rep(j, n){
			if(s[(i+j)%n]!=t[j])flag = false;
		}
		if(flag){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, X[SIZE];

  cin >> N;

  for (int i = 0; i < N; i++)
    cin >> X[i];

  ll ans = LLINF;

  for (int P = 0; P <= 100; P++) {
    ll sum = 0;
    for (int i = 0; i < N; i++) {
      sum += (X[i] - P) * (X[i] - P);
    }
    ans = min(ans, sum);
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n;
  cin>>n;
  int tmp = n;
  int s = 0;
  while(tmp>0){
    s += tmp%10;
    tmp /= 10;
  }
  puts(n%s==0 ? "Yes" : "No");
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    vector<int> b(N);
    vector<int> c(N);
    vector<int> dpa(N);
    vector<int> dpb(N);
    vector<int> dpc(N);
    rep(i,N){
        cin >>a[i] >> b[i] >> c[i];
    }
    rep(i,N){
        dpa[i] = 0;
        dpb[i] = 0;
        dpc[i] = 0;
    }

    dpa[0] = max(b[0],c[0]);
    dpb[0] = max(a[0],c[0]);
    dpc[0] = max(b[0],a[0]);

    rep(i,N-1){
        dpa[i+1] = max(dpb[i]+a[i+1],dpc[i]+a[i+1]);
        dpb[i+1] = max(dpa[i]+b[i+1],dpc[i]+b[i+1]);
        dpc[i+1] = max(dpb[i]+c[i+1],dpa[i]+c[i+1]);
    }




    
    cout << max(dpa[N-1],max(dpb[N-1],dpc[N-1])) <<endl;
    return 0;
    

}

Measured memory_bytes: 2560
#[allow(non_snake_case)]
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
        n: usize, S: [chars; n],
    }
    let (mut m, mut a, mut r, mut c, mut h):(i64, i64, i64, i64, i64) = (0, 0, 0, 0, 0);
    for i in 0..n{
        if S[i][0] == 'M'{
            m+=1;
        }
        else if S[i][0] == 'A'{
            a+=1;
        }
        else if S[i][0] == 'R'{
            r+=1;
        }
        else if S[i][0] == 'C'{
            c+=1;
        }
        else if S[i][0] == 'H'{
            h+=1;
        }
    }
    let D = [m, a, r, c, h];
    let mut ans:i64 = 0;
    let P = [0,0,0,0,0,0,1,1,1,2];
    let Q = [1,1,1,2,2,3,2,2,3,3];
    let R = [2,3,4,3,4,4,3,4,4,4];
    for i in 0..10{
        ans += D[P[i]] * D[Q[i]] * D[R[i]]; 
    }
    puts!("{}\n", ans);
}
fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

int main() {
  int N;
  cin >> N;
  vector<int> num(N);
  for(int i = 0; i < N; i++){
    cin >> num.at(i);
  }
  sort(num.begin(),num.end());
  int d = 0;
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(d < num.at(i)){
      ans++;
      d = num.at(i);
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair

int intcmp(const void *v1,const void *v2){return *(int *)v1-*(int *)v2;}

int sumv(int v){
  int ret = 0;
  while(v!=0){
    ret+=v%10;
    v/=10;
  }
  return ret;
}


int main(){
  int v;
  cin>>v;
  int p = sumv(v);
  cout<<(v%p?"No":"Yes")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <cctype>
using namespace std;
int main()
{
	char ch;
	cin >> ch;
	if (isupper(ch)) cout << "A\n";
	else cout << "a\n";
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 1000000000
#define MOD 1000000007
#define ll long long int
using namespace std;


int main(){
  int N; cin>>N;
  int K; cin>>K;
  int kanri;
  string s; cin>>s;
  vector <int> record;record.push_back(0);
  s += "##########";
  int cnt0 = 0;
  int cnt1 = 0;

  for(int i=0;i<s.size();i++){
    if(s[i] == '#'){
      if(cnt1 > 0) record.push_back(cnt1);
      else record.push_back(-cnt0);
      break;
    }
    if(s[i] == '0') cnt0++;
    if(s[i] == '1') cnt1++;

    if(s[i] == '0' and cnt1 >0) {
      record.push_back(cnt1);
      cnt1 = 0;
    }
    if(s[i] == '1' and cnt0 > 0){
      record.push_back(-cnt0);
      kanri++;
      cnt0 = 0;
    }
  }

  vector <int> sum;
  sum = record;

  for(int i=0;i<record.size();i++){
    sum[i] = abs(sum[i]);
  }
for(int i=1;i<sum.size();i++){
  sum[i] += sum[i-1];
  //cout<<sum[i];
}

  int ans = 0;

  for(int i=1; ;i++){
    int preans;
    int last;
    if(record[i] > 0){
       last = i + 2*K;
      if(last > record.size()-1) last = record.size()-1;
      preans = sum[last] - sum[i-1];
      ans = max(ans,preans);
      
    } else {
       last = i + 2*K-2 + 1;
      if(last > record.size()-1) last = record.size()-1;
      preans = sum[last] - sum[i-1];
      ans = max(ans,preans);

    }

    if(last > record.size()-2) break;

    
  }

cout<<ans<<endl;

return 0;

}

Measured memory_bytes: 1272
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
ele = 10**18
prod = 1
if 0 in x:
    print(0)
    exit()
for i in x:
    prod *= i
    if prod > ele:
        print(-1)
        exit()
print(prod)

Measured memory_bytes: 84752
// Separate what you do from who you are, that's what the guilt trap is all about!
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<int, int> > vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef pair<int, int> pii;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax];
int main()
{
    ios::sync_with_stdio(0);
    ll a = 1;
    int k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        a = min(a * 2, a + k);
    }
    cout << a;
    return 0;
}


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


int main() {
    int H, A;
    cin >> H >> A;

    if(H % A == 0){
        cout << H / A << endl;
    }
    else{
        cout << H / A + 1 << endl;
    }

    return 0;
}

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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(void){
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << '\n';
  return 0;
}

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

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

    ll s[N];
    ll sum = 0;
    for(ll i = 0; i < N; i++)
    {
        cin >> s[i];
        sum += s[i];
    }

    ll sumMax = 0;
    if(sum % 10 != 0)
    {
        cout << sum << endl;
        return 0;
    }
    
    for(ll i = 0; i < N; i++)
    {
        if((sum - s[i]) % 10 == 0)continue;
        sumMax = max(sumMax,sum-s[i]);
    }
    cout << sumMax << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include <algorithm>
using namespace std;

int main()
{
	int N;
	vector<long long int>a;
	cin >> N;
	long long int sum = 0;
	for (int i = 0; i < 3 * N; i++)
	{
		long long int num;
		cin >> num;
		a.push_back(num);
	}

	sort(a.begin(),a.end());

	for (int i = N + 1; i < 3 * N; i=i+2)
	{
		sum += a[i-1];
	}

	cout << sum;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (((a == b) || (b == c) || (c == a)) && !((a == b) && (b == c)))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

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

using namespace std;

typedef long long ll;

struct Data {
  int x,s0,s1;
  Data() {}
  Data(int a,int b,int c):x(a),s0(b),s1(c) {}
  bool operator < (const Data & b) const {
  	if ((ll)s0*b.s1!=(ll)s1*b.s0) return (ll)s0*b.s1<(ll)s1*b.s0;
  	else return s0<b.s0;
  }
};

priority_queue <Data> q;

namespace SETS {

int fa[200005];

void init(int n) {
  for(int i=1;i<=n;i++) fa[i]=i;
}

int find_father(int x) {
  return (fa[x]==x)?x:fa[x]=find_father(fa[x]);
}

void merge(int x,int y) {
  x=find_father(x);y=find_father(y);
  if (x==y) return;
  fa[y]=x;
}

}

bool vis[200005];
int sum0[200005],sum1[200005]; 
ll f[200005];

int p[200005];

int main() {
  int n;
  scanf("%d",&n);
  for(int i=2;i<=n;i++) scanf("%d",&p[i]);
  vis[0]=1;
  for(int i=1;i<=n;i++) {
  	int x;
  	scanf("%d",&x);
  	if (!x) {
  		sum0[i]=1;
  		q.push(Data(i,1,0));
	  }
	else {
		sum1[i]=1;
		q.push(Data(i,0,1));
	}
  }
  SETS::init(n);
  ll ans=0;
  int s1=0;
  while (!q.empty()) {
  	Data t=q.top();q.pop();
  	if (vis[t.x]||t.s0!=sum0[t.x]||t.s1!=sum1[t.x]) continue;
  	int x=t.x;
  	vis[x]=1;
  	if (vis[SETS::find_father(p[x])]) {
  		ans+=f[x]+(ll)s1*sum0[x];
  		s1+=sum1[x];
	  }
	else {
		int u=SETS::find_father(p[x]);
		f[u]+=f[x]+(ll)sum1[u]*sum0[x];
		sum0[u]+=sum0[x];
		sum1[u]+=sum1[x];
		q.push(Data(u,sum0[u],sum1[u]));
		SETS::merge(u,x);
	}
  }
  printf("%lld\n",ans);
  return 0;
}

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

long long gcd(long long x, long long y){
  if (x<y) return gcd(y,x);
  else if (y==0) return x;
  else return gcd(y,x%y);
}

int main(){
  long long N, M;
  cin >> N >> M;
  vector<long long> a(N), b(N);
  for (int i=0; i<N; i++) {
    cin >> a[i];
    b[i] = a[i]/2;
  }
  long long hoge = 0;
  while(a[0]%2==0){
    hoge++;
    a[0] /= 2;
  }
  for (int i=1; i<N; i++){
    long long fuga = 0;
    while(a[i]%2==0){
      fuga++;
      a[i]/=2;
    }
    if (hoge!=fuga){
      cout << 0 << endl;
      return 0;
    }
  }
  long long LCM = 1;
  for (int i=0; i<N; i++){
    LCM = LCM/gcd(LCM,b[i])*b[i];
    if (LCM > M){
      cout << 0 << endl;
      return 0;
    }
  }
  cout << M/LCM - M/(LCM*2) << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999
#define ALL(x) (x).begin(), (x).end()
#define LBi(x, n) lower_bound(ALL(x), n) - (x).begin()
#define ZIP(x) (x).erase(unique(ALL(x)), (x).end())
#define Pi pair<int, int>
#define Vi vector<int>

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

string s = "";
char ch[10];
int n, a, b, c, d, x, m[5];

int main() {
	rep(3) cin >> ch[i];
	cout << ch[0] + ch[1] + ch[2] - 144 << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int H = scan.nextInt();
        int W = scan.nextInt();
        int N = scan.nextInt();
        int max = Math.max(H, W);
        int ans = (N % max == 0 ? N/max : N/max+1);
        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	char c;cin>>c;
	if(c>='a' && c<='z') cout<<'a'<<endl;else cout<<'A'<<endl;
}


Measured memory_bytes: 3644
<?php

$string = trim(fgets(STDIN));

$parts = explode(" ", $string);


for ($i = 0; $i < count($parts) - 1; $i ++)
{


	//last char of first work
	$last = substr($parts[$i], -1, 1);



	$first	 = substr($parts[$i + 1], 0, 1);

	if ($first != $last)
	{
		echo "NO\n";
		die();
	}
}

echo "YES\n";
die();


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  long long Neb,New,Nob,Now;
  Neb=0;
  New=0;
  Nob=0;
  Now=0;
  for (long long i=0;i<S.size();i++){
    if (i%2){
      if (S[i]=='1'){
        Now++;
      }
      else{
        Nob++;
      }
    }
    else{
      if (S[i]=='1'){
        New++;
      }
      else{
        Neb++;
      }
    }
  }
  //cout<<Neb<<New<<Nob<<Now<<endl;
  cout<<min(Neb+Now,New+Nob)<<endl;
}


Measured memory_bytes: 512
h,w = map(int,input().split())
s = [input() for _ in range(h)]
ans = [[0 for _ in range(w)] for _ in range(h)]
lst = [-1,0,1]

def f(a,b):
    for i in lst:
        for j in lst:
            th = a+i
            tw = b+j
            if not (0 <= th <= h-1 and 0 <= tw <= w-1 and s[th][tw] != "#"):
                continue
            ans[th][tw] += 1 

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            f(i,j)
            ans[i][j] = "#"

for i in range(h):
    print("".join(map(str,ans[i])))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
typedef long long ll;
int main() {
	// your code goes here
    ll a,b,c,d;
  	cin>>a>>b>>c>>d;
  	int t1=(c-1)/b+1;
  	int t2=(a-1)/d+1;
  	if(t1>t2)
      cout<<"No";
  	else
      cout<<"Yes";
	return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;

    cin >> n;

    vector<bool> isSelected(n);
    vector<int> a(n);

    for (int i = 0; i < n; ++i) {
        isSelected.at(i) = false;
        cin >> a.at(i);
    }

    int select = 1;
    int i = 0;

    while (select != 2) {
        if (isSelected.at(select - 1)) {
            if (select != 2)
                i = -1;
            break;
        } else {
            isSelected.at(select - 1) = true;

            select = a.at(select - 1);
        }

        i++;




    }

    cout << i;

}


Measured memory_bytes: 640
N = int(input())
a = [0] * N
for i in range(N):
    a[i] = int(input())
now, cnt = 0, 0

for i in range(N):
    if now == 1:
        print(cnt)
        exit()
    else:
        now = a[now]-1
        cnt += 1
print(-1)

Measured memory_bytes: 12768
package main

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

const mod int = 1e9 + 7
const keta = 61

func main() {
	n := readInt()

	zeros := make([]int, keta)
	ones := make([]int, keta)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()

		for j := 0; j < keta; j++ {
			if a[i]&(1<<uint(j)) == 0 {
				zeros[j]++
			} else {
				ones[j]++
			}
		}
	}

	times := make([]int, keta)
	for i := 0; i < n-1; i++ {
		for j := 0; j < keta; j++ {
			if a[i]&(1<<uint(j)) == 0 {
				zeros[j]--
				times[j] += ones[j]
			} else {
				ones[j]--
				times[j] += zeros[j]
			}
		}
	}

	ans := 0
	for i := range times {
		ans += 1 << uint(i) % mod * (times[i] % mod)
		ans %= mod
	}

	fmt.Println(ans)
}

func main1() {
	n := readInt()

	zeros := make([]int, 60)
	ones := make([]int, 60)
	abins := make([][]byte, n)
	for i := 0; i < n; i++ {
		a := readInt()
		abins[i] = []byte(fmt.Sprintf("%060b", a))

		for j, b := range abins[i] {
			if b == '0' {
				zeros[j]++
			} else {
				ones[j]++
			}
		}
	}

	times := make([]int, 60)
	for i := 0; i < n-1; i++ {
		for j, b := range abins[i] {
			if b == '0' {
				zeros[j]--
				times[j] += ones[j]
			} else {
				ones[j]--
				times[j] += zeros[j]
			}
		}
	}

	ans := 0
	for i := range times {
		ans += 1 << uint(60-i-1) % mod * (times[i] % mod)
		ans %= mod
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 6144
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int findsumofain(int n){
        int sum = 0;
        while(n >0){
            sum += n%10;
            n /= 10;
        }
        return sum;
    }

int main()
{
    
    int nn,a,b,ans;
    ans = 0;
    cin >> nn >> a >> b;
    
    for(int i = 0; i <= nn; i++)
    {
        int sum = findsumofain(i);
        
        if (sum>=a&&sum<=b) {
            ans += i;
        }
        
    }
    cout << ans <<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, T, A;
  cin >> N >> T >> A;
  vector<int> H(N);
  rep(i, N) cin >> H[i];
  
  int ans=0;
  float m=abs(A-(T-H[0]*0.006));
  rep(i, N) {
    if(abs(A-(T-H[i]*0.006)) < m) {
      m = abs(A-(T-H[i]*0.006));
      ans = i;
    }
  }
  cout << ans+1 << endl;
}


Measured memory_bytes: 256
#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;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin  >>  n;
    if(n > 999){
        cout << "ABD" <<  endl;
    }else{
        cout << "ABC" << endl;
    };
    return 0;
}


Measured memory_bytes: 256
from collections import Counter

S = list(set(list(input())))

x = [0, 0]
for s in S:
    if s == "E":
        x[0] += 1
    elif s == "W":
        x[0] -= 1
    elif s == "N":
        x[1] += 1
    elif s == "S":
        x[1] -= 1

print('Yes' if x == [0, 0] else 'No')


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

long long oddsolve(long long a) { return (a + 1) / 2 % 2; }
long long solve(long long a) {
  if (a % 2 == 1)
    return oddsolve(a);
  else
    return oddsolve(a + 1) ^ (a + 1);
}
int main() {
  long long A, B;
  cin >> A >> B;
  cout << (solve(B) ^ solve(A - 1)) << endl;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  ll ans = 0;
  repLRE(i, 1, n) ans += (i + i * (n / i)) * (n / i) / 2;
  cout << ans << endl;

  return 0;
}


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

using namespace std;

const int N = 1005;
const int md = 1000000007;

int a[N][N], f[N][N];

void add(int &x, int y) {
	x += y;
	if (x >= md) {
		x -= md;
	}
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		string str;
		cin >> str;;
		for (int j = 0; j < m; j++) {
			a[i][j] = str[j];
		}
	}
	f[1][1] = 1;
	for (int i = 1; i <= n; i++) {
	  for (int j = 1; j <= m; j++) {
	  	if (a[i - 1][j - 1] == '#') continue;
	  	add(f[i][j], f[i - 1][j]);
	  	add(f[i][j], f[i][j - 1]);
	  }
	}
	printf("%d\n", f[n][m]);
	return 0;
}

Measured memory_bytes: 8064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[5];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            if (s.charAt(0) == 'M') {
                a[0]++;
            } else if (s.charAt(0) == 'A') {
                a[1]++;
            } else if (s.charAt(0) == 'R') {
                a[2]++;
            } else if (s.charAt(0) == 'C') {
                a[3]++;
            } else if (s.charAt(0) == 'H') {
                a[4]++;
            }
        }
        long ans = a[0]*a[1]*a[2] + a[0]*a[1]*a[3] + a[0]*a[1]*a[4] + a[0]*a[2]*a[3] + a[0]*a[2]*a[4] +
                    a[0]*a[3]*a[4] + a[1]*a[2]*a[3] + a[1]*a[2]*a[4] + a[1]*a[3]*a[4] + a[2]*a[3]*a[4];
        System.out.println(ans);
    }
}


Measured memory_bytes: 46180
N=gets.to_i
P=gets.split.map(&:to_i)

ans=0
(1..N-2).each do |i|
  ans += 1 if (P[i] < P[i+1] && P[i] >= P[i-1]) || (P[i] < P[i-1] && P[i] >= P[i+1])
end

p ans

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

class RMQ{
private:
    static const int MAX_N = 1 << 17;
    int n;
    long long dat[2*MAX_N -1];
    long long rec(int a,int b,int k,int l,int r){
        if(b <= l || r <= a){
            return 0;
        }
        
        if(a<=l && r<=b){
            return dat[k];
        }else{
            long long rl = rec(a,b,2*k+1,l,(l+r)/2);
            long long rr = rec(a,b,2*k+2,(l+r)/2,r);
            return max(rl,rr);
        }
    }
    
public:
    void init(int n_){
        n=1;
        while(n < n_) n <<= 1;
        
        for(int i=0;i<2*n-1;i++){
            dat[i] = 0;
        }
    }
    void update(int k, long long a){
        int reaf = k+n-1;
        dat[reaf]=a;
        while(reaf>0){
            reaf = (reaf-1)>>1;
            dat[reaf]=max(dat[reaf*2+1],dat[2*reaf+2]);
        }
    }
    long long query(int a,int b){
        return rec(a,b+1,0,0,n);
    }
};

int a[100010], ind[100010];

int main(){
    while (true) {
        int n;
        cin >> n;
        if (!n) return 0;
        
        long long m = n * (long long)(n + 1) / 2;
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            ind[a[i] - 1] = i;
        }
        RMQ r;
        r.init(n);
        for (int i = 0; i < n; ++i) {
            r.update(ind[i], r.query(0, ind[i]) + i + 1);
        }
        cout << m - r.query(0, n) << "\n";
        
        return 0;
    }
    return 0;
}

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

using ld=long double;
using P=complex<ld>;
struct Line{
    P a,b;
};
vector<P> ps;
int m;
const ld EPS=1e-9;
ld cross(P a,P b){
    return a.real()*b.imag()-a.imag()*b.real();
}
int solve(int id,vector<int> flag){
    if(id==m){
        
        vector<Line> lines(m/2);
        for(int i=1;i<=m/2;i++){
            for(int j=0;j<m;j++){
                if(flag[j]==i){
                    lines[i-1].a=ps[j];
                    j++;
                    for(;j<m;j++){
                        if(flag[j]==i){
                            lines[i-1].b=ps[j];
                            break;
                        }
                        
                    }
                    break;
                }
            }
        }    
        int res=0;
        for(int i=0;i<m/2;i++){
            for(int j=0;j<i;j++){
                if(abs(cross(lines[i].a-lines[i].b,lines[j].a-lines[j].b))<EPS){
                    res++;
                }
            }
        }  

        return res;
    }
    if(flag[id]) return solve(id+1,flag);
    int res=0;
    int nex=1+*max_element(flag.begin(),flag.end());
    flag[id]=nex;
    for(int i=id+1;i<m;i++){
        if(!flag[i]){
            flag[i]=nex;
            res=max(res,solve(id+1,flag));
            flag[i]=0;
        }
    }
    return res;
}
int main(){
    cin>>m;
    ps.resize(m);
    for(int i=0;i<m;i++){
        ld x,y; cin>>x>>y;
        ps[i]={x,y};
    }
    vector<int> flag(m);
    cout<<solve(0,flag)<<endl;
    return 0;
}


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

int main(void)
{
  string s;
  int sum=0;
  int a[3];
  cin >> s;
  for(int i=0;i<3;i++)
  {
    a[i]=stoi(s.substr(i,1));
    sum += a[i];
  }
  
  cout << sum;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	set<int>divA{};
	set<int>divB{};
	int A,B,C;
	cin >> A >> B >> C;
	for (int i = 1;i<=A;i++){
		if (A % i == 0){
			divA.insert(i);
		}
	}
	for (int i = 1;i<=B;i++){
		if (B % i == 0){
			divB.insert(i);
		}
	}
	vector<int> v(divA.size());
	set_intersection(ALL(divA),ALL(divB),v.begin());
	// for (int i = 0;i < v.size();i++){
	// 	cout << v[i] << endl; 
	// }
	sort(ALL(v),greater<int>());
	cout <<v[C-1] <<endl;
	return 0;
}

Measured memory_bytes: 256
/*
Author:Fuad Ashraful Mehmet
University of Asia Pacific
Date:23 Feb 2020
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N=1e5+5;
int n;

int main()
{
 ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    
    long long a,b,n;
    cin>>n>>a>>b;

    long long blue=n/(a+b);
     blue=a*blue;
    long long mod=n%(a+b);

    blue+=min(mod,a);

    cout<<blue<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;

    int v = 0, h = 0;
    int len = s.length();

    int E = std::count(s.begin(), s.end(), 'E');
    int W = std::count(s.begin(), s.end(), 'W');
    int S= std::count(s.begin(), s.end(), 'S');
    int N = std::count(s.begin(), s.end(), 'N');

    E = min(E, 1);
    W = min(W, 1);
    S = min(S, 1);
    N = min(N, 1);

    if (!(E ^ W) && !(S ^ N))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

using ll = long long;

int main(){
    ll n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    ll count=1;
    for(ll i=0;i<n;i++){
        if(a[i]==count)
        count++;
    }
    if(count==1)
    cout<<"-1";
    else
    cout<<abs(count-n-1);
    
    
}


Measured memory_bytes: 1024
use std::io::{BufRead, Read};

pub struct Scanner<R>
where
    R: BufRead,
{
    reader: R,
}

impl<R> Scanner<R>
where
    R: BufRead,
{
    pub fn new(reader: R) -> Self {
        Self { reader }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: ::std::str::FromStr,
        <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
    {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .unwrap()
    }
}

struct Dice {
    t: u8,
    b: u8,
    n: u8,
    w: u8,
    s: u8,
    e: u8,
}

impl Dice {
    fn roll_to(self, c: char) -> Self {
        let mut clone = self.clone();
        match c {
            'N' => {
                clone.b = self.n;
                clone.s = self.b;
                clone.t = self.s;
                clone.n = self.t;
            },
            'S' => {
                clone.b = self.s;
                clone.s = self.t;
                clone.t = self.n;
                clone.n = self.b
            },
            'E' => {
                clone.t = self.w;
                clone.e = self.t;
                clone.b = self.e;
                clone.w = self.b;
            },
            'W' => {
                clone.t = self.e;
                clone.e = self.b;
                clone.b = self.w;
                clone.w = self.t;
            },
            _ => panic!(),
        }
        clone
    }

    fn clone(&self) -> Self {
        Self{
            t: self.t,
            b: self.b,
            n: self.n,
            w: self.w,
            s: self.s,
            e: self.e,
        }
    }
}

fn main() {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let mut sc = Scanner::new(stdin);

    let ns: Vec<u8> = (0..6).map(|_| sc.next()).collect();
    let mut dice = Dice{
        t: ns[0],
        s: ns[1],
        e: ns[2],
        w: ns[3],
        n: ns[4],
        b: ns[5],
    };
    let cs: String = sc.next();
    for c in cs.chars() {
        dice = dice.roll_to(c);
    }
    println!("{}", dice.t);
}



Measured memory_bytes: 5028
from copy import deepcopy
N,M=list(map(int, input().strip().split()))
abc={}
used={}
for _ in range(M):
    a,b,c=(list(map(int, input().strip().split())))
    abc[a,b]=c
    used[a,b]=False
spth=[[float("inf")]*(N+1) for _ in range(N+1)]
for i in range(1,N+1):
    spth[i][i]=0
for ab,c in abc.items():
    spth[ab[0]][ab[1]]=c
    spth[ab[1]][ab[0]]=c
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            d=spth[i][k]+spth[k][j]
            if spth[i][j] > d:
                spth[i][j]=d

for ab,c in abc.items():
    for s in range(1,N+1):
        if used[ab]:break
        if spth[s][ab[1]]==spth[s][ab[0]]+c:
            used[ab]=True
            break
print(sum(not i for i in used.values()))

Measured memory_bytes: 4068
n, l = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    ans = ans + (i + l - 1)

s = 1 + l - 1
e = n + l - 1
if e < 0:
    ans = ans - e
elif s > 0:
    ans = ans - s

print(ans)


Measured memory_bytes: 2940
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(d:i64 n:i64));
    if d == 0 {
        n + (n / 100)
    } else if d == 1 {
        100 * (n + (n / 100))
    } else {
        10000 * (n + (n / 100))
    }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "0 5" => "5",
    add1: "0 100" => "101",
    test2: "1 11" => "1100",
    test3: "2 85" => "850000",
}


Measured memory_bytes: 4352