akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; 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;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    N /= 200;
    cout << 10 - N << endl;
}

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

namespace _7_A
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> output = new List<string>();
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int tyukan = x[0];
                int kimatu = x[1];
                int saisi = x[2];
                if(tyukan==-1&&kimatu==-1&&saisi==-1)
                {
                    break;
                }
                if (tyukan == -1 || kimatu == -1)
                {
                    output.Add("F");
                }
                else if (tyukan + kimatu >= 80)
                {
                    output.Add("A");
                }
                else if (tyukan + kimatu >= 65)
                {
                    output.Add("B");
                }
                else if (tyukan + kimatu >= 50)
                {
                    output.Add("C");
                }
                else if (tyukan + kimatu >= 30)
                {
                    if (saisi >= 50)
                    {
                        output.Add("C");
                    }
                    else
                    {
                        output.Add("D");
                    }
                }
                else
                {
                    output.Add("F");
                }
            }
            foreach(var i in output)
            {
                Console.WriteLine(i);
            }
        }
    }
}

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

int main(){
   int s;
   cin >> s; 
   int a = s/100;
   int b = s%100;
   if(12>=a && 12>=b && a!=0 && b!=0){
      cout << "AMBIGUOUS" << endl;
   } 
   else if(12>=a && a!=0){
      cout << "MMYY" << endl;
   }
   else if(12>=b && b!=0){
      cout << "YYMM" << endl;
   }
   else{
      cout << "NA" << endl;
   }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>

using namespace std;
 
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,a,b;
    cin>>n>>a>>b;
    bool flag=true;
    while(1){
        if(flag){
            if(a+1<b){
                a++;
            }else if(a-1>=1){
                a--;
            }else{
                cout<<"Borys"<<endl;
                return 0;
            }
            flag=false;
        }else{
            if(b-1>a){
                b--;
            }else if(b+1<=n){
                b++;
            }else{
                cout<<"Alice"<<endl;
                return 0;
            }
            flag=true;
        }
    } 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main() {
	int a[1030];
	int k;
	stringstream sout;
	string b;
	int kari;
	int kaka;
	cin >> kaka;
	for  (int j = 0; j < kaka; j++) {
		cin >> b;
		kari = 0;
		int rireki[10] = {0};
		k = b.size();
		for (int i = 0; i < k; i++) {
			sout.str("");
			sout.clear();
			sout << b[i];
			sout >> a[i];
		}
		for (int i = 0; i < k-1; i++) {
			if(a[i] != a[i+1] && a[i+1] == 0 && a[i] != 0) {
				kari = 1;
				if (a[i] == 1) {
					if(rireki[1] % 5 == 0) {
						printf(".");
					} else if (rireki[1] % 5 == 1) {
						printf(",");
					} else if (rireki[1] % 5 == 2) {
						printf("!");
					} else if (rireki[1] % 5 == 3) {
						printf("?");
					} else {
						printf(" ");
					}
					rireki[1] = 0;
				} else if (a[i] == 2) {
					if(rireki[2] % 3 == 0) {
						printf("a");
					} else if (rireki[2] % 3 == 1) {
						printf("b");
					} else {
						printf("c");
					}
					rireki[2] = 0;
				} else if (a[i] == 3) {
					if (rireki[3] % 3 == 0) {
						printf("d");
					} else if (rireki[3] % 3 == 1) {
						printf("e");
					} else {
						printf("f");
					}
					rireki[3] = 0;
				} else if (a[i] == 4) {
					if (rireki[4] % 3 == 0) {
						printf("g");
					} else if (rireki[4] % 3 == 1) {
						printf("h");
					} else {
						printf("i");
					}
					rireki[4] = 0;
				} else if (a[i] == 5) {
					if (rireki[5] % 3 == 0) {
						printf("j");
					} else if (rireki[5] % 3 == 1) {
						printf("k");
					} else {
						printf("l");
					} 
					rireki[5] = 0;
				} else if (a[i] == 6) {
					if (rireki[6] % 3 == 0) {
						printf("m");
					} else if (rireki[6] % 3 == 1) {
						printf("n");
					} else {
						printf("o");
					}
					rireki[6] = 0;
				} else if (a[i] == 7) {
					if (rireki[7] % 4 == 0) {
						printf("p");
					} else if (rireki[7] % 4 == 1) {
						printf("q");
					} else if (rireki[7] % 4 == 2) {
						printf("r");
					} else {
						printf("s");
					}
					rireki[7] = 0;
				} else if (a[i] == 8) {
					if (rireki[8] % 3 == 0) {
						printf("t");
					} else if(rireki[8] % 3 == 1) {
						printf("u");
					} else {
						printf("v");
					}
					rireki[8] = 0;
				} else {
					if (rireki[9] % 4 == 0) {
						printf("w");
					} else if (rireki[9] % 4 == 1) {
						printf("x");
					} else if (rireki[9] % 4 == 2) {
						printf("y");
					} else {
						printf("z");
					}
					rireki[9] = 0;
				}
			} else {
				if (a[i] == 0 || (a[i] != a[i+1])) {
					rireki[a[i]] = 0;
					continue;
				}
				rireki[a[i]]++;
			}
		}
		if (kari == 1) {
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;
int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	int ans = 0;
	for (int i = 1; i < N - 1; i++) {
		vector<int> num = { v[i - 1],v[i],v[i + 1] };
		sort(num.begin(), num.end());
		if (num[1] == v[i]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<P> p;
    rep (i, m) {
        int a, b;
        cin >> a >> b;
        p.emplace_back(a - 1, b - 1);
    }
    sort(all(p), [](P a, P b){return a.second < b.second;});
    for (P q : p) eprintf("(%d,%d)", q.first, q.second); eprintf("\n");
    int now = -1, ans = 0;
    for (P q : p) {
        if (q.first > now) {
            ans++;
            now = q.second - 1;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1400
n, a, b = map(int, input().split())
while 1:
    if b != a+1:
        a += 1
    elif a != 1:
        a -= 1
    else:
        print("Borys")
        exit()
    if a != b-1:
        b -= 1
    elif b != n:
        b += 1
    else:
        print("Alice")
        exit()


Measured memory_bytes: 9168
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut n = s.trim().parse().unwrap();
    let mut v = vec![0; n];
    s.clear();
    stdin().read_line(&mut s).ok();
    let mut itr = s.split_whitespace().map(|e| e.parse::<usize>().unwrap());

    for i in itr {
        v[i - 1] += 1;
    }

    for i in &v {
        println!("{}", i);
    }
}


Measured memory_bytes: 4048
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Ia;
		int p=a[0];
		long ans=0;
		for(int i = 1;i<n;i++) {
			p=Max(p,a[i]);
			ans+=p-a[i];
		}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 46212
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x


using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const long long MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

int main() {
    ll n,x;cin>>n>>x;
    vector<ll> a(n);cin>>a;
  
    vector<ll> b(a);
    
    ll ans = 0;
    rep(i,n){
        ans+=b[i];
    }
    
    repsg(k,1,n){
        
        rep(i,n){
            b[i]=min(b[i],a[(n+i-k)%n]);
        }
        
        ll sum = k*x;
        rep(i,n){
            sum+=b[i];
        }
        
        ans = min(ans,sum);
        
    }
    
    cout<<ans<<endl;
    
    
    
    return 0;
}




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

ll const INF = 1LL<<60;

int main(){
	int N;
	ll W;
	cin >> N >> W;
	vector<ll> w(N);
	vector<int> v(N);
	
	rep(i,N){
		cin >> w[i] >> v[i];
	}
	
	ll dp[110][100010];
	
	rep(i,N){
		rep(j,100010){
			dp[i][j] = INF;
		}
	}
	
	dp[0][0] = 0;
	
	rep(i,N){
		rep(j,100010){
			if(j < v[i]){
				dp[i+1][j] = dp[i][j];
			}else{
				dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i]);
			}
		}
	}
	
	int ans = 0;
	rep(j,100010){
		if(dp[N][j] <= W){
			ans = j;
		}
	}
	
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 81152
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = myconv(next(),4);
  var N = one[0];
  var M = one[1];
  var fixed = 1900 * M + 100 * (N - M);
  var output = 0;
  var count = 1;
  var ok = 1 / Math.pow(2,M);
  var ng = 1 - ok;
  while(count < 10000){
    output += (Math.pow(ng,count - 1) * ok) * fixed * count;
    count++;
  }
  myout(Math.round(output));
}

Measured memory_bytes: 11468
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

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

	vector<int> ans;
	for (int num = N; num >= 1; num--) {

		if (a[num - 1]) {
			DMP(num);
			for (int i = 1; i * i <= num; i++) {
				
				if (num % i == 0) {
					DMP(i);
					a[i - 1] ^= 1;
					if (i*i != num) a[num / i - 1] ^= 1;
				}

			}
			ans.emplace_back(num);
		}
	}

	cout << ans.size() << "\n";
	reverse(ans.begin(), ans.end());
	for (const auto &e : ans) cout << e << " ";

	return 0;
}

Measured memory_bytes: 2424
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> w(n);
  int ac, wa;
  ac = wa = 0;
  rep(i, m) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if(s == "AC") {
      if(a[p] == 0) {
        ac++;
        wa += w[p];
      }
      a[p]++;
    } else {
      w[p]++;
    }
  }
  printf("%d %d", ac, wa);
  return 0;
}

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

int main () {
  int A,B,C;
  cin>>A>>B>>C;
  int s = C-B;
  if(B>=C){
    cout<<"delicious"<<endl;
  }
  else if(s<=A){
    cout<<"safe"<<endl;
  }
  else if(s>A){
    cout<<"dangerous"<<endl;
  }
}

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

int main(){
	
/*
	for(int i=0; i<7; i++){
		int a,b;
		cin >> a >> b;
		cout << a - b <<endl;
		*/

	/*
	for(int i=0; i<4; i++){
		int T, K;
		cin >> T >> K;
		if(T == 1){
			cout << K*6000 << endl;
		}
		else if(T == 2){
			cout << K*4000 << endl;
		}
		else if(T == 3){
			cout << K*3000 << endl;
		}
		else{
			cout << K*2000 << endl;
		}

	}
	*/
	/*
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		int x, y, b, p;
		cin >> x >> y >> b >> p;

		if(b >= 5 && p >= 2){
			cout << (x*b + y*p)*4/5 << endl;
		}

		else{
			cout << min(x*b + y*p,(x * max(b,5) + y * max(p,2))*4/5 ) << endl;
		}
	}
	*/

	for(int data = 0; data<100; data++){
		int n;
		cin >> n;
		if(n == 0)return 0;

		int  N = n;
		bool jud = false;

		for(int i=0; i<n; i++){
			int k;
			cin >> k;
			if(k == 0) N--;
			else if(k > 1)jud = true;
		}

		if(jud == false) cout << "NA" << endl;
		else cout << N+1 << endl;


	}


	return 0;

}



Measured memory_bytes: 3088
use proconio::{input, marker::Usize1};

#[derive(Default)]
struct Solver {
    n: usize,
    m: u64,
    q: Vec<Q>,
    s: Vec<u64>,
}

type Q = (usize, usize, u64, u64);

impl Solver {
    fn solve() {
        input! {
            n: usize, m: u64,
            q: [(Usize1, Usize1, u64, u64)]
        }
        let mut s = Self { n, m, q, s: vec![] };
        println!("{}", s.dfs())
    }

    fn dfs(&mut self) -> u64 {
        if self.s.len() == self.n {
            self.q.iter().filter_map(|q| self.eval(q)).sum()
        } else {
            let l = *self.s.last().unwrap_or(&1);
            let m = self.m;
            let f = |x| {
                self.s.push(x);
                let ret = self.dfs();
                self.s.pop();
                ret
            };
            (l..=m).map(f).max().unwrap()
        }
    }

    fn eval(&self, &(a, b, c, d): &Q) -> Option<u64> {
        if self.s[b] - self.s[a] == c {
            Some(d)
        } else {
            None
        }
    }
}

fn main() { Solver::solve(); }


Measured memory_bytes: 2152
#include <stdio.h>

int main(){
    char cards[200];
    char newCards[200];
    int m, cardsLen;
    //int h[100];
    int h;

    while(true) {
        scanf("%s",cards);
        if(cards[0] == '-') break;

        cardsLen = 0;
        while(cards[cardsLen] != '\0') cardsLen++;

        scanf("%d",&m);
        for(int i=0;i<m;i++){
            //scanf("%d",&h[i]);
            scanf("%d",&h);

            for(int j=0;j<cardsLen;j++){
                newCards[j] = cards[(j+h) % cardsLen];
            }
            
            for(int j=0;j<cardsLen;j++){
                cards[j] = newCards[j];
            }
        }

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

length:
    return 0;
}

Measured memory_bytes: 2548
program ABC065A
    implicit none
    integer(8)::A,B,X
    read(5,*)X,A,B

    if(B-A<=0)then
        print'(A)',"delicious"
    else if(B-A<=X)then
        print'(A)',"safe"
    else
        print'(A)',"dangerous"
    end if
end program ABC065A

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> a(n);
    vector<int> num(pow(10,5),0);
    for(int i=0;i<n;i++){
        cin>>a[i];
        num[a[i]]++;
    }
    sort(a.begin(),a.end());
    long long kazu=0;
    long long ans=0;
    for(long long i=0;i<num.size()-1;i++){
        kazu=num[i]+num[i+1]+num[i+2];
        ans=max(ans,kazu);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void) {
	double a, b, x;
	int xx;
	cin >> a >> b;

	x = (a + b) / 2;
	xx = (a + b) / 2;

	if (x == xx) {
		cout << xx << endl;
	} else {
		cout << xx + 1 << endl;
	}



	return 0;
}

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

int main()
{
    int h,w;
    cin>>h>>w;
    vector<vector<char>> arr(h,vector<char>(w));
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>arr[i][j];
        }
    }
    vector<vector<int>> dp(h,vector<int>(w,0));
    if(arr[0][0]=='#'||arr[h-1][w-1]=='#')
    {
        cout<<0;
        return 0;
    }
    dp[0][0]=1;
    for(int i=1;i<w;i++)
    {
        if(arr[0][i]=='.')
        dp[0][i]=dp[0][i-1];
        else
        dp[0][i]=0;
    }
    for(int i=1;i<h;i++)
    {
        if(arr[i][0]=='.')
        dp[i][0]=dp[i-1][0];
        else
        dp[i][0]=0;
    }
    for(int i=1;i<h;i++)
    {
        for(int j=1;j<w;j++)
        {
            if(arr[i][j]=='#')
            dp[i][j]=0;
            else
            dp[i][j]=(dp[i-1][j]%MOD+dp[i][j-1]%MOD)%MOD;
        }
    }
    if(dp[h-1][w-1]==0) cout<<0;
    else
    cout<<dp[h-1][w-1]%MOD;
    return 0;
}

Measured memory_bytes: 8592
mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
        }
    }
}

use std::collections::VecDeque;
use std::iter::FromIterator;

fn main() {
    let stdin = std::io::stdin();
    let mut reader = utils::StdinReader::new(stdin.lock());

    let s = reader.readl::<String>();
    let q = reader.readl::<i32>();

    let mut reverse = false;
    let mut chars = VecDeque::from_iter(s.chars());

    for _ in 0..q {
        let line = reader.readl::<String>();
        let mut linec = line.chars();
        if let Some('1') = linec.next() { reverse ^= true; }
        else {
            let f = linec.nth(1).unwrap();
            let s = linec.nth(1).unwrap();
            if f == '1' { 
                if reverse {
                    chars.push_back(s);
                } else {
                    chars.push_front(s);
                }
            } else {
                if reverse {
                    chars.push_front(s);
                } else {
                    chars.push_back(s);
                }
            }
        }
    }
    
    println!{"{}", if reverse { chars.into_iter().rev().collect::<String>() } else { chars.into_iter().collect::<String>() }};
}


Measured memory_bytes: 6396
#include<stdio.h>
#include<math.h>
#include<string.h>
#define FOR(N) for(int i = 0;i < N;i++)
#define PRN(N) printf("%d\n",N)
#define PRS(S) printf("%s\n",S)
void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(void){
  int n;
  scanf("%d",&n);
  int a[n];
  FOR(n){
    scanf("%d",&a[i]);
  }
   quick_sort(a,0,n - 1);
  if(a[n / 2 - 1] == a[n / 2]){
    PRN(0);
  }else{
    PRN(a[n / 2] - a[n / 2 - 1]);
  }
  return 0;
}

Measured memory_bytes: 512
a,b,c,d = map(int,input().split())
if c<=b<=d:
    if a<=c:
        print(b-c)
        exit()
    else:
        print(b-a)
        exit()
if c<=a<=d:
    if d<=b:
        print(d-a)
        exit()
    else:
        print(b-a)
        exit()
if a <= d <= b:
    if c <= a:
        print(d - a)
        exit()
    else:
        print(d - c)
        exit()
if a <= c <= b:
    if b <= d:
        print(b - c)
        exit()
    else:
        print(d - c)
        exit()
else:
    print(0)

Measured memory_bytes: 3064
(A,B,C,D)=input().split()
(A,B,C,D)=(int(A),int(B),int(C),int(D))
while A>0 or C>0:
  C-=B
  if C>0:
    A-=D
    if A>0:
      continue
    else:
      print("No")
      break
  else:
    print("Yes")
    break

Measured memory_bytes: 9172
using namespace std;

#include <bits/stdc++.h>

int main(){
    int a[100007];
    int n;
    cin >> n;
    for ( int i = 0; i < n; i ++ ){
        cin >> a[ i ];
    }
    long long ans = 0;
    for ( int i = 0; i < n; i ++ ){
        for ( int j = i + 1; j < n; j ++ ){
            ans += a[ i ] * a[ j ];
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
#define N 100050
#define B 1023
int n;
int b1[B+10],b2[B+10],b3[B+10],b[N];
struct A {
	int x,id;
	bool operator < (const A &u) const {
		return x<u.x;
	}
}a[N];
int main() {
	scanf("%d",&n);
	int i;
	for(i=1;i<=n;i++) scanf("%d",&a[i].x),a[i].id=i;
	sort(a+1,a+n+1);
	int ans=0;
	for(i=1;i<=n;i++) {
		if((i&1)!=(a[i].id&1)) ans++;
	}
	printf("%d\n",ans>>1);
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int ctoi(char);

int main(void){
  string a="",b="";
  cin >> a >> b;
  int Aans=0, Bans=0;
  if(a.length()==b.length()){
    for(int i=0;i<a.length();++i){
      int A,B;
      A = ctoi(a.at(i));
      B = ctoi(b.at(i));
      if(A>B){
        cout << "GREATER" << endl;
        return 0;
      }else if(B>A){
        cout << "LESS" << endl;
        return 0;
      }
    }
    cout << "EQUAL" << endl;
  }else{
      Aans = a.length();
      Bans = b.length();
      if(Aans>Bans){
        cout << "GREATER" << endl;
      }else if(Aans<Bans){
        cout << "LESS" << endl;
      }else{
        cout << "EQUAL" << endl;
      }
    }
  return 0;
}

int ctoi(char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}


Measured memory_bytes: 256
n,m,q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(q):
  A,B,C,D=map(int,input().split())
  a.append(A)
  b.append(B)
  c.append(C)
  d.append(D)
ans=0
M=[0,0,0,0,0,0,0,0,0,0,0]
for i in range(n):
  M[i]=1
cursor=n
breakflag=0
while True:
  ev=0
  for i in range(q):
    if M[b[i]-1]-M[a[i]-1]==c[i]:
      ev+=d[i]
  if ev>ans:
    ans=ev
  while True:
    if M[cursor-1]<m:
      M[cursor-1]+=1
      for i in range(cursor,n):
        M[i]=M[cursor-1]
      cursor=n
      break
    cursor-=1
    if cursor==0:
      breakflag=1
      break
  if breakflag==1:
    break
print(ans)
    
    

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n,k;
  cin>>n>>k;
  vll p(n);
  REP(i,n)cin>>p[i];

  ll cnt=0;
  ll sum=0;
  ll ans=0;
  REP(i,n){
    if(cnt<k){
      sum+=p[i];
      cnt++;
    }
    else{
      sum-=p[i-k];
      sum+=p[i];
    }

    if(cnt>=k){
      ans=max(ans,sum);
    }
  }

  ld a = (k+ans)/2.0;
  cout<<Decimal;
  cout<<a<<endl;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.buffer.readline

n = int(input())
g = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].append(b)
    g[b].append(a)
C = list(map(int, input().split()))
C.sort()

s = []
parent = [-1]*n
order = []
s.append(0)
while s:
    v = s.pop()
    order.append(v)
    for u in g[v]:
        if parent[v] == u:
            continue
        parent[u] = v
        s.append(u)

order.reverse()
ans = 0
D = [0]*n
for i in range(n):
    v = order[i]
    D[v] = C[i]
    if i != n-1:
        ans += C[i]
print(ans)
print(*D)


Measured memory_bytes: 45808
import java.util.Scanner;

public class Main {	
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		long ans = n * 800 - (n / 15) * 200;
		System.out.println(ans);
		
	}
	
		
}














Measured memory_bytes: 22868
#include<stdio.h>

#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100

int n ,M[N][N], time;
int color[N], d[N], f[N];

void dfs_search(int i){

  int j;

  color[i] = GRAY;
  d[i] = ++time;

  for(j = 0; j < n; j++){

    if(M[i][j] == 0){
      continue;
    }

    if(color[j] == WHITE){
      dfs_search(j);
    }
  }

  color[i] = BLACK;
  f[i] = ++time;
}
void dfs(){

int i;

  for(i = 0; i < n; i++){
    color[i] = WHITE;
    time = 0;
  }

  for(i = 0; i < n; i++){

    if(color[i] == WHITE){
      dfs_search(i);
    }
  }

  for(i = 0; i < n; i++){
    printf("%d %d %d\n", i+1, d[i], f[i]);
  }
}

int main(){

  int i, j, k, u, v;

  scanf("%d",&n);

  for(i = 0; i < n ; i++){
    for(j = 0; j < n; j++)
      M[i][j] = 0;
  }
  for(i = 0; i < n; i++){
    scanf("%d %d", &u, &k);

    u--;
    for(j = 0; j < k; j++){
         scanf("%d", &v);

      v--;
      M[u][v] = 1;
    }
  }

  dfs();
  
  return 0;
}


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

using namespace std;

int main()
{
	int n, m, a;

	while (true){
		scanf("%d %d %d", &n, &m, &a);
		if (n == 0){
			break;
		}

		int nico[128];
		for (int i = 0; i < n; i++){
			nico[i] = i + 1;
		}

		int h, p, q;
		vector<pair<int, pair<int, int> > > amida;

		for (int i = 0; i < m; i++){
			scanf("%d %d %d", &h, &p, &q);

			amida.push_back(make_pair(h, make_pair(p, q)));
		}

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

		for (int i = 0; i < m; i++){
			swap(nico[amida[i].second.first - 1], nico[amida[i].second.second - 1]);
		}

		printf("%d\n", nico[a - 1]);
	}


	return (0);
}

Measured memory_bytes: 1216
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    size_t N, K;
    cin >> N >> K;

    set<intmax_t> st;
    vector<intmax_t> cnt(int(2e5) + 5);
    for (size_t i = 0; i < N; ++i) {
        intmax_t a; cin >> a;
        st.insert(a);
        cnt[a]++;
    }

    const size_t size = st.size();

    if (size <= K) {
        return cout << 0 << "\n", 0;
    }

    MinHeap<pair<intmax_t, intmax_t>> minval;
    for (auto &si: st) {
        minval.emplace(cnt[si], si);
    }

    intmax_t res = 0;
    for (size_t i = 0; i < size - K; ++i) {
        res += minval.top().first;
        minval.pop();
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 16240
#include <iostream>

using namespace std;

int main()
{
    int H,W;
    cin >> H >> W;
    string A[H];
    for (int i=0; i<H; i++){
        cin >> A[i];
    }
    for (int i=0; i<H; i++){
        cout << A[i] << endl;
        cout << A[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
        int n = int.Parse(ReadLine());
        string s = ReadLine();

        int[] w = new int[n];

        int ct_w = 0;
        for (int i = 0; i < n; i++)
        {
            w[i] = ct_w;
            if (s[i] == 'W'){ ct_w++; }
        }

        int ans = n;
        int ct_e = 0;
        for (int i = n - 1; i >= 0; i--)
        {
            int leftWs = w[i];
            int rightEs = ct_e;
            ans = Math.Min(ans, leftWs + rightEs);
            if (s[i] == 'E'){ ct_e++; }
        }

        WriteLine(ans);
    }
}


Measured memory_bytes: 13280
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int abs(int a){
  if(a>0)return a;
  else return -a;
}

int main(){
  int n,k;
  cin >>n>>k;
  vector<int> a(n+1);
  rep1(i,n) cin >> a[i];
  const int INF = pow(10,9)+7;
  vector<int> dp(n+10,INF);
  rep1(i,k) dp[i] = abs(a[i] - a[1]);
  for(int i = k+1;i<=n;i++){
    int tmp = INF;
    rep1(j,k){
      int cand = dp[i-j] + abs(a[i-j]-a[i]);
      tmp = min(tmp,cand);
    }
    dp[i] = tmp;
  }
  cout << dp[n] << endl;
}

Measured memory_bytes: 1152
n, y = gets.split.map(&:to_i)
(0..n).each do |i|
  tmp = y / 1000 - n - 4 * i
  break if tmp < 0 || 10 * n - y / 1000 - 5 * i < 0

  if tmp % 9 == 0
    puts [tmp / 9, i, n - i - tmp / 9].join(' ')
    exit
  end
end
puts '-1 -1 -1'

Measured memory_bytes: 1788
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = (long)sc.nextInt();

		int[] n = new int[100];
		int chKind = 0;
		int chNum = 0;

		long ans = 0;

		char tmp = s.charAt(0);

		for(int i = 0 ; i < s.length() ; i++){
			if(tmp == s.charAt(i)){
				chNum++;
			}else{
				n[chKind] = chNum;
				chKind++;
				chNum = 1;
				tmp = s.charAt(i);
			}
		}
		n[chKind] = chNum;
		chKind++;

		if(chKind == 1){
			ans = n[0]*k/2;
		}else if(s.charAt(0) != s.charAt(s.length()-1)){
			for(int i = 0 ; i < chKind ; i++){
				ans += n[i]/2;
			}
			ans = ans*k;
		}else{
			for(int i = 1 ; i < chKind-1 ; i++){
				ans += n[i]/2;
			}
			ans = k*ans;
			ans += (k-1)*((n[0]+n[chKind-1])/2) + (n[0]/2) + (n[chKind-1]/2);
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 21844
N, M = map(int, input().split())
a = [0] * M
for i in range(M):
    a[i] = int(input())
a.append(N+1)
mod = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if a[0] == 1:
    a.pop(0)
else:
    dp[1] = 1

for i in range(2, N + 1):
    if a[0] == i:
        dp[i] = 0
        a.pop(0)
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % mod

print(dp[N])


Measured memory_bytes: 13360
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int ans = 0;
    int mn;
    rep(i,5) {
        int a; cin >> a;
        if (i == 0) mn = a;
        ans += (a+10-1)/10*10;
        if (a%10!= 0 && a%10 < mn%10) mn = a;
    }
    ans -= (mn+10-1)/10*10;
    ans += mn;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int ans = 0;
    string N;
    cin >> N;
    rep(i, 4) {
        if (N[i] == '2') ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    int n,i;
    string s;
    double x,ans=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> x >> s;
        if(s=="JPY") ans+=x;
        else ans+=(x*380000);
    }
    cout << fixed << setprecision(5) << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(nullptr);
	cout.tie(nullptr);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];
	int ans = 0;
	REP(i, 1, n) {
		int now = 0;
		if(a[i-1] > a[i]) now = a[i-1] - a[i];
		a[i] += now;
		ans += now;
	}
	cout << ans << endl;
	//rep(i, n) cout << a[i] << " ";
	return 0;
}

Measured memory_bytes: 5132
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(ll i=j;i<k;i+=in)
#define DF(i,j,k,in) for(ll i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); it++)
#define fitr(it,it1,itr2,in) for(auto it=itr1;it!=itr2;it+=in)
#define Dfeach(it,l) for (auto it = l.end()-1; it != l.begin()-1; it--)
#define Dfitr(it,it1,itr2,in) for(auto it=itr1;it!=itr2-1;it-=in)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define ins insert
#define mkp make_pair
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef map<ll,ll> mll;
typedef pair<ll,ll> pll;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin>>n;
vll h(n);
vll mi(n);
F(i,0,n,1) cin>>h[i];
mi[0]=0;
mi[1]=abs(h[0]-h[1]);
F(i,2,n,1){
        mi[i]=min(mi[i-1]+abs(h[i]-h[i-1]),mi[i-2]+abs(h[i]-h[i-2]));
    }
cout<<mi[n-1]<<endl;
return 0;
}


Measured memory_bytes: 1792
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const char s[]="RYGB";

int n,m,d;
int main()
{
	get3(n,m,d);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			int id=0;
			if(((i+j)/d)%2)id++;
			if(((i-j+m)/d)%2)id+=2;
			putchar(s[id]);
		}
		puts("");
	}
	return 0;
}

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

int main(void){
    int n,m; cin>>n>>m;
    if(n>=m) {
        cout<<0<<endl;
        return 0;
    }
    int ans=0;
    vector <int> p(m);
    for (int i=0;i<m;i++){
        cin>>p[i];
    }
    sort(p.begin(),p.end());
    vector <int> aida(m-1);
    for(int i=0;i<m-1;i++){
        aida[i]=abs(p[i+1]-p[i]);
    }
    sort(aida.begin(),aida.end());
    reverse(aida.begin(),aida.end());
    for(int i=0;i<m-1;i++) {
        if(i>=n-1) ans+=aida[i];
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
/**
 *   author: master3214
 *   created: Sep-22-2020
**/





#include <bits/stdc++.h>

using namespace std;

int main(){
	int a;
	cin >> a;
	for(int i = 0; i<a; i++){
		cout << "ACL";
	}
}
	
	
	
	



Measured memory_bytes: 3580
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<int> b(n);
    std::deque<int> ret;
    for (auto &el : b) std::cin >> el;
    for (int i = n; i > 0; i--) {
        int k = -1;
        for (int j = 1; j <= i; j++) {
            if (b[j - 1] == j) k = j;
        }
        if (k < 0) {
            std::cout << -1 << std::endl;
            return 0;
        }

        ret.push_front(k);
        b.erase(b.begin() + k - 1);
    }
    for (auto el : ret) std::cout << el << std::endl;

    return 0;
}


Measured memory_bytes: 256