akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {

	static BufferedReader reader;
	final static boolean MODE_DEBUG = false;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		int N = readLineInt()[0];
		String S = readLine()[0];
		int RC = 0;
		int GC = 0;
		int BC = 0;
		char[] Sc = S.toCharArray();
		for(char c : Sc) {
			switch(c) {
				case 'R':
					RC++;break;
				case 'G':
					GC++;break;
				case 'B':
					BC++;break;
				default:
					print("ERR:"+c);
			}
		}
		
		long ALL = (long)RC*GC*BC;
		
		for(int i=0;i<N-2;i++) {
			for(int j=i+1;j*2-i<N;j++) {
				int k = j*2-i;
				if(Sc[i]!=Sc[j]&&Sc[j]!=Sc[k]&&Sc[i]!=Sc[k]) {
					ALL--;
				}
			}
		}
		print(ALL);
	}
	
	//functions here
	//note that all methods should be STATIC


	private static <T> int arraySearch(T needle, T[] heystack) {
		for(int i=0;i<heystack.length;i++) {
			if(needle.equals(heystack[i])) {
				return i;
			}
		}
		return -1;
	}
	private static int[] sort(int[] base) {
		int[] copy = array_copy(base);
		Arrays.sort(copy);
		return copy;
	}
	private static int[] array_copy(int[] base) {
		int[] copy = new int[base.length];
		for(int i=0;i<base.length;i++) {
			copy[i] = base[i];
		}
		return copy;
	}
	private static int[] asArray(ArrayList<Integer> ints) {
		int[] intlist = new int[ints.size()];
		for(int i=0;i<intlist.length;i++) {
			intlist[i] = ints.get(i);
		}
		return intlist;
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static int[] readLineInt(){
		try{
			String[] s = readLine();
			int[] ints = new int[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Integer.parseInt(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static byte[] readLineByte(){
		try{
			String[] s = readLine();
			byte[] bytes = new byte[s.length];
			for(int i=0;i<bytes.length;i++) {
				bytes[i] = Byte.parseByte(s[i]);
			}
			return bytes;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static char[] readLineChar(){
		try{
			String[] s = readLine();
			char[] chars = new char[s.length];
			for(int i=0;i<chars.length;i++) {
				chars[i] = (char)Integer.parseInt(s[i]);
			}
			return chars;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
	private static void printd(Object o){
		if(MODE_DEBUG)System.err.println(o);
	}
	private static void printd(){
		if(MODE_DEBUG)System.err.println();
	}
}


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

typedef long long ll;
const int maxn = 305;

int n, k, mod;
int C[maxn][maxn], f[maxn][maxn], s[maxn][maxn];

int main()
{
	scanf("%d%d%d", &n, &k, &mod);
	for (int i = 0; i <= n; ++i)
		for (int j = C[i][0] = 1; j <= i; ++j)
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
	for (int j = 0; j <= k; ++j) f[1][j] = 1, s[1][j] = k - j + 1;
	for (int i = 2; i <= n + 1; ++i) {
		for (int j = 0; j <= k; ++j)
			for (int k = 1; k < i; ++k)
				f[i][j] = (f[i][j] + (ll)f[i - k][j] * s[k][j + 1] % mod * C[i - 2][k - 1]) % mod;
		for (int j = k; j >= 0; --j)
			s[i][j] = (f[i][j] + s[i][j + 1]) % mod;
	}
	printf("%d\n", f[n + 1][0]);
	
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <math.h>
using namespace std;

int main()
{
	int n, y;
	cin >> n >> y;
	int res10000 = -1;
	int res5000 = -1;
	int res1000 = -1;
	for (int a = 0; a <= n; a++) {
		for (int b = 0; b + a <= n; b++) {
			int c = n - a - b;
			int total = 10000 * a + 5000 * b + 1000 * c;
			if (total == y) {
				res10000 = a;
				res5000 = b;
				res1000 = c;
			}
		}
	}
	cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
 
#define pii pair<int, int>
 
#define x1 x1228
#define y1 y1228
 
#define left left228
#define right right228
 
#define pb push_back
#define eb emplace_back
 
#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   
 
#define matr vector<vector<int> > 
 
#define all(x) x.begin(), x.end()
 
 
using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 1e9 + 9, inf = 1e9, MAXN = 1e6 + 7;
const double eps = 1e-9;                                                        
mt19937 rnd(time(0));
string a, b;

void solve() { 
    cin >> a >> b; 
    int ans = 0; 
    for (int i = 0; i < 3; ++i) ans += (a[i] == b[i]); 
    cout << ans; 
}                                
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
}  

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var A = ReadLongs();
            var B = ReadLongs();
            var C = ReadLongs();

            var manzoku = 0L;
            var pre = 99L;
            foreach (var a in A)
            {
                manzoku += B[(int)a - 1];
                if (pre + 1 == a)
                {
                    manzoku += C[(int)pre - 1];
                }
                pre = a;
            }

            return manzoku;
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 13396
#include <stdio.h>

int main(void)
{
	int a,b,c,i,j,k;
	for(k=1;k!=0;k++)
	{
		if(k!=1)
		{
			printf("\n");
		}
		scanf("%d%d",&a,&b);
		if(a==0 && b==0)
		{
			break;
		}
		for(i=1;i<b;i++)
		{
			printf("#");
		}
		for(i=1;i<a-1;i++)
		{
			printf("#\n#");
			for(j=1;j<b-1;j++)
			{
				printf(".");
			}
		}
		printf("#\n");
		for(i=1;i<=b;i++)
		{
			printf("#");
		}
		printf("\n");
	}
	return 0;
}

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

int n, m, t;

int main() {
    cin >> n >> m;
    int a[m], b[n+1];
    for (int i=0; i<n+1; i++) b[i]=i;
    for (int i=0; i<m; i++) {
        cin >> t; 
        for (int j=t; j<n+1; j++) {
            if (b[j] > b[j-t]+1) b[j] = b[j-t]+1;
        }
    }
    cout << b[n] << endl;
}


Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
typedef long long ll;

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (int i=(x);i<(y);i++)
#define REPJ(x,y)	for (int j=(x);j<(y);j++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef vector<vector<pair<int, int> > > GRA;

int i,j,a,b;

int main() {
	cin >> a >> b;

	if (a%2 && b%2) cout << "Odd" << endl;
	else cout << "Even" << endl;

	return 0;
}

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

int main(){
	double x,h,S_ans,S_teimen,S_sokumen;
	while(cin>>x>>h,x != 0&&h != 0){
		S_teimen = x * x;
		S_sokumen = 2 * x * sqrt(pow(x/2,2)+pow(h,2));

		S_ans = S_teimen + S_sokumen;
		printf("%0.7f\n",S_ans );
	}
	return 0;
}

Measured memory_bytes: 1236
n = int(input())
P = list(map(int,input().split()))
for _ in range(n-1):
    P.append(int(input().split()[1]))

INF = 10**18
dp = [[INF]*(n) for i in range(n)]

for i in range(n):#一つの行列部分にゼロを入れる
    dp[i][i] = 0

for l in range(1,n):
    for i in range(n-l):
        j = i + l
        dp[i][j] = INF
        for k in range(i,j):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + P[i-1] * P[k] * P[j])

print(dp[0][n-1])



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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	
	bool dp[k + 1];
	for (int i = 0; i < a[0]; i++) dp[i] = 0;
	for (int i = a[0]; i <= k; i++) {
		for (int j : a) {
			if (i - j >= 0) dp[i] = !dp[i - j];
			if (dp[i]) break;
		}
	}
	cout << (dp[k] ? "First" : "Second");
}

Measured memory_bytes: 3700
S=list(input())

A=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
L=[[]for i in range(26)]
for i in range(len(S)):
    for j in range(26):
        if S[i]==A[j]:
            L[j].append(i+1)
#print(L)
T=list(input())
M=[[]for i in range(26)]
for i in range(len(T)):
    for j in range(26):
        if T[i]==A[j]:
            M[j].append(i+1)
            T[i]=j
#print(M)
#print(T)

for i in range(26):
    if M[i] !=[] and L[i]==[]:
        print(-1)
        exit()

import math
import bisect
ans=0
mo=0
for i in T:
    if L[i][-1]<=ans:
        mo+=ans//len(S)
        ans%=len(S)
        if L[i][-1]<=ans:
            mo+=1
            ans-=len(S)
    ans=L[i][bisect.bisect_right(L[i],ans)]
    #print(mo*len(S)+ans,mo,ans)
print(mo*len(S)+ans)
    

Measured memory_bytes: 64520
x = input()
n = len(x)
ans = []
for i in range(n):
    if x[i] == 'S':
        ans.append(x[i])
    else:
        if len(ans) > 0:
            if ans[-1] == 'S':
                ans.pop()
            else:
                ans.append(x[i])
        else:
            ans.append(x[i])
    # print(ans)

print(len(ans))

Measured memory_bytes: 10728
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <map>
#include <cstdlib>
#include <vector>


using namespace std;


int main()
{
	int n;
	cin>>n;
	int ans;
	n%2==0?ans=n:ans=2*n;
	cout<<ans<<endl;
	

	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

//#define int ll


const int N = 5e3 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string s;
main() {
    file("threesum");
    ios;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) cout << 'x';
    cerr << "\nTime elapsed: " << (clock() + 0.0) / CLOCKS_PER_SEC;
    return 0;
}
/**

*/


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	string s; cin>>s;
	int arr[26]={0};
	rep(i,s.size()){
		arr[s[i]-'a']++;	
	}
	bool ans=true;
	rep(i,26){
		if(arr[i]&1) {
			ans=false;
			break;
		}
	}
	cout<<((ans)?"Yes":"No");
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/


const string yes = "yes";
const string no = "no";

string t,p;

int memo[500005];
int memo2[500005];

int main(){
    cin >> t >> p;
    int n = t.size();
    int m = p.size();

    int now = 0;
    for(int i=0;i<m;i++){
        while(now < n and t[now]!=p[i]){
            now++;
        }
        memo[i] = now++;
    }

    if(memo[m-1]>=n){
        cout << no << endl;
        return 0;
    }

    for(int i=0;i<m;i++){
        int st,ed;
        st = memo[i];
        ed = (i+1 < m) ? memo[i+1] : n;
        for(int j=st+1;j<ed;j++){
            if(t[j] == p[i]){
                //cout << i << " " << j << endl;
                cout << no << endl;
                return 0;
            }
        }
    }
    cout << yes << endl;
}

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

int n, m;
P offers[101010];

int main(){
  cin >> n >> m;
  rep(i, n) cin >> offers[i].first >> offers[i].second;
  sort(offers, offers + n);
  
  priority_queue<int> que;
  int res = 0, pos = 0;
  for(int i = 1; i <= m; i++){ //後ろにi日ある状態
    while(offers[pos].first <= i && pos < n){
      que.push(offers[pos].second);
      pos++;
    }
    if(que.size() == 0) continue;
    res += que.top();
    que.pop();
  }
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 1660
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input;
            int a, b;
            int result;
            input = Console.ReadLine();
            Int32.TryParse(input.Split(' ')[0], out a);
            Int32.TryParse(input.Split(' ')[1], out b);
            if (a >= 10 || b >= 10)
                result = -1;
            else
                result = a * b;
            Console.WriteLine(result.ToString());
        }
    }
}


Measured memory_bytes: 13140
def wa(a,b,output):
    output=a+b
    return output

def sa(a,b,output):
    output=a-b
    return output

def seki(a,b,output):
    output=a*b
    return output

def syou(a,b,output):
    output=a//b
    return output

num=list(map(str,input().split()))
out=[]
while num[1]!="?":
    output=0
    a=int(num[0])
    b=int(num[2])

    if num[1]=="+":
        output=wa(a,b,output)
    elif num[1]=="-":
        output=sa(a,b,output)
    elif num[1]=="*":
        output=seki(a,b,output)
    elif num[1]=="/":
        output=syou(a,b,output)
    out.append(output)
    num=list(map(str,input().split()))

for i in range(len(out)):
    print(out[i])



Measured memory_bytes: 5604
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
  char a[1010],ch[100];
  cin>>a;
  int l=strlen(a);
  if(a[l-1]=='s')
  {
    strcat(a,"es");
  }
  else
  {

    strcat(a,"s");
  }
  cout<<a<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
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;}
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

int main(){
    int A[5];
    rep(i,5) cin >> A[i];
    int k; cin >> k;
    bool flag =1;
    rep(i,5){
        rep(j,5){
            if(A[i]-A[j]>k) flag=0;
        }
    }
    
    if(flag) cout << "Yay!" << endl;
    else cout << ":(" << endl;

}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) xmax = x; return true;
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) xmin = x; return true;
    return false;
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;
ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) return mod_pow(x * x % MOD, n / 2) % MOD;
    else return x * mod_pow(x, (n - 1)) % MOD;
}
ll mod_pow_r(ll x, ll n) {
    if (x == 0) return 0;
    if (n == 0) return 1;
    ll ret = 1;
    while (n) if (n & 1) ret = ret * x % MOD; x = x * x % MOD; n /= 2;
    return ret;
}
ll factorial(ll n) {
    ll ret = 1;
    REP(i, n) ret *= (i + 1); ret %= MOD;
    return ret;
}
ll combination(ll n, ll r) {
    if (n < 0 || n < r || r < 0) return 0;
    ll fn = factorial(n);
    ll fr = factorial(r);
    ll fn_r = factorial(n-r);
    ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
    ll u = fn % MOD;
    return u * d % MOD;
}

void solve() {
    ll h, w; cin >> h >> w;
    if (h == 1) cout << 1;
    else if (w == 1) cout << 1;
    else if (h%2 == 0) cout << h*w/2;
    else cout << (h*w+1)/2;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;
}

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

int main() {
  int n, x;
  cin >> n >> x;
  int a = x-n+1;
  int b = 2*n-1+a;
  for(int i=a; i<b; i++) {
    cout << i << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3632
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
    class Program
    {
        //メイン関数
        static void Main(string[] args)
        {
            int n = ReadI();
            WriteLine(n / 3);
        }

        //メインじゃない関数
        private static string Read() { return ReadLine(); }
        private static int ReadI() { return int.Parse(ReadLine()); }
    }
}


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

int main(){
    int n;
    int sum=0;
    cin >> n;
    int tmp=n;
    while(tmp>0){
        sum+=tmp%10;
        tmp/=10;
    }
    if(n%sum==0) cout <<"Yes" <<endl;
    else cout <<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
import math

n = int(input())
# 75数=約数の数が75個
# 約数の個数->n=Πp_m^a_mと表せるとき、Π(a_m+1)
# 75=5^3より、a_1=74またはa_1=24,a_2=2またはa_1=14,a_2=4またはa_1=4,a_2=4,a_3=4の場合に75数となる.
# ここで階乗n!の素因数分解した際の素因数pの個数に関しては、ガウス数[a]を用いて、Σ[n/p^k]で求められる.
# よって、Σ[n/p^k]>=4となるようなpがいくつあるかに注目すればよい.また、Σ[n/p^k]>=2,n<=100より、p=50まで調べればよい.
prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
over_2 = []
over_4 = []
over_14 = []
over_24 = []
over_74 = []
answer = 0
for prime_number in prime_list:
    prime_count = 0
    chk_number = prime_number
    while True:
        prime_count += n // chk_number
        chk_number *= prime_number
        if chk_number > n:
            break
    if prime_count >= 2:
        over_2.append(prime_number)
    if prime_count >= 4:
        over_4.append(prime_number)
    if prime_count >= 14:
        over_14.append(prime_number)
    if prime_count >= 24:
        over_24.append(prime_number)
    if prime_count >= 74:
        over_74.append(prime_number)
# 74個以上含まれる素因数が存在するとき.その素因数を74個使用した約数が75数になる.
answer += len(over_74)
# 24個以上含まれる素因数が存在し、かつ2個以上の素因数がそれ以外に存在するとき、それぞれを使用した約数が75数になる.
# over_24にある素因数は必ずもover_4に含まれることに注意.
answer += len(over_24) * (len(over_2) - 1)
# 14個以上含まれる素因数が存在し、かつ4個以上の素因数がそれ以外に存在するとき、それぞれを使用した約数が75数になる.
# over_24にある素因数は必ずもover_4に含まれることに注意.
answer += len(over_14) * (len(over_4) - 1)
# 4個以上含まれる素因数が2種類存在し、かつ2個以上の素因数がそれ以外に存在するとき、それぞれを使用した約数が75数になる.
# over_4にある素因数は必ずover_2に含まれることに注意.
answer += (len(over_4) * (len(over_4) - 1) // 2) * (len(over_2) - 2)

print(answer)

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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void solve() {
    ll res = 1, num = 7;
    int k;
    cin >> k;
    if (k & 1) {
        while (1) {
            if (res >= 1e7) {res = -1; break;}
            if (num % k == 0) break;
            num = num * 10 + 7;
            num %= k;
            res++;
        }
    } else res = -1;
    cout << res << endl;
}

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


Measured memory_bytes: 3660
#include<stdio.h>
#define NIL -1
#define MAX 10000
typedef struct{
  int p;
  int l;
  int r;
}Node;
Node T[MAX];
int n,D[MAX],H[MAX];
void setD(int,int);
int setH(int);
int getS(int);
void print(int);

void setD(int u,int d)
{
  if(u==NIL)return;
  D[u]=d;
  setD(T[u].l,d+1);
  setD(T[u].r,d+1);
}
int setH(int u)
{
  int h1=0,h2=0;
  if(T[u].l != NIL) h1 = setH(T[u].l)+1;
  if(T[u].r != NIL) h2 = setH(T[u].r)+1;
  if(h1>h2)H[u]=h1;
  else H[u]=h2;
  return H[u];
}
int getS(int u)
{
  if(T[u].p==NIL)return NIL;
  if(T[T[u].p].l != u && T[T[u].p].l != NIL)
    return T[T[u].p].l;
  if(T[T[u].p].r != u && T[T[u].p].r != NIL)
    return T[T[u].p].r;
  return NIL;
}
void print(int u)
{
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("sibling = %d, ",getS(u));
  int deg=0;
  if(T[u].l !=NIL)deg++;
  if(T[u].r != NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].p ==NIL){
    printf("root\n");
  }
  else if(T[u].l==NIL && T[u].r==NIL){
    printf("leaf\n");
  }
  else{
    printf("internal node\n");
  }
}
int main()
{
  int V,L,R,root=0,i;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p=NIL;

  for(i=0;i<n;i++){
    scanf("%d %d %d",&V,&L,&R);
    T[V].l=L;
    T[V].r=R;
    if(L != NIL)T[L].p=V;
    if(R != NIL)T[R].p=V;
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL)root=i;
  }
  setD(root, 0);
  setH(root);

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

  return 0;
}


Measured memory_bytes: 2136
import java.util.Scanner;

class Main{
       public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	int n;
    	int total;
    	double hyouzyun;
    	double m;
    	double a;
    	double[] student;
    	
    	for(;;){
    		n = scan.nextInt();
    		total = 0;
    		hyouzyun = 0.0;
    		a = 0.0;
    		
    		if(n == 0){
    		break;
    		}
    		student = new double[n]; 
    		for(int i = 0; i < n; i++){
    			student[i] = scan.nextDouble();
    			total += student[i];
    		}
    		m = (double)total / (double)n;
    		
    		for(int i = 0; i < n; i++){
    			a += Math.pow((student[i] - m), 2);
    		}
    		a /= n;
    		hyouzyun = Math.sqrt(a);
    		
    		System.out.println(String.format("%.8f", hyouzyun));
    	}
     }
}

Measured memory_bytes: 39372
import sys
num_bill, y = map(int, input().split())

for num_10000 in range(y // 10000 + 1):
    for num_5000 in range(min((y - num_10000 * 10000) // 5000 + 1, num_bill - num_10000 + 1)):
        if ((num_bill - num_10000 - num_5000) * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + (num_bill - num_10000 - num_5000) == num_bill):
            print(num_10000, num_5000, (num_bill - num_10000 - num_5000))
            sys.exit()

print('-1 -1 -1')

Measured memory_bytes: 3064
S=input()
#N=int(input())
#a,b,x=map(int,input().split())
s=1
for i in S:
    if i=="a":
        s*=2
    if i=="b":
        s*=3
    if i=="c":
        s*=5
if s==30:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
def main():
    n = int(input())
    n -= 1
    
    s = []
    for _ in range(15):
        # print(n)
        s.append(chr(ord('a')+(n%26)))
        n = int(n / 26)
        if n==0:
            break
        n -= 1
    s.reverse()
    print(''.join(s))

    pass

main()

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
ll M;
ll T;

void solve() {
    cin >> N >> M;
    T = 1;
    bool ok = true;
    set<ll> x;
    ll p, q;
    for (int i = 0; i < N; ++i) {
        ll a;
        cin >> a;
        ll b = a / 2;
        p = (-a) & a;
        if (i){
            if (p != q){
                ok = false;
                break;
            }
        }
        else q = p;
        T = T * b / __gcd(T, b);
    }
    if (ok) cout << ((M / T) + 1) / 2 << endl;
    else cout << 0 << endl;
}

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, K, Q;
    cin >> N >> K >> Q;

    vector<int> points(N, K-Q);
    //配列
    vector<int> vec(Q);
    
    for (int i = 0; i < Q; i++) {
        cin >> vec.at(i);
    }

    for(int i = 0;i<Q; i++){
        points.at(vec.at(i)-1) += 1;
    }

    for(int i = 0; i < N ; i ++){
        if(points.at(i) > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    

}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s, t; cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	if(s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3568
'use strict'

/////////////////////////////////////
//コピペスペース//////////////////////

//定数
const INF  =  900719925474099 // Math.floor(Number.MAX_SAFE_INTEGER / 10);

//スペース区切りの数字列を数字の配列にして返す
function mapint(line){return line.split(' ').map((v)=>parseInt(v));}

function lower_bound(d,a,b,e){
    for(var c;1<b-a;)
        d[c=0|(a+b)/2]<e ? a=c : b=c;
    return d[a]<e?b:a
};

const MOD = 1000000007;
//コピペスペース//////////////////////
/////////////////////////////////////

const A = 0;
const C = 1;
const G = 2;
const T = 3;

function getACGTs(n){
	let s=[];
	let t = new Array(3);
	t[0] = n >> 4;
	t[1] = (n >> 2) & 3;
	t[2] = n&3;

	for(let i=0;i<3;i++){
		if(t[i] == A) s.push('A');
		if(t[i] == C) s.push('C');
		if(t[i] == G) s.push('G');
		if(t[i] == T) s.push('T');
	}
	return s.join('');

}
function getACGT(n){
		if(n == A) return 'A';
		if(n == C) return 'C';
		if(n == G) return 'G';
		if(n == T) return 'T';
}

function Main(input){
	let temp = input.trim();
	let n = parseInt(temp);

	let s = [...new Array(n+10)].map(()=>new Array(64).fill(0));

	for(let i=0;i<64;i++){
		s[3][i] = 1;
	}
	s[3][9] = 0; //AGC
	s[3][33] = 0; //GAC
	s[3][6] = 0; //ACG

	let add;
	let t;
	for(let i=4;i<=n;i++){
		//console.log('i---------------',i);
		for(let j=0;j<64;j++){
			//console.log('j=======',getACGTs(j));
			for(let k=0;k<4;k++){
				add = s[i-1][j];
				if(k==C){
					if( (j&60) == ((A<<4)+(G<<2)) ) add = 0;   //AGx => C
					else if( (j&15) == ((A<<2)+G) ) add = 0; //xAG -> C
					else if( (j&51) == ((A<<4)+G) ) add = 0; //AxG -> C
					else if( (j&15) == ((G<<2)+A) ) add = 0; //xGA -> C
				}else if(k==G){
					if( (j&15)==((A<<2)+C) ) add = 0; //xAC -> G
				}
				t = ((j&15) << 2) + k;
				s[i][t] += add;
				s[i][t] %= MOD;
				//console.log(getACGT(k),' t:',t,'add:',add);
			}
		}
	}
	let sum = 0;
	for(let i=0;i<64;i++){
		sum += s[n][i];
		sum %= MOD;
	}

	//console.log(s);
	console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	int c,i, j, k,l, n, x,count,counta[100];
	l = 0;
	while (1) {
		scanf("%d %d", &n, &x);
		if (n==0&&x==0){
			break;
		}
		count = 0;
		for ( i = 1; i <= n; i++){
			for (j = i+1; j <n; j++){
				for (k = j+1; k <=n; k++){
					if (i + j + k == x) {
						count++;
					}
				}
			}

		}
		counta[l] = count;
		l++;
	}
	c = l;
	for ( i = 0; i < c; i++){
		printf("%d\n", counta[i]);
	}
}

Measured memory_bytes: 1804
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


X,Y,A,B,C = MI()
P,Q,R = LI(),LI(),LI()

Z = [(P[i],1) for i in range(A)] + [(Q[i],0) for i in range(B)] + [(R[i],-1) for i in range(C)]
Z.sort(reverse=True)
a,b,c = 0,0,0  # 選択した赤リンゴ、緑リンゴ、無色リンゴの個数
n = 0  # 選択したリンゴの個数
ans = 0
for x in Z:
    if n == X+Y:
        break
    s,t = x
    if t == 1 and a == X:
        continue
    elif t == 0 and b == Y:
        continue
    else:
        n += 1
        ans += s
        if t == 1:
            a += 1
        elif t == 0:
            b += 1
        else:
            c += 1

print(ans)


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

vector<vector<int>> dist(10, vector<int> (10));

int main() {
  int H, W;
  cin >> H >> W;
  rep(i, 0, 10) {
    rep(j, 0, 10) {
      cin >> dist[i][j];
    }
  }

  rep(k, 0, 10) {
    rep(i, 0, 10) {
      rep(j, 0, 10) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  int ans = 0;
  int a;
  rep(i, 0, H) {
    rep(i, 0, W) {
      cin >> a;
      if (a != -1) {
        ans += dist[a][1];
      }
    }
  }

  cout << ans << endl;
};


Measured memory_bytes: 256
import sys

def solve():
    s = input()
    l = s.find('A')
    r = s.rfind('Z')

    print(r - l + 1)
    
def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None


if __name__ == '__main__':
    solve()

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

signed main(){
    int n,m,c;
    cin >>n>>m>>c;
    int b[m];
    for(int i=0;i<m;i++)cin >> b[i];
    int a[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)cin >> a[i][j];
    }
    int ans=0,k;
    for(int i=0;i<n;i++){
        k=c;
        for(int j=0;j<m;j++){
            k+=b[j]*a[i][j];
            //cerr << b[j]<<' '<<a[i][j]<<endl;
        }
       // cerr <<k;
        if(k>0)ans++;

    }
    cout <<ans;

    
    return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int N = one.get(0);
		int X = one.get(1);
		int output = N;
		int min = 1 << 16;
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < N; i++){
			int m = nextInt();
			list.add(m);
			min = Math.min(min, m);
			X -= m;
		}
		
		output += X / min;
		myout(output);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32820
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo 100000000000000000
const ll dx[]={-1,0,1, 0,-1,1, 1,-1};
const ll dy[]={ 0,1,0,-1, 1,1,-1,-1};

void solve(){
   ll n;
   cin>>n;
   ll ans;
   if(n>=400&&n<=599)ans = 8;
   if(n>=600&&n<=799)ans = 7;
    if(n>=800&&n<=999)ans = 6;
   if(n>=1000&&n<=1199)ans = 5;
   if(n>=1200&&n<=1399)ans = 4;
   if(n>=1400&&n<=1599)ans = 3;
   if(n>=1600&&n<=1799)ans = 2;
   if(n>=1800&&n<=1999)ans = 1;
    cout<<ans;
}

int main(){
    Boost();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
bool su[10000];
ll sum(ll n){
  ll cnt=0;
  ll hoge=0;
  while(cnt<n){
    if(su[cnt+hoge])hoge++;
    else cnt++;
  }
  return cnt+hoge;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;
  reverse(ALL(A));
  vi B(n);
  for(int i=0;i<n;i++){
    ll po=sum(A[i]);
    po--;
    // cout<<po<<"!"<<endl;
    if(po<n){
      B[po]=A[i];
      su[po]=true;
    }else{
      cout<<-1<<endl;
      return 0;
    }
  }
  for(int i=0;i<n;i++){
    cout<<B[i]<<endl;
  }
  return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li v[2020];

int main() {
    li a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;

    li cd = c * d / __gcd(c, d);

    // for a
    li ca = a / c;
    li da = a / d;
    li cda = a / cd;

    li resa = a - ca - da + cda;

    li cb = b / c;
    li db = b / d;
    li cdb = b / cd;
    li resb = b - cb - db + cdb;

    cout << resb - resa << endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  long long tot = 0;
  vector<long long> ans(N);
  
  
  for (int i=0; i<N; i++) {
    cin >> A[i];
    tot += A[i];
  }
  ans[0] = tot;
  for (int i=1; i<N; i+=2) {
    ans[0] -= A[i] * 2;
  }
  cout << ans[0] << ' ';
  for (int i=1; i<N; i++) {
    ans[i] = A[i-1]*2 - ans[i-1];
    if (i == N-1) {
      cout << ans[i] << endl;
      break;
    }
    cout << ans[i] << ' ';
  }
  
  
  
  return 0;
}

Measured memory_bytes: 2944
def main():
    N = int(input())
    H = list(map(int, input().split(' ')))
    left_h = 0
    for h in H:
        if left_h > h:
            print('No')
            exit(0)
        elif left_h == h:
            left_h = h
        else:
            left_h = h - 1
    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 14252
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, N,*A = map(int, read().split())
print('Yes' if H<=sum(A) else 'No')

Measured memory_bytes: 11608
def is_haiku(s):
    nums = s.split()
    counts = {x: nums.count(x) for x in nums}
    try:
        if counts['5'] == 2 and counts['7'] == 1:
            print("YES")
        else:
            print("NO")
    except:
        print("NO")

if __name__ == "__main__":
    is_haiku(input())

Measured memory_bytes: 3064
//A
#include <iostream>
using namespace std;
int main(void) {
	int n, m;
	cin >> n >> m;
	int eEPair = 0;
	int oOPair = 0;
	if (1 < n) {
		eEPair = n * (n - 1) / 2;
	}
	if (1 < m) {
		oOPair = m * (m - 1) / 2;
	}
	cout << eEPair + oOPair << endl;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.trim().split(" ");
  var N = parseInt(input[0], 10);
  var K = parseInt(input[1], 10);
 
  var sum = K;
 
  for (var i = 1; i < N; i++) {
    sum *= K - 1;
  }
 
  console.log(sum);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372