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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; ll A[int(2e5+5)], B[int(2e5+5)], m = 1e9;
bool flag = true;
int main(){
  cin >> N;
  ll sum = 0;
  for (int i = 0; i < N; i++){
    cin >> A[i] >> B[i];
    sum += A[i];
    if (A[i] != B[i]) flag = false;
    if (A[i] > B[i]) m = min(m, B[i]);
  }

  if (flag) cout << 0 << endl;
  else cout << sum - m << endl;

  return 0;
}


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

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

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


Measured memory_bytes: 256
#include<iostream>

int main(void){
	int n;
	int rooms[4][3][10];
	
	for (int i=0; i < 4; i++) for (int j = 0; j < 3; j++) for (int k = 0; k < 10; k++) rooms[i][j][k] = 0;
	
	std::cin >> n;
	
	for(int l = 1; l <= n; l++){
		int i, j, k, m;
		std::cin >> i >> j >> k >> m;
		rooms[i-1][j-1][k-1] += m; 
	}
	
	for (int i=0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				std::cout << ' ' << rooms[i][j][k];
			}
			std::cout << std::endl;
		}
		if (i < 3){
			for (int s = 1; s <= 20; s++) std::cout << "#";
			std::cout << std::endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;

const int MAXN=200010;
string ss;
unordered_map<int, int> myhash;

int getmin(int stat) {
	int ans=MAXN;
	if (stat == 0)
		return 0;
	//zero 
	auto fd0 = myhash.find(stat);
	if (fd0 != myhash.end())
		ans = fd0->second;
	//stat^prev^stat = (1<<i)^stat
	for (int i=0;i<26;i++) {//'a'+i
		if ( (stat^(1<<i)) == 0 )//self par.
			return 0;
		auto fd=myhash.find(stat^(1<<i));
		if (fd != myhash.end())
			ans = min(ans, fd->second);
	}
	return ans;
}

int main() {
	cin>>ss;
	int dp;
	for (int i=0,stat=0; i<ss.length(); i++) {
		//cout<<"Pos "<<i<<endl;
		stat ^= 1<<(ss[i]-'a');
		dp = getmin(stat)+1;
		auto fd = myhash.find(stat);
		if (fd==myhash.end() || fd->second>dp)
			myhash[stat]=dp;
		//cout<<"<Result> HereStat="<<stat<<“ dp[i]="<<dp[i]<<endl<<endl;
	}
	cout<<dp<<endl;
	return 0;
}


Measured memory_bytes: 8652
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())
    return N


def F(A: int, B: int) -> int:
    """
    10進表記における、Aの桁数とBの桁数のうち大きい方を返す.

    Args:\n
        A (int): 整数
        B (int): 整数

    Returns:\n
        int: 10進表記における、Aの桁数とBの桁数のうち大きい方
    """
    digits_A = len(str(A))
    digits_B = len(str(B))
    return max(digits_A, digits_B)


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 整数（1 <= N <= 10^10）
    """
    # 求解処理
    # 全探索を行い、F(A, B)の最小値を求める
    # a <= bとして、sqrt(N)まで探索を行うことで、時間を節約する
    ans = len(str(N))  # 初期値として、Nの桁数を入力
    for a in range(1, int(math.sqrt(N)) + 1):
        # bが整数でない場合、何もしない
        if N % a != 0:
            continue

        # bが整数である場合、a, bのうち桁数が大きい方を求める
        b = int(N / a)
        ans = min(ans, F(a, b))

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N = get_input()

    # メイン処理
    main(N)


Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
#define N 1111116

int n,m1,m2,m3;
pair<int,int> a[N];
priority_queue<int> q;
long long f[N],g[N],cnt,ans;

bool cmp(pair<int,int> a,pair<int,int> b){
	return a.first-a.second>b.first-b.second;
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	m1=read();m2=read();m3=read();n=m1+m2+m3;
	for (int i=1;i<=n;i++){
		int x=read(),y=read(),z=read();
		cnt+=z;a[i]=make_pair(x-z,y-z);
	}
	sort(a+1,a+n+1,cmp);
	for (int i=1;i<=n;i++){
		cnt+=a[i].first;q.push(-a[i].first);
		if (i>m1) cnt+=q.top(),q.pop();
		f[i]=cnt;
	}
	cnt=0;while (!q.empty()) q.pop();
	for (int i=n;i>=1;i--){
		cnt+=a[i].second;q.push(-a[i].second);
		if (i<=n-m2) cnt+=q.top(),q.pop();
		g[i]=cnt;
	}
	for (int i=m1;i<=m1+m3;i++)
		ans=max(ans,f[i]+g[i+1]);
	printf("%lld\n",ans);
	return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = l[0], W = l[1], D = l[2];
            var map = new Map[H*W+1];
            for (var i = 0; i <= H*W; i++)
                map[i] = new Map();
            
            for (var i = 0; i < H; i++) {
               var t = Console.ReadLine().Split().Select(int.Parse).ToArray();
               for (var j = 0; j < t.Length; j++) {
                  map[t[j]].X=i+1;
                  map[t[j]].Y=j+1;
               }
            }
            
            var ans = new int[map.Length];
            
            for (var i = D; i < map.Length; i++) {
                var x = ans[i-D] + Math.Abs(map[i].X-map[i-D].X)+Math.Abs(map[i].Y-map[i-D].Y);
                ans[i] = x;
                //Console.WriteLine(x);
            }
            
            var Q = int.Parse(Console.ReadLine());
            for (var i = 0; i < Q; i++) {
               var t = Console.ReadLine().Split().Select(int.Parse).ToArray();
               var a = ans[t[1]] - ans[t[0]];
               Console.WriteLine(a);
            }
        }
    }

    class Map
    {
       public int X {get; set;}
       public int Y {get; set;}
    }
}


Measured memory_bytes: 21044
#include <bits/stdc++.h>
     
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
     
using namespace std;
     
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vpii x(n);
  for (auto& pp: x) cin >> pp.first >> pp.second;
  bool ok = false;
  for (int i = 2; i < n; i++) {
    if (x[i].first == x[i].second and
        x[i - 1].first == x[i - 1].second and
        x[i - 2].first == x[i - 2].second) ok = true;
  }
  if (ok) cout << "Yes\n";
  else cout << "No\n";
  return (0);
}


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

using namespace std;

char s[105], t[105];

int main() {
    int n;
    scanf("%d%s%s", &n, s, t);
    
    for (int i = 0; i < n; i++) printf("%c%c", s[i], t[i]);
    printf("\n");
}

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

int main()
{
	int i, N, K, D[10];
	scanf("%d %d", &N, &K);
	for (i = 1; i <= K; i++) scanf("%d", &(D[i]));
	
	int pay = N, d, digit[5] = {N % 10, N / 10 % 10, N / 100 % 10, N / 1000 % 10}, forbid[10] = {};
	for (i = 1; i <= K; i++) forbid[D[i]] = 1;
	for (d = 4; digit[d] == 0; d--);
	while (1) {
		for (i = 0; i <= d; i++) if (forbid[digit[i]] == 1) break;
		if (i > d) break;
		
		for (i = 0; i <= d; i++) if (digit[i] < 9) break;
		if (i <= d) {
			for (digit[i--]++; i >= 0; digit[i--] = 0);
		} else {
			digit[++d] = 1;
			for (i--; i >= 0; digit[i--] = 0);
		}
		for (i = d, pay = 0; i >= 0; i--) pay = pay * 10 + digit[i];
	}
	
	printf("%d\n", pay);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <set>

using namespace std;
typedef long long ll;

int L;
vector <pair <int, int> > e;

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> L;
    int cc = 0;
    for (int i = 18; i >= 0; i--)
    {
        while (L >= cc + (1 << i))
        {
            e.push_back(make_pair(19-i, cc));
            cc += (1 << i);
        }
    }

    cout << 20 << " " << e.size() + 36 << "\n";
    for (int i = 1; i < 19; i++)
    {
        cout << i + 1 << " " << i + 2 << " " << 0 << "\n";
        cout << i + 1 << " " << i + 2 << " " << (1 << (18 - i)) << "\n";
    }
    for (int i = 0; i < e.size(); i++)
    {
        cout << 1 << " " << e[i].first + 1 << " " << e[i].second << "\n";
    }
}

Measured memory_bytes: 256
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input()
    if command == 'deleteFirst':
        dll.popleft()
    elif command == 'deleteLast':
        dll.pop()
    else:
        state, x = command.split()
        if state == 'insert':
            dll.appendleft(x)
        elif state == 'delete':
            try:
                dll.remove(x)
            except:
                pass
print(*dll)



Measured memory_bytes: 69732
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MOD=1e9+7;
static const ll MAX=101010;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

class unionFind {
public:
  vector<ll> data;
  
  unionFind(ll size) {
    data.assign(size, -1);
  }
  
  bool same(ll x, ll y) {
    return find(x)==find(y);
  }
  
  void unite(ll x, ll y) {
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(data[x]>data[y]) swap(x, y);
    data[x]+=data[y];
    data[y]=x;
  }
  
  ll find(ll k) {
    if(data[k]<0) return k;
    return data[k]=find(data[k]);
  }
  
  ll size(ll k) {
    return -data[find(k)];
  }
  
};


int main(void) {
  ll i, j, k;
  
  ll N, K, L;
  cin >> N >> K >> L;
  
  unionFind uf=unionFind(N);
  unionFind vf=unionFind(N);
  
  for(i=0; i<K; i++) {
    ll p, q;
    cin >> p >> q; p--; q--;
    uf.unite(p, q);
  }
  
  for(i=0; i<L; i++) {
    ll r, s;
    cin >> r >> s; r--; s--;
    vf.unite(r, s);
  }
  
  map<P, ll> mp;
  for(i=0; i<N; i++) mp[P(uf.find(i), vf.find(i))]++;
  
  for(i=0; i<N; i++) pt(mp[P(uf.find(i), vf.find(i))]);
  
}




Measured memory_bytes: 15104
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ld;
typedef unsigned long long int lu;
typedef vector< int > vi;
typedef vector < ld > vd;
typedef set <ld> sd;
typedef vector< vi > vvi;
typedef vector< vd > vvd;
typedef pair< int,int > ii;
typedef pair< ld,ld > id;
#define sz(a) ld((a).size())
#define test(t) ll t;cin>>t;while(t--)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Vi vector
#define pr pair
#define mpr make_pair
#define fi first
#define se second
#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

set <ld> s[100005];
ld d[100005];

vector<char> prime (100000+1, true);
void sieve(ld n)
{	
	//O(nloglogn) time
	prime[0] = prime[1] = false;
	for (ld i=2; i<=n; ++i)
	{
		if (prime[i])
		{
			s[i].insert(i);			
			for (ld j=2*i; j<=n; j+=i)
			{
				prime[j] = false;
				s[j].insert(i);
			}
		}
	}
}
#define forn(i,e) for(int i = 0; i < e; i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define reprev(i,a,b) for(i=a;i>=b;i--)

#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
ld gcd(ld a, ld b) { if(b == 0) return a; return gcd(b, a % b); }
ld fastpowMOD(ld a, ld p,ld MOD){ if(p==0) return 1; ld z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
ld fastpow(ld a, ld p){ if(p==0) return 1; ld z = fastpow(a,p/2); z = (z*z); if(p%2) z = (z*a); return z; }
ld a,b;

ld search1(ld a[], ld f,ld n)
{
	ld left=1;
	ld right=n+1;
	while(right-left>1)
	{
		ld mid = left + (right-left)/2;
		if(a[mid]<f)
		{
			left=mid;
		}
		else right=mid;
	}
	return a[left];
}
ld MOD = 1e9+7;
ld INF = 1e18;
int main(){
	ld n,i,j;
	cin >> n;
	ld ar[n][n];
	rep(i,0,n)
	{
		rep(j,0,n)cin >> ar[i][j];
	}
	ld dp[(1<<n)];
	ld bitmask[(1<<n)];
	for(i=0;i<(1<<n);i++)
	{
		dp[i]=0;
	}
	memset(bitmask,0,sizeof(bitmask));
	for(ld mask=0;mask<(1<<n);mask++)
	{
		vd v;
		for(i=0;i<n;i++)
		{
			if(mask&(1<<i))v.pb(i);
		}
		if(v.empty())continue;
		for(i=0;i<v.size();i++)
		{
			for(j=i+1;j<v.size();j++)
			{
				//bitmask[mask]+=ar[v[i]][v[j]];
				dp[mask]+=ar[v[i]][v[j]];
			}
		}
	}
	//
	
	
	for(ld m1=0;m1<(1<<n);m1++)
	{
		//dp[m1]=max(dp[m1],bitmask[m1]+bitmask[0]);
		for (ld m2 = m1; m2 > 0; m2 = (m2 - 1) & m1)
		{
			//dp[m1]=max(dp[m1],bitmask[m1^m2]+bitmask[m2]);
			dp[m1]=max(dp[m1],dp[m1^m2]+dp[m2]);
		}
	}
	cout << dp[(1<<n)-1] << endl;
	return 0;
}

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

int main(){
  int H,W,N,K;
  cin>>H>>W>>N;
  K=max(H,W);
  if(N%K==0){
      cout<<N/K<<endl;
      return 0;
  }
  else{
    cout<<N/K+1<<endl;
    return 0;
  }
   
  return 0;
}


   
    
  
 

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	vint p(n);
	rep(i,n) cin>>p[i],p[i]--;
	vll a(n);
	vll b(n);
	vll c(n);
	rep(i,n){
		a[i] = (i+1)*(n+1);
	}
	rep(i,n){
		b[p[i]] = (n-1-p[i]+1)*(n+1)+i;
	}
	rep(i,n){
		if(i) cout<<" ";
		cout<<a[i];
	}
	cout<<endl;
	rep(i,n){
		if(i) cout<<" ";
		cout<<b[i];
	}
	cout<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)

int main()
{
  int n, k, d;
  cin >> n >> k;
  vector<int> A(n), B(n + 1);
  int cnt = 0;
  for (int i = 0; i <= n; i++)
  {
    B[i] = 0;
  }
  
  for (int i = 0; i < k; i++)
  {
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      cin >> A[j];
      B[A[j]]++;
    }
  }
  for (int i = 1; i <= n; i++)
  {
    if (B[i] != 0)
      cnt++;
  }
  cout << n - cnt << endl;  
}



Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int ans;
  for(int i=N;i<=999;++i) {
    if(i/100==(i%100)/10 && i/100==i%10) {
      cout<<i<<endl;
      return 0;
    }
  }
}


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

namespace AtCoder.Abc
{
    class QuestionABC_081_A
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();

            // 整数の入力
            //long n = long.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            int count = 0;
            for (int i = 0; i < s.Length; i++)
                if (s[i] == '1') count++;


            //string result = "";

            Console.WriteLine(count);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define FOR(i, n) for(ll i = 0; i < n; i++)
#define FORR(i, n) for(ll i = n; i >= 0; i--)
#define FORS(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) accumulate(v.begin(),v.end(),0)
#define SORT(v) sort(v.begin(),v.end())
#define OUT(n) (cout << n << endl)
#define IN1(a) (cin >> a)
#define IN2(a,b) (cin >> a >> b)
#define IN3(a,b,c) (cin >> a >> b >> c)
#define IN4(a,b,c,d) (cin >> a >> b >> c >> d)
#define REVS(v) reverse(v.begin(),v.end())
#define PI 3.14159265359
using namespace std;
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  double ans,n,d;
  IN2(n,d);
  ans = ceil(n/(1+2*d));
  OUT(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
const int N = 1000300;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
int ans=0;
bool fn(int x)
{
	int cnt=0;
	while(x)
	{
		cnt++;
		x/=10;
	}
	if(cnt%2)
	return true;
	return false;
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
	if(fn(i))
	ans++;
}
cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int ax, ay, bx, by, cx, cy;
ld a, b, c;

int main() {
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    a = hypotl(ax - bx, ay - by);
    b = hypotl(ax - cx, ay - cy);
    c = hypotl(cx - bx, cy - by);
    ld p = (a + b + c) / 2;
    ld A = sqrtl(p * (p - a) * (p - b) * (p - c));
    ld r = A / p;
    ld mx = max(a, max(b, c));
    cout << fixed << setprecision(20) << mx * r / (2 * r + mx);
    
    return 0;
}


Measured memory_bytes: 3772
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
  int N, M, notM, ans;
  cin >> N >> M;
  notM = N - M;
  ans = notM * 100 + M*1900;
  ans = ans*pow(2, M);
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define ma 7368792

bool era[ma];

int main(){
	int n,m;
	while(cin >> m >> n && m!=0){
		for(int i=0;i<ma;i++){
			era[i] = 0;
		}
		int count = 0;
		int x = m;
		bool flag =0;
		while(1){
			if(era[x]==0){
				count +=1;
				for(int i=x;i<ma;i+=x){
					era[i] = 1;
				}
			}
			if(count > n)break;
			x += 1;
		}
		cout << x << endl;
	}
	return 0;
}

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

int main() {
  string Sa, Sb, Sc;
  cin >> Sa; 
  cin >> Sb;
  cin >> Sc;

  char flag = 'a';

  while(1) {
    
    if(Sa.size() == 0 && flag == 'a') { cout << "A"; return 0; }
    if(Sb.size() == 0 && flag == 'b') { cout << "B"; return 0; }
    if(Sc.size() == 0 && flag == 'c') { cout << "C"; return 0; }


    if(flag == 'a') { flag = Sa[0]; Sa.erase(0, 1); }
    else if(flag == 'b') { flag = Sb[0]; Sb.erase(0, 1); }
    else if(flag == 'c') { flag = Sc[0]; Sc.erase(0, 1); }

  }
 


}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include<complex>

using namespace std;

typedef long long            ll;
typedef unsigned             ui;
typedef unsigned long long   ull;
typedef pair<int,int>        i_i;
typedef pair<ll,int>         ll_i;
typedef pair<ll,ll>          ll_ll;
typedef pair<double,int>     d_i;
typedef pair<double,double>  d_d;
typedef vector<int>          vi;
typedef vector<vector<int> > vii;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      x.begin(),x.end()
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

bool comp(const i_i l,const i_i r){
  return l.F<r.F;
}

signed main(void)
{
  in(int,n,m);
  vector<i_i> ab(112345);
  vi a(112345);
  vi used(112345);
  vi b(112345);
  int i,j;
  rep(i,n){
    in(int,A,B);
    ab[i].F=A;
    ab[i].S=B;
    a[i]=A;
    b[i]=B;
  }
  drep(i,n){
    dprintf("%2d日で%2d円\n",ab[i].F,ab[i].S);
  }
  sort(ab.begin(),ab.begin()+n,comp);
  drep(i,n){
    dprintf("%2d日で%2d円\n",ab[i].F,ab[i].S);
  }

  priority_queue<int> pq;
  ll sum=0;
  j=0;
  for(i=1;i<=m;i++){
    // 候補を探す
    for(;j<n;j++){
      // 期間に入ってるならpqへ
      if(ab[j].F<=i){
        pq.push(ab[j].S);
      }else{
        break;
      }
    }

    // pqから最大を取り出す
    if(!pq.empty()){
      sum+=pq.top();
      //dprintf("-%d日:B %d",i,pq.top());
      pq.pop();
    }
  }

  putv(sum);
  return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define MM 1e9

int A,P;

void input() {
    cin >> A >> P;
}

void solve(){
    cout << (A*3+P)/2 << endl;
}

int main() {
    input();
    solve();
}

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

using namespace std;

using namespace std;

int main(){
    int H, W;
    while(cin >> H >> W){
        vector<vector<int>> A(H, vector<int>(W));
        vector<vector<int>> B(H, vector<int>(W));
        for(auto& v : A){
            for(auto& t : v) cin >> t;
        }
        for(auto& v : B){
            for(auto& t : v) cin >> t;
        }
        vector<vector<vector<int>>> dp(H, vector<vector<int>>(W, vector<int>(25601, 0)));
        {
            int a = A[0][0];
            int b = B[0][0];
            dp[0][0][12800+a-b] = 1;
            dp[0][0][12800-a+b] = 1;
        }
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                for(int k=0;k<=25600;k++){
                    if(!dp[i][j][k]) continue;
                    if(i+1 < H){
                        int a = A[i+1][j];
                        int b = B[i+1][j];
                        dp[i+1][j][k+a-b] = 1;
                        dp[i+1][j][k-a+b] = 1;
                    }
                    if(j+1 < W){
                        int a = A[i][j+1];
                        int b = B[i][j+1];
                        dp[i][j+1][k+a-b] = 1;
                        dp[i][j+1][k-a+b] = 1;
                    }
                }
            }
        }
        int res = 1000000000;
        for(int i=0;i<=25600;i++){
            if(!dp[H-1][W-1][i]) continue;
            res = min(res, abs(12800-i));
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 650752
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define mod 1000000007
#define mod1 1000000009
#define mod2 1000000021
#define INF 500001
#define MAX 1000000001
using namespace std;

/* 🐣🐥 */
int h[100001];
int dp[100001];
int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
	}
	fill(dp, dp + n, MAX);
	dp[0] = 0;
	for (int i = 1; i < n; i++) {
		for (int k = 1; i - k >= 0 && k <= m; k++) {
			dp[i] = min(dp[i], dp[i - k] + abs(h[i - k] - h[i]));
		}
	}
	printf("%d", dp[n - 1]);

	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[15];

void solve()
{
    scanf("%s", str);
    int n = strlen(str);
    if (n % 2) {
        printf("No\n"); return;
    }
    int i;
    for (i = 0; i < n; i++) {
        if (i % 2) {
            if (str[i] != 'i') {
                printf("No\n"); return;
            }
        }
        else {
            if (str[i] != 'h') {
                printf("No\n"); return;
            }
        }
    }
    printf("Yes\n");

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define _   int v, int tl, int tr, int l, int r
#define tm  (tl + tr >> 1)
#define sol v+v, tl, tm, l, r
#define sag v+v+1, tm+1, tr, l, r
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 2e3 + 3;    

char s[N][N];
int sam[N],dif[N];

signed main(){  
    int m,n;
    cin >> m >> n;
    for(int i=1; i<=m; i++)
        scanf(" %s", s[i]+1);
    
    int ans = max(m,n);
    for(int j=1; j<=n; j++){
        stack < pp > S;
        S.push(mp(-1,1));
        for(int i=2; i<=m+1; i++){
            int x = 0;
            if(s[i][j] == s[i-1][j]){
        		x = ++sam[i];
                dif[i] = 0;
            }   
            else{
                x = ++dif[i];
               	sam[i] = 0; 
            }
            if(i == m+1) x = 0;
            
            for(; S.top().st >= x;){
                int t = S.top().st;
                S.pop();
                ans = max(ans , t * (i-S.top().nd));
            }
            S.push(mp(x,i));
        }
    }
    
    cout << ans;
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int n, m;
  cin >> n >> m;
  cout << (n == m ? "Yes" : "No");
}

Measured memory_bytes: 892
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <ctime>
#include <unordered_map>
#include <iomanip>
#include <complex>
#include <cassert>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define deb(a) cerr<< #a << "= " << (a)<<"\n";

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef complex<double> base;
typedef vector<int> vi;
typedef pair<int,int> pii;

template<class T> ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream; }
ll fpow(ll x, ll p, ll m){ll r=1; for (;p;p>>=1){ if (p&1) r=r*x%m; x=x*x%m; } return r;}
ll inv(ll a, ll b){ return a<2 ? a : ((a-inv(b%a,a))*b+1)/a %b; }
int gcd(int a, int b){ if (!b) return a; return gcd(b,a%b);}
ll gcd(ll a, ll b){ if (!b) return a; return gcd(b,a%b);}

int x,y; string s;
int N; vi dx,dy;
bool dp[40000],ndp[40000];
int c=16100;

bool pos_sum(int s, vi &a){
	memset(dp,0,sizeof(dp));
	memset(ndp,0,sizeof(ndp));
	
	dp[c]=1;
	int l=0,r=0;
	
	N=a.size();
	int i,j;
	for (i=0; i<N; i++){
		for (j=l; j<=r; j++)
			ndp[j+c]=0;
			
		for (j=l; j<=r; j++)
			if (dp[j+c]){
				ndp[j+c-a[i]]=ndp[j+c+a[i]]=1;
			}
			
		l=l-a[i],r=r+a[i];
		for (j=l; j<=r; j++)
			dp[j+c]=ndp[j+c];
	}
	
	
	return dp[s+c];
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	N=s.length();
	cin >> x >> y;
	
	int l=0,v=0;
	while (l<N && s[l]=='F')
		v++,l++;
		
	x-=l;
	l++; bool p=1;
	while (l<N){
		v=0;
		while (l<N && s[l]=='F')
			v++,l++;
			
		if (!p) dx.pb(v);
		else dy.pb(v);
		
		p=!p;
		l++;
	}
	
	bool ans=pos_sum(x,dx) & pos_sum(y,dy);
	
	cout << (ans ? "Yes\n" : "No\n");
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  int N;
  cin >> N;
  string A, B;
  cin >> A;
  B = A;
  sort(B.begin(), B.end());
  
  ll cnt = 0;
  rep (i, N) {
    if (A[i] != B[i]) cnt++;
  }
  cout << cnt / 2 << endl;
  return 0;
}


Measured memory_bytes: 3920
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  string s;
  cin >> n >> s;
  if (n >= 3200) {
    cout << s << '\n';
  }
  else {
    cout << "red\n";
  }
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
def z;gets.split.map &:to_i;end
def x a,b;a[0]*b[1]-b[0]*a[1]end
def v a;[a[2]-a[0],a[3]-a[1]]end
while(n=z)!=[0]*4
a=[n,z,z]
q=a.zip(a.rotate).map{|b,c|(d=x(v(b),v(c))).abs>0&&(s,t=[b,c].map{|i|x v(b[0,2]+c[0,2]),v(i)}
[s,d-s,t,d-t].all?{|i|d<0?i<=0:i>=0}&&[0,1].map{|i|b[i]+t*(b[i+2]-b[i])/d.to_f})}
puts %w(dai-kichi chu-kichi kichi syo-kichi kyo)[q.all?&&(y=x(v(q[0]+q[1]),v(q[1]+q[2])).abs/1e5)>0&&[38,20,2,0].index{|i|1e-9>i-y}||4]end

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

using namespace std;
using ll = long long;

int main()
{
    int n, k;
    cin >> n;
    vector<int> v(n, 0);
    for (int x = 1; x < 101; x++)
    {
        for (int y = 1; y < 101; y++)
        {
            for (int z = 1; z < 101; z++)
            {
                k = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (x * z);
                if (k <= n)
                {
                    v[k - 1]++;
                }
            }
        }
    }

    for (int a : v)
    {
        cout << a << endl;
    }
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_172
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            string t = Read();

            int res = 0;
            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == t[i])
                {
                    continue;
                }

                res++;
            }

            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

using namespace std;

int main()
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    if((A+B)>(C+D))
        cout<<"Left"<<endl;
    else if((A+B)<(C+D))
        cout<<"Right"<<endl;
    else
        cout<<"Balanced"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define orta ((bas+son)/2)
#define N 1000005
using namespace std;

typedef long long ll;

ll n, A, B, bas, son, h[N];

bool dene(ll x){
	ll kal = x;
	for(int i = 1; i <= n; i++){
		ll bas = 0, son = kal + 1;
		while(bas < son)
			if(orta*A + (x - orta)*B >= h[i])
				son = orta;
			else
				bas = orta + 1;
		if(orta > kal)
			return 0;
		kal -= orta;
	}
	return 1;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("amk.txt", "w", stdout);
	scanf("%lld %lld %lld",&n ,&A ,&B);
	for(int i = 1; i <= n; i++){
		scanf("%lld",h + i);
		son = max(son, h[i]/B + 2);
	}
	while(bas < son)
		if(dene(orta))
			son = orta;
		else
			bas = orta + 1;
	printf("%lld\n", orta);
	return 0;
}


Measured memory_bytes: 1024
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int K =nextInt();
		int A=nextInt();
		int B=nextInt();

		for(int i=A;i<=B;i++){
			if(i%K==0){
				System.out.println("OK");
				return;
			}
		}
		System.out.println("NG");
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 25360
var
    a,b,c,cnt:longint;  
procedure swap(var a,b:longint);
var
    t:longint;
begin
    t:=a;a:=b;b:=t;
end;
begin
    readln(a,b,c);
    if a>b then swap(a,b);
    if a>c then swap(a,c);
    if b>c then swap(b,c);
    cnt:=0;
    while b<c do
        begin
            inc(a);inc(b);
            inc(cnt);
        end;
    while a<b do
        begin
            a:=a+2;
            inc(cnt);
        end;
    if a=b then writeln(cnt) else writeln(cnt+1);
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void){
    int n;cin>>n;
    ll ans =0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0)ans+=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>

int main() {
  std::string s;
  std::string p;
  std::cin >> s;
  std::cin >> p;

  std::string s2 = s + s;

  if (s2.find(p) != std::string::npos) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3204
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int xi,yi,xii,yii,ti,tii;
    xii = 0, yii = 0, tii = 0;
    bool ans = true;
    for(int i = 0; i < n; i++)
    {
        cin >> ti >> xi >> yi;
        int dist = abs(xi-xii)+abs(yi-yii);
        int t = ti - tii;
        if (dist>t || (t-dist)%2 != 0) {
            ans =false;
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long int
#define fr(i,n) for(ll i=0; i<n; i++)
#define fre(i,n) for(ll i=1; i<=n; i++)
#define pb push_back
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define pii pair<ll,ll>
#define ve vector
#define piii pair<pii, ll>
#define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

ll power(ll x, ll n, ll m)
{
    if(n==0)
        return 1;
    if(n==1)
        return x;
    x%=m;
    if(n%2)
        return (x*(power((x*x)%m, n/2, m)%m))%m;
    return power((x*x)%m, n/2, m)%m;
}

 
double dp[301][301][301];
double solve(int one, int two, int three, int& n)
{
    if(one < 0 || two < 0 || three < 0)
        return 0;
    if(three == 0 && two == 0 && one == 0)
        return 0;
 
    if(dp[one][two][three] > 0)
        return dp[one][two][three];
 
    double remaining = one + two + three;
    double exp_val = n+ one*solve(one-1,two,three,n) + two*solve(one+1,two-1,three,n) +
                    three*solve(one,two+1,three-1,n);
 
    return dp[one][two][three] = exp_val/remaining;
}
 
int main(){
    
    int n,one=0,two=0,three=0;
    cin>>n;

    for(int i=0; i<n; i++){
        int x;
        cin >> x;
        if(x == 1)one++;
        else if(x == 2)two++;
        else three++;
    }

    for(int i=0; i<301; i++){
        for(int j=0; j<301; j++){
            for(int k=0; k<301; k++)
                dp[i][j][k] = -1;
        }
    }
    cout<<fixed<<setprecision(9)<<solve(one,two,three,n);

    return 0;
}

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

int main()
{
int K,N,ans,m=0;scanf("%d %d",&K,&N);
vector<int> A(N);vector<int> dis(N,0);
for(int i=0;i<N;i++){scanf("%d ",&A[i]);if(i>0)dis[i]=A[i]-A[i-1];}
dis[0]=A[0]+K-A[N-1];
for(int i=0;i<N;i++)m=max(m,dis[i]);
ans=K-m;
printf("%d\n",ans);
}

Measured memory_bytes: 1792
class Stack:
    def __init__(self):
        self.stack = []

    def push(self, item):
        self.stack.append(item)

    def pop(self):
        result = self.stack[-1]
        del self.stack[-1]
        return result
    
def main():
    formula = input().split()
    stack = Stack()
    operator_list = ["+", "-", "*"] #演算子リスト
    a = 0 #popした値のtemp
    b = 0 #popした値のtemp

    for i in range(len(formula)):
        if formula[i] in operator_list:
            a = stack.pop()
            b = stack.pop()
            ans = eval(str(b) + str(formula[i]) + str(a))
            stack.push(ans)
        else:
            stack.push(formula[i])

    print(stack.pop())
        


if __name__ == "__main__":
    main()


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

int main(){
  int N, K; cin >> N >> K;
  vector<ll> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  ll ans = 1e18;
  for(int i = 0; i <1<<(N - 1); i++){
    bitset<18> bit(i);
    if(bit.count() != K-1)continue;
    ll ans1 = 0;
    ll bound = a[0];
    for(int j = 0; j < N - 1; j++){
      if(bit[j]){
        if(bound >= a[j + 1]){
          ans1 += bound - a[j + 1] + 1;
          bound++;
        }
        else{
          bound = a[j + 1];
        }
      }
      else{
        bound = max(bound, a[j + 1]);
      }
    }
    ans = min(ans, ans1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int n,k;
	cin>>n>>k;
	int a[n+1];
	for(int i=1;i<=n;i++)a[i]=0;
	for(int i=1;i<=k;i++)
	{
		int d;
		cin>>d;
		for(int j=1;j<=d;j++)
		{
			int y;
			cin>>y;
			a[y]=1;
		}
	}
	int c=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==0)
			c++;
	}
	cout<<c;
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 3640
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		System.out.println((a-c)*(b-d));
	}
}

Measured memory_bytes: 23636
//https://pyteyon.hatenablog.com/entry/2018/09/02/094228
//参考にさせて頂いた記事

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    ll N,K,Co=0,Co2=0;
    cin>>N>>K;
    int HK=K/2;
    if(K%2==1){
        for(int i=1;i<=N;i++){
            if(i%K==0)Co++;
        }
        cout<<Co*Co*Co<<endl;
    }else{
        for(int i=1;i<=N;i++){
            if(i%K==0)Co++;
            if(i%K==HK)Co2++;
        }
        cout<<Co*Co*Co+Co2*Co2*Co2<<endl;
    }
    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

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

def main():
    s = input()
    t = input()
    ans = 0
    for i in range(len(s)):
        if s[i]!=t[i]:
            ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 9556
using System;
using System.Linq;
 
public class Test
{
	public static void Main()
	{
		int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();
		Array.Sort(l);
		Array.Reverse(l);
		long ret=0;
		for(int i=0;i<x[1];i++){
			ret+=l[i];
		}
		Console.WriteLine(ret);
	}
}

Measured memory_bytes: 13396
dish = [int(input()) for x in range(5)]
hitoketa = list(map(int, [str(x)[-1] for x in dish]))

last = 999
for i in hitoketa:
    if not i % 10 == 0:
        last = min(last, i)

if last != 999:
    last = dish[hitoketa.index(last)]
else:
    last = dish[0]

ans = last
skip = False

for i in dish:
    if i == last and not skip:
        skip = True
    elif i % 10 == 0:
        ans += i
    else:
        ans += (i // 10 + 1) * 10

print(ans)


Measured memory_bytes: 3064