akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <map>
#include <string>
using namespace std;
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; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
#define min(a, b) ((a) < (b) ? (a) : (b))


long long dp[210][200010] = {0};

struct cell {
    int x, y;
};

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

    int a, b, c;

    cin >> a >> b >> c;

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


 	return 0;
}


Measured memory_bytes: 888
#include<cstdio>

using namespace std;

bool lt(int y1,int m1,int d1,int y2,int m2,int d2)
{
	if(y1<y2)	return true;
	if(y1>y2)	return false;
	if(m1<m2)	return true;
	if(m1>m2)	return false;
	if(d1<d2)	return true;
	if(d1>d2)	return false;
	return false;
}

int main(){
	int y,m,d;
	for(;~scanf("%d%d%d",&y,&m,&d);){
		if     (lt(y,m,d,1868,9,8))		puts("pre-meiji");
		else if(lt(y,m,d,1912,7,30))	printf("meiji %d %d %d\n",y-1867,m,d);
		else if(lt(y,m,d,1926,12,25))	printf("taisho %d %d %d\n",y-1911,m,d);
		else if(lt(y,m,d,1989,1,8))		printf("showa %d %d %d\n",y-1925,m,d);
		else							printf("heisei %d %d %d\n",y-1988,m,d);
	}
	return 0;
}

Measured memory_bytes: 0
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  tmp0 = input[0].split(" ");
  N = Number(tmp0[0]);
  K = Number(tmp0[1]);

  console.log(N - K + 1);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("13 3\n");


Measured memory_bytes: 21952
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    ll N, K, Q;
    cin >> N >> K >> Q;
    vector<ll> v(N, 0);
    ll a;
    REP(i, Q){
        cin >> a;
        a--;
        v[a]++;
    }
    REP(i, N){
        if (K - Q + v[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int A, B;

int main(void) {
    scanf("%d %d", &A, &B);
    if (A <= 8 && B <= 8) puts("Yay!");
    else puts(":(");

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define gc getchar()
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define Rep(i,v) rep(i,0,(int)v.size()-1)
#define lint long long
#define db long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
typedef pair<int,int> pii;
typedef set<int>::iterator sit;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
#define Ss(x,y) (x>=1&&x<=n&&y>=1&&y<=m&&v[x][y])
const int N=1010;int v[N][N],s[N][N];char str[N][N];
inline int S(int a,int b,int c,int d)
{
	return s[c][d]-s[a-1][d]-s[c][b-1]+s[a-1][b-1];
}
int main()
{
	int n=inn(),m=inn(),ans=0;
	rep(i,1,n) scanf("%s",str[i]+1);
	rep(i,1,n) rep(j,1,m)
		v[i+j][i-j+m]=(str[i][j]=='#');
	int nn=n+m,mm=n-1+m;n=nn,m=mm;
	rep(i,1,n) rep(j,1,m) s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+v[i][j];
	rep(i,1,n) rep(j,1,m) rep(k,j+2,m)
	{
		int d=k-j;if(!v[i][j]||!v[i][k]) continue;
		if(i-d>=1) ans+=S(i-d,j+1,i-d,k-1);
		if(i+d<=n) ans+=S(i+d,j+1,i+d,k-1);
	}
	rep(i,1,m) rep(j,1,n) rep(k,j+2,n)
	{
		int d=k-j;if(!v[j][i]||!v[k][i]) continue;
		if(i-d>=1) ans+=S(j+1,i-d,k-1,i-d);
		if(i+d<=m) ans+=S(j+1,i+d,k-1,i+d);
	}
	rep(i,1,n) rep(j,1,m)
	{
		if(!v[i][j]) continue;
		rep(d,1,max(n,m))
		{
			if(Ss(i-d,j)&&Ss(i,j-d)) ans++;
			if(Ss(i-d,j)&&Ss(i,j+d)) ans++;
			if(Ss(i+d,j)&&Ss(i,j-d)) ans++;
			if(Ss(i+d,j)&&Ss(i,j+d)) ans++;
		}
	}
	return !printf("%d\n",ans);
}

Measured memory_bytes: 7680
// Spc.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s,t;
	cin >> s;
	cin >> t;
	int counter = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == t[i])counter++;
	}
	cout << counter << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int n;cin>>n;
    int A[n],B[n],C[n-1];
    rep(i,n)cin>>A[i];
    rep(i,n)cin>>B[i];
    rep(i,n-1)cin>>C[i];
    int ans=0;
    rep(i,n-1){
        ans+=B[A[i]-1];
        if(A[i]+1==A[i+1])ans+=C[A[i]-1];
    }
    ans+=B[A[n-1]-1];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
fn get_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}

use std::collections::VecDeque;

fn main() {
    let mut xs: VecDeque<char> = get_line().chars().collect();

    let mut res = 0i64;
    while let Some(b) = xs.pop_back() {
        if let Some(f) = xs.pop_front() {
            if b != f {
                if f == 'x' {
                    res += 1;
                    xs.push_back(b);
                }
                else if b == 'x' {
                    res += 1;
                    xs.push_front(f);
                }
                else {
                    res = -1;
                    break;
                }
            }
        }
    }

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


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m, x;
    cin >> n >> m >> x;

    vl c(n);
    vvl a(n, vl(m));
    rep(i, n) {
        cin >> c[i];
        rep(j, m) {
            cin >> a[i][j];
        }
    }

    ll ans = INF;
    rep(b, 1<<n) {
        vl w(m);
        ll now = 0;
        rep(i, n) {
            if(b & 1<<i) {
                now += c[i];
                rep(j, m) {
                    w[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        rep(j, m) {
            if(w[j] < x) {
                ok = false;
            }
        }
        if(ok) {
            chmin(ans, now);
        }
    }

    if(ans == INF) {
        out(-1);
        re0;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 3636
n = gets.to_i
num = gets.strip.split.map(&:to_i)
#２で割れるだけ割る
sum = 0
while num.select{|x| x.even?}.size>0 do
  num.select!{|x| x.even?}
  for i in 0..(num.size-1)
    num[i] = num[i]/2
  end
  sum += num.size
end
puts sum

Measured memory_bytes: 16784
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

char grid[500][500];
int main() {
    int i,j;
    int H,W;
    scanf("%d %d",&H,&W);
    for (i = 0; i < H; i++) {
        for (j = 0; j < W; j++) scanf(" %c",&grid[i][j]);
    }

    for (i = 0; i < H; i++) {
        for (j = 0; j < W; j++) {
            if (j == 0) printf("#");
            else if (j == W-1) printf(".");
            else if ((i & 1) || (grid[i][j] == '#')) printf("#");
            else printf(".");
        }
        printf("\n");
    }
    printf("\n");
    for (i = 0; i < H; i++) {
        for (j = 0; j < W; j++) {
            if (j == 0) printf(".");
            else if (j == W-1) printf("#");
            else if (!(i & 1) || (grid[i][j] == '#')) printf("#");
            else printf(".");
        }
        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n, t, a;
	cin >> n >> t >> a;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		v.push_back(h);
	}

	int res = 0;
	float temp = t - 0.006 * v[0];

	if (n == 1) {
		cout << res << endl;
		return 0;
	}

	for (int i = 1; i < n; i++) {
		if (abs(temp - a) > abs(t - 0.006*v[i] - a)) {
			res = i;
			temp = t - 0.006*v[i];
		}
	}

	cout << res + 1 << endl;
}

Measured memory_bytes: 256
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline void reverse(Type& arr) { reverse(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1e9 + 7;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
using P = pair<ll, ll>;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> A;
    ll mx = 0;
    ll ans = 0;
    rep(i, N)
    {
        ll a;
        cin >> a;
        if (a < mx)
        {
            ans += mx - a;
            a = mx;
        }
        chmax(mx, a);
    }
    //
    cout << ans;

    return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}



signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(1){
    int n;
    cin>>n;
    if(n == 0) break;
    vector<int> A(n);
    cin>>A;

    int sum = 0;
    for(int i=0;i<n;i++) sum += A[i];

    int ans = 0;
    for(int i=0;i<n;i++)
      if(A[i] * n <= sum) ans++;

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



Measured memory_bytes: 3140
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<ull> vul;
#define For(i, n) for(ll i = 0; i < n; i++)
#define len(n) (ll)(n).size()
#define FAST_IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Sort(a) sort(a.begin(), a.end())

ll dp[101][(ll)1e5];

int main() {
    FAST_IO;
    ll n, w;
    cin >> n >> w;
    for (ll i = 1; i <= n; i++) {
        ll item_w, item_v;
        cin >> item_w >> item_v;
        for (ll j = 0; j <= w; j++) {
            if (j + item_w <= w) dp[i][j + item_w] = max(dp[i][j + item_w], dp[i - 1][j] + item_v);
            dp[i][j] = max(dp[i][j], dp[i - 1][j]);
        }
    }
    ll mx = 0;
    for (ll i = 1; i <= w; i++) mx = max(mx, dp[n][i]);
    cout << mx << '\n';
    return 0;
}

Measured memory_bytes: 81672
<?php

$inp = str_split( trim( fgets( STDIN ) ) );

if (count($inp) === 1) {
  echo 'No';
  exit;
}

while(count($inp) > 1) {
  $count = 1;
  $point = $inp[0];

  for ($j = 1; $j < count($inp); $j++) {
    if ($point === $inp[$j]) {
      ++$count;
    }
  }

  if ($count % 2 !== 0) {
    echo 'No';
    exit;
  }

  $inp = implode($inp);
  $inp = str_replace($point, '', $inp);
  $inp = str_split($inp);
}

echo 'Yes';

?>

Measured memory_bytes: 16204
/*
  ->->->->->-> Vora Mahammadasim <-<-<-<-<-<-
*/
#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define Mod 1000000007
#define all(a) a.begin(),a.end()
using namespace std;

void solve(){
  int n;
  cin>>n;
  int ans = 0;
  ans += (n/500)*1000;
  n%=500;
  ans += (n/5)*5;
  cout<<ans;
}

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt=1;
    //cin>>tt;
    while(tt--){
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,a[200010];
signed main(){
    cin>>n;
    rep(i,n)cin>>a[i];
    int now=0;
    rep(i,n){
        if(a[i]==now+1)now++;
    }
    if(now==0)cout<<-1<<endl;
    else cout<<n-now<<endl;
    return 0;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
		int n, x, a=1;
		std::cin >> n >> x;
		std::vector<int> l(n), d(n + 1);d[0] = 0;
		for (int i = 0;i < n ;++i) {
			std::cin >> l[i];
		}
		for (int i = 1;i < n+1;++i) {
			d[i] = d[i - 1] + l[i - 1];
			if (d[i] > x) { break; }
			else { a += 1; }
		}
		std::cout << a << std::endl;
		return 0;
	
}



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

vector<vector<char>>ans;

void solve(int N, int A, int B, int r, int c)
{
	int cnt = 0;
	vector<int>index1;
	for (int i = 0; i < N; i++)
	{
		bool a = (A >> i) & 1;
		bool b = (B >> i) & 1;

		if (a ^ b)
		{
			index1.push_back(i);
			cnt++;
		}
	}

	int nA = 0;
	int nB = (1 << cnt) - 1;

	for (int i = (1 << (N - 1)); i < (1 << N); i++)
	{
		ans[r][c + i] = 1;
	}

	if (N == 1)
	{

		for (int i = (int)index1.size() - 1; i >= 0; i--)
		{
			int i2 = index1[i];

			for (int j = 0; j < (1 << N); j++)
			{
				swap(ans[r + i2][c + j], ans[r + cnt - 1][c + j]);
			}
			cnt--;
		}

		for (int i = 0; i < N; i++)
		{
			for (int j = 0; j < (1 << N); j++)
			{
				ans[r + i][c + j] = ((A >> i) & 1) ^ ans[r + i][c + j];
			}
		}

		return;
	}

	solve(N - 1, 0, 1, r + 1, c);
	solve(N - 1, 1, nB >> 1, r + 1, c + (1 << (N - 1)));

	for (int i = (int)index1.size() - 1; i >= 0; i--)
	{
		int i2 = index1[i];

		for (int j = 0; j < (1 << N); j++)
		{
			swap(ans[r + i2][c + j], ans[r + cnt - 1][c + j]);
		}
		cnt--;
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < (1 << N); j++)
		{
			ans[r + i][c + j] = ((A >> i) & 1) ^ ans[r + i][c + j];
		}
	}
}

int main()
{
	int N, A, B; cin >> N >> A >> B;

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		bool a = (A >> i) & 1;
		bool b = (B >> i) & 1;

		if (a ^ b)cnt++;
	}
	if (cnt % 2 == 0)
	{
		cout << "NO" << endl;
		return 0;
	}

	ans.resize(N, vector<char>(1 << N));

	solve(N, A, B, 0, 0);

	cout << "YES" << endl;

	for (int j = 0; j < (1 << N); j++)
	{
		if (j)cout << " ";

		int x = 0;
		for (int i = 0; i < N; i++)
		{
			x += (int)ans[i][j] << i;
		}

		cout << x;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef  long long LL;
typedef  unsigned long long ULL;
typedef  double db;
typedef  long double ld;
#pragma comment(linker, "/STACK:102400000,102400000")
#define fuck(x) cout<<x<<endl
#define fuck1(x,y) cout<<x<<" "<<y<<endl
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define MP(a,b) make_pair(a,b)
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
const int INF = 0x3f3f3f3f3f,mod = 1e9+7;
const double eps  =1e-6,PI = acos(-1);
template<typename T> inline void read(T &x){
    x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    cout<<max(0,C-(A-B))<<endl;
    return 0;
}


Measured memory_bytes: 256
d, g = map(int, input().split())
pc = [tuple(map(int, input().split())) for i in range(d)]


nokori = set(range(1, d+1))


def dfs(i, sum, nokori, cnt):
    global ans
    if i == d:
        if sum < g:
            use = max(nokori)
            n = min(pc[use-1][0], -(-(g-sum)//(use*100)))
            cnt += n
            sum += n * use*100
        if sum >= g:
            ans = min(ans, cnt)
    else:
        dfs(i+1, sum, nokori, cnt)
        dfs(i+1, sum + pc[i][0] * (i+1) * 100 +
            pc[i][1], nokori-{i+1}, cnt+pc[i][0])


ans = float('inf')

dfs(0, 0, nokori, 0)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;cin>>s;
  int cnt=0;
    for(int i=0;i<s.size()/2;i++)
    {
      if(s.at(i)!=s.at(s.size()-1-i))
        cnt++;
    }
  cout<<cnt;
}

 
    
  
  

Measured memory_bytes: 256
x, y = map(int, input().split())

res = 0
if x == 1 and y == 1:
    res += 400000

if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000
if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000

print(res)

Measured memory_bytes: 3064
N,M=map(int,input().split())
L1=[0]*(N+1) #正解判定、iは問題分中と一致
L2=[0]*(N+1) #WAのカウント用、iは問題分中と一致

for i in range(M):
    p,S=input().split()
    if L1[int(p)]==1:
        pass
    else:
        if S=='AC':
            L1[int(p)]=1
        else:
            L2[int(p)]+=1

for j in range (N+1):
    if L1[j]==0 and L2[j]>0:
        L2[j]=0

print(sum(L1),sum(L2))

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int main()
{
    #ifdef __LOCAL
      fs::path p = __FILE__;
      fs::path input,output;
      input = output = p.parent_path();
      input += string("/input/") + string(p.stem()) + string(".txt");
      output += string("/output/") + string(p.stem()) + string(".txt");
      freopen(input.c_str(), "r", stdin);
      freopen(output.c_str(), "w", stdout);
    #endif

    int N;
    int count=0;
    vector<int> L;
    cin >> N;
    L = fetch_vec<int>(N);
    VSORT(L);
    for(int i=N-1;i>=0;i--)
        for(int j=0;j<i-1;j++)
            for(int k=j+1;k<i;k++)
                if(L[i] < L[j]+L[k]) count++;

    cout << count << endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0;i<N;i++){
        cin >> d.at(i);
    }

    sort(d.begin(), d.end());
    reverse(d.begin(), d.end());
    int str = 101;
    int count = 0;
    for(int i=0;i<N;i++){
        if(str > d.at(i)){
            count++;
        }
        str = d.at(i);
    }
    cout << count << endl;
}

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

def solve(N: int, M: int, Q: int, a: "List[int]", b: "List[int]", c: "List[int]", d: "List[int]"):
    from itertools import combinations_with_replacement
    def f(s):
        ret = 0
        for aa, bb, cc, dd in zip(a, b, c, d):
            if s[bb-1] - s[aa-1] == cc:
                ret += dd
        return ret
    return max(map(f, combinations_with_replacement(range(1, M+1), N)))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    a = [int()] * (Q)  # type: "List[int]"
    b = [int()] * (Q)  # type: "List[int]"
    c = [int()] * (Q)  # type: "List[int]"
    d = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
        c[i] = int(next(tokens))
        d[i] = int(next(tokens))
    print(solve(N, M, Q, a, b, c, d))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(void)
{
	cin>>s>>t;
	s+=s;
	if(s.find(t)!=string::npos)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e12; // larger than the longuest distance of s and t.
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  ll A, B, Q;
  cin >> A >> B >> Q;
  vector<ll> s(A+2);
  vector<ll> t(B+2);
  s[0] = - INF;
  s[A+1] = INF;
  rep(i, A) {
    cin >> s[i+1];
  }
  t[0] = - INF;
  t[B+1] = INF;
  rep(i, B) {
    cin >> t[i+1];
  }
  rep(i, Q) {
    ll x;
    cin >> x;

    ll sl, sr;
    auto sit = lower_bound(all(s), x);
    sr = *sit;
    --sit;
    sl = *sit;

    ll tl, tr;
    auto tit = lower_bound(all(t), x);
    tr = *tit;
    --tit;
    tl = *tit;

    ll ans = INF;
    ans = min(ans, abs(x-sl) + abs(sl-tl));
    ans = min(ans, abs(x-sl) + abs(sl-tr));
    ans = min(ans, abs(x-sr) + abs(sr-tl));
    ans = min(ans, abs(x-sr) + abs(sr-tr));
    ans = min(ans, abs(x-tl) + abs(tl-sl));
    ans = min(ans, abs(x-tl) + abs(tl-sr));
    ans = min(ans, abs(x-tr) + abs(tr-sl));
    ans = min(ans, abs(x-tr) + abs(tr-sr));

    cout << ans << endl;
  }
}


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

long long gcd(long long m, long long n)
{
    if (m < n) {
        swap(m, n);
    }

    long long r;
    while (n != 0) {
        r = m % n;
        m = n;
        n = r;
    }

    return m;
}

int main()
{
    long long n;
    long long t;
    long long ans = 1;

    cin >> n;
    for (long long i= 0; i < n; i++) {
        cin >> t;

        ans = (ans / gcd(ans, t) * t);
    }

    cout  << ans << endl;

    return 0;
}


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

int N,A[200010],pow[33] = {1};
int main(){
	cin >> N;
	map<int,int> m;
	for(int i=1;i<=32;i++) pow[i] = 2*pow[i-1];
	for(int i=1;i<=N;i++){
		cin >> A[i];
		m[A[i]]++;
	}
	sort(A+1,A+N+1);
	int ans = 0;
	for(int i=N;i>=1;i--){
		if(m[A[i]]==0) continue;
		for(int j=32;j>=0;j--){
			if(pow[j]-A[i]<=0) continue;
			if(m.count(pow[j]-A[i]) && m[pow[j]-A[i]]!=0){
				if(pow[j]-A[i]!=A[i]){
					m[A[i]]--; m[pow[j]-A[i]]--; ans++;
					break;
				}else{
					if(m[A[i]]>=2){
						m[A[i]] -= 2;
						ans++;
						break;
					}
				}
			}
		}
	}
	cout<< ans << endl;
}

Measured memory_bytes: 10368
import java.util.*;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		ArrayList<Integer> tree=new ArrayList<>(n);
		
		
		for(int i=0; i<n;i++){
			tree.add(sc.nextInt());
		}
		
		Collections.sort(tree);	
		
		
		
		int ans = 1000000000;
		
		for(int i=0;i<n-k+1;i++){
			ans=Math.min(tree.get(i+k-1)-tree.get(i),ans);
		}
			
		System.out.println(ans);
	}

}


Measured memory_bytes: 63296
import collections
n = int(input())
a = list(map(int, input().split()))
if len(set(a)) == 1:
    print(n // 2)
else:
    l_a = [a[i] for i in range(0, n, 2)]
    r_a = [a[i] for i in range(1, n, 2)]
    c_l = collections.Counter(l_a).most_common()
    c_r = collections.Counter(r_a).most_common()
    if c_l[0][0] != c_r[0][0]:
        ans = n - c_l[0][1] - c_r[0][1]
    else:
        ans = min(n - c_l[0][1] - c_r[1][1], n - c_l[1][1] - c_r[0][1])
    print(int(ans))


Measured memory_bytes: 21084
#include <iostream>
#include <string>

int main(){
    int n;
    std::cin >> n;
    char s[n];
    std::cin >> s;
    char t[n/2];
    std::string ans="Yes";
    
    if(n%2==1){
        std::cout << "No" << std::endl;
        return 0;
    }
    
    for(int i=0;i<n/2;++i){
        t[i]=s[n/2+i];
    }
    
    for(int i=0;i<n/2;++i){
        if(s[i]!=t[i]){
            ans="No";
            break;
        }
    }
    
    std::cout << ans << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<utility>
#define lli long long int
#define pb pushback
#define vec vector

using namespace std;

void dfs(vector <vector <int> >& adjList, vector <bool>& explored, int src);
void bfs(vector <vector <int> >& adjList, vector <bool>& explored, int src);

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    lli sum = 0;
    for (int i = 0; i < n; i++)cin >> a[i];
    for (int i = 1; i < n; i++)
    {
        if (a[i] < a[i - 1])
            sum += a[i - 1] - a[i], a[i] = a[i - 1];
    }
    cout << sum << endl;
    return 0;
}

void dfs(vector <vector <int> >& adjList, vector <bool>& explored, int src)
{
    explored.at(src - 1) = true;
    for (int i = 0, j = adjList.at(src - 1).size(); i < j; i++)
    {
        if (!explored.at(adjList.at(src - 1).at(i) - 1))
        {
            dfs(adjList, explored, adjList.at(src - 1).at(i));
        }
    }
    return;
}

void bfs(vector <vector <int> >& adjList, vector <bool>& explored, int src)
{
    explored.at(src - 1) = true;
    queue <int> q;
    q.push(src);
    while (!q.empty())
    {
        int temp = q.front();
        q.pop();
        for (int i = 0, j = adjList.at(temp - 1).size(); i < j; i++)
        {
            if (!explored.at(adjList.at(temp - 1).at(i) - 1))
            {
                explored.at(adjList.at(temp - 1).at(i) - 1) = true;
                q.push(adjList.at(temp - 1).at(i));
            }
        }
    }
}


Measured memory_bytes: 3932
use std::io;
use std::cmp;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let N: usize = iter.next().unwrap().parse().unwrap();
    let K: usize = iter.next().unwrap().parse().unwrap();
//    println!("{} {} ", N, K);
    
    let mut a: Vec<i64> = Vec::new();
    let mut buf2 = String::new();
    std::io::stdin().read_line(&mut buf2).unwrap();
    let mut iter2 = buf2.split_whitespace();
    for i in 0..N {
        let d: i64 = iter2.next().unwrap().parse().unwrap();
        a.push(d);
    }
//    for i in 0..N {
//    println!("{}", a[i]);
//}

    let mut cumsum: Vec<i64> = Vec::new();
    cumsum.push(0);
    for i in 0..N {
            let last = if cumsum.len()>0 { *cumsum.last().unwrap() } else {0};
        cumsum.push(a[i] + last);
    }
//    for i in 0..N+1 {
//    println!("{}", cumsum[i]);
//}

    let mut beauty: Vec<i64> = Vec::new();
    for l in 0..N+1 {
        for r in l+1..N+1 {
            beauty.push(cumsum[r] - cumsum[l]);
        }
    }
//    beauty.sort();
//    for &e in beauty.iter() {
//    println!("{}", &e);
//}

    let mut max: i64 = 0;
    for shift in (0..60).rev() {
//        println!("{}", beauty);
        let mask: i64 = 1 << shift;
        let mut count: usize = 0;
        for i in 0..beauty.len() {
//            println!("{} {} {}",beauty[i],mask,beauty[i] & mask);
            if (beauty[i] & mask) == 0 {
                continue;
            }
            count+=1;
        }
        if count >= K {
//    for &e in beauty.iter() {
//    print!(" {}", &e);
//}
//println!("");

            max |= mask;
            let mut tmp: Vec<i64> = Vec::new();
            for i in 0..beauty.len() {
                if (beauty[i] & mask) == 0 {
                    continue;
                }
                tmp.push(beauty[i]);
            }
            beauty.clear();
            for i in 0..tmp.len() {
                beauty.push(tmp[i]);
            }
        }
    }
    println!("{}", max);
}


Measured memory_bytes: 10360
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <cmath>
#include <limits>
#include <functional>

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 999999999

using namespace std;

#define int long long

signed main(){
	int n, m;
	while(1){
		cin >> n >> m;
		if(n==0) break;
		
		vector<int> p(n);
		REP(i, n){
			cin >> p[i];
		}
		p.push_back(0);
		sort(p.begin(), p.end());
		n++;
		
		vector<int> v;
		REP(i, n){
			FOR(j, i, n){
				if(p[i]+p[j]<=m) v.push_back(p[i]+p[j]);
			}
		}
		sort(v.begin(), v.end());
		
		int l=0, r=v.size()-1, ans=0;
		for(; l<=r; l++){
			while(v[l]+v[r]>m) r--;
			ans=max(ans, v[l]+v[r]);
		}
		
		cout << ans << endl;
	}
}

Measured memory_bytes: 9204
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> P;
const LL MOD = 1000000007LL;
char grid[100][100];
int main() {
	int A, B;
	cin >> A >> B;
	if (A <= B) { //黒の方が多い
		for (int i = 0; i < 100; i++) for (int j = 0; j < 100; j++) grid[i][j] = '.';
		A--;
		int x = 0, y = 0;
		while (A < B) {
			grid[y][x] = '#';
			x += 2;
			if (x >= 100) x=0,y += 2;
			B--;
		}
		x = 0, y += 2;
		while (A > 0) {
			for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) grid[y + i][x + j] = '#';
			grid[y + 1][x + 1] = '.';
			x += 4;
			if (x >= 100) x = 0, y += 4;
			A--;
		}
	}
	else if (A > B) { //白の方が多い
		for (int i = 0; i < 100; i++) for (int j = 0; j < 100; j++) grid[i][j] = '#';
		B--;
		int x = 0, y = 0;
		while (A > B) {
			grid[y][x] = '.';
			x += 2;
			if (x >= 100) x = 0, y += 2;
			A--;
		}
		x = 0, y += 2;
		while (B > 0) {
			for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) grid[y + i][x + j] = '.';
			grid[y + 1][x + 1] = '#';
			x += 4;
			if (x >= 100) x = 0, y += 4;
			B--;
		}
	}
	printf("100 100\n");
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) putchar(grid[i][j]);
		putchar('\n');
	}
}

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

double a[60];

int main() {
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%lf", a + i);
	sort(a, a + n);
	double ans = a[0];
	for (int i = 1; i < n; ++i)
		ans = (ans + a[i]) / 2;
	printf("%f\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[]a = new int[n];
for(int i=0; i<n; i++) a[i] =sc.nextInt();
for(int s=n-1; s>=0; s--){
if(s>0) System.out.print(a[s]+" ");
else System.out.println(a[0]);
}
}
}

Measured memory_bytes: 17272
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-RectangleCutting.py
#
w, h, x, y = map(int, input().split())
cutting = 0
if w == 2 * x and h == 2 * y:
  cutting += 1
print(w*h/2, cutting)



Measured memory_bytes: 2940
/********************************
*** ******** ********** *********
*** * ****** ********* * ********
*** ** ***** ******** *** *******
*** *** **** ******* ***** ******
*** **** *** ****** ******* *****
*** ***** ** ***** +++++++++ ****
*** ****** * **** *********** ***
*** *******  *** ************* **
*** ******** ** *************** *
**********_**********************
* |   /  / \  \     /    /\     *
* |  /  |   |  \   /    /  \    *
* | /   |   |   \ /    /    \   *
* |+\   |   |    |    /______\  *
* |  \  |   |    |   |        | *
* |   \  \_/     |   |        | *
********************************/
#include<bits/stdc++.h>
#define lli long long int
#define ld long double
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define lsb(i) (i & -i)
#define Pi 3.141592653589793238
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define all(a) a.begin(), a.end()
#define remax(a, b) (a = ((a<b) ? b : a))
#define remin(a, b) (a = ((a<b) ? a : b))
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define precise(a) cout<<fixed<<setprecision(a)
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

lli power(lli x,lli y,lli p) { 
	lli res = 1;	 
	x = x % p; 
	while (y > 0) 
	{ 
		if (y & 1) 
			res = (res*x) % p; 
		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
} 

void solve(){
	string s, t;
	cin >> s >> t;
	lli ans = 1e9, n = s.size(), m = t.size(), sm = 0;
	NA(i,0,n){
		if(i+m-1 >= n) break;
		sm = 0;
		NA(j,0,m) if(s[i+j]!=t[j]) ++sm;
		ans = min(ans, sm);
	}
	cout << ans ;
    return;
}

int main(){
    fastIO;
    lli t = 1;
	// cin >> t;
	NA(i,0,t) {
		// cout << "Case #" << i+1 << ": "; 
		solve();
	}
	return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll=long long; 
int main(){
  string m;
  cin>>m;
  ll N=m.size();
  ll c=0;
  ll a='0';
  vector<ll>tr(N);
  for(ll i=0;i<N;i++){
    
    tr.at(i)=m.at(i)-a;
    c+=tr.at(i);
  }
  
  if(c%9!=0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  
  
  
    
  
}


Measured memory_bytes: 5240
#include<stdio.h>

int main(){
    int n;
    int numbers[200];
    int i,j,k;
    int counter = 0;
    int flag = 0;

    scanf("%d", &n);

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

    while(1){
        for (j = 0; j < n ; ++j){
            if (numbers[j] %2 != 0)
                flag = 1;
            
        }
        if (flag ==1)
            break;
        
        
        ++counter;

        for(k = 0; k < n; ++k){
                numbers[k] = numbers[k]/2;
            }
        
    }
    printf("%d", counter);

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.lang.StringBuilder;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int c = 0;
		int n,x;
		do{
			n = sc.nextInt();
			x = sc.nextInt();
			c = 0;
			if(n==0&&x==0){
				break;
			}
			for(int i = 1;i <= n;i++){
				for(int o = 1;o <= n;o++){
					if(o==i){
						break;
					}
					for(int k = 1;k <= n;k++){
						if(i==k){
							break;
						}else if(o==k){
							break;
						}else if(i+o+k==x){
							++c;
						}
					}
				}
			}
			sb.append(c).append("\n");
		}while(true);
		System.out.print(sb);
	}
}

Measured memory_bytes: 26584
def linear_search(arr, key):
	arr.append(key)
	i = 0 
	while arr[i] != key:
		i += 1
		if i == n:
			return -1 
	return i 

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
count = 0 
for i in range(q):
	if linear_search(S, T[i]) != -1:
		count += 1
print(str(count))



Measured memory_bytes: 6552
#!/usr/bin/env python

from sys import stdin, stderr

def main():
   A, B = map(int, stdin.readline().split())
   p = 1
   res = -1
   while True:
      a = (p * 8) / 100
      b = (p * 10) / 100
      if a > A or b > B:
         break
      if a == A and b == B:
         res = p
         break
      p += 1

   print(res)

   return 0

if __name__ == '__main__': main()


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a[1111],tmp[1111],b[1111]={},mina=10000,ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    tmp[i]=a[i];
    mina=min(a[i],mina);
  }
  
  sort(tmp,tmp+n);
  
  for(int i=0;i<n;i++){
    int l=0,r=n,m;
    while(1){
      m=(l+r)/2;
      if(tmp[m]>a[i])r=m;
      else if(tmp[m]<a[i])l=m;
      else {
	a[i]=m;
	break;
      }
    }
  }
  
  for(int i=0;i<n;i++){
    if(a[i]!=i&&b[i]==0){
      int t=i,mint=10000,sum=0,cnt=0;
      while(1){
	cnt++;
	sum+=tmp[a[t]];
	mint=min(mint,tmp[a[t]]);
	b[t]++;
	t=a[t];
	if(t==i){
	  ans+=min(sum+mint*(cnt-2),sum-mint+mina*(cnt-1)+(mina+mint)*2);
	  break;
	}
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
	int bus[200];
	int a,b,min,sec,count=0,now=0,x;

	cin>>a;
	for(int i=0;i<a;i++){
		cin>>min>>sec;
		bus[count]=min*60+sec;
		count++;
	}
	
	cin>>b;
	for(int i=0;i<b;i++){
		cin>>min>>sec;
		bus[count]=min*60+sec;
		count++;
	}
	
	for(int s=0;s<count;s++){
		for(int t=s+1;t<count;t++){
			if(bus[t]<bus[s]){
				int tmp=bus[t];
				bus[t]=bus[s];
				bus[s]=tmp;
			}
		}
	}
	
	x=24*60;
	for(int i=0;i<count;i++){
		if(x==bus[i]){
		}else{
			if(i!=0)cout<<" ";
			cout<<bus[i]/60<<":";
			if(bus[i]%60<10){
				cout<<0<<bus[i]%60;
			}else{
				cout<<bus[i]%60;
			}
			x=bus[i];
		}
	}
	cout<<endl;
}

Measured memory_bytes: 1160
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s= sc.next();
		String[] bruh =  {"SUN","MON","TUE","WED","THU","FRI","SAT"};
		for (int i = 0 ; i < 7 ; i ++ )
			if (s.equals(bruh[i]))
			{
				System.out.println(7-i);
			}
	}

}


Measured memory_bytes: 21716
#include <iostream>
using namespace std;
int main(void){
    while(1){
        int n=0,x=0,a=0;
        cin >> n >> x;
        if(n==x && x==0){
            break;
        }
        for(int i=1;i<=x/3+1;i++){
            for(int j=i+1;j<=i+x/2;j++){
                if(x-i-j <= n && j < x-i-j){
                    a++;
                }
            }
        }
        cout << a <<endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
int MOD=1000000007;
int main(){
    int ma=0,ba=0,k;
    string S;
    cin >> S;
    k=S.size();
    for(int i=0; i<k; i++){
        if(S[i]=='o') ma+=1;
        else ba+=1;
        if(ba>7) {
            cout << "NO" << endl;
            return 0;
        }
    }if(15-ba>=8) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

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

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

const int MaxN = 100000 + 5;

int N, K;
int H[MaxN];
int Dp[MaxN];

inline int abs(int x) { return x > 0 ? x : -x; }
inline int min(int x, int y) { return x < y ? x : y; }

void init() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; ++i)
    scanf("%d", &H[i]);
}

void solve() {
  memset(Dp, 0x7F, sizeof Dp);
  Dp[1] = 0;
  for (int i = 2; i <= N; ++i)
    for (int j = 1; j <= K && i - j >= 1; ++j)
      Dp[i] = min(Dp[i], Dp[i - j] + abs(H[i] - H[i - j]));
  printf("%d\n", Dp[N]);
}

int main() {
  init();
  solve();
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,G[N];
vector < int > v[N];
void Dfs(int x,int p) {
	int G_=0;
	for (int i=0; i<v[x].size(); i++) 
		if (v[x][i]!=p) {
			Dfs(v[x][i],x);
			G_=(G_^(G[v[x][i]]+1));
		}
	
	G[x]=G_;
}
main () {
	cin>>n;
	
	for (int i=1; i<n; i++) {
		int x,y;
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	
	Dfs(1,1);
	
	if (G[1]) cout<<"Alice\n";
		else cout<<"Bob\n";
}

Measured memory_bytes: 13952