akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
  long long n,a,b;cin>>n>>a>>b;
  long long z[n];
  for(int i = 0; n > i; i++)cin>>z[i];
  long long ans = 0;
  for(int i = 1; n > i; i++){
    ans += min(b,(z[i]-z[i-1])*a);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int h,w,k,a[15],ans,i,j;
char c[10][10];
bool f[15];
void check(int len)
{
	bool x[10],y[10];
	int sum=0;
	memset(x,true,sizeof x);
	memset(y,true,sizeof y);
	for (int i=1;i<=len;i++)
	if (a[i]<=h) x[a[i]]=false;else y[a[i]-h]=false;
	for (int i=1;i<=h;i++)
	 for (int j=1;j<=w;j++)
	  if (c[i][j]=='#'&&x[i]&&y[j]) sum++;
	if (sum==k) ans++;
}
void dfs(int x)
{
	check(x);
	if (x>=h+w) return;
	for (int i=1;i<=h+w;i++)
	if (!f[i]&&i>a[x])
	{
		a[x+1]=i;
		f[i]=true;
		dfs(x+1);
		f[i]=false;
	}
}
int main()
{
	scanf("%d%d%d\n",&h,&w,&k);
	for (i=1;i<=h;++i)
	{
		for (j=1;j<=w;j++)
		scanf("%c",&c[i][j]);
		scanf("\n");
	}
	dfs(0);
	printf("%d",ans);
}

Measured memory_bytes: 3780
#include<stdio.h>
#include<limits.h>
#define MAX 105

int main(){

	int M[MAX][MAX],i,j,next,n,d[MAX],min=0,A[MAX],count=1,Pass[MAX],total=0;

	scanf("%d",&n);
	for(i = 0; i < n; i++){
		for(j = 0; j < n; j++){
			scanf("%d",&M[i][j]);
		}
		d[i] = INT_MAX;
		A[i] = 0;
	}
	d[0] = 0;
	A[0] = 1;
	Pass[0] = 0;
	while(1){
		for(i = 0; i < count; i++){
			for(j = 0; j < n; j++){
				if(A[Pass[i]] == 0 || A[j] == 0){
					if(M[Pass[i]][j] != -1 && d[count] >= M[Pass[i]][j]){
						d[count] = M[Pass[i]][j];
						next = j;
					}
				}
			}
		}
		count++;
		A[next] = 1;
		Pass[i] = next;
		if(count > n) break;
	}

	for(i = 0; i < n; i++)
		total += d[i];
	printf("%d\n",total);
	return 0;
}

Measured memory_bytes: 644
s = int(input())
l = []
l.append(s)
for i in range(1000000):
  if s%2==0:
    s = int(s/2)
    l.append(s)
  else:
    s = 3*s +1
    l.append(s)
    
  if l.count(s)==2:
    print(i+2)
    break

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}

int main(){
    string s,t; cin >> s >> t;
    
    bool ans = 0;
    if(s[0] == t[2] and s[1] == t[1] and s[2] == t[0]) ans = 1;
    
    cout << yn(ans) << endl;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

const int INF = 1e8;
const int MAX_V = 205;

void init(int m[MAX_V][MAX_V]){
	rep(i,MAX_V) rep(j,MAX_V) m[i][j] = INF;
	rep(i,MAX_V) m[i][i] = 0;
}

void warshallFloyd(int m[MAX_V][MAX_V], int n){
	rep(k,n){
		rep(i,n){
			rep(j,n){
				m[i][j] = min(m[i][j], m[i][k] + m[k][j]);
			}
		}
	}
}

int main(){
	int n, m;
	while(cin >> n >> m, n){
		int riku[MAX_V][MAX_V];
		int umi[MAX_V][MAX_V];
		init(riku);
		init(umi);
		rep(i,m){
			int x, y, t;
			string sl;
			cin >> x >> y >> t >> sl;
			x--; y--;
			if(sl[0] == 'L') riku[x][y] = riku[y][x] = min(riku[x][y], t);
			else umi[x][y] = umi[y][x] = min(umi[x][y], t);
		}
		warshallFloyd(riku, n);
		warshallFloyd(umi, n);

		int r;
		cin >> r;
		vector<int> z(r);
		rep(i,r) cin >> z[i];
		for(auto& i : z) i--;

		vector<vector<int>> dp(r, vector<int>(n, INF));
		dp[0][z[0]] = 0;
		rep(i,r - 1){
			int cur = z[i];
			int nxt = z[i + 1];
			rep(j,n){
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + riku[cur][nxt]);
				rep(k,n){
					dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + riku[cur][j] +
							umi[j][k] + riku[k][nxt]);
				}
			}
		}

		//rep(i,n) cout << dp.back()

		cout << *min_element(all(dp.back())) << endl;
	}
}



Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define ld long double
using namespace std;

const int mx = 1e9;
int H, W, h, w;

ld rg(int a, int b) {
	ld x = a, y = b;
	return x / y;
}

const int bj = 100000;
void irk(int &a, int &b, ld x, ld y) {
	for(b = bj; b <= mx; b += bj) {
		int l = 1, r = mx;
		while(l < r) {
			int m = (l + r) / 2;
			ld z = rg(m, b);
			if(z <= x) {
				l = m + 1;
			} else if(z >= y) {
				r = m - 1;
			} else {
				a = m;
				return;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> H >> W >> h >> w;
	ld x = rg((H / h) * (W / w), H * W - (H / h) * (W / w));
	ld y = rg(1, h * w - 1);
	if(x >= y) {
		return cout << "No" << endl, 0;
	}
	int a = 0, b = 0;
	irk(a, b, x, y);
	cout << "Yes\n";
	for(int i = 1; i <= H; ++i) {
		for(int j = 1; j <= W; ++j) {
			if(i % h == 0 && j % w == 0) {
				cout << -b << " ";
			} else {
				cout << a << " ";
			}
		}
		cout << "\n";
	}
	return 0;
}
// (H/h*W/w) | (H*W-H/h*W/w) < a | b < 1 | (h*w-1)


Measured memory_bytes: 1920
#include <stdio.h>
#define LL long long
int main(){
	LL a,b,n,r;
	scanf("%lld%lld%lld",&a,&b,&n);
	if(n<b)r=n;
	else r=b-1;
	printf("%lld\n",r*a/b);
	return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string s;
	cin>>s;
	int start=-1;
	int end=-1;
	int sLen=s.length();
	int i;
	for (i=0;i<sLen;i++){
		if (start==-1 && s[i]=='A'){
			start=i;
			break;
		}
	}
	for (i=sLen-1;i>=0;i--){
		if (end==-1 && s[i]=='Z'){
			end=i;
			break;
		}
	}
	cout<<end-start+1<<endl;
	return 0;
}

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


int main() {
    int n;
    cin >> n;
    vector<pair<int,int>> a(n);
    for(int i = 0; i < n;i++){
        int x,l;
        cin >> x >> l;
        a.at(i) = make_pair(x+l,x-l);
    }
    sort(a.begin(),a.end());
    int cnt = 0;
    int l = 0;
    int k = 1;
    while(k < n){
        if(a.at(l).first <= a.at(k).second){
            l = k;
            k++;
        }
        else{
            k++;
            cnt++;
        }
    }
    cout << n-cnt << endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n; cin >> n;
    int a[n+1], b[n];
    
    for(int i = 0; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    
    long long ans = 0;
    
    for(int i = 0; i < n; i++){
        int left = min(a[i], b[i]);
        ans += left;
        a[i] -= left;
        b[i] -= left;
        
        int right = min(a[i+1], b[i]);
        ans += right;
        a[i+1] -= right;
        b[i] -= right;
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 1024
import decimal,math
from collections import Counter,defaultdict
from fractions import gcd
from bisect import bisect_right,bisect_left
decimal.getcontext().prec = 100
import sys
sys.setrecursionlimit(1000000)

adj=[]
n,m = map(int,raw_input().split())
for i in range(n+1):
	adj.append([])
dp=[0]*(n+1)	
def dd(l):
	if(dp[l]!=-1):
		return dp[l]
	ma=dd(adj[l][0])
	for j in range(1,len(adj[l])):
		ma=max(ma,dd(adj[l][j]))
	dp[l]=ma+1
	return ma+1	
for i in range(m):
	x,y = map(int,raw_input().split())
	adj[y].append(x)
	dp[y]=-1
ans=[]
for i in range(1,n+1):
	ans.append(dd(i))
	# print i
print max(ans)	

Measured memory_bytes: 117032
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>
//#include <boost/multiprecision/cpp_int.hpp>

//namespace mp = boost::multiprecision;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
//using Bint = mp::cpp_int;
const ll MOD=1000000007;

int main()
{
	int N,M;
	cin>>N>>M;
	vector<int> S(N+5,0);
	vector<bool> B(N+5,true);
	S[0]=1;
	for(int i=0;i<M;i++)
	{
		int t;
		cin>>t;
		B[t]=false;
	}
	for(int i=0;i<N;i++)
	{
		if(B[i+1])
		{
			S[i+1]=(S[i+1]+S[i])%MOD;
		}
		if(B[i+2])
		{
			S[i+2]=(S[i+2]+S[i])%MOD;
		}
	}
	cout<<S[N]<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
 
ll N,K;
ll ans;

int main(){
    cin>>N>>K;
    //1回ずつ差を求めるとTLEなるから工夫必要, 数学問題
    //N%KとK-N%Kの小さい方が答えになる
    ans=min(N%K,K-N%K);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main()
{
  int h,w;
  char a[1005][1005];
  int mp[1005][1005]={};
  cin>>h>>w;
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      cin>>a[i][j];
    }
  } 
  mp[1][0]=1;
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      if(a[i][j]!='#'){
	mp[i][j]=(mp[i][j-1]%MOD+mp[i-1][j]%MOD)%MOD;
      }
    }
  }

  cout<<mp[h][w]<<'\n';
  return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int N; cin >> N;
    multiset<int> ms;
    for (int i = 0; i < N; i++) {
        int ai; cin >> ai;
        auto it = ms.lower_bound(ai);
        if (it == ms.begin()) {
            ms.insert(ai);
        }
        else {
            --it;
            ms.erase(it);
            ms.insert(ai);
        }
    }
    cout << ms.size() << '\n';
}



Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  int left = 1;
  int right = N;
  for (int i = 0; i < M; ++i) {
    int L, R;
    cin >> L >> R;
    left = max(left, L);
    right = min(right, R);
  }
  cout << max(0, right - left + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

signed main()
{
    ios::sync_with_stdio(false);
	int a, b, c, d, e, f;
	while(cin >> a)
	{
		cin >> b >> c >> d >> e >> f;
		double m = a * e - b * d;
		double x = (c * e) /m -( b * f)/m;
		double y = (a * f) /m -( c * d)/m;

		printf("%.3lf %.3lf\n", x , y);
	}
}

Measured memory_bytes: 3056
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();
		String s=sc.next();
		String t=sc.next();
		char[] a =s.toCharArray();
	    char[] b =t.toCharArray();
	      
	      for(int i=0;i<n;i++){
	      System.out.print(a[i]+""+b[i]);
	      }
	}

}

Measured memory_bytes: 22996
import java.util.Scanner;

import static java.lang.Math.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int sa =abs( a - b);
        int min = Math.min(a, b);

        boolean result = min + sa <= 8;
        if(result){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }

        //System.out.println((a + b + c) + "" + s);

        //"Yay!"
//":("
    }
}


Measured memory_bytes: 23764
N = int(input())
S = ""
while N != 0 :
    if N % (-2) != 0 :
        S = "1" + S
        N -= 1
    else :
        S = "0" + S
    N /= (-2)
if len(S) == 0 :
    print(0)
else :
    print(S)
    
    

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e6 + 5;
vi g[N];
int ok[N];
int S[N];
int lf[N];
int rg[N];
int get(vii v) {
	if (v.empty())
		return 0;
	if (v.size() == 1)
		return v[0].fi;
	int lf_sum = 0,rg_sum = 0;
	for (auto it : v) {
		lf_sum += it.fi;
		rg_sum += it.se;
	}
	int index = max_element(all(v)) - v.begin();
	lf_sum -= v[index].fi;
	rg_sum -= v[index].se;
	if (v[index].fi <= rg_sum) {
		return (lf_sum + v[index].fi) & 1;
	} else {
		return v[index].fi - rg_sum;
	}
}
void dfs(int node,int prev) {
	S[node] = ok[node];
	vii v;
	for (auto it : g[node]) {
		if (it == prev)
			continue;
		dfs(it,node);
		v.pb(mp(lf[it] + S[it],rg[it] + S[it]));
		S[node] += S[it];
		rg[node] += rg[it] + S[it];
	}
	lf[node] = get(v);
}
int main(void) {
    int n;
    cin>>n;
    string str;
    cin>>str;
    for (int i = 0;i < n;++i)
    	ok[i + 1] = str[i] == '1';
    for (int i = 1;i < n;++i) {
    	int u,v;
    	cin>>u>>v;
    	g[u].pb(v);
    	g[v].pb(u);
    }
    int ans = 1e9;
    for (int i = 1;i <= n;++i) {
    	for (int j = 1;j <= n;++j)
    		lf[j] = rg[j] = S[j] = 0;
    	dfs(i,0);
    	if (!lf[i]) {
    		smin(ans,rg[i] / 2);
    	}
    }
    if (ans == 1e9)
    	ans = -1;
    cout << ans << '\n';
    return 0;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;



void solve()
{
	int n; cin >> n;
	int arr[n];
	lop(i, 1, n + 1) cin >> arr[i];

	int cnt = 0;
	lop(i, 1, n + 1)
	{
		if ( i % 2 == 1 and arr[i] % 2 == 1) cnt++;
	}
	cout << cnt << endl;

}

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

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





















Measured memory_bytes: 3652
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200000

int main() {
	int x, y, z;
	int s, ans;
	scanf("%d %d", &x, &y);
	ans = max(0, (4 - x) * 100000);
	ans += max(0, (4 - y) * 100000);
	if ((x + y) == 2)ans += 400000;
	printf("%d\n", ans);


	return 0;
}


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

int main(){
 while(1){
   int x,y;
   cin>>x>>y;
   if(x == 0 && y == 0) break;

   
   if(x > y) swap(x,y);
   cout<<x<<" "<<y<<endl;

}

  return 0;
}


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

using namespace std;

void Solve(){
	int a, b, c, k;
	cin>>a>>b>>c>>k;
	long long res = 0;
	int x = min(k, a);
	int y = min(k - x, b);
	int z = k - x - y;
	res = x - z;

	cout<<res<<'\n';

}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int T = 1;
	//cin>>T;
	while(T--){
		Solve();
	}
}

Measured memory_bytes: 3652
import java.util.*

private fun readInts() = readLine()!!.split(" ").map { it.toInt() }
private fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
private fun <K, V> Map<out K, V>.toMutableMap(): MutableMap<K, V> = LinkedHashMap(this)
private fun <K, V> mutableMapOf(): MutableMap<K, V> = LinkedHashMap()
private fun <K, V> mutableMapOf(vararg pairs: Pair<K, V>) = pairs.toMap().toMutableMap()

fun main(args: Array<String>) {
    val (A, B, K) = readInts()

    val setA = mutableSetOf(1)
    val setB = mutableSetOf(1)
    for (a in 1 until A) if (A % a == 0) setA.add(A / a)
    for (b in 1 until B) if (B % b == 0) setB.add(B / b)

    println(setA.intersect(setB).sorted().reversed().drop(K - 1).first())
}

Measured memory_bytes: 36072
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	bool ans=false;
	range(i,1,10)range(j,1,10){
		if(i*j==n)ans=true;
	}
	Yn(ans);
}


Measured memory_bytes: 256
/*
 #                                               |
 #   _` |  __ \    _` |   __|   _ \   __ \    _` |   _` |
 #  (   |  |   |  (   |  (     (   |  |   |  (   |  (   |
 # \__,_| _|  _| \__,_| \___| \___/  _|  _| \__,_| \__,_|
 */
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define ZERO_IQ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x, y) cerr << (#x) << " " << (#y) <<" is " << (x) <<" "<< (y) << endl
#define debug2(x, y, z) cerr << (#x) << " " <<(#y) << " " << (#z) << " is " << (x) << " " << (y) << " " << (z) << endl
#define endl '\n'

ll const N = 1e5 + 5;

struct compare {
   bool operator ()(const pair<ll, ll> &a, const pair<ll, ll> &b) {
      if (a.second == b.second) {
         return a.first < b.first;
      }
      return a.second < b.second;
   }
};

int main() {
   ZERO_IQ
   int n, k;
   cin >> n >> k;
   vector<int> v(n);
   for (int i = 0; i < n; ++i) {
      cin >> v[i];
   }
   vector<bool> dp(k + 1, 0);
      for (int j = 0; j <= k; ++j) {
      for (auto i : v) {
         if (j >= i && !dp[j - i]) {
            dp[j] = true;
         }
      }
   }
   if (dp[k]) {
      cout << "First\n";
   }
   else
      cout << "Second\n";
   return 0;
}


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

unsigned long long H;
unsigned long long W;

void input() {
    cin >> H;
    cin >> W;
}

int main() {
    input();

    if(H == 1 || W == 1){
        cout << 1 << endl;
    } else {
        cout << (H * W + 1) / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main(){
string S;
cin>>S;
int n=0;
n=(S.size())/2;
  if(S.size()%2!=0){
   cout<<"No"<<endl;
  return 0;}
   if(S.size()==0){
   cout<<"No"<<endl;
   return 0;
   }
   if(S.size()==1){
   cout<<"No"<<endl;
   return 0;
   }
for(int i=0;i<n;i++){
 if(S.at(2*i)!='h' || S.at((2*i)+1)!='i'){
   cout<<"No"<<endl;
 return 0;
 }
} 
cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
# AtCoder Beginner Contest 084 D - 2017-like Number
import sys

end_no = 10 ** 5

# 素数判定 エラストテネスの篩
def eratosthenes(N):
    prime = []  # 最後に素数一覧を返す
    data = [i for i in range(2, N + 1)]

    while True:
        p = data[0]

        if p >= N ** 0.5:
            return prime + data

        prime.append(p)
        data = [i for i in data[:] if i % p != 0]


prime = eratosthenes(end_no)
prime = set(prime)

# 累積和の用意
cusum = [0] * (end_no + 1)
for n in range(1, end_no + 1):
    cusum[n] = cusum[n - 1]
    if n % 2 == 0:
        continue

    if n in prime and int((n + 1) / 2) in prime:
        cusum[n] += 1


# 入力
Q = int(input())

for _ in range(Q):
    l, r = map(int ,sys.stdin.readline().strip().split())
    print(cusum[r] - cusum[l - 1])


Measured memory_bytes: 87012
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll w[100000],v[100000];

ll knapsack(ll n,ll k){
	ll dp[n+1][k+1];
   for ( ll i = 0; i <= n; i++) 
   { 
       for ( ll j= 0; j <= k; j++) 
       { 
           if (i==0 || j==0) 
               dp[i][j] = 0; 
           else if (w[i-1] <= j) 
                 dp[i][j] = max(v[i-1] + dp[i-1][j-w[i-1]],  dp[i-1][j]); 
           else
                 dp[i][j] = dp[i-1][j]; 
       } 
   } 
  
   return dp[n][k]; 
	}
	
	
int main(){
	ll n,k;
	ll ans=0;
	cin>>n>>k;
	
	for(ll i=0;i<n;i++){
		cin>>w[i]>>v[i];
	
		}
	
	ans=knapsack(n,k);
	
	cout<<ans<<endl;
	}

Measured memory_bytes: 79104
#!/usr/bin/env python3

import sys
import numpy as np


def main():
    n, k = map(int, sys.stdin.buffer.readline().split())

    warps = list(map(int, sys.stdin.buffer.readline().split()))
    warps = [0] + warps
    warps = np.array(warps, dtype=int)

    dp = np.zeros((k.bit_length() + 1, n + 1), dtype=int)

    dp[0, :] = warps

    for h in range(1, len(dp)):
        dp[h] = dp[h - 1][dp[h - 1]]

    node = 1
    # for i in reversed(range(k.bit_length())):
    for i in range(k.bit_length(), -1, -1):
        if k >> i & 1:
            node = dp[i][node]

    print(node)


main()


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

int main()
{
    ll a, b, n;
    cin >> a >> b >> n;

    ll ans = (a * min(b - 1, n)) / b - a * (min(b - 1, n) / b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        if (x >= 30) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

        scanner.close();
    }
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
  ll N;
  cin>>N;
  vector<ll> v(N);
  rep(i,N) cin>>v[i];
  rep(i,N) v[i]--;
  vector<ll> place(N);
  rep(i,N) place[v[i]] = i;
  set<ll> s;
  ll ans = 0;
  s.insert(-1);
  s.insert(N);
  for(ll i = N-1; i >= 0; i --){
    if(i==N-1){
      s.insert(place[i]);
      continue;
    }
    auto ite1 = s.insert(place[i]);
    auto ite = ite1.first;
    auto ite2 = ite;
    auto ite3 = ite;
    ite3++;
    auto ite5 = ite3;
    ite5++;
    ite2--;
    ll cnt = 0;
    if(ite2!=s.begin()){
      auto ite4 = ite2;
      ite4--;
      cnt += (*ite2-*ite4)*(*ite3-place[i]);
    }
    if(ite5!=s.end()){
      cnt += (*ite5-*ite3)*(place[i] - *ite2);
    }
    ans += cnt * (i+1);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 9420
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        System.out.println(a*b);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

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


Measured memory_bytes: 32848
A, B = list(map(int,input().split()))
#print(A,B)
k = []
for i in range(2,13+1):
  k.append(i)

k.append(1)
#print(k)

if k.index(A) == k.index(B):
  print('Draw')
elif k.index(A) > k.index(B):
  print('Alice')
else:
  print('Bob')


Measured memory_bytes: 3060
N = int(input())
A = [int(i) for i in input().split()]
counter = 0
for i in range(N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if A[i] != A[minj]:
        A[i], A[minj] = A[minj], A[i]
        counter += 1

print(' '.join([str(A[i]) for i in range(N)]))
print(counter)

Measured memory_bytes: 7696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    
    int N;
    cin>>N;
    int ans=0;
    for(int i=1;i*i<N;i++){
        for(int j=i;i*j<N;j++){
            if(i!=j)ans+=2;
            else ans++;
        }
    }
    cout<<ans<<endl;




}


Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define mp make_pair
#define INF 100000000000
#define MOD 1000000007LL
#define MAX 10005
#define NIL -1
#define WHITE 0
#define BLACK 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

class Edge {
public:
    ll t, w;
    Edge(ll t, ll w): t(t), w(w) {}
};

ll modPow(ll x, ll n) {
    ll res=1;
    while(n>0) {
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}


int main(void) {
    ll n;
    ll v;
    ll cnt1[100010]={}, cnt2[100010]={};
    ll i;
    cin >> n;
    for(i=0; i<n; i++) {
        cin >> v;
        v--;
        if(i%2==0) {
            cnt1[v]++;
        }else {
            cnt2[v]++;
        }
        
    }
    
    
    ll max_id1=0, max_cnt1=1;
    for(i=0; i<=100005; i++) {
        if(max_cnt1<=cnt1[i]) {
            max_id1=i;
            max_cnt1=cnt1[i];
        }
    }
    
    ll max_id2=0, max_cnt2=1;
    for(i=0; i<=100005; i++) {
        if(max_cnt2<=cnt2[i]) {
            max_id2=i;
            max_cnt2=cnt2[i];
        }
    }
    
    for(i=0; i<=100005; i++) {
        cnt1[i]=-cnt1[i];
        cnt2[i]=-cnt2[i];
    }
    
    sort(cnt1, cnt1+100005);
    sort(cnt2, cnt2+100005);
    
    
    if(max_id1!=max_id2) {
        prin(n-max_cnt1-max_cnt2);
    }else if(max_cnt1>max_cnt2){
        ll cnt=0;
        for(i=0; i<=100000; i++) {
            if(-cnt1[i]==max_cnt1) {
                cnt++;
            }
        }
        if(cnt>=2) {
            prin(n-max_cnt1+cnt2[0]);
        }else {
            ll ans=min(n+cnt1[0]+cnt2[1], n+cnt1[1]+cnt2[0]);
            prin(ans);
        }
    }else {
        ll cnt=0;
        for(i=0; i<=100000; i++) {
            if(-cnt2[i]==max_cnt2) {
                cnt++;
            }
        }
        if(cnt>=2) {
            prin(n-max_cnt2+cnt1[0]);
        }else {
            ll ans=min(n+cnt1[0]+cnt2[1], n+cnt1[1]+cnt2[0]);
            prin(ans);
        }
    }
    
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <sstream>
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[])
{
    string str, code, festival;
    std::cin >> str;
    for (int i = 0; i < 4; i++){
        code.push_back(str[i]);
    }
    for (int i = 4; i < 12; i++){
        festival.push_back(str[i]);
    }
    std::cout << code << " " << festival << '\n';
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll X;
    cin >> X;
    ll T = X % 100;
    ll f = T / 5;
    ll a = 0;
    if (T % 5 != 0)
        a = 1;

    ll S = (f + a) * 100;
    if (S <= X)
        cout << 1 << endl;
    else
        cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import Counter


def read():
    w = input().strip()
    return w,


def solve(w):
    c = Counter(w)
    for v in c.values():
        if v % 2 != 0:
            return "No"
    return "Yes"


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


Measured memory_bytes: 9324
#include<iostream>
#include<stdio.h>//printf("%.9f\n",*********);
#include<vector>//文字列.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char(小文字-32=大文字) to_string,string,char
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define str string
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int SED(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}//stringのほうが効率よくないか？

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	rapid_pleaseAC_fast;

	int n;
	cin >> n;
	vstr s(n);
	vcin(s, n);

	rop(i, n - 1) {
		if (s[i - 1][s[i - 1].size()-1] != s[i][0]) {
			cout << "No" << rt;
			return 0;
		}
	}

	rop(i, n - 1) {
		rep(j, i) {
			if (s[i] == s[j]) {
				cout << "No" << rt;
				return 0;
			}
		}
	}

	cout << "Yes" << rt;

	please AC;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

void insert(int);
void inorder(Node);
void preorder(Node);
void find(int);

void find(int k){
  int t;
  Node x = root;

  t = 0;

  while(x != NIL){
    if(x->key == k){
      t = 1;
      break;
    }
    if(k < x->key) x = x->left;
    else x = x->right;
  }
  
  if(t == 1) printf("yes\n");
  else printf("no\n");
}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
    z->parent = y;
  }

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

void inorder(Node u){
    if(u->left != NIL) inorder(u->left);
    printf(" %d", u->key);
    if(u->right != NIL) inorder(u->right);
}
void preorder(Node u){
  printf(" %d", u->key);
  if(u->left != NIL) preorder(u->left);
  if(u->right != NIL) preorder(u->right);
}


int main(){
  int n, i, j;
  int x[500001];
  char com[500001][7];
  Node t;

  scanf("%d", &n);

  for(i = 0, j = 0;i < n;i++){
    scanf("%s", com[i]);
    if(com[i][0] == 'i' || com[i][0] == 'f'){
      scanf("%d", &x[j]);
      j++;
    }
  }
  
  root = malloc(sizeof(struct node));
  t = malloc(sizeof(struct node));
  root->left = NIL;
  root->right = NIL;
  root->parent = NIL;

  t = root;

  for(i = 0,j = 0;i < n;i++){
    if(com[i][0] == 'i' && i == 0){
      root->key = x[j];
      j++;
    }
    else if(com[i][0] == 'i'){
      insert(x[j]);
      j++;
    }
    else if(com[i][0] == 'f'){
      find(x[j]);
      j++;
    }
    else {
      inorder(t);
      printf("\n");
      preorder(t);
      printf("\n");
    }
  }

  free(root);
  return 0;
}

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

ll f(ll x, ll d) {
  return x - x / d;
}

int main() {
  ll a, b, c, d; cin >> a >> b >> c >> d;
  ll x = f(b, c) - f(a-1, c);
  ll y = f(b, d) - f(a-1, d);
  ll g = c / __gcd(c, d) * d;
  ll z = f(b, g) - f(a-1, g);
  cout << x + y - z << endl;
}

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

int main(){
  int m,d,ans = 0;cin >> m >> d;
  int a,b;
  for(int i=1;i<=m;i++){// i=月
    for(int j=1;j<=d;j++){
      a = j%10;
      b = j/10;
      if(a >= 2 && b >= 2 && a*b == i){
        ans += 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,cont=0;
	scanf("%d",&n);
	for(int i=0;i<=n;i++){
		if(i%2==0){
			continue;
		}
		else{
			cont+=1;
		}
	}
	printf("%.10lf\n",cont*1.0/n);
	return 0;
}


Measured memory_bytes: 128
class Dice:
    def __init__(self):
        self.u=1
        self.w=2
        self.s=3
        self.e=4
        self.n=5
        self.d=6
        self.dic={"W":0,"S":1,"E":2,"N":3}
    
    def __init__(self,u,w,s,e,n,d):
        self.u=u
        self.w=w
        self.s=s
        self.e=e
        self.n=n
        self.d=d
        self.dic={"W":0,"S":1,"E":2,"N":3}

    def rot(self,way):
        if isinstance(way,str):
            way=self.dic[way]

        if(way==0):
            c=self.u
            self.u=self.e
            self.e=self.d
            self.d=self.w
            self.w=c
        elif way==1:
            c=self.u
            self.u=self.n
            self.n=self.d
            self.d=self.s
            self.s=c
        elif way==2:
            c=self.u
            self.u=self.w
            self.w=self.d
            self.d=self.e
            self.e=c
        else :
            c=self.u
            self.u=self.s
            self.s=self.d
            self.d=self.n
            self.n=c

u,s,e,w,n,d=map(int,input().split())
dice=Dice(u,w,s,e,n,d)
st=input()
for c in st:
    dice.rot(c)
print(dice.u)

Measured memory_bytes: 7812
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;
            int N = int.Parse(Console.ReadLine());

            string[] s = Console.ReadLine().Split(' ');

            int Max = 0;

            for(int i=0;i<N;i++)
            {
                int H = int.Parse(s[i]);

                if(H >= Max)
                {
                    Max = H;
                    ans++;
                }
            }

            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ull;

lli dp[100005];

lli solve(lli ara[], int i, int n) {
    cout<<i<<": "<<endl;
    lli ans1=LONG_LONG_MAX, ans2=LONG_LONG_MAX;
    if(dp[i] != -1) return dp[i];
    if(i==n-1) return dp[i] = 0;
    if(i+1<n){
        if(dp[i+1] == -1) dp[i+1] = abs(ara[i] - ara[i+1]) + solve(ara, i+1, n);
        ans1 = dp[i+1];
    }
    if(i+2<n){
        if(dp[i+2] == -1) dp[i+2] = abs(ara[i] - ara[i+2]) + solve(ara, i+2, n);
        ans2 = dp[i+2];
    }
    lli ans = min(ans1, ans2);
    printf("I: %d, ans1 = %lld, ans2 = %lld, ans = %lld\n", i, ans1, ans2, ans);
    return ans;
}

int main(){
    int T=1, cs=1;
    //scanf("%d", &T);
    while(T--){

        int n;
        scanf("%d", &n);
        memset(dp, -1, 100005);
        lli ara[n+2];
        for (int i = 0; i < n; ++i) {
            scanf("%lld", &ara[i]);
        }
        //cout<<solve(ara, 0, n)<<endl;
        lli ans[n+2];
        ans[n-1] = 0;
        ans[n-2] = abs(ara[n-1] - ara[n-2]);
        for(int i=n-3; i>=0; i--){
            lli ans1 = abs(ara[i] - ara[i+1]) + ans[i+1];
            lli ans2 = abs(ara[i] - ara[i+2]) + ans[i+2];
            ans[i] = min(ans1, ans2);
        }

        //for(int i=0; i<n; i++) cout<<"ans "<<i<<": "<<ans[i]<<endl;
        cout<<ans[0]<<endl;
    }

    return 0;
}

Measured memory_bytes: 1920
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;

ll res, n;

int main() //PointBlank's code ¯\_(ツ)_/¯
{
    cin >> n;
    ll x, r, s, y;
    repp(i, 1, n) x = n/i, r = n - (n%i), s = i + r, y = (x*s)/2, res += y;
    cout << res;
}

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

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

int main()
{
	int n;
	int max = 0;
	cin >> n;
	int pre = 0;
	int count = 0;
	int now;

	for (int i = 0; i < n; i++) {
		cin >> now;
		if (now <= pre) {
			count++;
		} else {
			max = count > max ? count : max;
			count = 0;
		}
		//printf("[%d]\n", count);
		pre = now;
	}
	max = count > max ? count : max;

	printf("%d", max);

	return 0;
}

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

#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pii pair<ll, ll>
#define piii pair<ll, pair<ll, ll>>
#define debug(x) cout<<#x<<" = "<<x<<endl

using namespace std;
const int N = 200005;
ll t, n, m, k, q, a, b, x, y, ans, arr[N];
ll mod = 998244353;
string s;
bool vis[N];

int main() {
    io;
    t = 1;
//    cin >> t;
    while (t--) {
        cin >> n >> k;
        for (int i = 0; i < k; ++i) {
            cin >> q;
            while (q--) {
                cin >> x;
                ++arr[x];
            }
        }
        for (int i = 1; i <= n; ++i) {
            ans += !(arr[i]);
        }
        cout << ans << endl;
    }
    return 0;
}
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	FOR(i,N) cin>>A[i];
	ll mi=1LL<<60;
	FOR(j,2) {
		ll C=0;
		ll tot=0;
		ll T=(j==0)?1:-1;
		FOR(i,N) {
			C+=A[i];
			if(T==1) {
				if(C<T) tot+=T-C,C=T;
			}
			else {
				if(C>T) tot+=C-T,C=T;
			}
			T=-T;
		}
		mi=min(mi,tot);
	}
	cout<<mi<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;
class Test{
  public static void Main(){
    var N = int.Parse(Console.ReadLine());
    var nums = Console.ReadLine().Split(" ").Select(b => int.Parse(b)).ToList();
    var res = new int[N];
    for(int i = 0; i<N-1; i++){
      res[nums[i]-1]++;
    }
    for(int i = 0; i<N; i++){
      Console.WriteLine(res[i]);  
    }      
  }
}

Measured memory_bytes: 43364
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int [] nums = new int[n+m];
        int i = 0;
        while (i<n){
            nums[i] = 2;
            i++;
        }
        while (i<n+m){
            nums[i] = 1;
            i++;
        }
        int count = 0;
        for(int j = 0; j<nums.length; j++){
            for(int k = j+1; k<nums.length; k++){
                if((nums[j]+nums[k])%2 == 0){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23508
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>


using namespace std;

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

        int A = 0;
        int B =0;
        for (int i = 0; i <= N; i++) {

            A = N - i;


            if(A>0){
                B=B+1;
            }
        }
        cout<<(B-1)/2<<endl;

    }


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

int main() {

    string s;
    cin>>s;
    int cnt = 0;

    for(int i=0;i<s.size();i++) {
        if (s[i] == 'o'){
            cnt++;
        }
    }

    cout<<700+cnt*100<<endl;
}

Measured memory_bytes: 256