akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,l,r) for(int i=(l);i<(r);i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef long long ll;  //ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<ll, ll> > PS;
template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
// g++ -std=c++11 prac.cpp 

int main(){
    ll x=0,y=0,z=0,n,m=0,k,ans=0,h,w,sum=0,Max=-1e9-1,cnt=0,Min=1e9+1;
    string s,t,u;
    bool ok=true;
    cin >> s >> t; 
    
    cout << t << s << endl;
    return 0;
}


 

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
  public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
for(;;) {
	int n=sc.nextInt(),x=sc.nextInt(),sum=0;
	if(n==0&&x==0)break;
	else {
		for(int i=1;i<=n;i++) {
			for(int o=1;o<=n;o++) {
				for(int p=1;p<=n;p++) {
					if(i+o+p==x&&i!=o&&o!=p&&p!=i) {
						sum+=1;
					}
				}
			}
		}

		System.out.println(sum/6);
	}
}
sc.close();
  }
}



Measured memory_bytes: 27048
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <iomanip>
#include <utility>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>
#include <unordered_set>
using namespace std;
using int64 = long long;
using vint = vector<int>;
using vint64 = vector<int64>;
#define ForInt(i, n) for (int i = 0; i < (n); ++i)
#define ForLong(i, n) for (int64 i = 0; i < (n); ++i)
#define ForIntInit(i, begin, end) for (int i = (begin); i < (end); ++i)
#define ForItr(it, itBegin, itEnd) for (auto it = (itBegin); it != (itEnd); ++it)
#define Min(a, b) ((a) < (b) ? (a) : (b))

int main()
{
	int n, m;
	cin >> n >> m;
	vint64 keysFlags(m);
	vint keysPrice(m);
	ForInt(i, m)
	{
		int b;
		cin >> keysPrice[i] >> b;
		int64 flags = 0;
		ForInt(j, b)
		{
			int tmp;
			cin >> tmp;
			flags |= 1LL << (tmp - 1);
		}
		keysFlags[i] = flags;
	}

	

	int64 flagMax = 1LL << n;
	const int PRICE_MAX = 100000001;
	vector<vint> dp(m, vint(flagMax, PRICE_MAX));
	dp[0][0] = 0;
	dp[0][keysFlags[0]] = keysPrice[0];
	ForIntInit(i, 1, m)
	{
		ForLong(j, flagMax)
		{
			dp[i][j] = dp[i - 1][j];
		}
		ForLong(j, flagMax)
		{
			int64 newFlags = j | keysFlags[i];
			dp[i][newFlags] = Min(dp[i][newFlags], Min(dp[i - 1][newFlags], dp[i - 1][j] + keysPrice[i]));
		}
	}

	

	int allPrice = dp[m - 1][flagMax - 1];
	cout << (allPrice >= PRICE_MAX ? -1 : allPrice) << endl;

	return 0;
}

Measured memory_bytes: 16256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int a;
    int b;
    int c;
    
    scanf("%d %d %d", &a, &b, &c);

    if (a<b && b<c) {
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    vector<vector<int>> A(3,vector<int>(3));
    for(int j = 0; j < 3; j++){
        for(int k = 0; k < 3; k++){
            cin >> A.at(j).at(k);
        }
    }
    cin >> N;
    vector<int> B(N);
    for(int i = 0; i < N; i++){
        cin >> B.at(i);
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(B.at(i) == A.at(j).at(k)){
                    A.at(j).at(k) = -1;
                }
            }
        }
    }
    bool whi = false;
    for(int i = 0; i < 3; i++){
        if(A.at(i).at(0) == -1 && A.at(i).at(1) == -1 && A.at(i).at(2) == -1){
            whi = true;
        }
        else if(A.at(0).at(i) == -1 && A.at(1).at(i) == -1 && A.at(2).at(i) == -1){
            whi = true;
        }
    }
    if(A.at(0).at(0) == -1 && A.at(1).at(1) == -1 && A.at(2).at(2)){
        whi = true; 
    }
    else if(A.at(0).at(2) == -1 && A.at(1).at(1) == -1 && A.at(2).at(0) == -1){
        whi = true;
    }
    if(whi){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
void solve()
{
    vector < int > a(n),ans;
    int i,j,res;
    for (i=0;i<n;i++)
        cin>>a[i];
    for (i=-100;i<=100;i++)
    {
        res=0;
        for (j=0;j<n;j++)
            res+=(a[j]-i)*(a[j]-i);
        ans.push_back(res);
    }
    j=ans.size();
    res=1000000000;
    for (i=0;i<j;i++)
        res=res<ans[i]?res:ans[i];
    cout<<res<<endl;
}
int main()
{
    while(cin>>n)
        solve();
}

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

int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;

    int count=0;

    for(int i=0; i<a+1; i++){
        for(int j=0; j<b+1; j++){
            for(int k=0; k<c+1; k++){
                if(500*i+100*j+50*k==x){
                    count++;
                }
            }
        }
    }

    cout<<count<<endl;
}

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

int main(){
    int n;cin>>n;
    int a;
    int ans = 0;
    
    rep(i,n){
        cin>>a;
        if(a%2)ans++;
    }
    
    puts(ans%2==0 ? "YES":"NO");
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <queue>


using namespace std;
#define INF 0x3f3f3f3f3f
#define ll long long
#define pr(x) (cerr << #x << ' ' << x << ' ')
#define prln(x) (cerr << #x << ' ' << x << endl)


int main()
{
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
	#endif // LOCAL
	int a, b;
	scanf("%d %d", &a, &b);
	if (a * b == 15) {
		puts("*");
	}else if (a + b ==  15) {
		puts("+");
	}else {
		puts("x");
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		int[] roads = new int[N];
		for(int i=1; i<=M; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			roads[a-1]++;
			roads[b-1]++;
		}
		
		for(int i=0; i<N; i++) {
			System.out.println(roads[i]);
		}
	}

	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}
}

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

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

    int x;
    cin >> x;

    if(x==3 || x==5 || x==7) puts("YES");
    else puts("NO");
}

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;

int a,b;

int main(){
  cin >> a >> b;
  int ans = 0;
  if(a>12) ans = b;
  else if (a < 6) ans = 0;
  else ans = b/2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
void pk()
{
    ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	ll cn=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			for(ll k=j+1;k<n;k++)
			{
				if(arr[i]+arr[j]>arr[k]&&arr[j]+arr[k]>arr[i]&&arr[i]+arr[k]>arr[j]&&arr[i]!=arr[j]&&arr[j]!=arr[k]&&arr[i]!=arr[k])
				   cn++;
			}
		}
	}
	cout<<cn;
}
int main() 
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    // #ifndef ONLINE_JUDGE 
    // freopen("/home/priyanshu/Hackercup/input.txt", "r", stdin); 
    // freopen("/home/priyanshu/Hackercup/output.txt", "w", stdout); 
    // #endif 
	ll t=1;
    //cin>>t;
    while(t--)
    {
        pk();
    }
    return 0;
} 

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

signed main(){
	ll a,b;
	cin >> a >> b;
	
	ll ans = max(100000*(4-a),(ll)0);
	ans += max(100000*(4-b),(ll)0);
	if(ans == 600000) ans += 400000;
	
	cout << ans << endl;
	
    return 0;
}

Measured memory_bytes: 256
import numpy as np
N, K = map(int, input().split())
H = np.array(list(map(int, input().split())) + [0] * (K + 2), np.int32)
INF = 10 ** 9
dp = np.array([INF] * (N + K + 2), np.int32)
dp[0] = 0

for i in range(N):
    dp[i + 1:i + K + 1] = np.minimum(dp[i + 1:i + K + 1],
                                     dp[i] + np.abs(H[i + 1:i + K + 1] - H[i]))
print(dp[N - 1])


Measured memory_bytes: 22768
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> cnt(3, 0);
    rep(i, n) {
        int p; cin >> p;
        if (p <= a) cnt[0]++;
        else if (p <= b) cnt[1]++;
        else cnt[2]++;
    }

    int ans = INF;
    rep(i, 3) chmin(ans, cnt[i]);
    cout << ans << endl;
}


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

const int N = 2e5 + 5;

long long a[N], b[N];

int main() {
  long long ans = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    scanf("%lld", a+i);
  for (int i = 0; i < n; ++i)
    scanf("%lld", b+i);
  for (int lg = 31; lg >= 0; --lg) {
    sort(a, a+n);
    long long dua = 1LL << lg, mask = dua - 1;
    long long cur = 0;
    for (int i = 0; i < n; ++i) {
      long long now = dua - (mask & b[i]);
      long long satu = lower_bound(a, a+n, now + dua) - lower_bound(a, a+n, now) + lower_bound(a, a+n, now + dua * 3) - lower_bound(a, a+n, now + dua * 2);
      if (b[i] & dua)
        satu = n - satu, b[i] ^= dua;
      cur = (cur + satu) % 2;
    }
    if (cur)
      ans |= (1LL << lg);
    for (int i = 0; i < n; ++i)
      a[i] &= mask;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 3328
// https://atcoder.jp/contests/abc111/tasks/abc111_a
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (auto &x : s) {
        if (x == '1') {
            cout << '9';
        } else {
            cout << '1';
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
x, y, z = input().split()
if x == y:
  if x == z and y == z:
    print("No")
  else:
    print("Yes")
elif x == z:
  if x == y and y == z:
    print("No")
  else:
    print("Yes")
elif y == z:
  if x == y and x == z:
    print("No")
  else:
    print("Yes")
else:
  print("No")

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

#define forsn(i, s, n)	for (int i = s; i < n; i++)
#define forn(i, n)		for (int i = 0; i < n; i++)

using namespace std;

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

bool enRango(int x, int mini, int maxi) {
	return (x >= mini && x <= maxi);
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	vector<int> r;
	vector<int> g;
	vector<int> b;
	forn(i, n) {
		if (s[i] == 'R')
			r.push_back(i);
		else if (s[i] == 'G')
			g.push_back(i);
		else
			b.push_back(i);
	}
	
	ull ans = 0;
	for (int rPos : r) {
		for (int gPos : g) {
			ans += b.size();
			int iBForb = (rPos+gPos)/2;
			if (enRango(iBForb, 0, s.size()-1) && s[iBForb] == 'B' && abs(iBForb-rPos) == abs(iBForb-gPos))
				ans--;
			iBForb = max(rPos, gPos) + abs(rPos - gPos);
			if (enRango(iBForb, 0, s.size()-1) && s[iBForb] == 'B' && abs(iBForb-max(rPos, gPos)) == abs(rPos-gPos))
				ans--;
			iBForb = min(rPos, gPos) - abs(rPos - gPos);
			if (enRango(iBForb, 0, s.size()-1) && s[iBForb] == 'B' && abs(min(rPos, gPos) - iBForb) == abs(rPos-gPos))
				ans--;
		}
	}
	
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 3616
using System;
	using System.Linq;
 
    class Program
    {
    	static void Main(string[] args)
    	{
    		int a = int.Parse(Console.ReadLine());
    		// スペース区切りの整数の入力
			string ans = (Console.ReadLine().IndexOf("Y") >= 0) ? "Four" : "Three";
			Console.WriteLine(ans);
    	}
    }

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

int main(){
    int n,j;
    cin>>n;
    int a[n];

    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cout<<(i==0?"":" ")<<a[n-i-1];                     
    }
    cout<<"\n";
    return 0;
}


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

int main() {

	int a[6]; 

	for(int i = 0; i < 6; i++) {
		cin >> a[i]; 
	}

	if(a[4] - a[0] > a[5]) {
		cout << ":(" << endl; 
	}

	else {
		cout << "Yay!" << endl; 
	}


	return 0; 
} 

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    vector<int> a(n);
    int cnt = 0;
    for(int i=0; i<n; ++i){
        cin >> a[i];
        if(a[i] < 0){
            ++ cnt;
            a[i] *= -1;
        }
    }

    long long ans = 0;
    if(cnt % 2 == 0){
        ans = accumulate(a.begin(), a.end(), 0LL);
    }
    else{
        sort(a.begin(), a.end());
        ans = accumulate(a.begin() + 1, a.end(), 0LL) - a[0];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };

long long int n;
long long int v[100001];


int main(void) {
	long long int pos = 0;
	long long int point = 0;
	bool flag = false;

	cin >> n;

	vector< pair<long long int,long long int> > first(100001,make_pair(0,0)), second(100001,make_pair(0,0));
	FOR(i, 1, n) {
		cin >> v[i];
	}
	FOR(i, 1, 100000) {
		first[i].second = second[i].second = i;
	}
	pos = 0;
	for (int i = 1; i <= n; i += 2) {
		first[v[i]].first++;
	}
	for (int i = 2; i <= n; i += 2) {
		second[v[i]].first++;
	}

	sort(first.begin(), first.end(), greater<pair<long long int,long long int> >());
	sort(second.begin(), second.end(), greater<pair<long long int, long long int> >());

	/*FOR(i, 0, 4) {
		cout << first[i].first << " " << first[i].second << endl;
	}
	FOR(i, 0, 4) {
		cout << second[i].first << " " << second[i].second << endl;
	}*/

	point = n;
	if (first[0].second != second[0].second) {
		point = min(point,n - (first[0].first + second[0].first));
		//cout << "a" << endl;
		flag = true;
	}
	if (first[1].second != second[0].second) {
		point = min(point, n - (first[1].first + second[0].first));
		//cout << "b" << endl;
		//flag = true;
	}
	if (first[0].second != second[1].second) {
		point = min(point, n - (first[0].first + second[1].first));
		//cout << "c" << endl;
		//flag = true;
	}
	if (first[1].second != second[1].second ) {
		point = min(point, n - (first[1].first + second[1].first));
		//cout << "c" << endl;
		//flag = true;
	}
	
	/*if(point==n&&flag==false){
		point = n / 2;
	}*/

	cout << point << endl;

	return 0;
}

Measured memory_bytes: 4096
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() int {
	sc.Scan()

	val, err := strconv.Atoi(sc.Text())

	if err != nil {
		fmt.Println(err)
	}
	return val
}

func main() {
	sc.Split(bufio.ScanWords)
	N := next()
	K := next()

	var Pn []int

	for i := 0; i < N; i++ {
		Pn = append(Pn, next())
	}
	sort.Ints(Pn)

	sum := 0
	for i := 0; i < K; i++ {
		sum += Pn[i]
	}

	fmt.Println(sum)

}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;

#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define pi  3.14159265359
#define mod 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll n;
   cin>>n;
   ll arr[n];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
   }
   ll sum=0;
   for(int i=1;i<n;i++)
   {
       if(arr[i]<arr[i-1]){
        sum+=(arr[i-1]-arr[i]);
        arr[i]=arr[i-1];
       }
   }
   cout<<sum<<endl;


}



Measured memory_bytes: 5200
class Node
    attr_accessor :value
    attr_accessor :prev
    attr_accessor :next
    def initialize(value="END", prev_node=nil, next_node=nil)
        @value = value
        @prev = prev_node
        @next = next_node
    end
end

class MyList
    def initialize(head = Node.new("END"), cursor = nil)
        @head = head
        @cursor = @head
    end

    def insert(x)
        new_node = Node.new(x)
        unless @cursor.prev.nil? 
            @cursor.prev.next = new_node
            new_node.prev = @cursor.prev
            @cursor.prev = new_node
            new_node.next = @cursor
        else
            new_node.next = @head
            @head.prev = new_node
            @head = new_node
        end
        @cursor = new_node
    end

    def move(n)
        if(n < 0)
            n.upto(-1) { @cursor = @cursor.prev unless @cursor.prev.nil?}
        else
            n.times { @cursor = @cursor.next unless @cursor.next.nil?}
        end
    end

    def erase()
        unless @cursor.value == "END"
            @cursor.next.prev = @cursor.prev
            @cursor.prev.next = @cursor.next unless @cursor.prev.nil?
            @cursor = @cursor.next
            @head = @cursor if @cursor.prev.nil?
        end
    end

    def print
        node = @head
        while(node.value != "END")
            puts node.value
            node = node.next
        end
    end

    def print_cursor
        puts "Current Cursor val: #{@cursor.value}"
        puts "Prev val: #{@cursor.prev.value}" unless @cursor.prev.nil?
        puts "Next val: #{@cursor.next.value}" unless @cursor.next.nil?

    end
end

L = MyList.new()
gets.chomp.to_i.times{
    choice, x = gets.chomp.split(" ")
    case choice
    when "0"
        L.insert(x)
    when "1"
        L.move(x.to_i)
    when "2"
        L.erase()
    end
    # puts "*****"
    # print "Current List: "
    # L.print
    # L.print_cursor
    # puts "*****"

}
L.print



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

int main(){
    int n, m, k;
    cin >> n >> m >> k;

    bool judge = false;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++){
            if(i*(m-j) + j*(n-i) == k)  judge = true;
        }
    }

    if(judge)   cout << "Yes" << endl;
    else        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
/*
  
  Author: Arnab Sinha
	
  ███████╗██╗  ██╗███████╗██████╗         ██╗      ██████╗  ██████╗██╗  ██╗███████╗██████╗  █████╗  █████╗ 
  ██╔════╝██║  ██║██╔════╝██╔══██╗        ██║     ██╔═══██╗██╔════╝██║ ██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗
  ███████╗███████║█████╗  ██████╔╝        ██║     ██║   ██║██║     █████╔╝ █████╗  ██║  ██║╚██████║╚██████║
  ╚════ █║██╔══██║██╔══╝  ██╔══██╗        ██║     ██║   ██║██║     ██╔═██╗ ██╔══╝  ██║  ██║ ╚═══██║ ╚═══██║
  ███████║██║  ██║███████╗██║  ██║███████╗███████╗╚██████╔╝╚██████╗██║  ██╗███████╗██████╔╝ █████╔╝ █████╔╝
  ╚══════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝╚══════╝╚═════╝  ╚════╝  ╚════╝                                                                                                        
*/
 
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define li long long int
#define ld long long double
#define all(v) v.begin(),v.end()
#define sort(a) sort(all(a))
#define rev(a) reverse(all(a))
#define pb push_back
#define INF 1e18+10
#define MINF -1e18-10
#define rep(i,a,b) for(li i=a;i<b;i++)
#define vli vector<li>
#define MAXN 1e5+10
const li mod = 1e9+7;
using namespace std;
 
li power(li a, li b) { a%=mod; li ret = 1; while(b){ if(b&1) ret*=a; a*=a;; if(ret>=mod) ret%=mod; if(a>=mod) a%=mod; b>>=1; } return ret; }
 
template <class T> void read(T& x){
	cin>>x;
}
 
template <class T, class... U> void read(T& x, U&... u){
	read(x);
	read(u...);
}
 
template <class A> void read(vector<A>& v){
	for(auto &it:v)
		read(it);
}
 
template <class A> void print(A x){
	cout<<x;
}
 
template <class A> void printl(A x){
	cout<<x<<endl;
}
 
template <class A> void print(vector<A>& v)
{
	for(auto &it:v){
		print(it);
		cout<<' ';
	}
	cout<<'\n';
}
 
void solve()
{
	li a,b,c,d;
	cin>>a>>b>>c>>d;

	li ans = max(a*c,max(a*d,max(b*c,b*d)));

	cout<<ans<<endl;
}

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

Measured memory_bytes: 3636
#include<stdio.h>
int main(void)
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b){
        printf("a > b\n");
    }else if(a<b){
        printf("a < b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;
	vector<lli> b(n);
	REP(i,0,n)cin>>b[i];

	vector<lli> ans;

	lli flag[110]={0};
	for(lli i=0;i<n;i++){
		lli cnt=1;
		lli maxK=-1;
		lli maxPos=-1;
		
		for(lli j=0;j<n;j++){
			if(flag[j]==1)continue;
			if(b[j]==cnt){
				maxK=cnt;
				maxPos=j;
			}
			cnt++;
		}

		if(maxK==-1){
			cout<<-1<<endl;
			return 0;
		}

		ans.push_back(maxK);
		flag[maxPos]=1;
	}

	for(lli i=n-1;i>=0;i--){
		cout<<ans[i]<<endl;
	}


	return 0;
}

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

//constexpr ll mod = 1000000007;
//constexpr ll INF = mod * mod;
//constexpr double pi = 3.14159265358979;

int main() {
    int n;
    string s,t;
    cin >> n >> s >> t;
    int ans = n*2;
    rep(i,n) {
        string a = s.substr(i);
        string b = t.substr(0,n-i);
        if(a == b) {
            int counter = n*2 - (n-i);
            ans = min(ans,counter);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <iostream>
#include <functional>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <deque>
#include <algorithm>
#include  <cstring>
#include <string>
#include <cmath> 
using namespace std;
typedef long long LL;
const int MAX = 3010;
const LL base = 1e9 + 7;


struct Node {
	int x, y, w;
};

LL dp[MAX][MAX];
void solve() {

	LL result = 0;
	int n;

	cin >> n;
	string s;
	cin >> s;

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

	for (int i = 0; i < n - 1; ++i) {
		int nt = n  - i;
		int nt0 = n - 1 - i;
		if (s[i] == '>') {
			LL t = 0;
			for (int j = 0; j < nt-1; ++j) {
				t += dp[nt][j];
				t %= base;
				dp[nt0][j] = t;
			}
		}
		else {
			LL t = 0;
			for (int j = nt-1; j>=1; --j) {
				t += dp[nt][j];
				t %= base;
				dp[nt0][j - 1] = t;
			}
		}
	}
	result = dp[1][0];
	cout << result << endl;

}

int main() {
	const int inId = 0;
	const int outId = 0;
	if (inId>0) {
		cerr << "redirect stdin to input " << inId << endl;
		string s = "input";
		s += to_string(inId);
		s += ".txt";
		auto r = freopen(s.c_str(), "r", stdin);	
		if (r == nullptr) {
			cerr<< "invalid input file "<< s;
		}
	}
	if (outId>0) {
		cerr << "redirect stdout to stdout " << outId << endl;
		string s = "stdout";
		s += to_string(outId);
		s += ".txt";
		auto r = freopen(s.c_str(), "w", stdout);
		if (r == nullptr) {
			cerr<< "invalid output file "<< s;
		}		
	}
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // close sync between cout and printf
	cout.precision(10);
	solve();
}
 

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

int main(void) {
  int N, W;
  cin >> N >> W;
  vector<int> v(N), w(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }
  vector<long long> dp(W + 1);
  long long ret = 0;
  for (int i = 0; i < N; i++) {
    for (int wt = W; wt >= 0; wt--) {
      if (wt + w[i] > W) continue;
      dp[wt + w[i]] = max(dp[wt + w[i]], dp[wt] + v[i]);
      ret = max(dp[wt + w[i]], ret);
    }
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin >> n;
    vi p(n),q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    vi a(n);
    iota(a.begin(),a.end(),1);
    int A,B;
    int cnt = 1;
    do{
        if(p==a) A = cnt;
        if(q==a) B = cnt;
        cnt++; 
    }while(next_permutation(a.begin(),a.end()));
    cout << abs(A-B) << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	run()
}

func run() {
	// scanner := bufio.NewScanner(reader)
	// scanner.Scan()
	// S := scanner.Text()
	burReader := bufio.NewReaderSize(reader, 100000)
	input := make([]byte, 0, 100000)

	for {
		line, isPrefix, err := burReader.ReadLine()

		if err != nil {
			if err.Error() == "EOF" {
				break
			}

			panic(err)
		}

		input = append(input, line...)

		if !isPrefix {
			break
		}
	}

	// words := []string{"dream", "dreamer", "erase", "eraser"}
	words := [][]byte{[]byte("dream"), []byte("dreamer"), []byte("erase"), []byte("eraser")}

LOOP_MAIN:
	for i := len(input) - 1; i >= 0; {
	LOOP_WORDS:
		for _, word := range words {
			if len(word)-1 > i {
				continue
			}

			for j := 0; j < len(word); j++ {
				if word[len(word)-1-j] != input[i-j] {
					continue LOOP_WORDS
				}
			}

			i -= len(word)
			continue LOOP_MAIN
		}

		fmt.Fprintln(writer, "NO")
		return
	}
	fmt.Fprintln(writer, "YES")
}


Measured memory_bytes: 768
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, m = LI()
G = [[] for _ in range(n)]
for _ in range(m):
    a, b = LI()
    G[a-1]+=[b-1]



dp = [-1] * n

def f(x):
    if dp[x] != -1:
        return dp[x]
    ret = 0
    for y in G[x]:
        ret = max(f(y) + 1, ret)
    dp[x] = ret
    return ret

for i in range(n):
    f(i)

print(max(dp))






Measured memory_bytes: 128676
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, a, b) for(int i=a; i<b; i++)
#define per(i, a, b) for(int i=b-1; i>=a; i--)
#define ifor(n) for(int i=0;i<n;i++) 
#define jfor(n) for(int j=0;j<n;j++)
#define Ifor(n) for(int i=1;i<n;i++) 
#define Jfor(n) for(int j=1;j<n;j++)
const int inf=0x3f3f3f3f;
int main(){
   int n,k;
   cin>>n>>k;
   int ans=0;
   while(n){
   	   ans++;
   	   n/=k;
   }
   cout<<ans<<endl;
} 

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        String s = sc.next();
        l:
        {
            for (int i = 0; i < s.length() - 1; i++) {
                String a = s.substring(i, i + 1);
                if (a.equals(s.substring(i + 1, i + 2))) {
                    System.out.println("Bad");
                    break l;
                }
            }
            System.out.println("Good");
        }
    }

    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }


        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 21076
N, K = gets.split(' ').map(&:to_i)
A = gets.split(' ').map(&:to_i)
MOD = 10 ** 9 + 7

ans = 0
N.times do |i|
	l = 0
	r = 0
	N.times do |j|
		if A[j] < A[i]
			if j < i
				l += 1
			else
				r += 1
			end
		end
	end
	ans += (K * r + K * (K - 1) * (l + r) / 2) % MOD
	ans %= MOD
end
puts ans

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

def main():
    N = int(input())
    M = 100000
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        return is_prime
    prime = sieve(M)
    alike = [0]
    for i in range(1,M+1,2):
        if (prime[i-1] and prime[(i+1)//2-1]):
            alike.append(alike[-1]+1)
        else:
            alike.append(alike[-1])
            
    for i in range(N):
        l,r = map(int,input().split())
        l = (l+1)//2
        r = (r+1)//2
        print(alike[r]-alike[l-1])
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 4956
#!/usr/bin/env python
"""エイシング プログラミング コンテスト 2020: B - An Odd Problem
https://atcoder.jp/contests/aising2020/tasks/aising2020_b
"""


def main():
    N = int(input())
    As = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        if (i + 1) % 2 != 0 and As[i] % 2 != 0:
            ans += 1
    print('{}'.format(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
#include <stdio.h>
double zenka(double q){
   double x=q/2;
     while(x*x*x-q>=0.00001*q || x*x*x-q<=-0.00001*q){
       x=x-((x*x*x)-q)/(3*x*x);
   }     
return x;
}

int main(void){
   int q;
     while(1) {
       scanf("%d",&q);
       if(q==-1) break;
       else{
           printf("%.7f\n",zenka(q));
       }
   }
     return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;

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

int main(){
  int n;
  while(cin >> n, n){
    bool cal[51][31];
    memset(cal, false, sizeof(cal));
    int f, d;
    int Last = 0;
    rep(i, n){
      cin >> f;
      rep(j, f){
	cin >> d;
	Last = max(Last, d);
	cal[i][d] = true;
      }
    }
    
    set<int> person[51];
    rep(i, n) person[i].insert(i);
    bool finish = false;
    int ans;
    for(int day = 1 ; day <= Last ; day++){
      vector<int> ch;
      rep(i, n){
	if(cal[i][day]) ch.push_back(i);
      }
      set<int> tmp;      
      rep(i, ch.size()){
	for(set<int>::iterator it = person[ch[i]].begin() ; it != person[ch[i]].end() ; it++){
	  tmp.insert(*it);
	}
      }
      if(tmp.size() == n){
	finish = true;
	ans = day;
	goto END;
      }
      rep(i, ch.size()) person[ch[i]] = tmp;
    }
  END:;
    if(finish) cout << ans << endl;
    else cout << -1 << endl;    
  }	  
  return 0;
}

Measured memory_bytes: 1328
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int m, k;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> m >> k;
	int ub = 1 << m;
	if (k >= ub) {
		cout << "-1\n";
		return 0;
	}
	if (ub == 2) {
		if (k == 0) {
			cout << "0 0 1 1\n";
		}
		else {
			cout << "-1\n";
		}
		//system("pause");
		return 0;
	}
	for (int i = 0; i < ub; i++) {
		if (i == k) continue;
		cout << i << " ";
	}
	cout << k << " ";
	for (int i = ub - 1; i >= 0; i--) {
		if (i == k) continue;
		cout << i << " ";
	}
	cout << k << "\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T>
auto makeNdVector(int n) {
  return vector<T>(n);
}

template<typename T, typename N, typename... Tail>
auto makeNdVector(const N& n, const Tail&... tail) {
  auto vec = makeNdVector<T>(tail...);
  vector<decltype(vec)> vecs(n, vec);
  return vecs;
}

void add(LL& a, LL b) { a = (a + b) % kMod; }

int main() {
  int N; cin >> N;
  string S; cin >> S;
  auto dp = makeNdVector<LL>(N + 1, N + 1);

  for (int j = 0; j < N; ++j) dp[0][j] = 1;

  for (int i = 0; i < N; ++i) {
    if (S[i] == '<') {
      dp[i + 1][0] = dp[i][0];
      for (int j = 0; j + 1 < N - i - 1; ++j) {
        add(dp[i + 1][j + 1], dp[i + 1][j] + dp[i][j + 1]);
      }
    } else {  // '>'
      for (int j = N - i - 1; j >= 0; --j) {
        add(dp[i + 1][j], dp[i + 1][j + 1] + dp[i][j + 1]);
      }
    }
  }
  cout << dp[N-1][0] << endl;
}


Measured memory_bytes: 73664
# coding: utf-8
ans = 0
S = [0,0,0,0,0]
Ss = [0,0,0,0,0]
S[0] = int(input())
S[1] = int(input())
S[2] = int(input())
S[3] = int(input())
S[4] = int(input())

HJ = S[0] % 10
T = 0

for i in range(5):
    if HJ > S[i] % 10 and 0 != S[i] % 10:
         T = i
         HJ = S[i] % 10
         #print('testA')

for i in range(5):
    if S[i] % 10 != 0:
        Ss[i] = S[i] - (S[i] % 10) + 10
        #print('testB')
    else:
        Ss[i] = S[i]
        #print('testC')

Ss[T] = S[T]

ans = Ss[0]+Ss[1]+Ss[2]+Ss[3]+Ss[4]
print(ans)

Measured memory_bytes: 38256
n, m = gets.split.map(&:to_i)

ary_A = []
ary_B = []

n.times do
    ary_A.push(gets.split.map(&:to_i))
end

m.times do
    ary_B.push(gets.to_i)
end

n.times do |i|
    num = 0
    for j in 0..m-1 do
        num += ary_A[i][j] * ary_B[j]
    end
    puts num
end


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

int main(int argc, char const *argv[]) {
  char c;
  std::cin >> c;

  if(c == 'a'||c=='e'||c=='u'||c=='i'||c=='o'){
    std::cout << "vowel" << '\n';
  }
  else{
    std::cout << "consonant" << '\n';
  }
  return 0;
}


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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


	string s,t;cin>>s>>t;

	for(int i=0; i<s.length(); i++){
		if(s[i] != t[i]){
			writeln("No");
			return 0;
		}
	}

	writeln("Yes");

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, k; cin >> n >> k;
    VL x(n); cin >> x;
    ll ans = LLINF;
    eFOR(i, 0, n - k) {
        if (x[i + k - 1] <= 0)chmin(ans, -x[i]);
        else if (0 <= x[i])chmin(ans, x[i + k - 1]);
        else {
            chmin(ans, x[i + k - 1] - x[i] + min(-x[i], x[i + k - 1]));
        }
    }
    cout << ans << "\n";
}

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

using namespace std;

using i64 = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 n, a, b;
  cin >> n >> a >> b;
  if (!a and !b) {
    cout << 0 << '\n';
    return 0;
  }
  i64 ans = n / (a + b) * a;
  if (n % (a + b) != 0) {
    ans += min(a, n % (a + b));
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = map(int, input().split())

ans = True

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            ans &= True
        else:
            ans &= False

if ans:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 38384
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
const int MX=1e5+10;
int k;
int dist[MX];
deque<int> dq;
int bfs(int s)
{
    for(int i=0; i<=k; i++)
        dist[i]=1e9;
    dq.push_back(s);
    dist[s]=1;
    while(!dq.empty())
    {
        int node=dq.front();
      ///  cout<<node<<"\n";
        dq.pop_front();
        int ch=node*10;
        ch%=k;
        if(dist[ch] > dist[node])
        {
            dist[ch]=dist[node];
            dq.push_front(ch);
        }
        ch=node+1;
        ch%=k;
        if(dist[ch] > dist[node]+1)
        {
            dist[ch]=dist[node]+1;
            dq.push_back(ch);
        }
    }
    return dist[0];
}
int main()
{
    cin>>k;
    cout<<bfs(1)<<"\n";
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define call(x) (x).cbegin(), (x).cend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) {if (b<a) {a=b; return 1;} return 0;}
const int INF = INT_MAX;
const int MOD = 1000000007;
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

int main() {
    int N;
    cin >> N;
    vi h(N);
    rep(i, N) cin >> h[i];

    vi dp(N, INF);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    FOR(i, 2, N-1) {
        chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
    }
    
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        if((A+B)>=C) {
        	System.out.print("Yes");
        }	
        else {
        	System.out.print("No");
        }
    }
}

Measured memory_bytes: 21972