akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

int main()
{
    string a,b;
    cin>>a>>b;
    int i,len1,len2,m;
    len1=a.size();
    len2=b.size();
    m=min(len1,len2);
   // cout<<m<<endl;
    for(i=0; i<m; i++)
    {
        cout<<a[i]<<b[i];
    }
    if(m==len1){
        for(i=m; i<len2; i++)
            cout<<b[i];}
    else{
        for(i=m; i<len1; i++)
            cout<<a[i];}
            cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  unordered_map<int, int> mp;
  rep(i, k) {
    int x = b-i;
    int y = a+i;
    if(a<= x && x <= b) mp[x];
    if(a<=y && y<= b) mp[y];
  }
  vector<int> v;
  for(auto p : mp) {
   v.push_back(p.first); 
  }
  sort(v.begin(), v.end());
  rep(i, v.size()) cout << v[i] << endl;
  return 0;
}

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

int main(){
  string s, ans;
  cin >> s;
  
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == '0'){
      ans = ans + '0';
    }
    
    else if(s.at(i) == '1'){
      ans = ans + '1';
    }
    
    else if(s.at(i) == 'B'){
      if(ans.empty() == false){
        ans.pop_back();
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n; cin >> n;
    vector<ll> d(n);
    rep(i,0,n) cin >> d[i];
    sort(ALL(d));
    cout << d[n/2]-d[n/2-1] << endl;


    return 0;
}


Measured memory_bytes: 1024
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,A,B;
    in >> N >> A >> B;
    //vector<ll> X(N);

    if(A==0){
        out << 0 << endl;
    }else{
        ll ans=0,x,y;
        x = N%(A+B);
        y = floor(N/(A+B));
        if(x == 0){
            ans = y * A;
        }else if(x <= A){
            ans = y * A + x;
        }else{
            ans = y * A + A;
        }

        out << ans << endl;
    }

    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<10;i++){
    int count=0;
    for(int j=i;j<10;j++){
      if(s[j]=='A'||s[j]=='T'||s[j]=='C'||s[j]=='G')count++;
      else break;
    }
    if(ans<count)ans=count;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
/*
 * Created By : pash123
 * 2020-08-23-18.46
*/


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

const int M=1e9+7;

int main()
{
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;++i)
            cin>>h[i];

    int dp[n];  // dp[i] means min. cost to reach stone i.
    for(int i=0;i<n;++i)
        dp[i]=INT_MAX;
    dp[0]=0;

    for(int i=1;i<n;++i)
    {
        for(int j=1;j<=k && (i-j)>=0;++j)
             dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));

    }

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


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

using namespace std;

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//debug
#define dump(x)  cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";

//not typedef but using
using VI = vector<int>;
using VC = vector<char>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;

//stdin methods
int I(){ int a; scanf("%d", &a); return a; }
char R(){ char c; scanf("%c", &c); return c; }
string S(){ string s; cin >> s; return s; }
VI LI(int n){ VI v; REP(i,n){v.PB(I());} return v; } 
VC LR(int n){ VC v; REP(i,n){v.PB(R());} return v; }
VS LS(int n){ VS v; REP(i,n){v.PB(S());} return v; }

    
int main(){
  int H=I(), W=I();
  VVI c, A;
  REP(i,10) c.PB(LI(10));
  REP(i,H) A.PB(LI(W));

  REP(k,10) REP(j,10) REP(i,10)
        if (c[i][j] > c[i][k]+c[k][j]) c[i][j]=c[i][k]+c[k][j];
  int ans=0;
  REP(i,H) REP(j,W)
    ans+=A[i][j]!=-1 ? c[A[i][j]][1] : 0;
  printf("%d",ans);
  printf("\n");
}


Measured memory_bytes: 512
from collections import deque

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

tmp = [0 for _ in range(N + 1)]

now = 0
if 1 not in A:
    tmp[1] = 1
    
else:
    now += 1
    
if (2 not in A) and N >= 2:
    tmp[2] = tmp[1] + 1
    
else:
    now += 1

for i in range(3, N+1):
    
    try:
        if i != A[now]:
            tmp[i] = tmp[i-1] + tmp[i-2] 
            
        else:
            now += 1
        
    except:
        tmp[i] = tmp[i-1] + tmp[i-2] 

    
print(tmp[-1]%(10**9+7))

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

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

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

    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll X;
    cin >> X;
    ll year = 0;
    ll amount = 100;
    while (amount < X){
        year++;
        amount *= 1.01;
    }
    cout << year << "\n";

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 5999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

int s[114514];
int main() {
	int n,ans = 0;
	cin >> n;
	REP(i, n) {
		int a;
		cin >> a;
		FOR(i, -1, 2) s[a + i]++;
	}
	REP(i, 114514) {
		ans = max(ans, s[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
// 2^n 全探索

#include  <iostream>
#include  <vector>
#include  <cstdlib>
#include  <cmath>

long long solve0(long long var); // bit全探索
long long solve1(long long var); // 再起全探索
long long solve11(long long p, int q, long long offset); // 再起全探索(探索の実体)


int main(void)
{
	long long n;
	std::cin >> n;

	long long ans = 0;
	//ans = solve0(n);
	ans = solve1(n);

	std::cout << ans << std::endl;

	return EXIT_SUCCESS;
}

long long solve0(long long var)
{
	long long rtn = 0;
	int d = (int)std::log10(var) + 1;

	// 全パターン探索
	for(int bit = 0; bit < (1 << d-1); ++bit) {
		std::vector<long long> v;
		long long p = var, q = std::pow(10, d-1);

		for(int i = 0; i < d; ++i) {	
			if(bit & (1 << i)) {
				v.push_back(p/q);
				p = p%q;
			}
			q = q/10;
		}

		v.push_back(p);

		for(std::vector<long long>::iterator it = v.begin(); it != v.end(); ++it)
			rtn += *it;
	}

	return rtn;
}

long long solve1(long long var)
{
	long long rtn = 0;
	int d = (int)std::log10(var) + 1;

	rtn = solve11(var, std::pow(10, d-1), 0);

	return rtn;
}

long long solve11(long long p, int q, long long offset)
{
	long long rtn = 0;

	if(q == 1) {
		// あるパターンにおける挿入操作が終わった
		return p + offset;
	}
	else {
		// (1) '+'を挿入する
		rtn += solve11(p%q, q/10, offset + p/q);

		// (2) '+'を挿入しない
		rtn += solve11(p, q/10, offset);
	}

	return rtn;
}



Measured memory_bytes: 4056
use std::io;
use std::io::Read;

fn main() {
    let mut buf = String::new();
    io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();

    let N:usize = iter.next().unwrap().parse().unwrap();
    let T:usize = iter.next().unwrap().parse().unwrap();
    let ctl: Vec<(usize, usize)> = (0..N).map(|_| {
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }).collect();
    //debug!(N, T, ctl);

    let mut min = 1001;
    for ct in ctl {
        if ct.1 <= T && ct.0 < min {
            min = ct.0;
        }
    }
    if min > 1000 {
        println!("TLE");
    }else {
        println!("{}", min);
    }
}

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

#define int long long


set<int> s;
int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int N;
	cin >> N;
	if (N == 2)
	{
		cout<<1<<endl;
		return 0;
	}
	s.insert(N);
	for (int i = 2 ; i * i <= N ; i++)
	{
		if (N % i == 0)
		{
			int a = N;
			while (a % i == 0)
			{
				a/=i;
			}
			if (a%i == 1)
				s.insert(i);
			a = N;
			int b = N / i;
			while (a % b == 0)
			{
				a/=b;
			}
			if (a%b == 1) s.insert(b);
		}

	}
	int avant = N - 1;
	s.insert(avant);
	for (int i = 2 ; i  * i <= avant ; i++)
	{
		if (avant % i == 0)
		{
			s.insert(i);
			s.insert(avant / i);
		}
	}
	cout<<s.size()<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x,a,b;
    cin>>x;
    a=x/500;
    x=x%500;
    b=x/5;
    x=x%5;
    cout<<(a*1000)+(b*5);
    
}

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

/*#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#define mp make_pair
#define pb push_back
#define pll pair<LL,LL>
#define pii pair<int,int>
#define y second
#define x first
#define LL long long 
#define sqr(x) ((x)*(x))
#define pi acosl(-1)
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
using namespace std;
int mod=1e9+7;
LL f_pow(LL a,LL b){
    LL res=1,temp=a;
    while(b){
        if(b&1)res=res*temp%mod;
        temp=temp*temp%mod;
        b>>=1;
    }
    return res;
}
void solve(){
    int n;
    scanf("%d",&n);
    printf("%lld\n",((f_pow(10,n)-f_pow(9,n)*2+f_pow(8,n))%mod+mod)%mod);;
}
int main(){
    int t=1;
    int T=1;
    while(t--){
        solve();
    }
}
/*
100
5
5 4
4 2
4 2 3
5 4 2 3 1
*/

Measured memory_bytes: 3824
line = list(map(str, input().split()))
S = []
for i in line:
    if i in ['+', '-', '*']:
        b = int(S.pop())
        a = int(S.pop())

        if i == '+':
            S.append(a+b)
        elif i == '-':
            S.append(a-b)
        else:
            S.append(a*b)
    else:
        S.append(i)

print(S[0])



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

int main() {
  int A, B;
  cin >> A >> B;
  
  vector<int> data = {1, 2, 3};
  for(int i = 0; i < 3; i++){
    if(data.at(i) != A && data.at(i) != B) cout << data.at(i) << endl;
  }
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let d: i32 = read();
    let mut n: i32 = read();

    let mut x = 0;
    while n >= 1 {
        x += 1;
        if x % 100 != 0 {
            n -= 1;
        }
    }
    for _ in 0..d {
        x *= 100;
    }
    println!("{}", x);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int N,M;
  cin >> N >> M;
  vector<vector<int>> List(N,vector<int>());
  vector<P> A(M);
  REP(i,M){
    cin >> A[i].first >> A[i].second;
    A[i].first--;
    A[i].second--;
    List[A[i].first].push_back(A[i].second);
    List[A[i].second].push_back(A[i].first);
  }
  
  int ans = 0;
  REP(i,M){
    queue<int> que;
    que.push(0);
    vector<int> dist(N,-1);
    dist[0]=1;
    int cnt = 1;
    while(!que.empty()){
      int v = que.front();
      que.pop();
      for(auto nv:List[v]){
        if(((A[i].first==v&&A[i].second==nv)||(A[i].first==nv&&A[i].second==v))||dist[nv]!=-1){
          continue;
        }
        cnt++;
        dist[nv]=dist[v]+1;
        que.push(nv);
      }
    }
    if(cnt!=N){
      ans++;
    }
  }

  cout << ans << endl;
}

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

int N, ABC[100000][3];
int main(){
    cin >> N;
    for(int i=0;i<N;i++)    cin >> ABC[i][0] >> ABC[i][1] >> ABC[i][2];
    
    int DP[100001][3];
    for(int i=0;i<=N;i++){
        for(int j=0;j<3;j++)    DP[i][j] = 0;
    }
    
    for(int i=0;i<N;i++){
        
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j != k){
                    DP[i+1][k] = max(DP[i+1][k], DP[i][j] + ABC[i][k]);
                }
            }
        }
        
    }
    
    int ans = 0;
    for(int i=0;i<3;i++)    ans = max(ans, DP[N][i]);
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

void BubbleSort(vector<pair<int, int>>& pairs, int N){

  int i, j;

  for( i = 0; i < N; i++ ){
    for( j = N-1; j >= i+1; j-- ){
      if( pairs[j].first < pairs[j-1].first ){
        swap( pairs[j], pairs[j-1]);
      }
    }
  }
}

void SelectionSort(vector<pair<int, int>>& pairs, int N){

  int i, j;
  int minj;

  for( i = 0; i <= N-1; i++ ){
    minj = i;
    for( j = i; j <= N-1; j++ ){
      if( pairs[j].first < pairs[minj].first ){
        minj = j;
      }
    }
    swap( pairs[minj], pairs[i]);
  }
}

int Judge( string* C, vector<pair<int, int>> Bubble, vector<pair<int, int>> Selec, int N ){

  for( int i = 0; i < N; i++ ){
    if( C[Bubble[i].second] != C[Selec[i].second] ){
      return -1;
    }
  }

  return 0;

}


int main() {

  int N, A[200];
  vector<pair<int, int>> pairs(200), Bubble(200), Selec(200);
  string C[200];
  int ans;

  cin >> N;

  REP(i, N){
    cin >> C[i];  
    pairs[i] = make_pair( atoi( C[i].substr(1,2).c_str()), i);
  }

  Bubble = pairs;
  BubbleSort( Bubble, N );
  REP(i, N){
    cout << C[Bubble[i].second];
    if( i != N-1 ){
      cout << " ";
    }    
  }
  cout << endl;
  cout << "Stable" << endl;

  Selec = pairs;
  SelectionSort( Selec, N );
  REP(i, N){
    cout << C[Selec[i].second];
    if( i != N-1 ){
      cout << " ";
    }    
  }
  cout << endl;

  ans = Judge(C, Bubble, Selec, N);

  if( ans == -1 ){
    cout << "Not stable" << endl;
  }else{
    cout << "Stable" << endl;
  }



}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 3180
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

ll solve() {
  int N; cin>>N;
  ll ans = 0;
  vector<ll>  a(N);
  REP(i,N) {
    cin>>a[i];
  }
  if(a[0] != 0LL) {ans =	-1; return ans;}
  for(int i = 1; i < N;	i++) {
    if(a[i-1]+1LL < a[i]) {
      ans = -1LL; return ans;
    }
    else if(a[i-1]+1LL == a[i]) {
      // OK                                                                             
    } else {
      ans += a[i-1];
    }
  }
  ans += a[N-1];
  return ans;
}
int main() {
  ll ans = solve();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;

/*-----------------------------------------------------------------------------
　メイン
 -------------------------------------------------------------------------------*/
int main()
{
	ll N, M;
	cin >> N >> M;
	map<ll, ll> mp;
	vector<ll> A(N);
	vector<ll> sum(N + 1, 0);
	REP(i, N) {
		ll one;
		cin >> A[i];
		A[i] %= M;
		one = (sum[i] + A[i]) % M;
		sum[i + 1] = sum[i] + A[i];
		sum[i + 1] = one;
		mp[one]++;
	}
	
	ll ans = 0;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		ll one = it->second;
		if (it->first == 0) {
			ans += (one * (one + 1)) / 2;
		} else {
			ans += (one * (one - 1)) / 2;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 5760
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char ch='2';
		int ans=0;
		for(int i =0; i<s.length(); i++){
			if(s.charAt(i)==ch){
				ans++;
				ch=s.charAt(i)=='0'?'1':'0';
			}else{
				ch=s.charAt(i);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 27348
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dp[605][605],c[605][605],ans;
int n,k,a,b;
int go[605],g[605];

int main(){
	scanf("%d %d",&n,&k);
	for(int i=1;i<=k;i++){
		scanf("%d %d",&a,&b);
		go[a]=b,go[b]=a;
	}
	for(int i=0;i<=2*n;i++){
		g[i]=1;
		for(int j=1;j<i;j+=2) g[i]=1ll*g[i]*j%mod;
	}
	for(int l=1;l<2*n;l++){
		for(int r=l+1;r<=2*n;r+=2){
			int tot=0,flag=1;
			for(int i=l;i<=r;i++){
				if(go[i]&&(go[i]<l||go[i]>r)) flag=0;
				else if(!go[i]) tot++;
			}
			if(flag) c[l][r]=tot;else c[l][r]=-1;
		}
	}
	for(int l=1;l<2*n;l++){
		for(int r=l+1;r<=2*n;r+=2){
			if(c[l][r]==-1) continue;
			dp[l][r]=g[c[l][r]];
			for(int i=l;i<r;i++) (dp[l][r]+=mod-1ll*dp[l][i]*g[c[i+1][r]]%mod)%=mod;
			(ans+=1ll*dp[l][r]*g[2*n-2*k-c[l][r]]%mod)%=mod;
		}
	}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 3072
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <map>
// #include <bits/stdc++.h>
using namespace std;

int main()
{
  char b;
  cin >> b;
  map<char, char> m;
  m['A'] = 'T';
  m['T'] = 'A';
  m['G'] = 'C';
  m['C'] = 'G';
  cout << m[b] << endl;
  return 0;
}

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



ll dp[1<<16];
ll a[16][16];
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];

    for (int msk = 1; msk < (1 << n); msk++)
    {
        if (__builtin_popcount(msk) == 1) continue;
        vector <int> b;
        ll sm = 0;
        for (int i = 0; (1<<i) <= msk; i++)
        {
            if (!((1<<i)&msk)) continue;
            for (auto j : b){
                sm += a[i][j];
            }
            b.push_back(i);
        }
        dp[msk] = max(0LL, sm);
        for (int sbm = msk; sbm > 0; sbm = (sbm - 1) & msk)
        {
            if (sbm == msk) continue;
            dp[msk] = max(dp[msk], dp[sbm] + dp[msk^sbm]);
        }
    }
    cout << dp[(1<<n)-1];

    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> v;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		v.push_back(x);
	}
	sort(v.begin(), v.end());
	cout<<v[n/2]-v[n/2-1];
	return 0;
}

Measured memory_bytes: 892
#include <stdio.h>

int main(){
    int matrixA[101][101];
    int matrixB[101][101];
    double matrixC[101][101];
    int n,m,l;
    int i,j,k;
    
    /*initialize matrix*/
    for(i=0; i<101; i++){
        for(j=0; j<101; j++){
            matrixA[i][j] = 0;
            matrixB[i][j] = 0;
            matrixC[i][j] = 0;
        }
    }
    
    /*Input matrixA*/
    scanf("%d %d %d", &n, &m, &l);
    for(i=0; i<n; i++){
        getchar();
        for(j=0; j<m; j++){
            scanf("%d", &matrixA[i][j]);
        }
    }
    /*Input matrixB*/
    for(i=0; i<m; i++){
        getchar();
        for(j=0; j<l; j++){
            scanf("%d", &matrixB[i][j]);
        }
    }
    /*multi matrix*/
    for(i=0; i<n; i++){
        for(j=0; j<l; j++){
            for(k=0; k<m; k++){
                matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
            }
        }
    }
    /*print multiplication of matrix*/
    for(i=0; i<n; i++){
        for(j=0; j<l; j++){
            if(j != l-1) printf("%.0lf ", matrixC[i][j]);
            else printf("%.0lf", matrixC[i][j]);
        }
        printf("\n");
    }
    
}



Measured memory_bytes: 2064
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 19;

int n, m, k;
void solve(int test)
{
  int a, b;
  cin >> a >> b;
  int ans = 0, cur = 1;
  while (cur < b) {
    cur += a - 1;
    ++ans;
  }
  cout << ans << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.TreeSet;

public class Main {

    int N;
    TreeSet<Integer> set;

    public void solve() {
        N = nextInt();
        set = new TreeSet<>();
        for(int i = 0;i < N;i++){
            int a = nextInt();

            if (set.contains(a)) {
                set.remove(a);
            } else {
                set.add(a);
            }
        }

        out.println(set.size());
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 41388
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        
        Scanner sc = new Scanner(System.in);

        long x = sc.nextInt();

        long memx=0;
        long memy=0;
        for(long i=1; i<=200; i++){
            boolean flag = false;
            for(long j= -200; j<=200; j++){
                if(i*i*i*i*i - j*j*j*j*j == x){
                    memx = i;
                    memy = j;
                    flag = true;
                    break;
                }
            }
            if(flag)break;
        }
        System.out.println(memx + " " + memy);
    }
}

Measured memory_bytes: 38728
#include <iostream>

using namespace std;

class Point{
public:
	double x;
	double y;
};


int isTriangleOutside(Point p1, Point p2, Point p3, Point p4){
	  double r1,r2,r3;
	  
   	  r1 = (p2.x-p1.x)*(p4.y-p1.y) - (p4.x-p1.x)*(p2.y-p1.y);
   	  r2 = (p3.x-p2.x)*(p4.y-p2.y) - (p4.x-p2.x)*(p3.y-p2.y);
   	  r3 = (p1.x-p3.x)*(p4.y-p3.y) - (p4.x-p3.x)*(p1.y-p3.y);
   
   	  if(r1>0&&r2>0&&r3>0 || r1<0&&r2<0&&r3<0){
   	      return 0;
   	  }else{
   	  	  return 1;
   	  }
}


int main(void){
   
   Point pa,pb,pc,pd;
   char c;
   int r1,r2,r3,r4;
   
   while(cin>>pa.x>>c>>pa.y>>c>>pb.x>>c>>pb.y>>c>>pc.x>>c>>pc.y>>c>>pd.x>>c>>pd.y){
   	
   	  r1 = 	isTriangleOutside(pa,pb,pc,pd);
   	  r2 = 	isTriangleOutside(pb,pc,pd,pa);
   	  r3 = 	isTriangleOutside(pc,pd,pa,pb);
   	  r4 = 	isTriangleOutside(pa,pb,pd,pc);
   	  
	  if(r1==1 && r2==1 && r3==1 &&r4==1){
   	      cout<<"YES"<<endl;
   	  }else{
   	  	  cout<<"NO"<<endl;
   	  }

   }
   
   return 0;
}


Measured memory_bytes: 3056
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i =0; i < n ;i++)
using namespace std;

int main(){
    
    int D , N;
    cin >> D>> N;
    long long ans = 0;
    if (D==0){
        ans = N;
        if (N==100) ans += 1; 
    }
    else if (D==1){
        ans = 100 *N;
        if (N==100) ans += 100; 
    }

    else if (D==2){
        ans = 10000 *N;
        if (N==100) ans += 10000; 
    }


    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
abs = (N - 1).times.map { gets.split.map(&:to_i) }
graph = Array.new(N) { [] }
abs.each.with_index do |(a, b), i|
  a -= 1
  b -= 1
  graph[a].push([b, i])
  graph[b].push([a, i])
end

def dfs(graph, s)
  ans = Array.new(N - 1)
  queue = [[s, nil, nil]]
  while !queue.empty?
    u, parent, c = queue.shift
    new_c = 1
    graph[u].each do |(v, i)|
      next if v == parent
      new_c += 1 if new_c == c
      ans[i] = new_c
      queue.push([v, u, new_c])
      new_c += 1
    end
  end
  ans
end
ans = dfs(graph, 0)
count = ans.max
puts count
ans.each do |c|
  puts c
end


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

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var N = long.Parse(Console.ReadLine());
            var C = new List<long>();
            while(N != 1) {
                if(N %2 == 0) {
                    C.Add(2);
                    N /= 2;
                    continue;
                }
                for(var i = 3;i<=N/i;i += 2) {
                    if(N % i == 0) {
                        C.Add(i);
                        N /= i;
                        i -= 2;
                    }
                }
                C.Add(N);
                N /= N;
            }
            var tmp = C.GroupBy(_ => _).Where(x => x.Count() > 0).Select(x => x.Count()).ToList();
            var ans = 0;
            for(var t = 0;t<tmp.Count();t++) {
                for(var i = 1; i <= tmp[t]; i++) {
                    if(tmp[t] - i >= 0) {
                        ans++;
                        tmp[t] -= i;
                    }
                }
            }
            Console.Write(ans);
        }
    }
}

Measured memory_bytes: 28456
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def lcm(x,y):
    return (x*y) // gcd(x,y)
A,B,C,D =  list(map(int,input().split(" ")))
CD = lcm(C,D)
 
divisibleC = B // C - (A-1)//C
divisibleD = B // D - (A-1) // D
divisibleCD = B//CD - (A-1)//CD 
divisible = divisibleC +divisibleD - divisibleCD
numbers = B-A + 1
print(numbers -divisible )

Measured memory_bytes: 38496
def B():
    S = list(input())
    N = len(S)
    for i in range(N):
        for j in range(i, N):
            this_s = S[0:i] + S[j:N]
            if this_s == ['k', 'e', 'y', 'e', 'n', 'c', 'e']:
                ans = 1
                break
            else:
                ans = 0
        if ans:
            break
    if ans:
        print("YES")
    else:
        print("NO")
B()

Measured memory_bytes: 3060
#include <cassert>
#include <iostream>
#include <string>

using namespace std;

int main() {
  string line;
  cin >> line;
  assert(line.size() == 4);
  for (auto i = 0u; i < line.size() - 1; ++i) {
    if (line[i] == line[i + 1]) {
      cout << "Bad";
      return 0;
    }
  }
  cout << "Good";
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    size_t A,B,C,D,P,Cost_X,Cost_Y = 1;
    cin >> A >> B >> C >> D >> P;
    
    Cost_X = A*P;
    
    Cost_Y = B;
    if(P > C){
        P -= C;
        Cost_Y += P*D;
    }
    
    if(Cost_X < Cost_Y){
        cout << Cost_X << "\n";
    }else{
        cout << Cost_Y << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 3144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	/** 入力される数値の数 */
	private static final int NUMBER_OF_INPUT = 2;

	/** 入力される数値のインデックス（小） */
	private static final int INDEX_LITTLE = 0;

	/** 入力される数値のインデックス（大） */
	private static final int INDEX_GREAT = 1;

	/**
	 * 空白区切りの2つの数字を受け取り、その2つの数字の合計値の桁数を出力する。
	 *
	 * @param args
	 */
	public static void main(String[] args) throws IOException {

		// 入力がある限り処理を行う
		String line = null;
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		while ((line = reader.readLine()) != null) {

			// 入力文字列を数値配列に変換する
			int[] input = convertStringToIntArray(line);

			// 合計値の桁数を取得する
			Arrays.sort(input);
			int greatestCommonDivisor = calculateGreatestCommonDivisor(input);
			int leastCommonMultiplyer = calculateLeastCommonMultiplyer(input, greatestCommonDivisor);

			// 結果を出力する
			System.out.print(greatestCommonDivisor);
			System.out.print(" ");
			System.out.println(leastCommonMultiplyer);
		}

		if (reader != null) {
			reader.close();
		}
	}

	/**
	 * 空白区切りの数値を取得し、整数の配列として返却する。
	 *
	 * @param line
	 *            空白区切りの数値文字列
	 * @return 整数の配列
	 */
	protected static int[] convertStringToIntArray(String line) {
		int[] result = new int[NUMBER_OF_INPUT];

		String[] splittedLine = line.split(" ");
		for (int i = 0; i < splittedLine.length; i++) {
			result[i] = Integer.parseInt(splittedLine[i]);
		}

		return result;
	}

	/**
	 * 引数で渡された整数配列の最大公約数を返す。
	 *
	 * @param input
	 *            整数の配列
	 * @return 最大公約数
	 */
	protected static int calculateGreatestCommonDivisor(int[] input) {

		// ユークリッドの互除法
		int greater = input[INDEX_GREAT];
		int less = input[INDEX_LITTLE];
		int divisor = greater - less;

		while (divisor != 0) {

			// 大きい方の値を greater に、小さい方の値を less に設定する
			if (less >= divisor) {
				greater = less;
				less = divisor;
			} else {
				greater = divisor;
			}
			divisor = greater - less;
		}

		// 最後のひとつ前の値が最大公約数
		return less;
	}

	/**
	 * 引数で渡された整数配列と最大公約数から最小公倍数を返す。
	 *
	 * @param input
	 *            整数の配列
	 * @param greatestCommonDivisor
	 * 			  最大公約数
	 *
	 * @return 最小公倍数
	 */
	protected static int calculateLeastCommonMultiplyer(int[] input, int greatestCommonDivisor) {

		// 最小公倍数 = 入力値A × 入力値B / 最大公約数
		// 最終結果は int の範囲に収まるが、先に割り算しておかないと int の範囲を超える可能性がある
		int leastCommonMultiplyer = input[INDEX_LITTLE] * (input[INDEX_GREAT]
				/ greatestCommonDivisor);
		return leastCommonMultiplyer;

	}

}

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

int main()
{
	long long n, m; cin >> n >> m;

	const long long mod = 1000000007LL;

	if (m < n) swap(n, m);

	if (2 <= m - n) {
		cout << 0 << endl;
		return 0;
	}

	long long tmp;

	if (n == m) {
		tmp = 2;
	}
	else { // n + 1 = m
		tmp = 1;
	}

	while (true) {
		tmp *= m;
		tmp = tmp % mod;
		tmp *= n;
		tmp = tmp % mod;

		if (m == 1LL && n == 1LL) {
			break;
		}
		m = max(m - 1, 1LL);
		n = max(n - 1, 1LL);
	}
	
	cout << tmp << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()

yes = True
while S != "":
    if S.endswith('dream'):
        S = S[:-5]
    elif S.endswith('dreamer'):
        S = S[:-7]
    elif S.endswith('erase'):
        S = S[:-5]
    elif S.endswith('eraser'):
        S = S[:-6]
    else:
        yes = False
        break
if yes:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
import java.util.Scanner;

  public class Main {
    public static void main(String args[]){

      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
 
      int max = a+b;
       max = Math.max(max,a-b);
       max = Math.max(max,a*b);

    System.out.println(max);
    }
  }

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var N = str[0];
            var M = str[1];

            long[][] pair = new long[M][];
            for(int i = 0; i < M; i++)
            {
                var hoge = IO.GetLongList();
                pair[i] = new long[4];
                pair[i][0] = hoge[0];
                pair[i][1] = hoge[1];
                pair[i][2] = i;
            }
            long[] P = Enumerable.Repeat((long)1, N).ToArray();
            pair = pair.OrderBy(p => p[1]).ToArray();
            for(int i = 0; i < M; i++)
            {
                pair[i][3] = P[pair[i][0]-1];
                P[pair[i][0]-1]++;
            }
            pair = pair.OrderBy(p => p[2]).ToArray();
            for(int i = 0; i < M; i++)
            {
                long num = 1000000000000 + pair[i][0] * 1000000 + pair[i][3];
                string ans = num.ToString();
                ans = ans.Substring(1, ans.Length - 1);
                Console.WriteLine(ans);
            }

            //Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 35500
#include <stdio.h>
int main(void){
char s[105];
  int count=0;
  int hoji;
  scanf("%s",&s);
  for(count=0;;count++){
  if(s[count]=='C'){hoji=count;break;}
  if(s[count]=='\0'){printf("No"); return 0;}
  }
  
  for(hoji=count;s[hoji]!='\0';hoji++){
  if(s[hoji]=='F'){printf("Yes");return 0;}
  }
  printf("No");
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
typedef long long ll;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    cout << pow(N, 3) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1e9+7
#define hell2 1e9+9
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cout << (#x) << " is " << (x) << endl
#define INF 1e9

using namespace std;

ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;
}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 

// max({a, b, c, d})

vector<ll>adj[200005];
ll update[200005];
ll ans[200005];

int binaryToDecimal(string n) 
{ 
    string num = n; 
    int dec_value = 0; 
  
    // Initializing base value to 1, i.e 2^0 
    int base = 1; 
  
    int len = num.length(); 
    for (int i = len - 1; i >= 0; i--) { 
        if (num[i] == '1') 
            dec_value += base; 
        base = base * 2; 
    } 
  
    return dec_value; 
} 

bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 

int main()
{
    ll n, l;
    cin >> n >> l;

    ll a[n];
    for(int i=0;i<n;i++)
        a[i] = i+1;

    ll f[n], sum = 0;
    for(int i=0;i<n;i++)
    {
        f[i] = l+i;
        // see(f[i]);
        sum += f[i];
    }

    if(f[0] == 0) cout << sum << "\n";
    else if(f[0] > 0) cout << sum-f[0] << "\n";
    else if(f[0] < 0 && f[n-1] < 0) cout << sum-f[n-1] << "\n";
    else if(f[0] < 0 && f[n-1] > 0) cout << sum << "\n";
    else cout << sum << "\n";
}




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

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

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

#define PI 3.141592653589793

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	long x, y;
	cin >> x >> y;
	cout << (abs(x - y) > 1 ? "Alice" : "Brown") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
map<ll,ll>mp;
ll n,m,x,mi;
int main()
{
	cin>>n>>m;
	cin>>mi;
	for(int i=1;i<n;i++)
	{
		cin>>x;
		mp[x-mi]++;
		mi=min(mi,x);
	}
	ll pnt;
	for(map<ll,ll>::iterator it=mp.begin();it!=mp.end();it++)pnt=it->second;
	cout<<pnt<<endl;
	return 0;
}

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

int main() {
    int N = 0;
    cin >> N ;
    vector<double> A(N);
    double sum = 0;
    for (int i = 0; i < N ; i++){
        cin >> A.at(i);
        sum += 1 / A.at(i);
    }
    
    cout << 1 / sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	string s;
	cin >> s;
	bool x[26] = {};
	for (auto c : s) {
		x[c - 'a'] = true;
	}
	for (size_t i = 0; i < 26; ++i) {
		if (!x[i]) {
			cout << static_cast<char>(i + 'a');
			return 0;
		}
	}
	cout << "None";
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9)
			System.out.println("hon");
		if(N%10==0||N%10==1||N%10==6||N%10==8)
			System.out.println("pon");
		if(N%10==3)
			System.out.println("bon");
	}
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int sf[1010];

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    priority_queue< P, vector<P>, greater<P> > que;
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        que.push({x, y});
    }
    while (que.size()) {
        P p = que.top(); que.pop();
        sf[p.first]++;
        sf[p.second]--;
    }
    int tmp = 0;
    rep(i, b) {
        tmp += sf[i];
        if (i >= a) {
            if (tmp >= 1) {
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}

Measured memory_bytes: 3096
import java.util.Scanner;

public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(a<b){
            if(b<c){
                System.out.printf("%d %d %d\n",a,b,c);
            }else{
                if(a>c){
                    System.out.printf("%d %d %d\n",c,a,b);
                }else{
                    System.out.printf("%d %d %d\n",a,c,b);
                }
            }
            }
            else{
                if(a<c){
                    System.out.printf("%d %d %d\n",b,a,c);
                }else{
                    if(b>c){
                        System.out.printf("%d %d %d\n",c,b,a);
                    }else{
                        System.out.printf("%d %d %d\n",b,c,a);
                    }
                }
            }
            }
        
        }
    


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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

#define MAX_N 1000000

signed main() {
	ll n; cin >> n;
	vector<ll> v(201, INF);
	vector<ll> p(4),t(4);
	rep(i, 4)cin >> p[i];
	rep(i, 4)cin >> t[i];
	v[0] = 0;
	ll ans = INF;
	rep(i, 101) {
		if (v[i] == INF) continue;
		rep(j, 4) {
			v[i + t[j]] = min(v[i + t[j]], v[i] + p[j]);
			if (i + t[j] >= n) {
				ans = min(ans, v[i + t[j]]);
			}
		}
	}
	cout << ans << endl;
}


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

int main( void )
{
    string line;
    long long a, b, n;
    while ( getline( cin, line ) ) {
        istringstream is( line );
        is >> a >> b >> n;
        a %= b;
        
        long long sum = 0;
        for ( long long i = 0; i < n; i++ ) {
            a *= 10;
            sum += a / b;
            a %= b;
        }

        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
/* テンプレートここまで */

int main() {
  int n, k; cin >> n >> k;
  if(n%k == 0) cout << 0 << endl;
  else cout << 1 << endl;
}


Measured memory_bytes: 256