akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

long long int read_num(int& i,string& s){
  int prei=i;
  for(;s[i]!=']';i++){
    assert(isdigit(s[i]));
  }
  return stoi(s.substr(prei,i-prei));
}

long long int solve(int &i,string &s){
  assert(s[i]!=']');
  i++;
  if(isdigit(s[i])){
    long long int val=read_num(i,s);
    return val/2+1;
  }
  priority_queue<long long int,vector<long long int>,greater<long long int>> que;
  while(i<s.size() && s[i]!=']'){
    long long int val=solve(i,s);
    que.push(val);
    i++;
  }
  int place=que.size();
  long long int val=0;
  for(int j=0;j<place/2+1;j++){
    long long int vote=que.top();

    val+=vote;
    que.pop();
  }

  return val;
}

int main(){
  int n;
  cin>>n;
  for(int loop=0;loop<n;loop++){
    string s; cin>>s;
    int i=0;
    cout<<solve(i,s)<<endl;
  }
  return 0;

}

Measured memory_bytes: 3120
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
struct ToUpper {
    char operator()(char c) { return toupper(c); }
};
struct ToLower {
    char operator()(char c) { return tolower(c); }
};
const int N=200010;
const int P=1000000007;
using ll = long long;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/

/*
	char s[N];
	strlen(s)
*/

/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/

/*添字1がa個、2がb個
  vector<vector<ll>> map(a,vector<ll>(b));
*/

int main(){
  ll k;
  cin>>k;
  ll ans=1;
  ll now=7;
  while(ans<k+10){
    if(now%k==0){
      break;
    }else{
      ans++;
      now=(now*10+7)%k;
    }
  }
  if(ans<k+9){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
}
    
  

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //c
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<int> front(n + 1), back(n + 2);
  for (int i = 1; i <= n; i++) {
    front[i] = max(front[i - 1], a[i]);
  }
  for (int i = n; i >= 1; i--) {
    back[i] = max(back[i + 1], a[i]);
  }
  for (int i = 1; i <= n; i++) {
    cout << max(front[i - 1], back[i + 1]) << '\n';
  }
  return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <cmath>
#define INF 1000000007
using namespace std ;

int main(int argc, char const *argv[])
{

	long long int n,a,b ;
	cin>>n>>a>>b;

	long long int ans = 0 ;
	long long int temp = n/(a+b) ;

	ans+= (temp * a) ;

	long long int dif = n - (temp * (a+b)) ;

	if(dif > a) ans+=a ;
	else ans+= dif ;

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

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, k, s = rli()
    ans = [s for _ in range(k)]
    if s < n:
        inf = 10000000
    else:
        inf = 1
    ans += [inf]*(n-k)
    print(" ".join(map(str, ans)))



if __name__ == '__main__':
    main()


Measured memory_bytes: 12412
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=2000+100;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

namespace My_Math{
	#define N 100000

	int fac[N+100],invfac[N+100];

	int add(int x,int y) {return x+y>=maxd?x+y-maxd:x+y;}
	int dec(int x,int y) {return x<y?x-y+maxd:x-y;}
	int mul(int x,int y) {return 1ll*x*y%maxd;}
	ll qpow(ll x,int y)
	{
		ll ans=1;
		while (y)
		{
			if (y&1) ans=mul(ans,x);
			x=mul(x,x);y>>=1;
		}
		return ans;
	}
	int getinv(int x) {return qpow(x,maxd-2);}

	int C(int n,int m)
	{
		if ((n<m) || (n<0) || (m<0)) return 0;
		return mul(mul(fac[n],invfac[m]),invfac[n-m]);
	}

	void math_init()
	{
		fac[0]=invfac[0]=1;
		rep(i,1,N) fac[i]=mul(fac[i-1],i);
		invfac[N]=getinv(fac[N]);
		per(i,N-1,1) invfac[i]=mul(invfac[i+1],i+1);
	}
	#undef N
}
using namespace My_Math;

int n,m,k,a[N];
vi num,tmp;

int solve(int x)
{
	num.clear();
	//cout << "now " << x << endl; 
	int lst=0;
	rep(i,1,n+1)
	{
		if (a[i]>=x) continue;
		tmp.clear();
		rep(j,lst+1,i-1) tmp.pb(a[j]);
		sort(tmp.begin(),tmp.end());lst=i;
		int len=tmp.size();
		if (len<k) continue;
		rep(j,0,len-k) num.pb(tmp[j]);
	}
	int len=num.size();
	if (len<m) return maxd;
	sort(num.begin(),num.end());
	//rep(i,0,len-1) cout << num[i] << " ";cout << endl;
	return num[m-1]-x;
}

int main()
{
	n=read();k=read();m=read();
	rep(i,1,n) a[i]=read();
	int ans=1e9;
	rep(i,1,n) ans=min(ans,solve(a[i]));
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

int n, k, a[214514];
vector<int>ne[214514];
int last[214514];
bool last2[214514];
signed main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
		ne[a[i]].push_back(i);
	}
	int memo = 1, now = a[0], index = 0;
	while (1) {
		int l = upper_bound(all(ne[now]), index) - ne[now].begin();
		if (l == ne[now].size()) {
			last[memo] = index - 1;
			if (last[memo] == n - 1)break;
			memo++;
			index = ne[now][0] + 1; now = a[index];
		}
		else {
			index = ne[now][l] + 1; now = a[index];
		}
	}
	k %= memo; if (!k)k = memo;
	int wh = last[k];
	vector<int>vec;
	int ind = 0;
	for (int i = wh + 1; i < n; i++) {
		if (!last2[a[i]]) {
			vec.push_back(a[i]);
			last2[a[i]] = 1;
		}
		else {
			for (int j = vec.size() - 1;; j--) {
				int b = vec[j];
				last2[vec[j]] = 0; vec.pop_back();
				if (b == a[i])break;
			}
		}
	}
	for (auto i : vec)cout << i << " ";
	cout << endl;
}

Measured memory_bytes: 17780
h,w=gets.chomp.split.map(&:to_i)
s=[]
aa=[]
h.times do |i|
  a=gets.chomp
  aa << [0]*w
  w.times do |j|
    if a[j]==?#
      s << [i,j]
      aa[i][j]=1
    end
  end
end
c=0
while s!=[]
  ss = []
  c += 1
  s.each do |i, j|
    if j > 0 && aa[i][j-1] == 0
      aa[i][j-1] = 1
      ss << [i, j-1]
    end
    if i > 0 && aa[i-1][j] == 0
      aa[i-1][j] = 1
      ss << [i-1, j]
    end
    if j < w-1 && aa[i][j+1] == 0
      aa[i][j+1] = 1
      ss << [i, j+1]
    end
    if i < h-1 && aa[i+1][j] == 0
      aa[i+1][j] = 1
      ss << [i+1, j]
    end
  end
  s = ss.dup
end
p c-1


Measured memory_bytes: 83708
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{


	class Program
	{
		static void Main(string[] args)
		{
			var A = new int[3, 3];

			// ビンゴの中身セット
			for (int x = 0; x < 3; x++)
			{
				var inputNum = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				for (int y = 0; y < 3; y++)
				{
					A[x, y] = inputNum[y];
				}
			}

			var N = int.Parse(Console.ReadLine());

			for (int i = 0; i < N; i++)
			{
				var b = int.Parse(Console.ReadLine());

				// ビンゴの中身チェック
				for (int x = 0; x < 3; x++)
				{
					for (int y = 0; y < 3; y++)
					{
						if (b == A[x, y])
						{
							A[x, y] += 100;
						}
					}
				}
			}

			var flag = false;

			// ビンゴの中身チェック
			for (int x = 0; x < 3; x++)
			{
				int num = 0;
				for (int y = 0; y < 3; y++)
				{
					if (A[x, y] > 100)
					{
						num++;
					}
				}

				if (num == 3)
				{
					flag = true;
					break;
				}
			}


			if (!flag)
			{
				// ビンゴの中身チェック
				for (int x = 0; x < 3; x++)
				{
					int num = 0;
					for (int y = 0; y < 3; y++)
					{
						if (A[y, x] > 100)
						{
							num++;
						}
					}

					if (num == 3)
					{
						flag = true;
						break;
					}
				}
			}

			if (!flag)
			{
				// ビンゴの中身チェック
				if (A[0, 0] > 100 && A[1, 1] > 100 & A[2, 2] > 100)
				{
					flag = true;
				}
			}

			if (!flag)
			{
				// ビンゴの中身チェック
				if (A[0, 2] > 100 && A[1, 1] > 100 & A[2, 0] > 100)
				{
					flag = true;
				}

			}


			if (flag)
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
		}
	}
}

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

int main(){
	bool a,b ;
	a = b = false ;
	char c ;
	for(int i=0;i<3;i++){
		cin >> c ;
		if(c=='A') a = true ;
		else b = true ;
	}
	if(a&&b) cout << "Yes" << endl ;
	else cout << "No" << endl ;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
 
int main() {
    ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int a[26] = {};
	string b = "abcdefghijklmnopqrstuvwxyz";
	for (int i = 0 ; i < s.length() ; i++) {
		for (int j = 0 ; j < 26 ; j++) {
			if (s[i] == b[j]) {
				a[j]++;
				j = 26;
			}
		}
	}
	for (int i = 0 ; i < 26 ; i++) {
		if (a[i] == 0) {
			cout << b[i];
			return 0;
		}
	} 
	cout << "None";
}

Measured memory_bytes: 3752
n=int(input())
sp=[]
for i in range(n):
  s=input().split()
  t=[s[0],int(s[1]),i+1]
  sp.append(t)
from operator import itemgetter
sp.sort(key=itemgetter(1),reverse=1)
sp.sort(key=itemgetter(0))
for i in range(n):
  print(sp[i][2])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, x; cin >> n >> x;
  for(int i = 0; i <= n; i++){
  	for(int j = 0; j+i <= n; j++){
    	int k = n - i - j;
      	if(i*10000 + j*5000 + k*1000 == x){
        	cout << i << " " << j << " " << k << endl;
          return 0;
        }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	int a1 = 0;
	int a2 = 0;
	int a4 = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x % 4 == 0)a4++;
		else if(x % 2 == 0)a2++;
		else a1++;
	}
	if (n / 2 <= a4)cout << "Yes" << endl;
	else if (n - (a4 * 2) <= a2)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
l = 0
r = n
for i in range(m):
    li,ri = map(int, input().split())
    l = max(l,li)
    r = min(r,ri)
if r < l:
    ans = 0
else:
    ans = r - l + 1
print(ans)

Measured memory_bytes: 9096
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int ans = 0;
    string s; cin >> s;
    rep(i,s.size()){
        if(s[i] == '+') ans++;
        else ans--;
    }
    ANS;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	int a,b,hz,rem;
	Scanner scan =new Scanner(System.in);
	a=scan.nextInt();
	b=scan.nextInt();
	if(b>a){
	    hz=a;
	    a=b;
	    b=hz;
	}
	rem=a%b;
        while(rem!=0){
	    a=b;
	    b=rem;
	    rem=a%b;
	}
	System.out.println(b);
    }
}



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

int main() {

    ll N;
    cin >> N;
    ll min_step = N;
    ll s; 
    for(ll i=1;i*i<=N;i++){
        if(N%i==0){
            s = i + N/i - 2;
            if(s<min_step){
                min_step = s;
            }
        }
    }
    cout << min_step;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a, b, t, c, ji;
	scanf("%d%d", &a, &b);
	if(a > b)
	{
		t = a;
		a = b;
		b = t;
	}
	for(int i = a; i <= b; i++)
	{
		c = i;
		ji = a*b*c;
		if(ji%2 == 1)
		break;
	}
	if(ji%2 == 0)
	printf("No");
	else
	printf("Yes");
	return 0;
 } 

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  int n,count;
  int max_count=0;
  int tmp;
  int result=1;
  scanf("%d", &n);
  for(int i=1; i<=n; i++){
    tmp=i;
    count = 0;
    while(tmp % 2 == 0){
      count++;
      tmp=tmp/2;
    }
    if(max_count < count){
      max_count = count;
      result = i;
    }
  }
  printf("%d\n",result);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;   //m[3]=5;
vector<int> v;

int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;++i){
		int x;
		cin>>x;
		if(m.count(x)==0)v.push_back(x);
		++m[x];
	}
	int ans=0;
	for(int i=0;i<v.size();++i)
		if(v[i]>m[v[i]]) ans+=m[v[i]];
		else if(v[i]<m[v[i]]) ans+=m[v[i]]-v[i];
	cout<<ans<<"\n";
	return 0; 
}

Measured memory_bytes: 5112
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#ifndef ONLINE_JUDGE
#include <custom/prettyprint.hpp>
#endif
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define pow10(n) stoll("1"+string(n,'0'))
#define dbg(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9+7; //998244353
const int inf = 1e9+3;
const ll INF = ll(3e18)+3;
const ld PI = acos((ld)-1);
const int dx[8] = {1,0,-1,0,1,1,-1,-1}, dy[8] = {0,1,0,-1,-1,1,1,-1};
mt19937_64 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll n) { return uniform_int_distribution<ll>(0, n)(rng); }
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

void setIO(const string& s) {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {
    
    setIO("input");
    int n; cin >> n;
    ll ans = 0;
    int mx = 0;
    for(int i=0, a; i<n; ++i) {
        cin >> a;
        ans += max(0, mx - a);
        mx = max(mx, a);
    }
    cout << ans << '\n';
    
}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

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

int main()
{
    string s;
    cin >> s;

    const int n = (s.length() - 1) / 2;
    string bef = s.substr(0, n);
    string aft = s.substr((s.length() + 1) / 2, n);
    bool ok = true;

    for (int i = 0; i < (n+1)/2; i++)
    {
        if (bef[i] != bef[n - 1 - i]) {
            ok = false;
        }
    }
    for (int i = 0; i < (n+1)/2; i++)
    {
        if (aft[i] != aft[n - 1 - i]) {
            ok = false;
        }
    }
    for (size_t i = 0; i < s.length(); i++)
    {
        if (s[i] != s[s.length() - 1 - i]) {
            ok = false;
        }
    }
    

    if (ok)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    cout << ( n - 2 ) * 180 << endl;
    return 0;
}



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

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

    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    rep(i, n) {
        cin >> v[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] >= k)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin>>x;
    for(ll i=-155;i<=155;i++){
        for(ll j=-155;j<=155;j++){
            if(i*i*i*i*i==x+j*j*j*j*j)return cout<<i<<" "<<j<<endl,0;
        }
    }
}


Measured memory_bytes: 3624
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val x = n * 100 / 108
    println(when (n) {
        x * 108 / 100 -> x
        (x + 1) * 108 / 100 -> x + 1
        else -> ":("
    })
}

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

using namespace std;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	int ans = 0, x = 0;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'I')
			x++;
		else
			x--;
		ans = max(ans, x);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) for(auto x:obj)cout<<x<<' ';cout<<endl;
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	long double Q,H,S,D;
	ll N;
	cin>>Q>>H>>S>>D>>N;
	Q *= 4; H *= 2; D /= 2;
	ll ans = 0LL;
	if(min({Q,H,D,S}) == D){
		ans += N/2 * (2*D);
		N  %= 2;
	}
	ans += min({Q,H,S})*N;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import re
p = re.compile('^(.)\\1')
w = ''.join(sorted(list(raw_input())))
r = re.subn(p,'',w)
while r[1]:
    r = re.subn(p,'',r[0])
if len(r[0]):
    print 'No'
else:
    print 'Yes'


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

#define endl '\n'
#define dbg(a) cout << #a << " := " << (a) << endl
#define all(a) (a).begin(), (a).end()

using namespace std;


void solve();
signed main(){
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    solve();
}


void solve(){
    int a, b, k; cin >> a >> b >> k;
    set<int> r;
    for (int i = a; i < min(a + k, b + 1); ++i)
        r.insert(i);
    for (int i = b; i >= max(a, b - k + 1); --i)
        r.insert(i);
    for (auto i : r){
        cout << i << endl;
    }
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, t;
  while (cin >> n >> t) {
    lli x[n];
    for (int i = 0; i < n; ++i) {
      cin >> x[i];
    }
    lli sum = 0;
    for (int i = 0; i + 1 < n; ++i) {
      int j = i + 1;
      if (x[j] <= (x[i] + t)) sum += x[j] - x[i];
      else sum += t;
    }
    cout << sum + t << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;


int main(){
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.append(0)
ans = 0
cnt = 0
for i in range(1,n+1):
    cnt += 1
    if a[i] != a[i-1]:
        if cnt < a[i-1]:
            ans += cnt
        else:
            ans += cnt - a[i-1]
        cnt = 0
    #print(ans)
print(ans)

Measured memory_bytes: 14688
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;


int main(){
    int n;
    cin >> n;
    int A1[n];
    int  A2[n];
    for (int i=0; i< n;i++){
        cin >> A1[i];
    }for (int i=0; i< n;i++){
        cin >> A2[i];
    }
    int A3[n];
    for(int i =0;i<n;i++){
        int a =(int)A2[i]-(int)A1[i] ;
        a = fabs(a);
        A3[i] = a;
    }
    double ans =0;
    for(int i =0;i<n;i++){
        ans += A3[i];
    }
    printf("%f\n",ans);
    
    double ans2 =0;
    for(int i =0;i <n; i++){
        ans2 += A3[i]*A3[i];
    }ans2 = sqrt(ans2);
    printf("%f\n",ans2);
    
    double ans3 =0;
    for(int i=0;i<n; i++){
        ans3 += pow(A3[i],3);
    }ans3 = cbrt(ans3);
    printf("%f\n",ans3);
    
    double ansi = 0;
    for(int i=0;i<n;i++){
        if (A3[i] > ansi) ansi = A3[i];
    }printf("%f\n",ansi);
}


Measured memory_bytes: 3400
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const ll INF = 1e18 + 10 ; 
int main(){
    fastio
    string s ; 
    cin >> s ; 
    int n = (int) s.size() ;
    vector<vector<int> > cnt(26) ; 
    for(int i = 0; i < n; i++){
        cnt[s[i] - 'a'].push_back(i);
    }
    for(int i = 0; i < n; i++){
        vector<int> &v = cnt[s[i] - 'a'];
        int nextE = upper_bound(v.begin(), v.end(), i) - v.begin();
        int c = 1;
        for(int j = nextE; j < (int) v.size(); j++){
            int len = v[j] - i + 1;
            int half = len / 2 ;
            c++;
            if ( c > half ){
                return cout << i + 1 << ' ' << v[j] + 1 << endl, 0;
            }
        }
    }
    cout << -1 << ' ' << -1 << endl;
    return 0 ;
}

Measured memory_bytes: 1104
#include<stdio.h>

int main()
{
    int i, a, b, c;
    int k = 0;

    scanf("%d %d %d", &a, &b, &c);

    for(i =a; i <= b; i++){
	if(c%i == 0)
	    k = k + 1;
    }

    printf("%d\n", k);

    return 0;
}



Measured memory_bytes: 2148
#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
int w[300000];
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n = next<int>();
	rep(i, 0, n-1) w[next<int>()]++;
	hrp(i, 1, n) cout<<w[i]<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}

Measured memory_bytes: 5172
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll H, W, N;
  cin >> H >> W >> N;
  ll maxnum = max(H, W);
  ll count = 0;
  while (N > 0) {
    N -= maxnum;
    count++;
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
using ll = long long;
using color_t = uint16_t;
using namespace std;
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }


array<color_t,4> rotate(array<color_t, 4 > c, int r) {
    // r分ずつ左にずれる
    rotate(c.begin(), c.begin() + r, c.end());
    return c;
}


void normalize(array<color_t,4> & c) {
    // 各面の表記を統一させる
    // この場合は角の色を数列として考えて、その辞書順で最も小さいのを探している
    array<color_t,4> d = c;
    for(int r = 0; r < 4; r++){
        setmin(c, rotate(d, r));
    }
}


int multiplicity(array<color_t,4> const & c) {
    // 回転させても同じ色の配置になる回数
    int n = 1;
    for (int r = 1; r < 4; r++){
        if (c == rotate(c, r)){
            n += 1;
        }
    }
    return n;
}


int main() {
    int n; cin >> n;
    vector<array<color_t,4> > c(n);
    for (int i = 0; i < n; i++){
        for(int j = 0; j < 4; j++){
            cin >> c[i][j];
        }
    }
    for (int i = 0; i < n; i++){
        // 各パネルの表現を決める
        normalize(c[i]);
    }
    
    map<array<color_t,4>,int> cnt;
    for(int i = 0; i < n; i++){
        // 同じパネルが何枚あるか
        cnt[c[i]] += 1;
    }
    map<array<color_t,4>,int> mul;
    for (auto it : cnt){
        mul[it.first] = multiplicity(it.first);
    }

    ll ans = 0;
    for(int bi = 0; bi < n; bi++){
        for(int ai = 0; ai < bi; ai++){
        // 一枚ずつ使用している
        // 後で元に戻す
        cnt[c[ai]] -= 1;
        cnt[c[bi]] -= 1;
        for(int br = 0; br < 4; br++){
            // bの面をbr回、回転させる
            //    b0 -- b3
            //   /     / |
            // a0 -- a1  |
            //  | _b1_|_ | b2
            //  |     | /
            // a3 -- a2
            array<color_t,4> const & a = c[ai];
            array<color_t,4> b = rotate(c[bi], br);
            array<array<color_t,4>,4> ds;
            // 各側面の角の色の組み合わせ
            ds[0] = { b[0], b[3], a[1], a[0] };
            ds[1] = { b[3], b[2], a[2], a[1] };
            ds[2] = { b[2], b[1], a[3], a[2] };
            ds[3] = { b[1], b[0], a[0], a[3] };

            ll acc = 1;
            map<array<color_t,4>,int> used;
            for (auto & d : ds) {
                normalize(d);
                if (!cnt.count(d)){
                    // この角の色の組み合わせの側面は存在していない
                    acc = 0;
                    break;
                }
                used[d] += 1; // 使用した回数
                acc *= mul[d] * (cnt[d] - used[d] + 1); // 重複した回転*(使用できる枚数　- 使用した枚数 + 1)
            }
            ans += acc;
        }
        cnt[c[ai]] += 1;
        cnt[c[bi]] += 1;
        }
    }
    ans /= 3;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		try {
			while ((buffer = reader.readLine())  != null) {
				Integer a = Integer.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" ")));
				buffer = buffer.substring(buffer.indexOf(" ") + 1);
				Integer b = Integer.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" ")));
				buffer = buffer.substring(buffer.indexOf(" ") + 1);
				Integer c = Integer.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" ")));
				int d = a / b;
				int r = a - b * d;
				double f = (double)a / b;
				System.out.println(d + " " + r + " " + BigDecimal.valueOf(f).toPlainString());
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

Measured memory_bytes: 24860
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	a := iSScan(n)
	x := 0
	for i := 0; i < n; i++ {
		if a[i] < 0 {
			x++
		}
		a[i] = abs(a[i])
	}
	if x%2 == 0 {
		fmt.Println(sum(a))
	} else {
		fmt.Println(sum(a) - min(a)*2)
	}
}


Measured memory_bytes: 4208
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n,m,l;
    int i,j,k;
    int a[100][100];
    int b[100][100];
    long int c[100][100]={0};
    scanf("%d %d %d",&n,&m,&l);
    for(i=0;i<n;i++){//???
        for(j=0;j<m;j++){//?¨?
            scanf("%d",&a[j][i]);
        }
    }
    for(i=0;i<m;i++){
        for(j=0;j<l;j++){
            scanf("%d",&b[j][i]);
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            for(k=0;k<m;k++){
                c[j][i]+=a[k][i]*b[j][k];
            }
        }
    }
    for(i=0;i<n;i++){
        if(i!=0){
            printf("\n");
        }
        for(j=0;j<l;j++){
            if(j!=0){
                printf(" ");
            }
            printf("%ld",c[j][i]);
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 768
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    
    n = int(input())
    a = [0]*n
    b = [0]*n
    c = [0]*n
    for i in range(n):
        a[i],b[i],c[i] = map(int,input().split())

    dpa = [a[0]]+[0]*(n-1)
    dpb = [b[0]]+[0]*(n-1)
    dpc = [c[0]]+[0]*(n-1)
    for i in range(1,n):
        dpa[i] = max(dpb[i-1],dpc[i-1]) + a[i]
        dpb[i] = max(dpc[i-1],dpa[i-1]) + b[i]
        dpc[i] = max(dpa[i-1],dpb[i-1]) + c[i]
    print(max(dpa[-1],dpb[-1],dpc[-1]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 48604
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
ll dp[110][200000];
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int N, W;
  cin >> N >> W;
  vector<int> w(N), v(N);
  REP(i, N) cin >> w[i] >> v[i];
  REP(i, 110) REP(j, 200000) dp[i][j] = 1e13;
  dp[0][0] = 0;
  REP(i, N) {
    REP(j, 200000) {
      chmin(dp[i + 1][j], dp[i][j]);
      chmin(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
    }
  }
  ll ans = 0;
  for (int i = 199999; i >= 0; i--) {
    if (dp[N][i] <= W) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 175520
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    vector<string> fromName(n), toName(n);
    vector<int> fromTime(n), toTime(n);
    for(int i=0; i<n; ++i){
        int h1, h2, m1, m2;
        char c;
        cin >> h1 >> c >> m1 >> fromName[i] >> h2 >> c >> m2 >> toName[i];
        fromTime[i] = h1 * 60 + m1;
        toTime[i] = h2 * 60 + m2;
    }

    vector<string> retName;
    vector<int> retTime;
    for(int i=0; i<n-1; ++i){
        int diff = fromTime[i+1] - toTime[i];
        if(diff >= t){
            retName.push_back(toName[i]);
            retTime.push_back(diff);
        }
    }

    cout << retName.size() << endl;
    for(unsigned i=0; i<retName.size(); ++i)
        cout << retName[i] << ' ' << retTime[i] << endl;
    return 0;
}

Measured memory_bytes: 1236
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    vector<int> l(2 * n);

    for(int i = 0; i < 2 * n; i++) cin >> l[i];


    sort(l.begin(), l.end());

    int ans = 0;
    for(int i = 0; i < 2 * n; i += 2){
        ans += min(l[i], l[i + 1]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<long,long>mp;
int main()
{
    long i,j,t,a,b,n,c,y,m,prev,sum,ans=1,count,k;
    t=1;
    // cin>>t;
    while(t--)
    {
        cin>>n;
        set<int>st;
        for(i=0;i<n;i++)
        {
            cin>>a;
            if(st.find(a)!=st.end())
            st.erase(a);
            else st.insert(a);
        }
        cout<<st.size();
    }
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,n;
	cin>>n;
	ld ar[n+1];
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}

	ld s=0;
	for(i=1;i<=n;i++){
		s+=(1.0l/ar[i]);
	}
	s=(1.0l/s);
	cout<<fixed<<setprecision(10)<<s;
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

r = int(input())
print(r**2)

Measured memory_bytes: 73000
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	double a, b, x=0, y=0, buf=0;
	int xn, yn;

	while(1){
		scanf("%lf,%lf", &a, &b);
		if(a==0 && b==0)
			break;
		x = a * sin(buf) + x;
		y = a * cos(buf) + y;
		buf = (M_PI*b)/180 + buf;
	}

	xn = (int)x;
	yn = (int)y;

	printf("%d\n", xn);
	printf("%d\n", yn);

	return 0;
}

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

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		int INF = Integer.MAX_VALUE/2;
		StringBuilder ans = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		int D = Integer.parseInt(sc.next());
		int[] c = new int[26];
		Arrays.setAll(c, i -> Integer.parseInt(sc.next()));
		int[][] s = new int[D][26];
		for(int i = 0; i < D; i++)
			Arrays.setAll(s[i], x -> Integer.parseInt(sc.next()));
		sc.close();
		int[] con = new int[D];
		TreeSet<Integer>[] used = new TreeSet[26];
		for(int i = 0; i < 26; i++) {
			used[i] = new TreeSet<>();
			used[i].add(-1);
		}
		int sum = 0;
		for(int d = 0; d < D; d++) {
			int max = -INF, now = 0;
			for(int i = 0; i < 26; i++) {
				int temp = 0;
				temp += s[d][i];
				for(int j = 0; j < 26; j++)
					if(i != j)
						temp -= c[j] * (d - used[j].last());
				if(max < temp) {
					max = temp;
					now = i;
				}
			}
			con[d] = now;
			used[now].add(d);
		}
		for(int i = 0; i < 26; i++)
			used[i].add(D);
		//Random r = new Random();
		LOOP:while(true) {
			//int d = r.nextInt(D);
			for(int d = 0; d < D; d++) {
			for(int q = 0; q < 26; q++) {
				long temp = 0;
				temp -= s[d][con[d]];
				temp += s[d][q];
				temp -= c[con[d]] * (used[con[d]].ceiling(d) - d) * (d - used[con[d]].lower(d));
				temp += c[q] * (d - used[q].lower(d)) * (used[q].ceiling(d) - d);
				if(temp > 0) {
					con[d] = q;
					used[con[d]].remove(d);
					used[q].add(d);
				}
			}
			if(System.currentTimeMillis() - start > 1850)
				break LOOP;
			}
		}
		for(int i : con)
			ans.append((i+1) + "\n");
		System.out.println(ans);
	}

}

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

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        
        Console.WriteLine(Gcd(a));
    }

    static int Gcd(int a,int b)
    {
        if (b == 0) return a;
        else return Gcd(b, a % b);
    }

    static int Gcd(int[] a)
    {
        int ans = a[0];
        for (int i = 1; i < a.Length; i++)
        {
            ans = Gcd(ans, a[i]);
        }
        return ans;
    }
}

Measured memory_bytes: 21728