akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fast ios::sync_with_stdio(0),cin.tie(0)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define ls (rt<<1)
#define rs (rt<<1|1)
#define All(a) (a).begin(),(a).end()
#define clr(a) memset((a),0,sizeof(a))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,a,b) for(int i=(a);i>=(b);--i)
#define FOR_edge(i,u)  for(int i=hd[u];i;i=e[i].nxt)
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};

inline char in() {
	static char buf[10001],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,10000,stdin),p1==p2)?EOF:*p1++;
}
template <class Tp> inline void read(register Tp &s) {
	s=0;
	register bool neg=0;
	register char c;
	while(!isdigit(c=in())) if(c=='-') neg=1;
	while(s=(s<<3)+(s<<1)+c-48,isdigit(c=in()));
	s=(neg?-s:s);
}
template <class Tp> inline void write(register Tp x) {
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
template <class Tp> inline void print(const Tp &x,const char &end) {write(x); putchar(end);}
template <class Tp> inline Tp pow(register Tp x,register Tp p,const Tp &mod) {
	register Tp res=1;
	for(;p;p>>=1,x=(x*x)%mod) if(p&1) res=(res*x)%mod;
	return res;
}
inline int comp(const double &x,const double &y) {
	const double d=x-y,eps=1e-8;
	return (d<=eps&&d>=-eps)?0:(d>eps?1:-1);
}
template <class Tp> inline Tp sqr(const Tp &x) {return x*x;}
template <class Tp> inline Tp gcd(const Tp &x,const Tp &y) {return(y==0?x:gcd(y,x%y));}
template <class Tp> inline Tp inv(const Tp &x,const Tp &MOD) {return POW(x,MOD-2,MOD);}
template <class Tp> inline Tp lowbit(const Tp &x) {return x&-x;}


int a[4];
int main() {
	read(a[1]); read(a[2]); read(a[3]);
	sort(a+1,a+4);
	int ans=a[3]-a[1];
	printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <map>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
ll n, a;
vector<ll> v;
ll dp[60][60 * 60][60];
ll dfs(ll depth, ll sum, ll num)
{
    if(dp[depth][sum][num] == -1) return 0;
    if(dp[depth][sum][num]) return dp[depth][sum][num];
    if(depth == n)
    {
        if(sum == a * num) return 1;
        else return 0;
    }
    ll res = dfs(depth + 1, sum, num) + dfs(depth + 1, sum + v[depth], num + 1);
    if(res == 0)
    {
        dp[depth][sum][num] = -1;
        return 0;
    }
    return dp[depth][sum][num] += res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    memset(dp, 0, sizeof(dp));
    cin >> n >> a;
    v.resize(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    ll ans = dfs(0, 0, 0) - 1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 101504
x,y=map(int,input().split())
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]
def ans():
    while True:
        for l in A,B,C:
            if x in l and y in l:
                return 'Yes'
                break
        return 'No'
        break
print(ans())

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>
// #include <atcoder/all>

template <class InputIterator>
std::ostream& range_output(std::ostream& os_arg, InputIterator first_arg, InputIterator last_arg){ if(first_arg != last_arg){ do{ os_arg << *(first_arg++); if(first_arg == last_arg) break; os_arg << ' '; } while(true); }  return os_arg; }
template <class Tp> std::ostream& operator << (std::ostream& os_arg, const std::vector<Tp>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class Tp, std::size_t Size> std::ostream& operator << (std::ostream& os_arg, const std::array<Tp, Size>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class S, class T> std::ostream& operator << (std::ostream& os_arg, const std::pair<S, T>& pair_arg){ return os_arg << '(' << pair_arg.first << ", " << pair_arg.second << ')'; }

#ifndef ONLINE_JUDGE
    template <typename Head> void dump_out(Head head_arg){ std::cerr << head_arg << '\n'; }
    template <typename Head, typename... Tail>
    void dump_out(Head head_arg, Tail... tail_args){ std::cerr << head_arg << ", "; dump_out(tail_args...); }
    #define dump(...) do { std::cerr << "[in line " << __LINE__ << "] " << #__VA_ARGS__ << " : "; dump_out(__VA_ARGS__); } while(false)
#else
    #define dump(...) (void(0))
#endif




int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    int n, m; std::cin >> n >> m;
    std::vector<std::vector<int>> edge(n);
    std::vector<int> in(n, 0);
    for(int _ = 0; _ < m; ++_){
        int u, v; std::cin >> u >> v; --u; --v;
        edge[u].push_back(v); ++in[v];
    }
    std::vector<int> dp(n, 0);
    std::vector<int> Stk;
    for(int i = 0; i < n; ++i) if(in[i] == 0) Stk.push_back(i);

    while(not Stk.empty()){
        const int u = Stk.back(); Stk.pop_back();
        const int val = dp[u] + 1;
        for(const int v : edge[u]){
            if(dp[v] < val) dp[v] = val;
            --in[v]; if(in[v] == 0) Stk.push_back(v);
        }
    }
    const int res = *std::max_element(dp.cbegin(), dp.cend());
    std::cout << res << '\n';
    return 0;
}

Measured memory_bytes: 9388
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

                Scanner scan = new Scanner(System.in);
                int a = Integer.parseInt(scan.next());
                int b = Integer.parseInt(scan.next());

                if ((a * b ) % 2 == 0 ) {
                    System.out.printf("Even");
                } else {
                    System.out.printf("Odd");
                }
            }
}


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

using namespace std;
using lli = int_fast64_t;
using ulli = unsigned long long;
#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 = copy(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

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;


int main() {
	lli N, K;
	cin >> N >> K;
	vector<lli> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		A[i]--;
	}

	// sum,MOD
	vector<pair<lli, lli>> v(N, { -1,-1 });
	lli now = 0;
	lli save = -1;
	lli savef = -1;
	lli mod = 0;
	for (int i = 0; i < N * 5; i++) {
		if (v[now].first == -1) {
			if (i == K) {
				cout << now + 1 << endl;
				return 0;
			}
			v[now].first = i;
		}
		//loop detect
		else {
			if (save == -1) {
				save = i;
				savef = v[now].first;
			}
			if (v[now].second != -1)break;
			mod++;
			v[now].first = savef;
			v[now].second = i - save;
		}
		now = A[now];
	}
	for (int i = 0; i < N; i++) {
		if (v[i].second!= -1 && mod != 1) {
			if (K % mod == (v[i].first + v[i].second) % mod) {
				cout << i +1 << endl;
				return 0;
			}
		}
		if (mod == 1) {
			if (v[i].first == save - 1) {
				cout << i + 1 << endl;
				return 0;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 7960
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
const ll INF=99999999999999999;
ll a,b,c,d,e,f,ans=0;
int main(){
    char s;
    cin>>s;
    if(s=='A')cout<<'T';
    if(s=='T')cout<<'A';
    if(s=='G')cout<<'C';
    if(s=='C')cout<<'G';
    
}

Measured memory_bytes: 256
import copy
n,k = map(int,input().split())
ai = [int(i) for i in input().split()]

#old_ai = ai
cnt = 0

aij = [[0 for i in range(n)] for j in range(2)]
aij[0] = ai

while 1 == 1:
    li = [0]*(n+1)
    for i in range(n):
        li[max(0,i-aij[0][i])] += 1
        li[min(n,i+1+aij[0][i])] -= 1
        #print(li)
    #print(li)
    tmp = 0
    for i in range(n):
        if i == 0:
            aij[1][i] = li[i]
            tmp += aij[1][i]
        else:
            aij[1][i] = li[i] + aij[1][i-1]
            tmp += aij[1][i]
    #print(rui)
    if aij[1] == aij[0]:
        print(*aij[1])
        exit()
        break
    cnt += 1
    if cnt == k:
        print(*aij[1])
        exit()
    for i in range(n):
        aij[0][i] = aij[1][i]

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll current = 0;
    vector<pair<ll, ll>> A;
    cin >> N;
    A.resize(N);
    rep(i, N) {
        ll a, b;
        cin >> a >> b;
        A[i] = pair<ll, ll>{a, b};
    }
    reverse(A.begin(), A.end());
    iter(i, A) {
        ll mod = (i.first + current) % i.second;
        if(mod == 0) continue;
        current += i.second - mod;
    }
    cout << current << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>

int main(void) {
    int N, Y;
    if(std::scanf("%d %d", &N, &Y) != 2)	return 1;

    int D = Y / 1000 - N;
    for(int a = 0; a <= N; ++a) {
        if(10000 * a > Y)   break;

        int tmp = D - 9*a;
        if(tmp % 4 == 0) {
            int b = tmp / 4;
            int c = N - a - b;
            
            if(b < 0)   continue;
            if(c < 0)   continue;
            
            std::printf("%d %d %d\n", a, b, c);
            return 0;
        }
    }

    std::printf("-1 -1 -1\n");
}


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


int main()
{
	string num;
	cin >> num;
	char last = 'a';
	for(char x : num){
		// 3783
		if(x == last){
			cout << "Bad";
			return 0;
		}
		last = x;
	}

	cout << "Good";
	
}	


Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<"="<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<"={";for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<",";cerr<<"}"<<endl;}
#define inf 100000000
#define N 1000
int main()
{
	ll a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	ll t=min(2*c,a+b);
	ll r=min(x,y);x-=r,y-=r;
	printf("%lld\n",r*t+x*min(a,2*c)+y*min(b,2*c));
}

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

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

//typedef pair<int,int> pp;
const int MAXN = 13;

vector<int> hindo(vector<int> s)
{
    map<int, int> m;
    REP(s.size()) m[s[i]]++;

    vector<int> ans;
    REP(s.size()) ans.push_back(m[s[i]]);
    
    return ans;
}
void os(vector<int> s)
{
    REP(s.size())
    {
        cout << s[i];
        if(i == s.size() -1){ cout << endl; return;}
        cout << " ";
    }
    return ;
}

int main()
{
    int n;
    while(cin >> n && n)
    {
        int num;
        vector<int> s[MAXN + 1];

        REP(n) {cin >> num; s[0].push_back(num);}

        REP(MAXN) s[i+1] = hindo(s[i]);

        REP(MAXN)if(s[i+1] == s[i] ){cout << i << endl; break;}
        os( s[MAXN -1]);
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
/*
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
*/

#define INF 10e9
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;


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

   vector<pair<long long int, long long int> > graph[n];
   long long int u, k, v, c;

   long long int i, j;
   for(i = 0; i < n; i++){
       cin >> u >> k;
       for(j = 0; j < k; j++){
           cin >> v >> c;
           pair<long long int, long long int> p = make_pair(v, c);
           graph[u].push_back(p);
       }
   }

   int used[n];
   long long int d[n];

   for(i = 0; i < n; i++){
       used[i] = 0;
       if(i == 0){
           d[i] = 0;
       }else{
           d[i] = INF;
       }
   }

   for(i = 0; i < n; i++){
       long long int id;
       for(j = 0; j < n; j++){
           if(used[j] != 1){
               id = j;
               break;
           }
       }
       for(j = 0; j < n; j++){
           if(used[j] != 1 && d[id]>d[j]){
               id = j;
           }
       }
       used[id] = 1;
       for(j = 0; j < graph[id].size(); j++){
           d[graph[id][j].first] = min(d[graph[id][j].first], d[id] + graph[id][j].second);
       }
   }

   for(i = 0; i < n; i++) cout << i << " " << d[i] << endl;
}



Measured memory_bytes: 3120
#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>

#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 fill(x,y) memset(x,y,sizeof(x))
#define name(x) #x
using namespace std;


const int INF = INT_MAX;
const int 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() {
    string s, t;
    cin >> s;
    cin >> t;
    
    vector<char> S(s.size()+1);
    vector<char> T(t.size()+1);
    
    for(auto i = 1; i<=s.size(); i++){
        S[i] = s[i-1];
    }
    for(auto i = 1; i<=t.size(); i++){
        T[i] = t[i-1];
    }
    
    VV(int) dp(s.size()+1,vector<int>(t.size()+1,0));

    
    
    for(auto i = 0; i<=s.size(); i++){
        for(auto j = 0; j<=t.size(); j++){
            
            if (i == 0 || j == 0){
                dp[i][j] = 0;
                continue;
            }
            
            if (s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }else{
                dp[i][j] = max( dp[i-1][j], dp[i][j-1] );
            }
        }
    }
    
    int y = (int)s.size();
    int x = (int)t.size();

    string res = "";
    
    while (y > 0 && x > 0){
        
        if (s[y-1] == t[x-1]){
            res +=s[y-1];
            x--;y--;
        }else if (dp[y][x-1] < dp[y-1][x]){
            y--;
        }else{
            x--;
        }
    }
    
    reverse(all(res));
    cout << res << endl;
    
    
    return 0;
}




Measured memory_bytes: 35584
import sys
readline = sys.stdin.readline

def main():
    N, X = map(int, readline().rstrip().split())
    L = list(map(int, readline().rstrip().split()))
    ans = 1
    d = 0
    for l in L:
        d += l
        if d <= X:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

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

int main()
{
ll n ;
cin >> n ;
vector<ll> h(n);
rep(i, n){
  cin >> h[i];
}
h[0]--;
rep(i,n-1){
  if(h[i]==h[i+1])continue;
  else if(h[i]<=h[i+1])h[i+1]--;
  else {
    cout << "No" << endl;
    return 0;
  }
}
    cout << "Yes" << endl;

return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli f[N];

void solve()
{

    lli n, m;
    cin>>n>>m;
    for(int i = 1; i <= n; i ++) {
        f[i] = 1;
    }

    set<lli> s;
    s.insert(1);

    for(int i = 0; i < m ; i ++) {
        lli x, y;
        cin>>x>>y;
        f[x] --;
        f[y] ++;
        if(s.count(x)) {
            s.insert(y);
        }
        if(f[x] == 0) {
            s.erase(x);
        }
    }

    cout<<s.size();

    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 5760
#nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

N = int(input())

list = []

for i in range(55556):
    if(is_prime(i) and i % 5 == 1):
        list.append(i)
        
print(' '.join(str(item) for item in list[0:N]))

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

	public static void main(String[] args) {

//		入力nを読み取る
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a=1;
		//aが0より大きい間
		while(a<=n){
			
			//計算用の変数b
			int b = a;
			//3で割れる時
			if(b%3==0){
				
				System.out.print(" "+a);
			
			//3で割れない時	
			}else{
				//0より大きい間
				while(b>0){
					//10で割った時3あまる時
					if(b%10==3){
						System.out.print(" "+a);
						break;
					}
					//位の移動
					b/=10;
				}
			}
			a++;
		}
		//改行
		System.out.println("");
	}
}


Measured memory_bytes: 28848
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        Long K = sc.nextLong();
        sc.close();
        int x =0;
        int idx = -1;
        for(int i = 0; i < S.length(); i++){
            if(S.charAt(i) != '1'){
                x = Integer.parseInt(String.valueOf(S.charAt(i)));
                idx = i;
                break;
            }
        }
        if(idx < 0 || idx >= K)System.out.println(1);
        else System.out.println(x);
    }

}


Measured memory_bytes: 21844
N = int(input())
H = list(map(int, input().split())) + [10**9 + 10]
check = 0
ans = [0]

for i in range(1, N + 1):
    if H[i - 1] >= H[i]:
        check += 1
    else:
        if min(ans) < check:
            ans.append(check)
            check = 0

print(max(ans))

Measured memory_bytes: 63856
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    int n, k; cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];

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

    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    ABC102LinearApproximation solver = new ABC102LinearApproximation();
    solver.solve(1, in, out);
    out.close();
  }

  static class ABC102LinearApproximation {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int[] ar = new int[n];
      long res = 0;
      for (int i = 0; i < n; i++) {
        ar[i] = in.nextInt() - (i + 1);
      }
      Arrays.sort(ar);
      int mode = ar[n / 2];
      for (int i = 0; i < n; i++) {
        res += Math.abs(ar[i] - mode);
      }
      out.println(res);
    }

  }
}

Measured memory_bytes: 64632
#include <stdio.h>

void main(void){
    int N,sum = 0;
    int m[N];
    scanf("%d",&N);
    for(int i= 0;i < N;i++){
        scanf("%d",&m[i]);
        if(i%2 == 0){
            if(m[i]%2 != 0){
                sum++;
            }
        }
    }
    printf("%d",sum);
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD ((ll)1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)
template<class F,class S>void add(map<F,S>&mp,F f,S s){if(mp.find(f)==mp.end())mp[f]=F();mp[f]+=s;}
 
int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    if(k==0){
        cout<<n*n<<endl;
        return 0;
    }
    
    for(int i=k+1;i<=n;i++){//bのループ
        int mx=(n+1)/i;
        //cout<<i<<":"<<mx<<endl;
        ans+=mx*(i-k);
        int up=n+1-(n+1)/i*i;
        if(up>=k){
            ans+=up-k;
        }
        //cout<<up<<",";
        //cout<<ans<<endl;
    }
        cout<<ans<<endl;
}


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

const int N=1e5+5;
ll a[101][2],dp[105][N];
int n,w;

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

    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin>>n>>w;

    int ma=0;
    for(int i=0;i<n;i++)
        cin>>a[i][0]>>a[i][1],ma+=a[i][1];
    
    for(int i=0;i<n;i++){
        for(int val=0;val<=ma;val++){
            dp[i][val]=1e18;

            if(val==a[i][1])    
                dp[i][val]=min(dp[i][val],a[i][0]);

            if(i)   dp[i][val]=min(dp[i][val],dp[i-1][val]);

            if(val>=a[i][1] && i && dp[i-1][val-a[i][1]]!=1e18){
                dp[i][val]=min(a[i][0]+dp[i-1][val-a[i][1]],dp[i][val]);    
            }

        }        
    }
    for(int val=ma;val>=0;val--){
        for(int i=0;i<n;i++){
            if(dp[i][val]<=w){
                cout<<val<<"\n";
                return 0;
            }
        }
    }
}

Measured memory_bytes: 81736
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        int count = 0;
        for(int i = n; i > 0; i--){
            if(i - k >= 0){
                count++;
            }
        }
        
        System.out.println(count);
    }
    
}

Measured memory_bytes: 21844
//include
//------------------------------------------
#include <bits/stdc++.h> // only for GCC

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

//repetition
//------------------------------------------
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T>ostream&operator<<(ostream&os, vector<T>const&v){
        iter(it,v) os<<*it<<(it+1==v.end()?"":",");
        return os;
    }
    template<typename T, typename U>ostream&operator<<(ostream&os,const pair<T,U>&p){
        return os << "[" << p.dirst << "," << p.second << "]";
    }
}

//clear memory
// ------------------------------------------
#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
   int n,sum;
   while(cin >> n && n){
      int a[n+1][n+1];
      rep(i,n){
         sum=0;
         rep(j,n){
            cin>>a[i][j];
            sum+=a[i][j];
         }
         a[i][n]=sum;
      }
      rep(j,n+1){
         sum=0;
         rep(i,n){
            sum+=a[i][j];
         }
         a[n][j]=sum;
      }
      rep(i,n+1){
         rep(j,n+1){
            printf("%5d",a[i][j]);
         }
         cout << endl;
      }
   }
}

Measured memory_bytes: 1180
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int A, B, C;

int main(){
	cin >> A >> B >> C;
	A -= B;
	C -= A;
	if (C < 0)C = 0;
	cout << C << endl;

	return 0;
}

Measured memory_bytes: 256
s = list(input())

north = s.count("N")
west = s.count("W")
south = s.count("S")
east = s.count("E")

if north == 0:
    if south > 0:
        print("No")
        exit()
if south == 0:
    if north > 0:
        print("No")
        exit()
if west == 0:
    if east > 0:
        print("No")
        exit()
if east == 0:
    if west > 0:
        print("No")
        exit()
        
print("Yes")
    

Measured memory_bytes: 3064
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

import Data.Ratio
import GHC.Exts

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	as <- readInts
	let
		ave = sum as % n
	print $ snd $ head $ sortWith ( \p -> abs $ fst p - ave ) $ zip ( map ( % 1 ) as ) [ 0 .. ]

Measured memory_bytes: 764
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

ll w[200];
ll v[200];

ll sum = 0;
ll M = 0;
ll W;
ll w0;
vector<vector<ll> > A(4, vector<ll>(0));
void calc(int n=0, ll tmp=0LL, ll tmp_w=W, ll w0=w0) {
  if(n == 4) {
    if(tmp > M)
      M = tmp;
    return;
  } else {
    for(int i=0; i<=min((int)(tmp_w/(w0+n)), (int)A[n].size()); i++) {
      calc(n+1, tmp+accumulate(A[n].begin(), A[n].begin()+i, 0LL),
	   tmp_w-(w0+n)*i, w0);
    }
  }
}

int main(){
  int N;
  cin >> N >> W;
  for(int i=0; i<N; i++) {
    cin >> w[i] >> v[i];
    if(i == 0) {
      w0 = w[0];
      A[0].push_back(v[0]);
    } else {
      A[w[i]-w0].push_back(v[i]);
    }
  }
  for(int i=0; i<4; i++)
    sort(A[i].begin(), A[i].end(), greater<ll>());
  calc();
  cout << M << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <algorithm>
#include <tuple>
#include <numeric>

int main()
{
	int N, M, C;
	std::vector<int> B;
	int result = 0;

	std::cin >> N >> M >> C;
	B.resize(M);
	for (auto& b : B)
		std::cin >> b;
	for (int i = 0; i < N; ++i) {
		int trait = C;
		for (auto b : B) {
			int a;
			std::cin >> a;
			trait += a * b;
		}
		if (trait > 0)
			++result;
	}

	std::cout << result << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  cout << setprecision(10);
  long K, s=0;
  cin >> K;
  for(int a=1; a<=K; a++){
    for(int b=1; b<=K; b++){
      for(int c=1; c<=K; c++){
        s += gcd(a,gcd(b,c));
      }
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 3636
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

M=gets.to_i
puts 24+24-M

Measured memory_bytes: 1788
/*For the name of God*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

template< class T > T gcd(T a, T b)
{
    return (b != 0 ? gcd<T>(b, a%b) : a);
}
template< class T > T lcm(T a, T b)
{
    return (a / gcd<T>(a, b) * b);
}
const int N = 200200;

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast

    char c;
    cin>>c;
    c=c+1;
    cout<<c<<endl;
}


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

int main()
{
    int a, b ,c;
    cin >> a >> b >> c;
    cout << (a/b) << " " << (a%b) << " " ;
    cout << fixed << setprecision(8) << ((double)a/(double)b) << endl;
}


Measured memory_bytes: 3256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()
k = ni()
x = na()

ans = 0
for i in range(n):
    ans += min(abs(x[i]) * 2, abs(x[i] - k) * 2)
print(ans)

Measured memory_bytes: 3064
package main

import (
	"fmt"
	"sort"
)

var n int

func check(card []int) (alice, bob int) {
	for i := 0; i < n; i += 2 {
		alice += card[i]
		if i+1 < n {
			bob += card[i+1]
		}
	}
	return alice, bob
}

func main() {
	fmt.Scan(&n)
	cards := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&cards[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(cards)))

	alice, bob := check(cards)

	fmt.Println(alice - bob)
}


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

bool isprime(long long n) {
  bool flg = true;
  for (int i = 2; i < n/2; i++) {
    if (n%i == 0) {
      flg = false;
      break;
    }
  }
  return flg;
}

int main() {
  long long x;
  bool flg = true;
  cin >> x;
  while (flg) {
    if (isprime(x)) {
      break;
    } else {
      x++;
    }
  }
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N;
    cin >> N;
    ll ans = LINF;
    for (ll x = 1; x * x <= N; x++) {
        if (N % x != 0) continue;
        ll y = N / x;
        ll d = abs(1 - x) + abs(1 - y);
        ans = min(d, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
const int INF=1e9;
#define ll long long
int main(){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double d=abs(2*M_PI*(double)m/60.0-2*M_PI*(double)(60*h+m)/720.0);
    double cc=pow(a,2)+pow(b,2)-2*a*b*cos(min(d,2*M_PI-d));
    double c=pow(cc,0.5);
    printf("%.10f\n",c);
} 

Measured memory_bytes: 4244
/*  ex9_2
    B30095    */
#include <stdio.h>
#include <stdlib.h>

// node definition
typedef struct node{
    char elem;
    struct node *next;
} node;

int is_stack_empty(node ** first);
void push(node **first, char elem);
char pop(node **first);

int main(void){
    node * first = NULL;
    char newColor, topColor; 
    int cnt = 0;

    while(1){
        newColor = getchar();
        if(newColor == '\n' || newColor == EOF || newColor == '\0') break;  /// end loop if the end of input is reached


        // push new cube to the stack if its color is the same as the top cube's or the stack is empty
        if(newColor == topColor || is_stack_empty(&first)){
            push(&first, newColor);
        }
        // remove the top cube if its color is not the same as new cube's
        else{
            pop(&first);
            cnt += 2;
        }

        // renew top cube's color
        if(!is_stack_empty(&first)){
            topColor = pop(&first);
            push(&first, topColor);  // put the element back
        }
    }
    
    // print result
    printf("%d", cnt);

    return 0;
}

int is_stack_empty(node ** first){
    if(*first == NULL) return 1;
    else return 0;
}

// stack push operation
void push(node **first, char elem){
    node *new = calloc(1, sizeof(node));  // allocate memory for new node
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}


// stack pop operation
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    free(tmp);  // deallocate memory of unused node
    return elem;
}


Measured memory_bytes: 4668
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    string s;
    cin >> s;
    bool ans=true;
    int n=s.size();
    if(s[0]!='A') ans=false;
    if(!(s[1]-'a'>=0&&s[1]-'a'<26)) ans=false;
    bool ok=false;
    repi(i,2,n-1){
        if(s[i]=='C'){
            if(ok){
                ans=false;
                break;
            }
            else ok=true;
            continue;
        }
        if(!(s[i]-'a'>=0&&s[i]-'a'<26)){
            ans=false;
        }
    }
    if(!ok) ans=false;
    if(!(s[n-1]-'a'>=0&&s[n-1]-'a'<26)) ans=false;
    if(ans) print("AC");
    else print("WA");
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 256
N = int(input())
l_a = list(map(int,input().split()))
b_x = sum(l_a) - sum(l_a[1::2])*2
l_x =[b_x]
for s in range(N-1):
    x = l_a[s]*2 - b_x
    l_x.append(x)
    b_x = x
print(*l_x)


Measured memory_bytes: 14032
var
	N,D,i,j,k,ans,now:Longint;
	X:array[1..20,1..10]of Longint;
begin
	read(N,D);
	for i:=1 to N do begin
		for j:=1 to D do read(X[i,j]);
	end;
	for i:=1 to N do for j:=i+1 to N do begin
		now:=0;
		for k:=1 to D do inc(now,(X[i,k]-X[j,k])*(X[i,k]-X[j,k]));
		if now=round(sqrt(now))*round(sqrt(now)) then inc(ans);
	end;
	writeln(ans);
end.


Measured memory_bytes: 128
#include<stdio.h>

int main(){
	long long int a,b,ans;
	scanf("%lld%lld",&a,&b);
	ans = a+b;
	if(ans%2==1){
		printf("IMPOSSIBLE");
		return 0;
	}
	else
		printf("%d",ans/2);
	return 0;
}

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

using namespace std;

int main(){
	string s;
	cin>>s;
	if(s=="Sunny"){
		printf("Cloudy\n");
	}	
	else if(s=="Cloudy"){
		printf("Rainy\n");
	}
	else{
		printf("Sunny\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>MOD){
		a -= MOD;
	}
}

int cnt[100100];

int main(void){
	int n,q,i,l,r;
	string s;
	cin >> n >> q;
	cin >> s;
	for(i=1; i<n; ++i){
		cnt[i+1] = cnt[i];
		if(s[i-1]=='A' && s[i]=='C'){
			++cnt[i+1];
		}
	}
	for(i=0; i<q; ++i){
		cin >> l >> r;
		cout << (cnt[r]-cnt[l]) << endl;
	}
	return 0;
}


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

int N;
vector<int> A, B;

void input_init(void) {
	cin >> N;
	A.resize(N);
	B.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> A[i] >> B[i];
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
}

int odd_calcu(void) {
	int id = N / 2;
	int min_val = A[id];
	int max_val = B[id];
	int cnt = max_val - min_val + 1;
	return cnt;
}

int even_calcu(void) {
	int id = N / 2 - 1;
	int min_val_1 = A[id];
	int max_val_1 = B[id];
	int min_val_2 = A[id + 1];
	int max_val_2 = B[id + 1];
	int min_val = min_val_1 + min_val_2;
	int max_val = max_val_1 + max_val_2;
	int cnt = max_val - min_val + 1;
	return cnt;
}

int main(void) {
	input_init();
	int ans = 0;
	if (N % 2 == 1)
		ans = odd_calcu();
	else
		ans = even_calcu();
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 4788
import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
    var n = 0
    while( {n=readInt;n} != 0 ) {
      (1 to n).foreach{ _ =>
        val s = readLine.split(" ").map(_.toInt)
        val x = s(0)*s(4)-s(1)*s(5)-s(2)*s(6)-s(3)*s(7)
        val y = s(0)*s(5)+s(1)*s(4)+s(2)*s(7)-s(3)*s(6)
        val z = s(0)*s(6)+s(2)*s(4)-s(1)*s(7)+s(3)*s(5)
        val w = s(0)*s(7)+s(3)*s(4)+s(1)*s(6)-s(2)*s(5)
        println(x + " " + y + " " + z + " " + w)
      }
    }
  }
}

Measured memory_bytes: 44168
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; string s; cin >> n >> s;
  ll r = 0, g = 0, b = 0;
  rep(i, s.size()){
    if(s[i] == 'R') r++;
    else if(s[i] == 'G') g++;
    else b++;
  }
  ll ans = r*g*b;
  for(int i = 0; i < s.size(); i++){
    for(int j = i+1; j < s.size(); j++){
      ll d = 2*j-i;
      if(d < n && s[i] != s[d] && s[j] != s[d] && s[i] != s[j])
        ans--;
    }
  }
  cout << ans << endl;
  system("pause");
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

struct edge
{
    int from;
    int to;
    int cost;
};

int main()
{
    int V, E, r;
    cin >> V >> E >> r;

    vector<edge> es(E);
    vector<int> dist(V, INF);

    rep(i, E)
    {
        int s, t, d;
        cin >> s >> t >> d;
        es[i] = {s, t, d};
    }

    dist[r] = 0;
    bool flag = true;
    int cnt = 0;

    while (flag)
    {
        if (cnt == V)
        {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
        flag = false;
        rep(i, E)
        {
            edge e = es[i];
            if (dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost)
            {
                dist[e.to] = dist[e.from] + e.cost;
                flag = true;
            }
        }
        cnt++;
    }

    rep(i, V)
    {
        if (dist[i] == INF)
        {
            cout << "INF" << endl;
        }
        else
        {
            cout << dist[i] << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define fo(i,a) for(i = 0;i < a;i++)
using namespace std;
int main(void)
{
	int n,a=0,b=0,x,y,i;
	
	cin >> n ;
	while(n != 0){
		fo(i,n){
			cin >> x >> y ;
			if(x > y) a += x + y ;
			else if(x < y) b += x + y ;
			else{
				a += x ;
				b += y ;
			}
		}
		
		cout << a << " " << b << endl ;
		a = 0 ;
		b = 0 ;
		cin >> n ;
	}
	
	return 0;
}

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

int main(){
	long long a,b,x,y;
	cin >> a >> b >> x >> y;
	
	printf("%.6f ",((double)a * b) / 2);
	cout << (((b&1^1) && (b/2==y)) && (a&1^1) && (a/2==x));
}


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

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

    int n;
    cin >> n;

    queue<int> q;

    ll sum = 0;

    rep(i,n) {
        int a;
        cin >> a;
        sum += ll(a);
        q.push(a);
    }

    ll sunuke = 0;
    ll arai = sum;
    // ll ans = abs(arai-sunuke);
    ll ans = 1e16;

    while((int)q.size() > 1) {
        sunuke += q.front();
        arai -= q.front();
        q.pop();
        ans = min(ans, abs(arai - sunuke));
    }

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

Measured memory_bytes: 4052