akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).ok();
    let mut it = input.trim().split_whitespace();
    let a:u8 = it.next().unwrap().parse().unwrap();
    let b:u8 = it.next().unwrap().parse().unwrap();
    if a <= 8 && b <= 8 {println!("Yay!")} else {println!(":(")}
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
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 main(){
	int cnt = 1;
	while(1){
		int n;
		cin >> n;
		if(n==0) break;/*break while roop*/
		cout << "Case " << cnt << ": " << n << endl;
		cnt++;
	}
	/*
	int n;
	int cnt = 0;
	while(cin >> n,n){
		cout << "Case " << cnt << ": " << n << endl;
		cnt++;
	}
	*/
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
int main(void)
{
	ll a,b;
	scanf("%lld%lld",&a,&b);
	ll sum=a*b;
	if(a==1||b==1)
	{
		sum=1;
	}
	printf("%lld",(sum+1)/2);
}

Measured memory_bytes: 256
n = int(input())
ans = [0]*(n+1)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            ni = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if ni <= n:
                ans[ni] += 1
for i in range(1, n+1):
    print(ans[i])



Measured memory_bytes: 68944
#include <iostream>
using namespace std;
string text;
int i,n;
int main(){
	while(getline(cin,text)){
		n=1;
		while(n!=27){
			i=0;
			while(i!=text.size()){
				if('a'<=text[i]&&text[i]<'z'){
					text[i]+=1;
				}else if(text[i]=='z'){
					text[i]='a';
				}
				i++;
			}
			if(text.find("the")!=-1)break;
			if(text.find("this")!=-1)break;
			if(text.find("that")!=-1)break;
			n++;
		}
		cout <<text<<endl;
	}
	return 0;
}

Measured memory_bytes: 3136
#include "bits/stdc++.h"
using namespace std;

int main(){
 int n;
 cin >>n;
 vector<int>a(n);
 for(int i=0;i<n;i++){
     cin >>a.at(i);
 }
 int ans =1;
 int che =a.at(0);
 for(int i=1;i<n;i++){ 
    if(che<=a.at(i)&&a.at(i-1)<=a.at(i)){
        ans++;
        che = max(che,a.at(i));
    }
 }
 cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

bool ee(int mod[]) {
  return mod[1] == 0 && mod[2] == 0 && mod[3] == 0;
}

bool eo(int mod[], int e) {
  return mod[1] == 0 && mod[3] == 0 && mod[2] <= e / 2;
}

bool oo(int mod[], int x, int y) {
  if(mod[1] == 0 && mod[3] == 1) {
      mod[2]++;
  } else if(!(mod[1] == 1 && mod[3] == 0)) {
    return false;
  }
  return mod[2] <= x / 2 + y / 2;
}

int main() {
  ios::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;
  int count[26] = {};
  REP(i,0,H) {
    string s;
    cin >> s;
    FOR(c,s) {
      count[c-'a']++;
    }
  }
  int mod[4] = {};
  REP(i,0,26) {
    mod[count[i] % 4]++;
  }
  bool ans;
  if(H % 2 == 0 && W % 2 == 0) {
    ans = ee(mod);
  } else if(H % 2 == 1 && W % 2 == 1) {
    ans = oo(mod, H, W);
  } else if(H % 2 == 1) {
    ans = eo(mod, W);
  } else {
    ans = eo(mod, H);
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern

 


signed main() {    
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    
   string s;
   cin >> s;
   if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R'){
		cout<<3;
   }
   else if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')){
		cout<<2;
   }
   else if(s[0] == 'R' || s[1] == 'R'  || s[2] == 'R'){
	   cout<<1;
   }
   else{
	   cout<<0;
   }
    
    
	
	 
    return 0;
}


Measured memory_bytes: 3648
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
  int x, y;
  
  cin >> x >> y;
  
  int flg = 0;
  
  for(int i = 0; i <= x; i++){
    if(y == (2*i + 4*(x-i)))
      flg = 1;
  }
  
  if(flg == 1)
    printf("Yes");
  
  else
    printf("No");
  
  
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}


Measured memory_bytes: 3764
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::*;
//use std::collections::*;
use std::cmp::*;
// use std::num;
fn main() {
    input! {N:usize, A:[i64;N]}
    let inf = std::i64::MIN / 2;
    let mut ans = inf;
    let mut dp = vec![vec![vec![inf; 2]; 2]; N];
    dp[0][0][1] = A[0];
    dp[1][0][0] = A[0];
    dp[1][0][1] = A[1];
    // dp[i][j] i番目までのうち、((i+1)/2)-j 個選んでいるときの最大値。
    for i in 2..N {
        let k = (i + 1) / 2;
        if i & 1 == 1 {
            // 奇数番目(偶数個)で、半分選び、i番目を選ばないケース
            dp[i][0][0] = dp[i - 1][0][1];
            // 奇数番目(偶数個)で、半分選び、i番目を選ぶケース
            dp[i][0][1] = dp[i - 1][1][0] + A[i];
            // 奇数番目(偶数個)で、半分-1個選び、i番目を選ばないケース
            dp[i][1][0] = max(dp[i - 1][1][0], dp[i - 1][1][1]);
        // 奇数番目(偶数個)で、半分-1個選び、i番目を選ぶケース
        // その後条件を満たさないので考慮扶養。
        } else {
            // 偶数番目目(奇数個)
            // (i+1)/2 個選び、i番目を選ばないケース
            // 無理
            // (i+1)/2 個選び、i番目を選ぶケース
            dp[i][0][1] = dp[i - 1][0][0] + A[i];
            // (i+1)/2-1 個選び、i番目を選ばないケース
            dp[i][1][0] = max(dp[i - 1][0][0], dp[i - 1][0][1]);
            // (i+1)/2-1 個選び、i番目を選ぶケース
            dp[i][1][1] = dp[i - 1][1][0] + A[i];
            if i == 2 {
                dp[i][1][1] = A[i];
            }
            // (i+1)/2-2 個選び、i番目を選ばないケース
            // dp[i][2][0] = max(dp[i - 1][1][0], dp[i - 1][1][1]);
            // (i+1)/2-2 個選び、i番目を選ぶケース
            // 無理 dp[i][2][1] = dp[i - 1][2][0] + A[i];
        }
    }
    //println!("{:?}", dp);
    if N & 1 == 0 {
        ans = max(dp[N - 1][0][0], dp[N - 1][0][1]);
    } else {
        ans = max(dp[N - 1][1][0], dp[N - 1][1][1]);
    }

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


Measured memory_bytes: 35516
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using P = std::pair<int, int>;

int N;
int A[100010];
std::vector<P> ps;
std::vector<P> mani;
int sum = 0;

int main()
{
  scanf( "%d", &N );
  rep( i, N )
  {
    scanf( "%d", A+i );

    ps.push_back( P( A[i], i+1 ) );
  }

  std::sort( all(ps) );

  repi( i, 1, N-1 )
    sum += abs(ps[i].first);

  sum += ps[N-1].first-ps[0].first;

  int ma = ps[N-1].second, mi = ps[0].second;
  int zero = std::lower_bound( all(ps), P( 0, -1 ) )-ps.begin();
  if( !zero )
    ++zero;
  if( zero == N )
    --zero;

  int miV = A[mi-1], maV = A[ma-1];
  for( int i = zero; i < N-1; ++i )
  {
    mani.push_back( P( miV, ps[i].first ) );

    miV -= ps[i].first;
  }

  mani.push_back( P( maV, miV ) );
  maV -= miV;
  for( int i = 1; i < std::min(zero, N-1); ++i )
  {
    mani.push_back( P( maV, ps[i].first ) );
    
    maV -= ps[i].first;
  }

  printf( "%d\n", sum );
  rep( i, mani.size() )
    printf( "%d %d\n", mani[i].first, mani[i].second );

  return 0;
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
    int a, b, c;
	cin >> a >> b >> c;

	if(c >= a && c <= b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
int main() {
    int A, B, C, K; cin >> A >> B >> C >> K;
    rep(i, K) {
        if (A >= B)B *= 2;
        else if (B >= C)C *= 2;
        else C *= 2;
    }
    cout << (A < B && B < C? "Yes":"No") << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)



struct modCalc{
	int mod;
	int n;
	vector<int> fact,invfact;
	modCalc(){};

	modCalc(int _mod,int _n){
		mod=_mod,n=_n;
		fact.resize(n+1,1);
		invfact.resize(n+1,1);

		for(int i=0;i<n;i++)fact[i+1]=fact[i]*(i+1)%mod;
		invfact[n]=minv(fact[n]);
		for(int i=n;i>1;i--)invfact[i-1]=invfact[i]*i%mod;
	};

	int mpwr(int x,int n){
		int ret=1;
		while(n>0){
			if(n&1)(ret*=x)%=mod;
			(x*=x)%=mod;
			n>>=1;
		}
		return ret;
	}
	int minv(int x){
		return mpwr(x,mod-2);
	}
	int nCm(int x,int y){
		if(y==0)return 1;
		else return fact[x]*invfact[y]%mod*invfact[x-y]%mod;
	}
	int nPm(int x,int y){
		return fact[x]*invfact[x-y]%mod;
	}
};

	int n,a,b,c;
	int mod=1e9+7;

int prbM(int m){
	static modCalc mc(mod,max(2*n,100ll));
	int inv100=mc.minv(100);
	int a0=a*mc.minv(a+b)%mod;
	int b0=b*mc.minv(a+b)%mod;
	int ret1=mc.nCm(m-1,n-1)*m %mod *(mc.mpwr(a0,n)*mc.mpwr(b0,m-n) %mod +mc.mpwr(b0,n)*mc.mpwr(a0,m-n)%mod)%mod;
	return ret1 *100 %mod * mc.minv(100-c) % mod;

}


signed main() {
	cin>>n>>a>>b>>c;
	int ret=0;
	for(int m=n;m<=2*n-1;m++){(ret+=prbM(m))%=mod;}
	cout<<ret<<endl;



}


Measured memory_bytes: 3456
import sys

lines = sys.stdin.readlines()

n = int(lines[0])
lines = lines[1:]
lines = [line.strip() for line in lines]
tmp = []
for line in lines:
    x = line[0]
    x += line[-1]
    tmp.append(x)

base = 0
for line in lines:
    base += line.count('AB')

# print(base)
ab = ba = ""
astart = aend = bstart = bend = 0
for line in tmp:
    if line[0] == 'A' and line[-1] == 'B':
        ab += line
    elif line[0] == 'B' and line[-1] == 'A':
        ba += line
    elif line[-1] == 'A':
        astart += 1
    elif line[0] == 'B':
        bstart += 1


# create ans
base += ba.count('AB')
if ba != "":
    if astart > 0:
        base += 1
        astart -= 1
    if bstart > 0:
        base += 1
        bstart -= 1

# do this later
base += min(astart, bstart)
print(base)





Measured memory_bytes: 45644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int n, m, k, ans, mod=1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int i, j, temp=0;
	cin>>n>>m>>k;
	cout<<(k-1)/max(n, m)+1;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a.at(i);
    }
    int next = 1;
    int answer = 0;
    for(int i=0;i<N+1;i++){
        next = a.at(next-1);
        answer++;
        if(next == 2){
            break;
        }
        if(i==N){
            answer = -1;
            break;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 768
use proconio::input;

fn main() {
    input! {
        n: i64,
    }

    let mut v = vec![1i64; n as usize + 1];

    for i in 2..=n {
        for j in 1.. {
            if i * j > n {
                break;
            }

            v[(i * j) as usize] += 1;
        }
    }

    // dbg!(&v);

    let mut ans = 0;
    for i in 1..=n {
        ans += i * v[i as usize];
    }
    println!("{}", ans);
}


Measured memory_bytes: 80196
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int main() {
    long long a,b;
    cin >> a >> b;
    if(a%2==b%2){
        cout << (a+b)/2 << endl;
    }
    else
        cout << "IMPOSSIBLE\n" << endl;
    return 0;
}


Measured memory_bytes: 256
a=str(input())
b=str(input())
c=""
for i in range(len(a)):
    if a[i]==0:
        if a==b:
            c="Yes"
            break
        else:
            c="No"
    elif a[i]==b:
        if a[i]+a[j:len(a)]==b:
            c="Yes"
            break
        else:
            c="No"
    else:
        if a[i:len(a)]+a[0:i]==b:
            c="Yes"
            break
        else:
            c="No"
print(c)

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

int M;
struct Point{
    double x, y;
};

int rec(Point start, Point end, int i){
    if(i == M){
	return 0;
    }
    Point p1, p2, p3;
    p1.x = (2 * start.x + end.x) / 3;
    p1.y = (2 * start.y + end.y) / 3;
    p3.x = (start.x + 2 * end.x) / 3;
    p3.y = (start.y + 2 * end.y) / 3;

    p2.x = (p3.x - p1.x) * std::cos(M_PI / 3) - (p3.y - p1.y) * std::sin(M_PI / 3) + p1.x;
    p2.y = (p3.x - p1.x) * std::sin(M_PI / 3) + (p3.y - p1.y) * std::cos(M_PI / 3) + p1.y;

    rec(start, p1, i+1);
    std::cout << p1.x << " " << p1.y << std::endl;
    rec(p1, p2, i+1);
    std::cout << p2.x << " " << p2.y << std::endl;
    rec(p2, p3, i+1);
    std::cout << p3.x << " " << p3.y << std::endl;
    rec(p3, end, i+1);
    
    
}

int main(void){
    Point start, end;
    start.x = 0;
    start.y = 0;
    end.x = 100;
    end.y = 0;

    std::cin >> M;

    std::cout << start.x << " " << start.y << std::endl;
    rec(start, end, 0);
    std::cout << end.x << " " << end.y << std::endl;

    return 0;
}



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

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

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (to_string(i).length() % 2 == 1) {
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
A, B, C = map(int, raw_input().split())

init = [A, B, C]
current = [A, B, C]

if A & 1 or B & 1 or C & 1:
    print(0)
elif (A == B and B == C):
    print(-1)
else:
    answer = 0
    while True:
        answer += 1
        a = current[0] / 2
        b = current[1] / 2
        c = current[2] / 2
        current = [b + c, a + c, b + c]
        if current[0]&1 or current[1]&1 or current[2]&1:
            break
    print(answer)


Measured memory_bytes: 2568
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
lli nCr(lli n, lli r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N >> K;
  A=0;
  B=N;
  rep(i,0,N+1){
    if(i>=K-1)sum+=B-A+1;
    //Out(A);
    //Out(B);
    A+=i+1;
    B+=N-i-1;
    sum%=mod;
    A%=mod;
    B%=mod;
    //Out(sum);
  }
  Out((sum+mod)%mod);
}

Measured memory_bytes: 3656
import java.util.HashMap;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    HashMap<Integer, Integer> freq = new HashMap<>();
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      freq.put(a, freq.getOrDefault(a, 0) + 1);
    }

    int count = 0;
    int numEven = 0;
    for (int f : freq.values()) {
      count += f / 2;
      if (f % 2 == 0) numEven++;
    }
    count -= numEven / 2;
    System.out.println(N - count * 2);
  }
}


Measured memory_bytes: 60716
//#include "pch.h"
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	ll x;

	cin >> x;

	ll sum = (x / 500) * 1000;
	x %= 500;
	sum += (x / 5 ) * 5;
	cout << sum << endl;



	return 0;
}

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

int main() {
    int n,m,d,i=0,j=0;
    cin>>n;
    int xnAll[n+1];
    xnAll[n]=2020;
    while(i<n){
        cin>>d;
        xnAll[i]=d;
        i++;
    }
    cin>>m;
    while(j<m){
        cin>>d;
        if(xnAll[d-1]+1!=xnAll[d]){
            xnAll[d-1]++;
        }
        j++;
    }
    for (int k = 0; k < n; k++)
    {
        cout << xnAll[k] << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
/*
        @uthor: Kashish Gilhotra
        user: CodeChef, CodeForces, HackerEarth, HackerRank, SPOJ: kashish001
*/

#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
  
#define int long long int 
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vpi;

double EPS = 1e-9; 
int INF = 1000000005; 
long long INFF = 1000000000000000005LL;
const int mod = 1e9 + 7; 

//#define CI cpp_int
string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << to_string(H) << " " ;
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define EB emplace_back
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define size(v) (int)v.size() 
#define endl "\n"
#define UMO unordered_map
#define USO unordered_set
#define setBits(n) __builtin_popcountll(n)
#define MX *max_element
#define MN *min_element
#define TC int t; cin >> t; while (t--) 

void Panda() {
    int a, b;
    cin >> a >> b;
    if((a == 1 and b == 2) or (a == 2 and b == 1)) cout << 3 << endl;
    else if((a == 1 and b == 3) or (a == 3 and b == 1)) cout << 2 << endl;
    else if((a == 2 and b == 3) or (a == 3 and b == 2)) cout << 1 << endl;
}
  
int32_t main() {
 
    FAST;

   
    
    Panda();

    return 0; 
} 

Measured memory_bytes: 3656
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1 = Counter(v[::2])
v2 = Counter(v[1::2])
E = v1.most_common()
O = v2.most_common()
if E[0][0] == O[0][0]:
    tmp1 = E[1][1] if len(E) > 1 else 0
    tmp2 = O[1][1] if len(O) > 1 else 0
    ans = min(n-E[0][1]-tmp2, n-tmp1-O[0][1])
else:
    ans = n-E[0][1]-O[0][1]
print(ans)

Measured memory_bytes: 21180
H,W = map(int,input().split())
a = [input() for i in range(H)]

y = [False]*H
x = [False]*W

for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            y[i] = True
            x[j] = True
            
for i in range(H):
    if y[i] == True:
        for j in range(W):
            if x[j] == True:
                print(a[i][j],end="")
        print()

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

int main() {
  int w,h,n; cin>>w>>h>>n;
  int maxx=w,maxy=h,minx=0,miny=0;
  for(int i=0;i<n;i++){
    int x,y,a; cin>>x>>y>>a;
    if(a==1){
      if(x>minx) minx=x;
    }
    if(a==2){
      if(x<maxx) maxx=x;
    }
    if(a==3){
      if(y>miny) miny=y;
    }
    if(a==4){
      if(y<maxy) maxy=y;
    }
  }
  if(maxx-minx<=0 ||maxy-miny<=0){
    cout<<0<<endl;
  }
  else cout<<(maxx-minx)*(maxy-miny)<<endl;
}
    
  

    
  


Measured memory_bytes: 256
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<math.h>
#include<list>
#include<complex>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vtype(type) vector<type>
#define vvtype(type) vector<vector<type>>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;

ll const MAX = 105;
vll a(MAX);

int main() {
	ll n, m;
	cin >> n >> m;
	REP(i, 1, m) {
		cin >> a[i];
	}
	if (n == 1) {
		cout << 1 << endl << 1 << endl << 1 << endl;
		return 0;
	}
	ll odd = 0;
	vll odd_ad(MAX);
	REP(i, 1, m) {
		if (a[i] % 2 == 1) {
			odd++;
			odd_ad[odd] = i;
		}
	}
	if (n % 2 == 0) {
		if (odd == 0) {
			REP(i, 1, m) {
				cout << a[i];
				if (i < m) {
					cout << " ";
				}
			}
			cout << endl;
			if (a[1] == n) {
				cout << 2 << endl << n - 1 << " " << 1 << endl;
			}
			else {
				cout << m << endl << a[1] - 1 << " ";
				REP(i, 2, m - 1) {
					cout << a[i] << " ";
				}
				cout << a[m] + 1 << endl;
			}
		}
		else if (odd == 2) {

			swap(a[1], a[odd_ad[1]]);
			swap(a[m], a[odd_ad[2]]);
			REP(i, 1, m) {
				cout << a[i];
				if (i < m) {
					cout << " ";
				}
			}cout << endl;

			if (a[m] == 1) {
				cout << m - 1 << endl;
				cout << a[1] + 1 << " ";
				REP(i, 2, m - 1) {
					cout << a[i];
					if (i < m - 1) {
						cout << " ";
					}
				}
				cout << endl;
			}
			else {
				cout << m << endl;
				cout << a[1] + 1 << " ";
				REP(i, 2, m - 1) {
					cout << a[i] << " ";
				}
				cout << a[m] - 1 << endl;
			}
		}
		else {
			cout << "Impossible" << endl;
		}
	}
	else {
		if (m == 1) {
			cout << n << endl;
			cout << 2 << endl;
			cout << n - 1 << " " << 1 << endl;
		}
		else if (odd != 1) {
			cout << "Impossible" << endl;
		}
		else {
			swap(a[1], a[odd_ad[1]]);
			REP(i, 1, m) {
				cout << a[i];
				if (i < m) {
					cout << " ";
				}
			}
			cout << endl;
			cout << m << endl;
			cout << a[1] + 1 << " ";
			REP(i,2,m-1){
				cout << a[i] << " ";
			}
			cout << a[m] - 1 << endl;
		}
	}
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b+c==17&&((a==7&&b==5)||(b==7&&a==5)||(a==5&&c==7)))
    cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int n,m,p,f,t;
	int[][] map;
	int[] ticket;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			n = sc.nextInt();
			m = sc.nextInt();
			p = sc.nextInt();
			f = sc.nextInt()-1;
			t = sc.nextInt()-1;
			if( (n|m|p|(f+1)|(t+1)) == 0 ) break;
			ticket = new int[n];
			map = new int[m][m];
			for(int[] a: map) fill(a, INF);
			for(int i=0;i<n;i++) ticket[i] = sc.nextInt();
			for(int i=0;i<p;i++) {
				int a = sc.nextInt()-1;
				int b = sc.nextInt()-1;
				int c = sc.nextInt();
				map[a][b] = map[b][a] = c;
			}
			System.out.println(dijkstra());
		}
	}
	
	String dijkstra() {
		PriorityQueue<Node> que = new PriorityQueue<Node>(1, new MyComp());
		Node now = new Node(f);
		que.add(now);
		double[][] d = new double[m][1<<n];
		for(double[] a: d) fill(a, INF);
		d[f][1<<n-1] = 0;
		
		for(;!que.isEmpty();) {
//			debug(now.now, now.c, now.ticket);
//			debug(now.visited);
			now = que.remove();
			if( now.now == t ) return String.valueOf(now.c);
			for(int i=0;i<m;i++) {
				if(((now.visited>>i)&1 ) == 0 && map[now.now][i] != INF){
					for(int j=0;j<n;j++){
						if(((now.ticket>>j)&1) == 1 ) {
							double w = now.c + (double)map[now.now][i] / ticket[j];
							Node next = new Node(i, now.visited+(1<<i), now.ticket - (1<<j), w);
							if( d[i][now.ticket-(1<<j)] > w ) {
								d[i][now.ticket-(1<<j)] = w;
								que.add(next);
							}
						}
					}
				}	
			}
			
		}
		
		return "Impossible";
	}
	
	class Node implements Comparable<Node> {
		int now;
		double c;
		int visited;
		int ticket;
		Node(int now) {
			this.now = now;
			visited = 1<<now;
			ticket = (1 << n) - 1;
			c = 0;
		}
		
		Node(int now , int visited, int ticket, double c) {
			this.now = now;
			this.visited = visited;
			this.ticket = ticket;
			this.c = c;
		}

		@Override
		public int compareTo(Node o) {
			// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
			if(c-o.c > 0) return 1;
			else if( c -o.c < 0 ) return -1;
			return 0;
		}
		
		public boolean equals(Object o) {
			if( o instanceof Node ) {
				Node n = (Node)o;
				if( visited == n.visited && now == n.now && ticket == n.ticket ) return true;
			}
			return false;
		}
	}
	class MyComp implements Comparator<Node> {

		@Override
		public int compare(Node o1, Node o2) {
			// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
			int ret;
			if( o1.c > o2.c ) ret = 1;
			else if(o1.c < o2.c) ret = -1;
			else ret = 0;
			return ret;
		}
		
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

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

vector<string> ss;

void compair(int i, string s, string t){
  bool fl=true;
  for(int j=0; j<t.size(); j++){
    if(s[i+j]!=t[j] && s[i+j]!='?')fl=false;
  }

  if(fl){
    string sx;
    for(int j=0; j<i; j++){
      if(s[j]=='?')sx.push_back('a');
      else sx.push_back(s[j]);
    }
    sx+=t;
    for(int j=i+t.size(); j<s.size(); j++){
      if(s[j]=='?')sx.push_back('a');
      else sx.push_back(s[j]);
    }
    ss.push_back(sx);
  }else return;
}

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

  if(s.size()>=t.size()){
    for(int i=0; i<s.size()-t.size()+1; i++){
      compair(i, s, t);
    }
  }

  if(ss.size()==0)cout<<"UNRESTORABLE"<<endl;
  else{
    sort(ss.begin(),ss.end());
    cout<<ss[0]<<endl;
  }  
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

typedef long long ll;

int main(){
 ll L,R; cin >> L >> R;
  if( R - L >= 2019){ cout << 0 << endl; return 0;}
  else{
    for(ll i = L; i<= R; i++){
      if( i % 2019 == 0){ cout << 0 << endl; return 0;}}
    int ans = 1e8;
    for(ll i = L; i <= R - 1; i++){
      for(ll j = i + 1; j <= R; j++){
        int c = ( i * j ) % 2019;
        ans = min( ans , c) ;}}
    
    cout << ans << endl; return 0;} 
} 
      
      

Measured memory_bytes: 256
N=int(input())
result_list = ['AC', 'WA', 'TLE', 'RE']
count_list = [0, 0, 0, 0]
for i in range(N):
  S = input()
  count_list[result_list.index(S)] = count_list[result_list.index(S)] + 1

for i in range(4):
  print(result_list[i]+' x '+str(count_list[i]))

Measured memory_bytes: 9200
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[warn(dead_code)]
fn sieve_of_eratosthenes(n: usize) -> Vec<usize> {
    // spf:
    // store smallest prime factor of number
    // 最小の素因数を格納
    // is_prime:
    // 配列番号が素数であるかどうかを示す
    let mut spf = vec![None; n + 1];
    let mut is_prime = vec![true; n + 1];
    let mut primes = Vec::new();

    // 0 と 1 は素数ではない
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n + 1 {
        // is_prime[i]:
        // それ以下の素数で割り切られていなければ True となる
        if is_prime[i] {
            // この if 文より i は素数なので
            primes.push(i);

            // 素数はそれ自身の最も小さい素因数であるから
            spf[i] = Some(i);
        }

        // 全ての prime の倍数(prime * i)を取り除く
        for prime in &primes {
            // prime が i の最も小さい因数よりも大きくなってしまったら探索終了
            if i * prime >= n + 1 || prime > &spf[i].unwrap() {
                break;
            }

            is_prime[i * prime] = false;

            // i * primes[j] の最も小さい素数は primes[j] 自身
            spf[i * prime] = Some(*prime);
        }
    }
    primes
}
use std::cmp::Ordering;
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}
fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

#[warn(unused_mut)]
#[warn(unused_imports)]
use std::collections::BTreeSet;
fn main() {
    input! {
        a: u64,
        b: u64,
        c: u64,
    }

    println!("{}",if a + b + c <= 21 {"win"}else{"bust"});
}


Measured memory_bytes: 4352
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7
import numpy as np

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
N = i()
S = [s() for _ in range(N)]
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(N):
    if S[i][0] == 'M':
        m += 1
    elif S[i][0] == 'A':
        a += 1
    elif S[i][0] == 'R':
        r += 1
    elif S[i][0] == 'C':
        c += 1
    elif S[i][0] == 'H':
        h += 1
cmbs = [m,a,r,c,h]
cmbs = itertools.combinations(cmbs,3)
ans = 0
for c in cmbs:
    ans += np.prod(list(c))
print(ans)

Measured memory_bytes: 34264
from collections import deque
def isok(x):
    que=deque(sorted(z%x for z in a))
    res=0
    while que:
        l=que[0]
        if l==0:
            que.popleft()
            continue
        r=que[-1]
        if r==0:
            que.pop()
            continue
        d=min(l,x-r)
        que[0]-=d
        que[-1]=(que[-1]+d)%x
        res+=d
    return res
        

n,k=map(int,input().split())
a=list(map(int,input().split()))
sum_=sum(a)

fac=set()
for i in range(1,sum_+1):
    if i*i>sum_:
        break
    if sum_%i==0:
        fac.add(i)
        fac.add(sum_//i)

fac=sorted(fac,reverse=True)
ans=1
for x in fac:
    c=isok(x)
    if c<=k:
        ans=x
        break
print(ans)

Measured memory_bytes: 3436
#include <stdio.h>
#include <string.h>
int main(void) {
	char card[400]={};
	scanf("%s", card);
	char end[400]={};
	char temp[400]={};
	strcpy(end, "-");
	int n, m, i, j, l;
	while (strcmp(card, end)!=0)
	{
		scanf("%d", &n);
		l=strlen(card);
		for (i=0; i<n; i++)
		{
			scanf("%d", &m);
			for (j=0; j<m; j++)
			{
				temp[j]=card[j];
			}
			for (j=0; j<l-m; j++)
			{
				card[j]=card[j+m];
			}
			for (j=l-m; j<l; j++)
			{
				card[j]=temp[j-l+m];
			}
		}
		printf("%s\n", card);
		scanf("%s", card);
	}
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
 
#define DEBUG if(1)
#define MAX INT_MAX
#define MAXLL INT_MAX
#define MAXU ULLONG_MAX
#define MIN -2000000
#define endl "\n"
#define INF INT_MAX
#define MOD 1000000007
#define s(n) scanf("%d", &n)
#define ss(a,b) scanf("%d %d",&a,&b)
#define pb push_back
#define mp make_pair
#define M_PI 3.14159265358979323846
#define sz(a) int(a.size())
#define lli long long int
#define rep(i,a,n) for (int i=a;i<n;i++)
#define ler(a,n,vec) for(int i=0;i<n;i++)s(a), vec.pb(a)
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> ii;
#define DEBUG if(1)
#define F first
#define S second
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int ddx[] = {1, 0};
int ddy[] = {1, 1};
#define MAXN 100010
#define MAXL 20

lli n, w;
vector<pair<lli, lli> > vec;

lli pd[101][(int) 1e5 + 1];

lli solve(int obj, int peso){
	if(obj == sz(vec)) return 0;

	lli &ans = pd[obj][peso];

	if(ans != -1) return ans;

	lli a = solve(obj+1, peso);

	if(vec[obj].F <= peso){
		lli b = solve(obj+1, peso - vec[obj].F) + vec[obj].S;
		return ans = max(a, b);
	}

	return ans = a;
}

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

  cin >> n >> w;
  for(int i=0;i<n;i++){
  	lli a, b;
  	cin >> a >> b;
  	vec.pb({a, b});
  }

  memset(pd, -1, sizeof pd);

  cout << solve(0, w) << endl;

  return 0;
}

Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int h,a;
int main(){
	h=read(),a=read();
	cout << (h+a-1)/a;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int count[26];
    int i, num;
    for(i = 0; i < 26; i++){
        count[i] = 0;
    }
    char ch;
    while(cin >> ch){
        num = tolower(ch) - 'a';
        count[num]++;
    }
    for(i = 0; i < 26; i++){
        ch = i + 'a';
        cout << ch << " : " << count[i] << endl;
    }
 
}


Measured memory_bytes: 3072
# include <stdio.h>

int main(void){
	int N, i;
	int j=0;
	scanf("%d", &N);
	for(i=1; i<10; i++){
		if(N%i==0 && N/i < 10){
			printf("Yes");
			j = 1;
			break;
		}
	}
	if(j == 0){
		 printf("No");
	 }
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int N;
    char s[7]="ABC";
    char t[4]="\0";

    scanf("%d\n",&N);

    t[0]=(N/100)+'0';
    N=N%100;
    t[1]=(N/10)+'0';
    N=N%10;
    t[2]=N+'0';
    t[3]='\0';

    strcat(s,t);

    printf("%s\n",s);

    return 0;
}

Measured memory_bytes: 128
n,m,c=map(int,input().split())

B=list(map(int,input().split()))

cnt=0
for i in range(n):
    A=list(map(int,input().split()))
    res=c
    for j in range(m):
        res+=A[j]*B[j]
    if res>0:
        cnt+=1
        
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(int, n);
  Cins(int, n - 1, b);
  vector<int> a(n);
  a[0] = b[0];
  rep(i, n - 1) {
    a[i] = min(a[i], b[i]);
    a[i + 1] = b[i];
  }
  cout << accumulate(rng(a), 0) << endl;
}

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

long long sum = 0;

void calc(long long now_sum, long long now_n, string s){
  if(s.length() == 0){
    sum += now_sum + now_n;
  } else {
    // + を入れる場合
    calc(now_sum + now_n, s[0] - '0' , s.substr(1, s.length()-1));
    // 入れない場合
    calc(now_sum, now_n * 10 + s[0] - '0' , s.substr(1, s.length()-1));
  }
}

int main(){
  string s;
  cin >> s;
  calc(0, s[0] - '0', s.substr(1, s.length()-1));
  cout << sum << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD			1000000007
#define FOR(i,l,r)	for(int i=l;i<=r;i++)
#define REP(i,n)	for(int i=1;i<=n;i++)
#define REP0(i,n)	for(int i=0;i<n;i++)
#define PB			push_back
#define MP			make_pair
#define PII			pair<int,int>
#define VI			vector<int>
#define ALL(x)		(x).begin(),(x).end()
int a,b;
int main(){
	cin>>a>>b;
	for(int i=0;i<=100;i++){
		if(i*(a-1)+1>=b){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

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

int main() {
	string s;
	getline(cin, s);
	for(int i = 0; i < s.size(); i++) {
		s[i] = toupper(s[i]);
	}
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
     
    using namespace std;
    #define endl '\n'
    #define MAX 200005
    #define pb push_back
    #define mk make_pair
    #define ll long long
    #define pii pair<int , int>
     
    int mat [81][81];
    vector<ll> dp[81][81];
    int aa[81][81];
    bool is[12900];
    void clean()
    {
        for(int i =0; i< 12900; i++)
        {
            is[i] = false;
        }
    }
    int main() {
        	
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        int h,w;
        cin >> h >> w;
        for(int i=0; i< h; i++)
        {
            for(int j =0; j< w; j++)
            {
                //ll a,b;
                cin >> aa[i][j];
                //mat[i][j] = abs(a-b);
            }
        }
        for(int i=0; i< h; i++)
        {
            for(int j =0; j< w; j++)
            {
                //ll a,b;
                int temp;
                cin >> temp;
                //cin >> aa[i][j];
                mat[i][j] = abs(temp- aa[i][j]);
            }
        }
        //dp[0][0] = mat[0][0];
        dp[0][0].pb(mat[0][0]);
        for(int i =0; i< h; i++)
        {
            for(int j=0; j< w; j++)
            {
                
                if(i==0 && j ==0)
                {
                    continue;
                }
                //map<ll,bool>is;
                clean();
                if(i!=0)
                {
                    for(int x = 0; x < dp[i-1][j].size(); x++)
                    {
                        ll num = dp[i-1][j][x];
                        ll up = abs(num + mat[i][j]);
                        ll down = abs(num - mat[i][j]);
                        if(!is[up])
                        {
                            is[up] = true;
                            dp[i][j].pb(up);
                        }
                        if(!is[down])
                        {
                            is[down] = true;
                            dp[i][j].pb(down);
                        }
                    }
                }
                if(j!= 0)
                {
                    for(int x = 0; x < dp[i][j-1].size(); x++)
                    {
                        ll num = dp[i][j-1][x];
                        ll up = abs(num + mat[i][j]);
                        ll down = abs(num - mat[i][j]);
                        if(!is[up])
                        {
                            is[up] = true;
                            dp[i][j].pb(up);
                        }
                        if(!is[down])
                        {
                            is[down] = true;
                            dp[i][j].pb(down);
                        }
                    }
                }
            }
        }
        //cout << "dp[0][0] = " << dp[0][0] << endl;
        //cout << dp[h-1][w-1] << endl;
        ll ans = 100000000000000LL;
        for(int i =0; i< dp[h-1][w-1].size(); i++)
        {
            ans = min(ans, dp[h-1][w-1][i]);
        }
        cout << ans <<endl;
        return 0;
    }

Measured memory_bytes: 178816
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();	
		int z = sc.nextInt();
		System.out.println(z+" "+x+" "+y);
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
using ll=long long;
using ii=pair<ll,ll>;

ll a,b,c,i,j,l,m,n,ans,tmp,hoge,fuga,piyo;
unsigned long long k;
ll A[200000];

int main(){
    cin>>n;
    REP(i,n)cin>>A[i];
    k = 1;
    m = 0;
    for (i = 0; i < n; i++) {
        if (A[i] == k) {
            k++;
        } else {
            m++;
        }
    }
    if (k > 1 && m < n) {
        printf("%llu", m);
    } else {
        printf("-1");
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        ll a;
        cin>>a;
        ll val=a+a*a+a*a*a;
        cout<<val<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3648