akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t N;
	std::cin >> N;
	std::vector<int64_t> a(N);
	for (int64_t i = 0; i < N; i++)
	{
		std::cin >> a[i];
	}

	int64_t ans = 0;
	int64_t current = 1;

	for (int64_t i = 0; i < N; i++)
	{
		if (a[i] == current)
		{
			current++;
		}
		else
		{
			ans++;
		}
	}

	if (current == 1) ans = -1;

	std::cout << ans << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}


Measured memory_bytes: 4764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans = 0;
            for (int i = 0; i < n; ++i)
            {
                for (int j = i + 1; j < n; ++j)
                {
                    ans += d[i] * d[j];
                }
            }
            Console.WriteLine(ans);
            //Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13268
#include <cstring> 
#include <malloc.h> 
#include <iostream> 
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	int sum = 1;
	while(n--)
	{
		int a = sum;
		if(a * 2 > a + k) sum = a + k;
		else sum = a * 2;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin>>n;
  vector<long> a(n);
  int minus_even = 1;
  for (size_t i = 0; i < n; i++) {
    cin>>a[i];
    if (a[i]<0) {
      minus_even*=(-1);
      a[i]*=(-1);
    }
  }
  sort(a.begin(),a.end());
  if (minus_even==-1) {
    a[0]*=(-1);
  }
  long sum=0;
  for (size_t i = 0; i < n; i++) {
    sum+=a[i];
  }
  cout<<sum;
}

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

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

    int n;
    cin >> n;
    map<int, int> mp;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        mp[a-1]++;
        mp[a]++;
        mp[a+1]++;
    }

    int ans = -1e9;
    for(auto x: mp){
        ans = max(ans, x.second);
    }

    cout << ans << endl;


    return 0;
}

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

int main(){
    string S, T;
    cin >> S >> T;

    string x = "";
    x.append(T);
    x.append(T);

    if(x.find(S)<=S.size()) cout << "Yes" << endl;
    else cout << "No" << endl;    
}

Measured memory_bytes: 384
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int W = scan.nextInt();
		int H = scan.nextInt();
		PriorityQueue<Pair> pq = new PriorityQueue<>();
		for(int i=0;i<W;i++){
			pq.add(new Pair(scan.nextLong(),i));
		}
		for(int i=0;i<H;i++){
			pq.add(new Pair(scan.nextLong(),i+W));
		}

		long res = 0;
		int w = W+1;
		int h = H+1;

		while(!pq.isEmpty()){
			Pair p = pq.poll();
			long val = p.p;
			long index = p.q;

			if(index < W && h > 0){
				res += h*val;
				w--;
			}else if( index >= W && w > 0 ){
				res += w*val;
				h--;
			}

		}
		System.out.println(res);

	}

	static class Pair implements Comparable{
		long p, q;
		public Pair(long p, long q){
			this.p = p;
			this.q = q;

		}
		public int compareTo(Object object){
			Pair other = (Pair)object;
			return (int)(this.p-((Pair)other).p);
		}
	}

}

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

using namespace std;
typedef long long ll;

int main() {
    int x, y;
    cin >> x >> y;
    if (y % 2 == 0 && y >= x * 2 && y <= x * 4) {
        puts("Yes");
    } else {
        puts("No");
    }
}


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

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

    int x,a;
    cin >> x >> a;
    
    int ans = 0;
    if(x >= a){
        ans = 10;
    }
    
    cout << ans << endl;

    return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main(){
  int r;
  cin >> r;
  
  cout << r*r*3 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,s=1,k=1,zyl[20]={0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768};
bool boo[40004],flag;
struct note
{
	int a,x[16],y[16];
}p[16];
struct srrx
{
	int num,c;
}dui[500005];
int read()
{
	char ch=getchar();int g=0;
	while(ch<'0'||ch>'g') ch=getchar();
	while(ch>='0'&&ch<='9') {g=g*10+ch-'0';ch=getchar();} 
	return g;
}
void dfs(int ss,int tt)
{
	int ayg;
	for(int i=1;i<=n;++i)
		if((ss&zyl[i])>0)
		{
			ayg=ss&~zyl[i];
			if(!boo[ayg])
			{
				boo[ayg]=1;dui[++k].num=ayg;dui[k].c=tt-1;
				if(tt-1>0) dfs(ayg,tt-1);
			}
		}
}
bool cmp(srrx i,srrx j)
{
	if(i.c>j.c||(j.c==i.c&&i.num>j.num)) return 1;
	return 0;
}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)
	{
		s*=2;
		p[i].a=read();
		for(int j=1;j<=p[i].a;++j)
			{p[i].x[j]=read();p[i].y[j]=read();}
	}
	s--;
	dui[1].num=s;dui[1].c=n;boo[s]=1;
	dfs(s,n);
	sort(dui+1,dui+k+1,cmp);
	for(int i=1;i<=k;++i)
	{
		flag=0;
		for(int j=1;j<=n;++j)
		{
			if((dui[i].num&zyl[j])>0)
				for(int r=1;r<=p[j].a;++r)
					if(min(dui[i].num&zyl[p[j].x[r]],1)!=p[j].y[r]) {flag=1;break;}
			if(flag) break;
		}
		if(!flag) {printf("%d",dui[i].c);return 0;}
	}
	return 0;
}

Measured memory_bytes: 512
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var a = o.l();
  var s = a.reduce((a,b)=>a+b);
  var div = f(s);
  for(var i = 0; i < div.length; i++){
    var x = a.map(a=>a%div[i]).sort((a,b)=>b-a);
    var sum = 0;
    for(var j = 0; j < n; j++){
      sum += x[j];
    }
    var mx = sum;
    sum /= div[i];
    for(j = 0; j < sum; j++){
      mx -= x[j];
    }
    if(mx <= k)return div[i];
  }
  return 1;
}

function f(n){
  var r = [n];
  var m = Math.sqrt(n);
  var x = Math.floor(m);
  if(x*x === n)r.push(x);
  for(var i = 2; i < m; i++){
    if(n%i === 0)r.push(i,n/i);
  }
  return r.sort((a,b)=>b-a);
}

Measured memory_bytes: 11372
import java.math.BigInteger

fun main(args: Array<String>) {
    abc065c()
}

val mod = BigInteger.valueOf(1000000000L + 7L)

fun abc065c() {
    val (n, m) = readLine()!!.split(" ").map { it.toLong() }

    if (Math.abs(n - m) > 1) return println(0)

    val answer = fact(n) * fact(m) % mod * if (n == m) BigInteger.valueOf(2) else BigInteger.valueOf(1)

    println(answer % mod)
}

private fun fact(n: Long): BigInteger {
    var answer = BigInteger.ONE
    (n downTo 2).forEach {
        answer *= BigInteger.valueOf(it)
        answer %= mod
    }
    return answer
}


Measured memory_bytes: 52452
#include<iostream>
using namespace std;
int main(){
	int N,M,a,b,c,bit,answer;
	int cost[(1<<12)+1]={0};
	cin>>N>>M;
	for(int i=0;i<M;i++){
		cin>>a>>b;
		bit=0;
		for(int j=0;j<b;j++){
			cin>>c;
			bit+=1<<(c-1);
		}
		for(int j=(1<<N)-1;j>=0;j--){
			if(cost[j]!=0||j==0){
				cost[j|bit] = min(cost[j|bit],cost[j]+a);
				if(cost[j|bit]==0)cost[j|bit]=cost[j]+a;
			}
		}
	}
	answer=cost[(1<<N)-1];
	if(answer==0)cout<<-1<<endl;
	else cout<<answer<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _cin      ios_base::sync_with_stdio(0);  cin.tie(0);
#define READ      freopen("input.txt", "r", stdin);
#define WRITE     freopen("output.txt", "w", stdout);
#define endl "\n"
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define vvll vector<vector<ll> >
#define vll vector<ll>
#define mll map<ll,ll>
#define sz(x) (ll)x.size()
#define sll set<ll>
#define pll pair<ll,ll>
#define F first
#define S second
const ll MAX = 1000004;
const ll INF = 1e18L + 5;

int main() {

	_cin
	// READ
	// WRITE
	string x, y;
	cin >> x;
	cin >> y;
	ll n = x.length(), m = y.length();
	ll lcs[n + 1][m + 1];
	rep(i, 0, n + 1) {
		rep(j, 0, m + 1) {
			if (i == 0 || j == 0) lcs[i][j] = 0;
			else if (x[i - 1] == y[j - 1]) lcs[i][j] = lcs[i - 1][j - 1] + 1;
			else lcs[i][j] = max(lcs[i][j - 1], lcs[i - 1][j]);
		}

	}
	string ans="";
	ll i=n,j=m;
	while(i>0 && j>0){
		if(x[i-1]==y[j-1]){
			ans+=x[i-1];
			i--;
			j--;

		}else{
			if(lcs[i][j-1]>lcs[i-1][j]) j--;
			else i--;
		}
	}
	reverse(ans.begin(),ans.end());
	cout << ans<< endl;
}

Measured memory_bytes: 74024
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int q,presum[maxn];
bool isprime[maxn];
bool check(int x)
{
	return isprime[x]&&isprime[(x+1)/2];
}
void build()
{
	for(int i=2;i<maxn;i++)
		isprime[i]=true;
	for(int i=2;i<maxn;i++)
		if(isprime[i])
			for(int j=i+i;j<maxn;j+=i)
				isprime[j]=false;
	for(int i=2;i<maxn;i++)
		if(i&1)
			presum[i]=presum[i-1]+check(i);
		else
			presum[i]=presum[i-1];
}
void solve()
{
	int l,r;
	cin>>l>>r;
	cout<<presum[r]-presum[l-1]<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	cin>>q;
	build();
	while(q--)
		solve();
	return 0;
}
/*
1
3 7
output:2

4
13 13
7 11
7 11
2017 2017
output:
1
0
0
1 

6
1 53
13 91
37 55
19 51
73 91
13 49
output:
4
4
1
1
1
2

1
1 2
output:0

1
1 100000
output:672
*/


Measured memory_bytes: 4040
#include<iostream>
using namespace std;
unsigned long xor_x=88172645463325252ULL;
unsigned long rng()
{
	xor_x^=xor_x<<7;
	return xor_x^=xor_x>>9;
}
int D;
int c[26],s[365][26];
int t[365],now;
int anst[365],ans;
void calc()
{
	int lst[26];
	for(int i=0;i<26;i++)lst[i]=-1;
	now=0;
	for(int i=0;i<D;i++)
	{
		now+=s[i][t[i]];
		lst[t[i]]=i;
		for(int j=0;j<26;j++)now-=c[j]*(i-lst[j]);
	}
}
int change(int d,int q)
{
	int ret=0;
	ret-=s[d][t[d]];
	ret+=s[d][q];
	{
		int r=d+1;
		while(r<D&&t[r]!=t[d])r++;
		int l=d-1;
		while(l>=0&&t[l]!=t[d])l--;
		ret-=c[t[d]]*(r-d)*(d-l);
	}
	{
		int r=d+1;
		while(r<D&&t[r]!=q)r++;
		int l=d-1;
		while(l>=0&&t[l]!=q)l--;
		ret+=c[q]*(r-d)*(d-l);
	}
	return ret;
}
main()
{
	cin>>D;
	for(int i=0;i<26;i++)cin>>c[i];
	for(int i=0;i<D;i++)for(int j=0;j<26;j++)cin>>s[i][j];
	{
		int lst[26];
		for(int i=0;i<26;i++)lst[i]=-1;
		for(int i=0;i<D;i++)
		{
			int x=-1,tc=-1;
			for(int j=0;j<26;j++)
			{
				int u=s[i][j]+c[j]*(i-lst[j])*5;
				if(tc<u)
				{
					tc=u;
					x=j;
				}
			}
			t[i]=x;
			lst[x]=i;
		}
	}
	calc();
	ans=now;
	for(int tm=0;tm<3000;tm++)
	{
		while(true)
		{
			int d=rng()%D,q=rng()%26;
			int ret=change(d,q);
			if(rng()%2000>tm||ret>=0)
			{
				now+=ret;
				t[d]=q;
				break;
			}
		}
		for(int k=0;k<3000;k++)
		{
			int d1=rng()%(D-1)+1,d2=rng()%d1;
			int pt1=t[d1],pt2=t[d2];
			int diff=0;
			diff+=change(d1,pt2);
			t[d1]=pt2;
			diff+=change(d2,pt1);
			t[d2]=pt1;
			if(diff>=0)
			{
				now+=diff;
			}
			else
			{
				t[d1]=pt1;
				t[d2]=pt2;
			}
		}
		if(ans<=now)
		{
			ans=now;
			for(int i=0;i<D;i++)anst[i]=t[i];
		}
		else if(rng()%2000<tm)
		{
			now=ans;
			for(int i=0;i<D;i++)t[i]=anst[i];
		}
	}
	for(int i=0;i<D;i++)cout<<anst[i]+1<<endl;
	cerr<<ans<<endl;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(void){
    int a,b,c = 0;
    bool ok = false;
    cin >> a >> b >>c;
    if(a == b){
        if(b != c){
            ok = true;
        }
    }
    if(a == c){
        if(b != a){
            ok = true;
        }
    }

    if(b == c){
        if(c != a){
            ok = true;
        }
    }
    
    if(ok){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

ll gcd(ll a, ll b) {
    if(a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

int main(){
    int K;
    cin >> K;
    ll count = 0;

    for(int i=1; i<=K; i++) {
        for(int j=1; j<=K; j++) {
            for(int k=1; k<=K; k++) {
                count += gcd(i, gcd(j, k));
            }
        }
    }
    cout << count << endl;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll m;
    cin >> m;
    cout << 24 + (24 - m) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
typedef long long ll;

int main(){
  int H, W;


  while(cin>>H>>W && H!=0 && W!=0){
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
        if((i%2==0 && j%2==0)||(i%2!=0 && j%2!=0)){
          cout<<"#";
        }else{
          cout<<".";
        }

        }
        cout<<endl;
      }
      cout<<endl;
    }
}

Measured memory_bytes: 3100
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
ll nCr(ll n, ll r){
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
  ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
  return ret;
}

int main(void){
  int n,a,b,c;
  cin>>n;
  vector<int> A,B,C;
  ll ans = 0;
  rep(i,n){
    cin>>a;a--;
    A.push_back(a);
  }
  rep(i,n){
    cin>>b;
    B.push_back(b);
  }
  rep(i,n-1){
    cin>>c;
    C.push_back(c);
  }
  rep(t, n){
    ans += B[A[t]];
    if(t==0) continue;
    if(A[t] == A[t-1] + 1){
      ans += C[A[t-1]];
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

map<int,int> a;

int main()
{
  int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++) {
    int x;
    scanf("%d",&x);
    a[x]++;
  }
  int ans = 0;
  for(auto p : a) {
    if(p.first > p.second) ans += p.second;
    else ans += p.second - p.first;
  }
  printf("%d\n",ans);
}


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

int main() {
  int A,B;
  cin >> A>>B;
  
  if (0<=A && A<=5){
    cout << 0 <<endl;
  }
  else if(6<=A && A<=12){
    cout <<B/2<<endl;
  }
  else{
      cout << B <<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> V;

#define _ cin.tie(0);ios::sync_with_stdio(false);
int n,a;
int main(){ _;
  cin>>n;
  V acc(n+1);
  acc[0]=0;
  REP(i,n){
    cin>>a;
    acc[i+1]=acc[i]+a;
  }
  VSORT(acc);
  llong ans=0;
  llong count=1;

  FOR(i,1,n+1){
    if(acc[i]==acc[i-1])
      ++count;
    else{
      ans+=count*(count-1)/2;
      count=1;
    }
  }
  ans+=count*(count-1)/2;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SIZE 200005
#define INF 100000000000000000LL

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

int main(){
    int N,p[10];
    cin>>N;
    rep(i,N){
        cin>>p[i];
    }
    sort(p+0,p+N,greater<int>());
    int ans = p[0]/2;
    for(int i = 1;i<N;i++){
        ans += p[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int n,k,xb,yb,zb,xe,ye,ze;
    long long x1[51],x2[51],xs[101],y1[51],y2[51],ys[101],z1[51],z2[51],zs[101];
    cin>>n>>k;
    for(int i=0;i<n;++i){
        cin>>xb>>yb>>zb>>xe>>ye>>ze;
        x1[i]=xs[i*2]=xb;x2[i]=xs[i*2+1]=xe;
        y1[i]=ys[i*2]=yb;y2[i]=ys[i*2+1]=ye;
        z1[i]=zs[i*2]=zb;z2[i]=zs[i*2+1]=ze;
    }
    sort(xs,xs+2*n);sort(ys,ys+2*n);sort(zs,zs+2*n);
    long long ans=0;
    for(int i=0;i<2*n-1;++i){
        for(int j=0;j<2*n-1;++j){
            for(int p=0;p<2*n-1;++p){
                int cnt=0;
                for(int l=0;l<n;++l){
                    if(xs[i+1]<=x2[l]&&xs[i]>=x1[l]&&ys[j+1]<=y2[l]&&ys[j]>=y1[l]&&zs[p+1]<=z2[l]&&zs[p]>=z1[l]) ++cnt;
                }
                if(cnt>=k) ans +=(xs[i+1]-xs[i])*(ys[j+1]-ys[j])*(zs[p+1]-zs[p]);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3108
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String str = reader.readLine();
			String[] arr = str.split(" ");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			int c = Integer.parseInt(arr[2]);
			
			if(a < b && b < c) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 24192
#include <bits/stdc++.h>
// #include<iostream>
// #include<vector>
// #include<cmath>
// #include<iomanip>
using namespace std;

const double PI= acos(-1.0);

int gcd_func(int a, int b){
    return b? gcd_func(b, a%b) : a;
} 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n, k; cin >> n >> k;
    vector<long long>p(n,0);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    long long ns = 0;
    for(int i =0; i < k; i++){
        ns+=p[i];
    }
    cout << ns;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll mp::cpp_int
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;
typedef pair<int, pair<int, int> > ppp;

int main()
{
    int n,r;
    cin>>n>>r;
    if(n>=10)
        cout<<r<<endl;
    else
        cout<<r + (100*(10-n))<<endl;
}

Measured memory_bytes: 256
n, m, q = map(int, input().split())

As = [[i] for i in range(1, m+1)]

while len(As[0]) != n:
    current = As.pop(0)
    for i in range(current[-1], m+1):
        As.append(current+[i])

inputs = []

for _ in range(q):
    inputs.append(list(map(int, input().split())))

answer = 0

for A in As:
    local_ans = 0
    for i in inputs:
        if A[i[1]-1]-A[i[0]-1] == i[2]:
            local_ans += i[3]
    answer = max(answer, local_ans)

print(answer)


Measured memory_bytes: 22884
#include <iostream>
#include <algorithm>
#include<stdio.h>
#include<string>
using namespace std;

int main() {
	int s,w;
	cin >> s >> w;

	if (w >= s) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  int ans;
  if (a > b){
    ans = 2*a-1;
  }
  else if (b > a){
    ans = 2*b-1;
  }
  else{
    ans = 2*a;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//////////////////////////
//      _        ____   //
//  U  /"\  u U /"___|  //
//   \/ _ \/  \| | u    //
//   / ___ \   | |/__   //
//  /_/   \_\   \____|  //
//   \\    >>  _// \\   //
//  (__)  (__)(__)(__)  //
//  Compro by NULL_CT©  //
//////////////////////////
// STL libs
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(I, LIM) for (int I = 0; I < (LIM); I++)
#define ALL(LIST) (LIST.begin()), (LIST.end())

using namespace std;

typedef long long ll;

const int MOD = pow(10,9)+7;

vector<long> divisor(long &_n) {
  vector<long> head, tail;
  for (long i = 1; i * i <= _n; i++) {
    if (_n % i == 0) {
      head.push_back(i);
      if (i * i != _n) tail.push_back(_n / i);
    }
  }
  head.insert(head.end(), tail.rbegin(), tail.rend());
  return head;
}

long kadanes(vector<long> &_ls) {
  long highestMax = 0, currentMax = 0, length = _ls.size();
  for (long i = 0; i < length; i++) {
    currentMax = max(_ls[i], currentMax + _ls[i]);
    highestMax = max(highestMax, currentMax);
  }
  return highestMax;
}

struct init {
  init() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // cout<<fixed<<setprecision(20);
  }
} init;

/*----------------------------*/

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> sums(n);
  REP(i,n){ cin>>a[i]; }

  ll ans = 0;

  for (int i = a.size()-1; i != 0; i--){
    if(i == a.size()-1){
      sums[i] = a[i];
    }else{
      sums[i] = (a[i] + sums[i + 1])%MOD;
    }
  }

  for (int i = 0; i < a.size() - 1;i++){
    ans += (a[i] * sums[i + 1]) % MOD;
    ans %= MOD;
  }

  cout << ans << "\n";

  ;
}


Measured memory_bytes: 5984
fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val AB = Array(N) { readLine()!!.split(" ").map(String::toInt).let { it[0] to it[1] } }
    AB.sortBy { it.first }
    var sum = 0
    var result = 0L
    for (ab in AB) {
        for (i in 1..ab.second) {
            sum++
            result += ab.first
            if (sum == M) {
                println(result)
                return
            }
        }
    }
}



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

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    long X = sc.nextLong();
    long a = 100;
    long ans = 1;
    while(true) {
       a = (long) (a * 1.01);
      if( X <= a) {
        break;
      }
      ans ++;
    }

    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

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

#define ll long long
vector<ll>height,dp,b;
vector<ll>tree;
// buildtree(int *arr,start,end,node){
    
// }
// void treeupdate(int indx,int s,int  e,int updi,int upd ){
//     if(s==e) {
//         tree[indx]=upd;
        
//     }
//     else{
//         int mid=(s+e)/2;
//         int le=2*indx,ri=2*indx+1;
//         if(updi<=mid) treeupdate(le,0,mid,updi,upd);
//         else treeupdate(ri,mid+1,e,updi,upd);
//         tree[indx]=max(tree[le],tree[ri]);
//     }
// }
void treeupdate(int idx, int L, int R, int ii, ll upd)
{
	if(L == R)
	{
		tree[idx] = upd;
		return;
	}
	int le = 2*idx + 1, ri = le + 1, mid = (L + R) / 2;
	if(ii <= mid)
		treeupdate(le, L, mid, ii, upd);
	else treeupdate(ri, mid + 1, R, ii, upd);
	//
	tree[idx] = max(tree[le], tree[ri]);
}
// int treemax(int ind,int l,int r,int ql,int qr){
//     if(ql>r||qr<l) return 0;
//     if(ql<=l&&qr>=r) return tree[ind];
//     else{
//         int mid=(l+r)/2;
//         return max(treemax(2*ind,l,mid,ql,qr),treemax(2*ind+1,mid+1,r,ql,qr));
//     }
// }
ll treemax(int idx, int L, int R, int QL, int QR)
{
	if(L >= QL && R <= QR)
	{
		return tree[idx];
	}
	if(L > QR || R < QL)
		return 0;
	int le = 2*idx + 1, ri = le + 1, mid = (L + R) / 2;
	ll a1 = treemax(le, L, mid, QL, QR);
	ll a2 = treemax(ri, mid + 1, R, QL, QR);
	//
	return max(a1, a2);
}
long long findbase(long long k){
    long long ans=0;
    
    while(k){
         k=k>>1;
        ans++;
    }
    return ans;
}
int main(){
    ll n;
    cin>>n;
    height.resize(n);
    dp.resize(n);
    b.resize(n);
    // cout<<findbase(n);
    tree.resize(int(2e5 + 2)<<2);
    // tree.resize(100);
    for(int i=0;i<n;i++){
        cin>>height[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
        // dp[i]=b[i];
    }
    for(int i=0;i<n;i++){
        dp[i]=treemax(1,1,n,1,height[i]-1)+b[i];
        treeupdate(1,1,n,height[i],dp[i]);
        // cout<<dp[i]<<"X";
    }
    ll ans=0;
    for(int i=0;i<dp.size();i++){
    //   cout<<tree[i];
        ans=max(ans,dp[i]);
    }
    cout<<ans;
    
    // cout<<treemax(0);
    return 0;
}


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

int sz[200005],val[200005];
ll dp[105][100005];

int main()
{
    int s,n;
    scanf("%d %d",&n,&s);
    
    for(int i=1;i<=n;i++)
    scanf("%d %d",&sz[i],&val[i]);
    
    for(int item=0;item<=n;item++)
    {
        for(int cap=0;cap<=s;cap++)
        {
            if(!cap || !item)
            dp[item][cap]=0LL;
            
            else if(sz[item]<=cap)
            dp[item][cap]=max(dp[item-1][cap],dp[item-1][cap-sz[item]]+(ll)val[item]);
            
            else
            dp[item][cap] = dp[item-1][cap];
        }
    }
    
    printf("%lld\n",dp[n][s]);
    return 0;
}


Measured memory_bytes: 82484
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！

def main():
    *a,=map(int,input().split())
    print(sum(sorted(a)[:2]))
if __name__ == '__main__':
    main()

Measured memory_bytes: 5992
def resolve():

    n = int(input())
    h = list(map(int, input().split()))

    for i in range(n):

        if i == 0:
            h[i] -= 1
            continue

        if h[i-1] < h[i]:
            h[i] -= 1

        if h[i-1] > h[i]:
            print('No')
            return

    print('Yes')
    
resolve()

Measured memory_bytes: 63984
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    int n;
    cin >> n;
    vector<int64_t> a(n);
    int64_t index[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = a[i]-1;
        index[a[i]] = i;
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; ++i) {
        cout << index[a[i]] + 1;
        if (i == n - 1) {
            cout << endl;
        } else {
            cout << " ";
        }
    }
}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;
 
int main()
{
    int n;
    cin >> n;
    long long int cnt = 0;

    std::map<int, int> mp;
    //for(int i=0; i<n; i++){
        cnt = 0;
        //cout << "### " << i+1 << endl;
        for(int x=1; x<=101; x++){
            long long int x2 = x*x;
            if(x2 > n) continue;
            for(int y=1; y<=101; y++){
                //long long int y2 = y*y;
                //long long int xy = x*y;
                //long long int num = x2+y2+xy;
                //if(num+3 > n) continue;
                for(int z=1; z<=101; z++){
                    
                    //long long int z2 = z*z;
                    //long long int xz = x*z;
                    //long long int yz = y*z;
                    long long int num = x*x + y*y + z*z + x*y + x*z + y*z;
                    mp[num]++;
                    /*
                    if(num == i+1){
                        //cout << x << ", " << y << ", " << z << endl;
                        //cout << num << ":" << num+z2+xz+yz << endl;
                        cnt++;
                    }
                    */
                }
            }
        }
        //cout << cnt << endl;
    //}
    for(int i=1; i<=n; i++){
        cout << mp[i] << endl;
    }
 
    return 0;
}

Measured memory_bytes: 5476
// template ver2.02

// include
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

using namespace std;

// conversion
inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

// typedef
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

// util
#define MP make_pair
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define CLR(a) memset((a), 0 , sizeof(a))
template<class T, class C> inline bool in(T e, C c) {return c.find(e) != c.end();}
template<class T> inline bool in(T x, T a, T b) {return a <= x && x < b;}

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define RREP(i, n) RFOR(i, 0, n)

// IO
#define PRA(a, n) cout << a[0]; FOR(itr, 1, n) {cout << " " << a[itr];} cout << endl;
#define PRF(x, w) cout << setprecision((w)); cout << setiosflags(ios::fixed); cout << (x) << endl;

// constant
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = (int)1e9;
const int DI[] = {0, 1, 0, -1};
const int DJ[] = {1, 0, -1, 0};

// debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DUMPA(a, n) cerr << #a << " = {" << a[0]; FOR(itr, 1, n) { cout << ", " << a[itr]; } cerr << "}" << endl;
#define DUMPAA(a, n, m) REP(itr, n) {REP(jtr, m) {cout << a[itr][jtr] << " ";} cout << endl;}

// template end

int n;

void dfs(int x, int m, string s) 
{
    if (x == 0) {
        cout << s << endl;
        return;
    }
    RFOR(i, 1, min(x, m) + 1) {
        if (x == n) dfs(x - i, i, to_str(i));
        else dfs(x - i, i, s + ' ' + to_str(i));
    }
}

void init()
{
}

void solve()
{
    dfs(n, n, "");
}

int main()
{
    init();
    while (cin >> n, n) solve();
    return 0;
}


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

using namespace std;
const int MAX = 1e5 + 5;

int ara[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n , k , q;
    cin>>n>>k>>q;
    int tgt = q - k;
    
    while(q--) {
        int tmp;
        cin>>tmp;
        ara[tmp]++;
    }
    
    for(int i =1; i <=n ; i++ ) {
        
        if(ara[i] > tgt )  cout<<"Yes\n";
        else cout<<"No\n";
    }

    return 0;
}

Measured memory_bytes: 1024
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N = 0;
    cin >> N;

    vvll X(N,vll(2));
    vll cnt1(N);
    REP(i,N){cin >> X[i][0] >> X[i][1];
    cnt1[i] = X[i][0]+X[i][1];
    }
    sort(ALL(cnt1));
    ll ans1=cnt1[N-1]-cnt1[0];

    vvll X2(N,vll(2));
    vll cnt2(N);
    REP(i,N){
      X2[i][0]=-X[i][0];
      X2[i][1]=X[i][1];
      cnt2[i] = X2[i][0]+ X2[i][1];
    }
    sort(ALL(cnt2));
    ll ans2=cnt2[N-1]-cnt2[0];

    vvll X3(N,vll(2));
    vll cnt3(N);
    REP(i,N){
      X3[i][0]=X[i][0];
      X3[i][1]=-X[i][1];
      cnt3[i] = X3[i][0]+ X3[i][1];
    }
    sort(ALL(cnt3));
    ll ans3=cnt3[N-1]-cnt3[0];

    vvll X4(N,vll(2));
    vll cnt4(N);
    REP(i,N){
      X4[i][0]=-X[i][0];
      X4[i][1]=-X[i][1];
      cnt4[i] = X4[i][0]+ X4[i][1];
    }
    sort(ALL(cnt4));
    ll ans4=cnt4[N-1]-cnt4[0];
    

    //本文
    ll ans = max(ans1,max(ans2,max(ans3,ans4)));

    //出力
    cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

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

int N;
string s, alp={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};

int main() {
    alp+=alp;
    cin>>N>>s;
    for (int i=0; i<s.size(); i++) {
        for (int j=0; j<26; j++) {
            if (s[i]==alp[j]) cout<<alp[j+N];
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let l: f64 = scan(tokens);
    println!("{}", (l / 3.0).powi(3));
}


Measured memory_bytes: 4352
program abc
	implicit none 
	character(len=3) :: fname
	character(len=1) :: nana
   	integer :: n

	read(*,*) fname

	nana = "7"
    n = 0

	if(fname(1:1) == nana)  n = 1
   	if(fname(2:2) == nana)  n = 1
   	if(fname(3:3) == nana)  n = 1

	if(n == 1) then
    	write(*,*) "Yes"
    else
    	write(*,*) "No"
    endif
    
end program abc

Measured memory_bytes: 2800
# coding: utf-8
# Your code here!

N = int(input())
num1 = int(N / 1.08)
num2 = int(num1 * 1.08)
num3 = int((num1 + 1) * 1.08)
if N == num2:
  print(num1)
elif N == num3:
  print(num1 + 1)
else:
  print(':(')


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


int main(){
    int n;
    cin>>n;
    int ma=0,mi=1000000000;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ma=max(ma,a);
        mi=min(mi,a);
    }
    cout<<ma-mi;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
        h:[i64;n],
    }
    let mut prev = -33;
    pub fn yn(ans: bool) {
        if ans {
            println!("Yes");
        } else {
            println!("No");
        }
    }
    let mut ans = true;
    for i in 0..n {
        if prev > h[i] {
            if prev - 1 == h[i] {
                prev = h[i] + 1;
            } else {
                ans = false;
                break;
            }
        } else {
            prev = h[i];
        }
    }
    yn(ans);
}


Measured memory_bytes: 3780
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=b+min(c,a+b+1);
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    string str;
    cin >> str;
    auto n = (int) str.size();
    cout << ((str[0] == str[n-1]) ^ (n % 2 == 1) ? "First" : "Second") << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>




int main() {
	int n, m;

	std::cin >> n >> m;

	std::vector<std::vector<int>> g(n);

	for (int i{}; i < m; ++i) {
		int x, y;
		std::cin >> x >> y;
		g[x - 1].emplace_back(y - 1);
	}

	std::vector<int> dist(n, -1);

	for (int i{}; i < n; ++i) {

		[&](auto f, int index) {
			return 
				f(f, index);
		}(
			[&](auto f, int index)->int {

				if (dist[index] != -1)// has NOT visited yet
					return dist[index];

//				std::cout << index << " : " << dist[index] << " ";

				std::decay_t<decltype(dist[index])> ans{ 0 };
				for (const auto&e : g[index])
					ans = std::max( f(f, e) + 1, ans);
				
//				std::cout <<"Ans:"<< ans << "\n";

				return
					dist[index] = ans;
			}
			,i
		); 
		//std::cout << "\n";
		//std::cout << dist[i] << "\n";

	}//for

	std::cout << *std::max_element(std::cbegin(dist), std::cend(dist) ) << "\n";

	return 0;
}

Measured memory_bytes: 10240
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }


ll N, K;
ll dfs(ll n, ll t) {
	if (n == 0) return t;

	return min(dfs(n - 1, t * 2), dfs(n - 1, t + K));
}

int main() {
	fastio;

	cin >> N >> K;
	cout << dfs(N, 1) << endl;
}

Measured memory_bytes: 256