akhauriyash/Code-Regression huggingface dataset:
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let 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! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

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

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    "erasedream" => "YES",
    "dreameraser" => "YES",
    "dreamerer" => "NO"
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        s: String,
    }

    let patterns: Vec<String> = ["dream", "dreamer", "erase", "eraser"]
        .iter()
        .map(|s| s.chars().rev().collect::<String>())
        .collect();

    let s = s.chars().rev().collect::<String>();
    let mut s = &s[..];
    let mut succeeded = true;

    while s.len() > 0 {
        let matched = patterns.iter().find(|&p| s.starts_with(p));
        if let Some(p) = matched {
            s = &s[p.len()..];
        } else {
            succeeded = false;
            break;
        }
    }

    if succeeded {
        String::from("YES")
    } else {
        String::from("NO")
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

int N;
vector<string> dp;

string merge(string s, string t){
    if(s.find(t) != string::npos)return s;
    for(int i=max(0, (int)(s.size() - t.size())); i<(int)s.size(); ++i){
        if(s.substr(i) == t.substr(0, (int)s.size() - i)){
            return s.substr(0, i) + t;
        }
    }
    return s + t;
}

string solve(){
    rep(S, 1<<N){
        if(__builtin_popcount(S) == 1)continue;
        for(int U=S-1&S; U>0; --U&=S){
            dp[S] = min(dp[S], merge(dp[U], dp[S^U]),
                        [](const string &s, const string &t){
                            return s.size() < t.size() || (s.size() == t.size() && s < t);
                        });
        }
    }
    return dp[(1<<N) - 1];
}

int main(){
    while(cin >> N, N){
        dp.assign(1<<N, string(100, 'z'));
        rep(i, N)cin >> dp[1<<i];
        cout << solve() << '\n';
    }
    return 0;
}

Measured memory_bytes: 1316
#include <iostream>
#include <cmath>

using namespace std;
const int NMAX = 100;
int v[NMAX+5];
int main()
{
    long long sum=0, p;
    double d;
    int n, i;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>v[i];
        sum = sum + v[i];
    }
     d = 1.0* sum / n;
    long long p1, p2;
    p1 = (long long)ceil(d);
    p2 = (long long)floor(d);
    long long sum1 = 0, sum2 = 0;
    for(i=1;i<=n;i++)
    {
       sum1 = sum1 + (1ll*v[i]- p1) * (1ll*v[i]-p1);
       sum2 = sum2 + (1ll*v[i]- p2) * (1ll*v[i]-p2);
    }
    cout<<min(sum1, sum2)<<"\n";


    return 0;
}


Measured memory_bytes: 256
//                               //
    // author : samars_diary //
    // 17-09-2020 │ 08:08:58 //
//                               //

#include <iostream>
#include <string>
using namespace std;

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

    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif

    int t = 1;
    cin >> t;
    long long int AC(0),TLE(0),WA(0),RE(0);
    string temp;
    while(t--){
        cin>>temp;
        if(temp=="AC"){
            AC++;
        }else if(temp=="TLE"){
            TLE++;
        }else if(temp=="WA"){
            WA++;
        }else{
            RE++;
        }
    }
    printf("AC x %d \nWA x %d \nTLE x %d \nRE x %d \n", (int)AC, (int)WA, (int)TLE, (int)RE);
    return 0;
}

Measured memory_bytes: 3748
program sample
    implicit none
    character(100)::s
    character(100),allocatable::t(:),ans(:)
    integer(8) :: i,j,m,n,h,w,a,b,c
    integer(8),allocatable :: x(:,:),y(:)
    read(*,*)h,w
    allocate(t(h))
    t(1)='0'
   
    a=0
    b=0
    do i=1,h
        a=0
        read(*,*) s
        do j=1,w
            if(s(j:j) .eq. '#')then
               a=1 
            end if
        end do
        if(a==1)then
            b=b+1
            t(b)=s
            
        end if
    end do
    
    c=0
    do j=1,w
        a=0
        do i=1,b
            if(t(i)(j:j) .eq. '#')then
                a=1 
            end if
        
        end do
        if (a==1)then
            c=c+1
            do i=1,b
                t(i)(c:c)=t(i)(j:j)
            end do
        end if


    end do
    
    do i=1,b
        write(*,'(a)')t(i)(1:c)
        
    end do
   
  
    stop
end program sample
  


  



Measured memory_bytes: 2884
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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()
//setprecision(15)有効数字15桁
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
string s;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    vector<string> a(8);
    a[0]="SAT";
    a[1]="FRI";
    a[2]="THU";
    a[3]="WED";
    a[4]="TUE";
    a[5]="MON";
    a[6]="SUN";
    for(int i=0;i<7;i++){
        if(a[i]==s){
            return cout<<i+1<<"\n",0;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    map<string, int> mp;
    set<string> se;
    int m = 0;
    REP(i, N)
    {
        string S;
        cin >> S;
        mp[S]++;
        m = max(mp[S], m);
        se.insert(S);
    }
    for (auto s : se)
    {
        if (mp[s] == m)
            cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 34560
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

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

void update(vector<int>& v, int k) {
  v[0]++;
  v[k]--;
  if (k + 1 < v.size()) v[k+1]++;
}

int main()
{
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> sum(N, 0);
  REP(i, Q) {
    int A;
    cin >> A;
    A--;
    update(sum, A);
  }
  partial_sum(ALL(sum), sum.begin());
  REP(i, sum.size()) {
    if (sum[i] >= K) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1024
import kotlin.*


fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val s = Array(n) { sc.next() }
        val t = arrayOf("AC", "WA", "TLE", "RE")
        for(i in 0 until 4){
            println("${t[i]} x ${s.count { it == t[i] }}")
        }
    }
}

class MyScanner {
    private var ptr = 0
    private var l = listOf<String>()

    fun next(): String {
        while (l.size <= ptr) {
            l = readLine()!!.split(' ')
            ptr = 0
        }
        return l[ptr++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun list(): List<String> {
        ptr = l.size
        return readLine()!!.split(' ')
    }

    fun intList() = list().map { s -> s.toInt() }
    fun longList() = list().map { s -> s.toLong() }
    fun doubleList() = list().map { s -> s.toDouble() }

    fun array() = list().toTypedArray()
    fun intArray() = intList().toIntArray()
    fun longArray() = longList().toLongArray()
    fun doubleArray() = doubleList().toDoubleArray()
}


Measured memory_bytes: 64052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

void print(int x, int y) {
    cout << x+1 << ' ' << y+1 << '\n';
}

int main() {
    int N, M; cin >> N >> M;
    if (N % 2 == 0) {
        int i = 0;
        int j = N / 2 - 1;
        while (i < j) {
            if (M > 0) {
                print(i, j);
                M--;
            }
            i++;
            j--;
        }
        i = N / 2 + 1;
        j = N - 1;
        while (i < j) {
            if (M > 0) {
                print(i, j);
                M--;
            }
            i++;
            j--;
        }
    } else {
        int i = 0;
        int j = N / 2;
        while (i < j) {
            if (M > 0) {
                print(i, j);
                M--;
            }
            i++;
            j--;
        }
        i = N / 2 + 1;
        j = N - 1;
        while (i < j) {
            if (M > 0) {
                print(i, j);
                M--;
            }
            i++;
            j--;
        }
    }
}

Measured memory_bytes: 3636
#include <stdio.h>

int main (){
    int n,m,i;
    scanf ("%d%d", &n,&m);
    for (i = 0; i < m; i++)
    {
        int x;
        scanf ("%d", &x);
        n -= x;
    }
    if (n >= 0){
        printf ("%d\n", n);
    } else {
        printf ("-1\n");
    }   
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  int X = 100 * A, Y = 0;
  vector<int> xs, ys;
  rep(i, F + 1) rep(j, F + 1) {
    if (100 * A * i + 100 * B * j <= F) {
      xs.push_back(100 * A * i + 100 * B * j);
    }
  }

  rep(i, F + 1) rep(j, F + 1) {
    if (C * i + D * j <= F) {
      ys.push_back(C * i + D * j);
    }
  }

  for (auto x: xs) for (auto y: ys) {
    if (x + y <= F) {
      if (y * (100 + E) <= E * (x + y)) {
        if (Y * (x + y) < y * (X + Y)) {
          X = x, Y = y;
        }
      }
    }
  }

  cout << X + Y << " " << Y << endl;
  
  return 0;
}

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

int main(){
	string botun[] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};

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

		string ans = ""; 
		int btn = 0, count = 0;
		for(int j = 0; j < input.size(); j++){
			if(btn == 0 && (int)input[j] > 0){
				btn = input[j] - '0';
				count = 0;
			}else if(btn == (int)input[j] - '0'){
				count++;
			}else if((int)input[j] - '0' == 0 && btn > 0){
				ans += botun[btn][count % botun[btn].size()];
				//cout << botun[btn][count % botun[btn].size()] << " ";
				btn = 0;
				count = 0;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
#include<cstdio>

int cnt(int x){
	int ret = 0;
	for(int i=0;i<10;i++){
		ret += x % 10;
		x /= 10;
	}
	return ret;
}

int main(){
	int n;
	int ans = 100000;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int tmp = cnt(i) + cnt(n-i);
		if(tmp<ans) ans = tmp;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 128
// A.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	if (s.length() > 2) {
		reverse(s.begin(), s.end());
	}
	cout << s << endl;
	return 0;
}


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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define eb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define output(x) cout<<x<<endl;
#define fre(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define frd(i, a, b) for (int i = (int)(a); i >= b; --i)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<int,int> > vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
const ll mod=1e9+7;
const int maxn = 310000;

ll dp[500][500];
ll a[500],p[500];

ll f(int x,int y){
	if(dp[x][y]!=0) return dp[x][y];
	if(x==y) return 0;
	ll temp=2e18;
	fre(i,x,y-1){
		temp=min(temp,f(x,i)+f(i+1,y));
	}
	dp[x][y]=p[y]-p[x-1]+temp;
	return dp[x][y];
}

int main(){
	cin.tie(0);ios_base::sync_with_stdio(0);	
	int n;
	cin>>n;
	fre(i,1,n) cin>>a[i],p[i]=p[i-1]+a[i];
	output(f(1,n));
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

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

int main(){
  ll A,B,C,D;
  cin>>A>>B>>C>>D;
  ll divc,divd,divboth;
  divc=B/C-(A-1)/C;
  divd=B/D-(A-1)/D;

  ll LCD=C*D/gcd(C,D);

  divboth=B/LCD-(A-1)/LCD;

  cout<<B-A+1-divc-divd+divboth<<endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
 
using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
 
int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  int N = input();
  for(int i=0;i<N;i++){
    int a = input();
    if(a % 2 == 0 && a % 3 != 0 && a % 5 != 0 ){
      output("DENIED");
      return 0;
    }
  }

  output("APPROVED");
 
  return 0;
}

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

#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define int long long
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)
#define H(x) cout << #x << " " << x << endl;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef double ld;
typedef pair<ld, ld> dd;

const ll INF = 1000000000000000000LL;
const int NMAX = 1e6+4;
const int mod = 1e9+7;
const ld eps = 1e-10;
const ld PI = acos(-1);

map<int, int> cnt;

int pow2(int n){
    int res = 1;
    while(res <= n) res *= 2;
    return res;
}

signed main(){
    fast_io();

    int tot = 0;
    int N;
    cin >> N;
    FOR(i, 0, N) {
        int A;
        cin >> A;
        cnt[-A] ++;
    }

    for(auto p : cnt) if(p.snd != 0) {
        //cout << p.fst << " " << p.snd << endl;
        int A = -p.fst;
        int po = pow2(A);
        //cout << po << endl;
        int amt = min(p.snd, cnt[A-po]);
        if(2*A == po) amt /= 2;
        cnt[A-po] -= amt;
        tot += amt;
        cnt[-A] -= amt;
    }
    cout << tot << endl;
}


Measured memory_bytes: 25472
#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	ll k;
	scanf("%d%lld", &n, &k);
	vector<int> a(n), nxt(n), add(n);
	for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
	vector<vector<int>> pos(200005);
	for (int i = 0; i < n; ++i) {
		pos[a[i]].push_back(i);
	}
	for (int i = 1; i <= 200000; ++i) {
		for (int j = 0; j < pos[i].size(); ++j) {
			nxt[pos[i][j]] = (pos[i][(j + 1) % pos[i].size()] + 1) % n;
			add[pos[i][j]] = (j + 1 == pos[i].size()) + (nxt[pos[i][j]] == 0);
		}
	}
	int p = 0;
	ll r = 0;
	do {
		ll nr = r + add[p];
		int np = nxt[p];
		if (nr >= k) break;
		r = nr;
		p = np;
	} while (p);
	if (!p && r) {
		k %= r;
		r = 0;
		for (;;) {
			ll nr = r + add[p];
			int np = nxt[p];
			if (nr >= k) break;
			r = nr;
			p = np;
		}
	}
	if (!k) {
		return 0;
	}
	assert(r == k - 1 || r == k - 2);
	vector<bool> has(200005);
	vector<int> ans;
	while (r < k) {
		if (has[a[p]]) {
			while (has[a[p]]) {
				has[ans.back()] = false;
				ans.pop_back();
			}
		} else {
			has[a[p]] = true;
			ans.push_back(a[p]);
		}
		++p;
		if (p == n) {
			++r;
			p = 0;
		}
	}
	for (int a : ans) printf("%d ", a);
}


Measured memory_bytes: 15732
import java.util.*;
public class Main {
	public static void main(String[]args) {
		/*整数Nが与えられます。N 以下の正の整数のうち、(先頭に0をつけずに十進法で表記したときの) 桁数が奇数であるようなものの個数を求めてください。*/
		
		Scanner sc = new Scanner(System.in);
		
		Integer N = sc.nextInt();
		sc.close();
		
		int result = 0;
		
		for (int i = 1; i <= N;i++) {
			String test  = Integer.toString(i);
		
			if (test.length()%2 != 0) result++;
		
		}
		
		System.out.println(result);

	}

}
				
				
			

Measured memory_bytes: 28244
#include<iostream>
#include<vector>
#include<string>

using namespace std;

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

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define PII pair<int,int>
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define LL long long
#define ll long long
#define ULL unsigned long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

string S;

int main(){

	cin >> S;
	int iter=0;
	while(S[iter] == 'd' || S[iter] == 'e') {
		if(S.substr(iter,7)=="dreamer" && S.substr(iter+5,5) != "erase"){
			iter+=7;
			continue;
		}

		if(S.substr(iter,5)=="dream"){
			iter+=5;
			continue;
		}
		if(S.substr(iter,6)=="eraser"){
			iter+=6;
			continue;
		}
		if(S.substr(iter,5)=="erase"){
			iter+=5;
			continue;
		}
		break;
	}
	if(iter == S.size())
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const int NAX=1005;
const long long  MOD=(long long)(1e9+7);

Int N,M,K;
Int X,Y,Z;
Int H,W;
Int perform(Int x){
    return (x*(x+1))/2LL;
}
vector<Int> A;
vector<int> adj[MAXN];
using D=long double;

bool inRange(Int a,Int b){
    return a*b<=0;
}

long long ModExpo(long long x,unsigned long long y,long long M){
    Int ans=1;
    ans=(long long)ans;
    
    while(y>0){
        if(y&1) ans=((ans%M)*(x%M))%M;
        y>>=1LL;
        x=((x%M)*(x%M))%M;
    }
    return ans%M;
}
long long dp[MAXN];

Int solve(Int N){
    if(N<0) return 0;
    if(N==0) return 1;
    if(dp[N]!=-1) return dp[N];
    Int ans=0;
    for(int i=3;i<=N;++i){
        ans=(ans+solve(N-i))%MOD;
    }
    return dp[N]=ans;
}
int main()
{
    cin>>N;
    memset(dp,-1,sizeof(dp));
    Int ans=solve(N)%MOD;
    cout<<ans<<"\n";
}


Measured memory_bytes: 19224
while 1:
    n,w,d = map(int,raw_input().split())
    if w == 0: break
    cake = [[w,d]]
    for loop in xrange(n):
        p,s = map(int,raw_input().split())
        x,y = cake.pop(p-1)
        s %= (x+y)
        if s < x:
            x1,x2 = sorted([s,x-s])
            cake.append([x1,y])
            cake.append([x2,y])
        else:
            s -= x
            y1,y2 = sorted([s,y-s])
            cake.append([x,y1])
            cake.append([x,y2])
    print " ".join(map(str,sorted([x*y for x,y in cake])))

Measured memory_bytes: 4248
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define println(x) cout << x << endl
#define print(x) cout << x << " "
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int h,n;
    cin >> h >> n;
    REP(i,n){
        int b;
        cin >> b;
        h -= b;
    }
    if(h <= 0){
        Yes();
    }else No();

    return 0;
}

Measured memory_bytes: 256
N = int(input())
l = []

# 全探索を行う
for i in range(int(N/4 + 1)):
    for j in range(int(N/7 + 1)):
        if i * 4 + j * 7 <= 100:
            l.append(i * 4 + j * 7)

if N in l:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <stdio.h>
#define pi 3.1415926535
int main()
{
    int n,m,a,sum=0;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d",&a);
        sum+=a;
    }
    if(sum>n)
    printf("-1");
    else
    printf("%d",(n-sum));
}


Measured memory_bytes: 1676
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;

ll a(int arr[] , int n , int t)
{
    ll sum = 0;
	int sign = t;
	ll ans = 0;
	for(int i=0 ; i<n ; i++)
	{
	    sum += arr[i];
		if(sign == 1)
		{
			if(sum <= 0) ans += abs(sum)+1 , sum=1;
		}
		else
		{
			if(sum >= 0) ans += abs(sum)+1 , sum=-1;;
		}
		sign = sign * -1;
	}
    
    return ans;
}

int main()
{
	FAST;
	int n;
	cin >> n;
	int arr[n];
	for(int i=0 ; i<n ; i++)
		cin >> arr[i];
	
	cout << min(a(arr , n , -1) , a(arr , n , 1));

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll, ll, ll>>>;

// MOD確認

ll A[110];

int main(){
   ll N;
   cin >> N;
   rep(i,N) cin >> A[i];
   ll ans = 0;
   rep(i,N){
      if(i % 2 == 0 && A[i] % 2 == 1) ans++;
   }
   cout << ans << endl;
}

Measured memory_bytes: 3588
S = gets.chomp

S.chars.each_with_index { |c, i|
  if i.even?
    if %w{R U D}.include?(c).!
      puts "No"
      exit
    end
  else
    if %w{L U D}.include?(c).!
      puts "No"
      exit
    end
  end
}

puts "Yes"


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, a, b, m, ans = 0;
  cin >> n >> m;
  vector<ll> s(n);
  rep(i, m) {
    cin >> a >> b;
    a--, b--;
    s[a]++, s[b]++;
  }

  bool ok = true;
  for (ll t : s)
    if (t % 2) {
      ok = false;
      break;
    }

  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//

int divisor(int n) {
  int ret = 0;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret++;
      if (i * i != n) ret++;
    }
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  rrep(i, n-1) {
    ans += (ll)divisor(i);
  }
  cout << ans << endl;
}

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

int main(){
  string s;
  cin >> s;
  int len = s.size();
  long sum = 0;
  long tem = 0;
  for(int i=0; i<(1<<(len-1)); ++i){
    for(int j=0; j<len; ++j){
      tem *= 10;
      tem += s[j] - '0';
      if(i&(1<<j) || j==len-1){
        sum += tem;
        tem = 0;
      }
    }
  }
  cout << sum << "\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する

int main() {
    int N,T;
    cin >> N >> T;
    vector<int> v(N);
    int ans = 0;
    REP(i,0,N){
        cin >> v[i];
    }
    REP(i,1,N){
        ans += min(v[i] - v[i-1],T);
    }
    ans += T;
    cout << ans << endl;

}


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

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::Write;
use std::collections::HashMap;


fn main() {
    input!{
      n: usize,
      aa: [usize; n],
    }
    let mut aa = aa;
    aa.sort();

    let mut map: HashMap<usize, usize> = HashMap::new();

    let mut ans = 0;

    for i in 0..n {
        let a = aa[i];
        let e = map.entry(a).or_insert(0);
        *e += 1;
    }

    for r in (0..n).rev() {
        let a = aa[r];
        if let Some(v) = map.get_mut(&a) {
            if *v == 0 {
                continue;
            }
            *v -= 1;
        }

        let mut t = 2;
        while t <= a { t *= 2; }
        // debug!(a, t);

        if let Some(v) = map.get_mut(&(t-a)) {
            if *v > 0 {
                *v -= 1;
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 15476
console.log(require('fs').readFileSync('/dev/stdin','utf8').trim().split(/[ |\n]/).slice(1).map((k,i,a)=>`node ${++i}: key = ${k}, `+((i-1)?`parent key = ${a[Math.floor(i/2)-1]}, `:'')+(2*i<=a.length?`left key = ${a[2*i-1]}, `:'')+(2*i<a.length?`right key = ${a[2*i]}, `:'')).join('\n'));


Measured memory_bytes: 16480
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}



using Graph = vector<vector<int>>;


int main() {
	ll N, an = 0;
	
	cin >> N;
	vector<vector<ll>> P(N, vector<ll>(21));
	rep(i, N) {
		ll A;
		cin >> A;
		rep(j, 21) {
			P.at(i).at(j) = A % 2;
			A /= 2;
		}
	}
	ll L = 0; ll R = 0;
	vector<ll> c(21);
	rep(j, 21) {
		c.at(j) += P.at(L).at(j);
	}
	while (L < N) {
		
		bool cheak = false;

		rep(j, 21) {
			
			if (c.at(j) > 1) {
				cheak = true;
				break;
			}
		}

		if (cheak==true) {
			an += R - L;
	
			rep(j, 21) {
				c.at(j) -= P.at(L).at(j);
			}
			
			L++;
			
		}
		else {
			
			R++;
			if (R == N) {
				
				an += (R - L) * (R - L+1) / 2;
				break;
			}
			rep(j, 21) {
				c.at(j) += P.at(R).at(j);
			}
			
		}
	}
	cout << an << endl;
}

Measured memory_bytes: 39424
#!/usr/bin/env python3
import sys


def chmin(cumsum, a):
    if cumsum > a:
        return a
    else:
        return cumsum


def solve(N: int, h: "List[int]"):
    cumsums = [float("inf")]*N
    cumsums[0]=0

    for i in range(1, N):
        cumsums[i] = chmin(cumsums[i], cumsums[i-1]+abs(h[i]-h[i-1]))
        if i>1:
            cumsums[i] = chmin(cumsums[i], cumsums[i-2]+abs(h[i]-h[i-2]))
    return cumsums[-1]


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    h = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    print(solve(N, h))

if __name__ == '__main__':
    main()


Measured memory_bytes: 18092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define sort(v) sort(v.begin(),v.end());
const ll mod = 1E9 + 7;

int main()
{
    string a,b;
    cin>>a>>b;
    ll ans = 0;
    loop(i,0,a.size()){
        if(a[i]!=b[i])ans++;
    }
    cout<<ans<<endl;
}


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

#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

#define MAX_N 100000
int A[MAX_N + 5];

int partition(int p, int r) {
  int x = A[r];
  int i = p - 1;
  int tmp;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      tmp = A[j];
      A[j] = A[i];
      A[i] = tmp;
    }
  }
  tmp = A[r];
  A[r] = A[i + 1];
  A[i + 1] = tmp;
  return i + 1;
}

int main() {
  int n;
  cin >> n;
  rep(i, n) cin >> A[i];
  int idx = partition(0, n - 1);
  rep(i, n) {
    if (i > 0) cout << " ";
    if (i == idx) cout << "[";
    cout << A[i];
    if (i == idx) cout << "]";
  }
  cout << endl;
  return 0;
}



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

using namespace std;

template <typename T>
T random(T lo, T hi) {
  std::random_device rd;
  std::uniform_int_distribution<T> uid(lo, hi);
  return uid(rd);
}

class RollingHash {
 private:
  const uint64_t mod = (UINT64_C(1) << 61) - 1;
  static inline uint64_t base = random(UINT32_C(10007), UINT32_MAX);
  std::vector<uint64_t> hashes, pows;

  inline uint64_t add(uint64_t a, uint64_t b) const {
    a += b;
    if (a >= mod) a -= mod;
    return a;
  }

  inline uint64_t sub(uint64_t a, uint64_t b) const {
    if (a < b) a += mod;
    a -= b;
    return a;
  }

  inline uint64_t mul(uint64_t a, uint64_t b) const {
    uint64_t ah = a >> 31, al = a & ((UINT64_C(1) << 31) - 1), bh = b >> 31,
             bl = b & ((UINT64_C(1) << 31) - 1), m = ah * bl + al * bh,
             v = (ah * bh << 1) + (m >> 30) +
                 ((m & ((UINT64_C(1) << 30) - 1)) << 31) + al * bl;
    v = (v & ((UINT64_C(1) << 61) - 1)) + (v >> 61);
    return v;
  }

 public:
  template <typename T>
  RollingHash(const T &S) : hashes(S.size() + 1, 0), pows(S.size() + 1, 0) {
    pows[0] = 1;
    for (size_t i = 0; i < S.size(); i++) {
      pows[i + 1] = mul(pows[i], base);
      hashes[i + 1] = add(mul(hashes[i], base), S[i]);
    }
    // cout << base << '\n';
  }

  // S[l, r)
  uint64_t slice(int l, int r) const {
    return sub(hashes[r], mul(hashes[l], pows[r - l]));
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  vector<int> S(N), T(N);
  for (int i = 0; i < N; i++) {
    S[i] = A[i] ^ A[(i + 1) % N];
    T[i] = B[i] ^ B[(i + 1) % N];
  }
  for (int i = 0; i < N; i++) {
    S.emplace_back(S[i]);
  }
  RollingHash rhs(S), rht(T);
  for (int i = 0; i < N; i++) {
    if (rhs.slice(i, i + N) == rht.slice(0, N)) {
      cout << i << ' ' << (A[i] ^ B[0]) << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 16992
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [p, q, r] <- getIntList
    print $ minimum [p + q, q + r, r + p]

Measured memory_bytes: 380
N, L, T = map(int, input().split())
n = (map(int, input().split()) for _ in range(N))
t = [X + (0, T, -T)[W] for X, W in n]
l = sorted(i % L for i in t)
s = sum(i // L for i in t) % N
for i in l[s:] + l[:s]: print(i)

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int a[N];



int main () {
	SpeedForce;
	int s;
	cin >> n >> k >> s;

	for (int i = 1; i <= k; i ++)
		cout << s << ' ';
	for (int i = k + 1; i <= n; i ++) {
		if (s == 1e9) cout << s - 1 << ' ' ;
		else cout << s + 1 << ' ';
	}

   	return Accepted;
}

// B...a

Measured memory_bytes: 1280
//Keep Working Hard
  // I__Like__Food  
  #include<bits/stdc++.h>
  #include <ext/pb_ds/assoc_container.hpp> 
  #include <ext/pb_ds/tree_policy.hpp>
  #define rep(i,a,b) for(int i = a; i <=b; i++)
  #define rep2(i,a,b) for(int i = a; i>=b; i--)
  #pragma GCC optimize("O3")
  #pragma GCC optimize("Ofast") 
  #pragma GCC optimize("unroll-loops")
  using namespace std;
  using namespace __gnu_pbds;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int mod = 1e9 + 7;
  const int N = 100005;
  const int INF = 1e16;
  const double PI = acos(-1);

int32_t main()
{


    int n;
    cin >> n;

    int ans =0;
    
    for(int i =1; i <= n; i++)
    {
      for(int j = 1; j <= n; j++)
      {
        for(int k = 1; k <= n; k++)
        {
          ans += __gcd(i,__gcd(j,k));
        }
      }
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 3604
//------------------------------------------
// C++ templete
//------------------------------------------
#include <bits/stdc++.h>
// #define int long long
using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<VS> VVS;

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

//container util
//------------------------------------------
#define pb push_back
#define ALL(a) (a).begin(), (a).end()
#define PRINT(V)     \
  for (auto v : (V)) \
  cout << v << " "
#define PRINTL(V)    \
  for (auto v : (V)) \
  cout << v << endl
#define SORT(V) sort((V).begin(), (V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//最大公約数
//------------------------------------------
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

//grobal variable
//------------------------------------------
int N, M;
VI Vec;

//main
//------------------------------------------
signed main()
{
  int n,m;
  cin >> n ;
  map<string, int> mp;
  mp["AC"] = 0;
  mp["WA"] = 0;
  mp["TLE"] = 0;
  mp["RE"] = 0;
  string tmp;
  for (int i = 0; i < n; i++)
  {
    cin >> tmp;
    mp[tmp]++;
  }
  cout << "AC x " << mp["AC"]<<endl;
  cout << "WA x " << mp["WA"]<<endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
    for(int n; cin >> n && n; )
	{
		int p[8] = {0};
		
		rep(i, n)
		{
			int a;
			cin >> a;
			p[min(a, 60) / 10]++;
		}
		
		rep(i, 7) cout << p[i] << endl;
	}
}

Measured memory_bytes: 0
N = input()
A = int(N[0])
B = int(N[1])
C = int(N[2])
D = int(N[3])

while True:
    if A + B + C + D == 7:
        print(str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
        break
    elif A + B + C - D == 7:
        print(str(A) + "+" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
        break
    elif A + B - C + D == 7:
        print(str(A) + "+" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
        break
    elif A + B - C - D == 7:
        print(str(A) + "+" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
        break
    elif A - B + C + D == 7:
        print(str(A) + "-" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
        break
    elif A - B - C + D == 7:
        print(str(A) + "-" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
        break
    elif A - B + C - D == 7:
        print(str(A) + "-" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
        break
    elif A - B - C - D == 7:
        print(str(A) + "-" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
        break

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

int main (void) {
    int N, K;
    cin >> N >> K;
    vector<bool> sunuke(N, false);

    int d, a;
    for ( int i=0; i<K; i++ ) {
        cin >> d;
        for ( int j=0; j<d; j++ ) {
            cin >> a;
            sunuke.at(a-1) = true;
        }
    }

    int ans = 0;
    for ( bool p : sunuke ) {
        if ( p == false )
            ans++;
    }

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


Measured memory_bytes: 3596
import sys
eps=1e-9
for l in sys.stdin:
	a,b,c,d,e,f=map(float,l.split())
	x=(f-e*c/b)/(d-e*a/b)
	y=(a*x-c)/b
	print "%.3f %.3f" % (x+eps,-y+eps)

Measured memory_bytes: 6308
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s, t string
	fmt.Scan(&s)
	fmt.Scan(&t)

	sLower := strings.ToLower(s)
	tLower := strings.ToLower(t)
	if sLower != s || tLower != t {
		fmt.Println("No")
		return
	}
	if !(1 <= len(s) && len(s) <= 10) {
		fmt.Println("No")
		return
	}
	tLast := t[len(t)-1:]
	tSame := t[0 : len(t)-1]
	if tSame != s || len(tLast) != 1 {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")

}


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

int main() {
  long long num;
  long long kekka = 0;
  cin >> num;
  
  for(int i = 1; i <= num; i++){
    if(i % 3 == 0 || i % 5 == 0){
      continue;
    }else{
      kekka += i;
    }
  }
  
  cout << kekka;
}


Measured memory_bytes: 3636