akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  int n; cin >> n;
  int N = 1<<n;
  V a(N); cin >> a;

  VV v(N);
  rep(i, N) v[i].push_back(a[i]);

  rep(i, n) {
    rep(S, N) if (!(S>>i&1)) {
      int S2 = S | (1<<i);
      for (auto e : v[S]) v[S2].push_back(e);
      sort(all(v[S2]), greater<int>());
      v[S2].erase(v[S2].begin()+2, v[S2].end());
    }
  }

  V ans(N);
  rep2(S, 1, N) {
    for (auto e : v[S]) ans[S] += e;
    chmax(ans[S], ans[S-1]);
    cout << ans[S] << '\n';
  }
  return 0;
}


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

class Program {
    static Scanner cin = new Scanner();

    static void Main(string[] args) {
        int n = cin.Int();
        int h = cin.Int();
        int w = cin.Int();
        Console.WriteLine((n - h + 1) * (n - w + 1));
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = (a); i <= (b); ++i)

const int N = 100;
char s[N];
map<char, int> mp;
int i;
int number() { return mp[s[i++]]; }
int expr() {
    if(s[i] == '(') {
        i++;
        int a = expr();
        if(s[i] == '*') {
            i++;
            int b = expr();
            i++;
            return a & b;
        } else if(s[i] == '^') {
            i++;
            int b = expr();
            i++;
            return a ^ b;
        } else
            assert(0);
    } else if(s[i] == '-') {
        i++;
        return 1 - expr();
    } else {
        return number();
    }
}

template <typename T> void chmin(T &a, T b) { a = min(a, b); }
main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    mp['0'] = 0, mp['1'] = 1;
    vector<int> v(1 << 16, INT_MAX);
    // 0
    v[0] = 1;
    // 1
    v[(1 << 16) - 1] = 1;
    // a ~ d
    int c[4];
    rep(i, 4) {
        int now = 0;
        rep(mask, 1 << 4) {
            if(mask & 1 << i) now += 1 << mask;
        }
        c[i] = now;
        v[now] = 1;
    }
    rep(_, 7) {
        vector<int> w;
        rep(i, 1 << 16) if(v[i] <= 16) w.emplace_back(i);
        // -
        rep(i, w.size()) chmin(v[((1 << 16) - 1) ^ w[i]], v[w[i]] + 1);
        w.clear();
        rep(i, 1 << 16) if(v[i] <= 16) w.emplace_back(i);
        rep(i, w.size()) rep(j, w.size()) chmin(v[w[i] ^ w[j]], v[w[i]] + v[w[j]] + 3);
        rep(i, w.size()) rep(j, w.size()) chmin(v[w[i] & w[j]], v[w[i]] + v[w[j]] + 3);
    }
    while(1) {
        string S;
        cin >> S;
        rep(i, S.size()) s[i] = S[i];
        s[S.size()] = 0;
        int ans = 0;
        if(s[0] == '.') break;
        rep(mask, 1 << 4) {
            rep(j, 4) mp['a' + j] = (mask & 1 << j) > 0;
            i = 0;
            ans ^= expr() << mask;
        }
        cout << v[ans] << endl;
    }
}


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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int a = 60 * h1 + m1;
	int b = 60 * h2 + m2;
	if (b < a) {
		cout << 0;
		return 0;
	}
	cout << max(0, (b - a) - k);

}

Measured memory_bytes: 3652
matrix = [list(map(int,input().split())) for i in range(3)]
a_1 = 0
a_2 = matrix[1][0] - matrix[0][0]
a_3 = matrix[2][0] - matrix[0][0]
b_1 = matrix[0][0]
b_2 = matrix[0][1]
b_3 = matrix[0][2]

if a_2 + b_2 == matrix[1][1] and a_2 + b_3 == matrix[1][2] and a_3 + b_2 == matrix[2][1] and a_3 + b_3 == matrix[2][2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String input_N = sc.next();
 
        // programming
        if (input_N.equals("1")) {
            System.out.println("Hello World");
        } else {
            int input_A = Integer.parseInt(sc.next());
            int input_B = Integer.parseInt(sc.next());
            System.out.println(input_A + input_B);
        }
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
const int N=2005;
int n,k,mi,gs,x[N],y[N];
vector<int>g[N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
void dfs(int u,int fa,int dep)
{
	if(dep>k/2)gs++;
	for(int i=0;i<g[u].size();i++)
	{
		int v=g[u][i];
		if(v==fa)continue;
		dfs(v,u,dep+1);
	}
}
int main()
{
	n=read();k=read();
	mi=n;
	for(int i=1;i<n;i++)
	{
		x[i]=read(),y[i]=read();
		g[x[i]].push_back(y[i]);
		g[y[i]].push_back(x[i]);
	}
	if(k%2==0)
	{
		for(int i=1;i<=n;i++)
		{
			gs=0;
			dfs(i,0,0);
			mi=min(mi,gs);
		}
		cout<<mi;
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		gs=0;
		dfs(x[i],y[i],0);
		dfs(y[i],x[i],0);
		mi=min(mi,gs);
	}
	cout<<mi;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
string A, B;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> A >> B;
    int la = A.size();
    int lb = B.size();
    int ans = 0;
    if(la>lb) ans=1;
    else if(la<lb) ans = -1;
    else ans = A>B ? 1 : -1;
    if(A==B) ans = 0;
    switch(ans) {
        case 0: cout << "EQUAL"; break;
        case 1: cout << "GREATER";break;
        case -1: cout << "LESS"; break;
    }
    cout << endl;
}


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

int calc_accumulate(const vector<vector<vector<int>>> &f, int c, int x, int y, int k)
{
    int ret = 0;
    ret += f[c][x + k - 1][y + k - 1];
    if (x > 0)
    {
        ret -= f[c][x - 1][y + k - 1];
    }
    if (y > 0)
    {
        ret -= f[c][x + k - 1][y - 1];
    }
    if (x > 0 && y > 0)
    {
        ret += f[c][x - 1][y - 1];
    }
    return ret;
}

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

    long long x, y;
    char c;
    vector<vector<vector<int>>> field(2, vector<vector<int>>(4 * K, vector<int>(4 * K, 0)));
    for (int i = 0; i < N; i++)
    {
        cin >> x >> y >> c;
        x %= 2 * K;
        y %= 2 * K;
        if (c == 'B')
        {
            field[0][x][y]++;
            field[0][x + 2 * K][y]++;
            field[0][x][y + 2 * K]++;
            field[0][x + 2 * K][y + 2 * K]++;
        }
        else
        {
            field[1][x][y]++;
            field[1][x + 2 * K][y]++;
            field[1][x][y + 2 * K]++;
            field[1][x + 2 * K][y + 2 * K]++;
        }
    }

    // for (int i = 0; i < 2 * K; i++)
    // {
    //     for (int j = 0; j < 2 * K; j++)
    //     {
    //         cout << field[0][i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // cout << endl;

    // for (int i = 0; i < 2 * K; i++)
    // {
    //     for (int j = 0; j < 2 * K; j++)
    //     {
    //         cout << field[1][i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;

    for (int i = 0; i < 4 * K; i++)
    {
        for (int j = 0; j < 4 * K; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                if (i > 0)
                {
                    field[k][i][j] += field[k][i - 1][j];
                }
                if (j > 0)
                {
                    field[k][i][j] += field[k][i][j - 1];
                }
                if (i > 0 && j > 0)
                {
                    field[k][i][j] -= field[k][i - 1][j - 1];
                }
            }
        }
    }

    // for (int i = 0; i < 2 * K; i++)
    // {
    //     for (int j = 0; j < 2 * K; j++)
    //     {
    //         cout << field[0][i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // cout << endl;

    // for (int i = 0; i < 2 * K; i++)
    // {
    //     for (int j = 0; j < 2 * K; j++)
    //     {
    //         cout << field[1][i][j] << " ";
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    int tmp;
    for (int i = 0; i < 2 * K; i++)
    {
        for (int j = 0; j < 2 * K; j++)
        {
            tmp = 0;
            tmp += calc_accumulate(field, 0, i, j, K);
            tmp += calc_accumulate(field, 1, i + K, j, K);
            tmp += calc_accumulate(field, 1, i, j + K, K);
            tmp += calc_accumulate(field, 0, i + K, j + K, K);
            // cout << i << " " << j << " " << tmp << endl;
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
}


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

using namespace std;

int main()
{
	int		H, W;

	for (;;)
	{
		cin >> H >> W;

		if ((H == 0) && (W == 0))
			break;

		string		str("#");
		string		str2(".");
		for (int i = 1; i < W; i++)
		{
			if (i % 2)
			{
				str += ".";
				str2 += "#";
			}
			else
			{
				str += "#";
				str2 += ".";
			}
		}
		str += "\n";
		str2 += "\n";

		for (int i = 0; i < H; i++)
		{
			if (i % 2)
				cout << str2;
			else
				cout << str;
		}
		cout << "\n";
	}

	return 0;
}

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

#define rep(i,s,N) for(int i=s;i<N;++i) 

template<typename T>
void swap(T& a, T& b) {
	T t = a;
	a = b;
	b = t;
}

template<typename T>
void print(std::vector<T> v) {
	for(int i=0;i<v.size();++i){
		if (i==0) std::cout << v[i];
		else std::cout << " " << v[i];
	}
}

template<typename T>
int sort_selection(std::vector<T> &x){
	int counter = 0;
	for (int i=0; i<x.size(); ++i) {
		int min_index = i;
		for (int j=i+1; j<x.size(); ++j) {
			if (x[j] < x[min_index]) min_index = j; 
		}
		if (x[i] == x[min_index]) {
			continue;
		}
		swap(x[i], x[min_index]);
		counter++;
	}
	return counter;
}

using namespace std;

int main() {
	int N;
	cin >> N;
	std::vector<int> x(N);
	for(auto it = x.begin(); it != x.end(); ++it) {
		cin >> *it;
	}
	int swap_count = sort_selection(x);
	print(x); cout << endl;
	cout << swap_count << endl;
	return 0;
}




Measured memory_bytes: 3112
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){

    string N;
    cin>>N;

    if(N[0]==N[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3032
class UnionFind(object):
  def __init__(self,n):
    self.par=[i for i in range(n+1)]
    self.rank=[0 for i in range(n+1)]
    self.member=[1 for i in range(n+1)]
    
  def find(self,x):
    if self.par[x]==x:
      return x
    else:
      self.par[x]=self.find(self.par[x])
      return self.par[x]
  
  def check(self,x,y):
    return self.find(x)==self.find(y)
  
  def union(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if self.rank[x]<self.rank[y]:
      self.par[x]=y
      self.member[y]+=self.member[x]
    elif self.rank[x]>self.rank[y]:
      self.par[y]=x
      self.member[x]+=self.member[y]
    else:
      self.par[y]=x
      self.rank[x]+=1
      self.member[x]+=self.member[y]
    
  def size(self,x):
    return self.member[self.par[x]]

N,M=map(int,input().split())
E=[list(map(int,input().split())) for i in range(M)]
ans=[0 for i in range(M+1)]
ans[-1]=N*(N-1)//2
tree=UnionFind(N)
for i, e in enumerate(E[::-1]):
  if tree.check(e[0],e[1]):
    ans[-(i+2)]=ans[-(i+1)]
  else:
    ans[-(i+2)]=ans[-(i+1)]-tree.size(e[0])*tree.size(e[1])
    tree.union(e[0],e[1])
for a in ans[1:]:
  print(a)

Measured memory_bytes: 35788
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
int getd(int xx,int yy,int x,int y){
	int dx=xx-x;
	int dy=yy-y;
	if(dx<0)dx=-dx;
	if(dy<0)dy=-dy;
	return dx+dy;
}


int main(){
	int n,x[111],y[111],h[111];
	cin>>n;
	FOR(i,0,n){
		cin>>x[i]>>y[i]>>h[i];
		if(h[i]>0&&i!=0){
			swap(x[0],x[i]);
			swap(y[0],y[i]);
			swap(h[0],h[i]);
		}
	}
	FOR(xx,0,101){
		FOR(yy,0,101){
			int d=getd(xx,yy,x[0],y[0]);
			int eh=d+h[0],f=1;
			FOR(i,1,n){
				int dd=getd(xx,yy,x[i],y[i]);
				if(max(eh-dd,0)!=h[i]){
					f=0;
				}
			}
			if(f){
				cout<<xx<<" "<<yy<<" "<<eh<<endl;
				return 0;
			}
		}
	}
    return 0;
}


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

int ans = 0;
vector<vector<int>> e(51,vector<int>(0));
void search(int num){
    if(e[e[num][0]].size()==1||e[e[num][0]].size()>2){
        e[num].erase(find(e[num].begin(),e[num].end(),e[num][0]));
        e[e[num][0]].erase(find(e[e[num][0]].begin(),e[e[num][0]].end(),num));
        ans ++;
        return;
    }
    if(e[e[num][0]].size()==2) {
        e[num].erase(find(e[num].begin(),e[num].end(),e[num][0]));
        e[e[num][0]].erase(find(e[e[num][0]].begin(),e[e[num][0]].end(),num));
        ans ++;
        search(e[num][0]);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    for(int i = 0;i < m;i ++){
        int a,b;
        cin >> a >> b;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    for(int i = 1;i <= n;i ++){
        if(e[i].size()==1)search(i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H_list = list(map(int, input().split()))
min_err = 10000
num = -1
for i in range(N):
    temperture = T-H_list[i]*0.006
    err = abs(A - temperture)
    if err < min_err:
        min_err = err
        num = i
print(num+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
   vector<int> a(3);
   cin >> a[0] >> a[1] >> a[2];
   sort(all(a));
   if(a[0] == 5 && a[1] == 5 && a[2] == 7)cout << "YES";
   else cout << "NO";
}


Measured memory_bytes: 256
#include <cstdio>
#define buf 1000
using namespace std;

void Search(double n,double m);

int main(void){
  double n,m;
  char str[buf];

  for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
      sscanf(str,"%lf %lf",&n,&m);
      Search(n,m);
  }
  return 0;
}

void Search(double n,double m){

  if(n<35.50 && m<71.00)          printf("AAA\n");
  else if(n<35.50 && m<71.00)     printf("AAA\n");
  else if(n<37.50 && m<77.00)     printf("AA\n");
  else if(n<40.00 && m<83.00)     printf("A\n");
  else if(n<43.00 && m<89.00)     printf("B\n");
  else if(n<50.00 && m<105.00)    printf("C\n");
  else if(n<55.00 && m<116.00)    printf("D\n");
  else if(n<70.00 && m<148.00)    printf("E\n");
  else if(n>=70.00 || m>=148.00)  printf("NA\n");
}

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

using namespace std;

typedef long long ll;

double getTime() { 
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  int n, m; cin >> n >> m;
  if(n == m) {
    puts("Yes");
  }
  else {
    puts("No");
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 200005
const ll INF = 1000000000000000001;
const ll MOD = 1000000007;

//vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
//ll vis[N] = {0}, par[N] = {0}, child[N] = {0},cnt = 0;


void solve(){
    ll n,m,k; cin >>n>>m>>k;
    ll a[n+1] = {0}, b[m+1] = {0};
    f(1, n) cin >> a[i];
    f(1, m) cin >> b[i];
    
    f(1, n) a[i] += a[i-1];
    f(1, m) b[i] += b[i-1];
    ll ans =0, i=0, j=m;
    while(i <= n){
        if(a[i] > k) break;
        while(j >= 0 and b[j] + a[i] > k) j-=1;
        ans = max(ans , i+j);
        i++;
    }  
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
   //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

Measured memory_bytes: 6784
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

int main() {
	go;
    cin >> N;
    ll ans = N * 800;
    ans -= N / 15 * 200;
    cout << ans << "\n";
    
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3588
N = int(input())
As = list(map(int, input().split()))
arridx = [(i, a) for i, a in enumerate(As)]
arridx.sort(key=lambda x: x[1])

dp = {}
dp[(0, N-1)] = 0
for i in range(N-1, -1, -1):
    ndp = {}
    for l in range(N-i+1):
        r = l + i - 1
        idx, a = arridx[i]
        lsc = rsc = 0
        if l > 0:
            # l-1, r から
            lsc = dp[(l-1, r)] + a * abs(l-1-idx)
        if r < N-1:
            # l, r+1 から
            rsc = dp[(l, r+1)] + a * abs(r+1-idx)
        ndp[(l, r)] = max(lsc, rsc)
    dp = ndp
print(max(dp.values()))

Measured memory_bytes: 78388
class Dice:
    D = {'E': (3, 1, 0, 5, 4, 2),
         'W': (2, 1, 5, 0, 4, 3),
         'S': (4, 0, 2, 3, 5, 1),
         'N': (1, 5, 2, 3, 0, 4)}
    def __init__(self, a, b, c, d, e, f):
        self.nbrs = [a, b, c, d, e, f]
        self.tp = a
        self.fwd = b
        self.rs = c
        self.ls = d
        self.bk = e
        self.bm = f
    def rll(self, dr):
        self.nbrs = [self.nbrs[i] for i in self.D[dr]]
        self.tp = self.nbrs[0]
        self.fwd = self.nbrs[1]
        self.rs = self.nbrs[2]
        self.ls = self.nbrs[3]
        self.bk = self.nbrs[4]
        self.bm = self.nbrs[5]


a, b, c, d, e, f = input().split()
dice1 = Dice(a, b, c, d, e, f)
a, b, c, d, e, f = input().split()
dice2 = Dice(a, b, c, d, e, f)
for i in 'NNNN':
    dice2.rll(i)
    for i in 'EEEE':
        dice2.rll(i)
        for i in 'NNNN':
            dice2.rll(i)
            if dice2.nbrs == dice1.nbrs:
                print('Yes')
                exit()
print('No')


Measured memory_bytes: 5576
#include<stdio.h>
    #include<math.h>
    int main(){
    int N,Y;
    scanf("%d " ,&N);
    scanf("%d" ,&Y);
    double k = Y / 1000;
    double b = k-N;
    double round_x ,round_y ,round_z;
    int answer_x ,answer_y ,answer_z ;
    round_x = floor(b/4);
    round_y = ceil(2*(b)/9);
    round_z = floor(k/5);
     
    if(round_y<=round_x && round_y <= round_z){
         answer_x = b - 4*round_y;
         answer_y = 9*round_y - 2 * b;
         answer_z = k - 5 * round_y;
     
    }else {
        answer_x = -1;
        answer_y = -1;
        answer_z = -1;
    }
    printf("%d %d %d ", answer_x ,answer_y ,answer_z );
    return 0;
    }

Measured memory_bytes: 128
package main

import (
	"fmt"
	"reflect"
	"sort"
	"strings"
)

func rotate(s string) string {
	if s == "" {
		return s
	}
	if len(s) == 1 {
		return s
	}
	b := []rune(s)

	return string(append(b[1:], b[0]))
}

func main() {
	var S, T string

	fmt.Scan(&S)
	fmt.Scan(&T)

	if S == T {
		fmt.Println("Yes")
		return
	}

	if len(S) != len(T) {
		fmt.Println("No")
		return
	}

	as := strings.Split(S, "")
	at := strings.Split(T, "")

	sort.Strings(as)
	sort.Strings(at)

	if !reflect.DeepEqual(as, at) {
		fmt.Println("No")
		return
	}
	for i := 0; i <= len([]rune(S)); i++ {
		S = rotate(S)

		if S == T {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))

result =""
i_pre = 1000000000
for i in (reversed(A)):
  if i_pre >= i:
      i_pre = i
  else:
    z = i -1
    if  z <= i_pre:
      i_pre = z
    else:
      result = "No"

if result =="":
  result = "Yes"

print(result)

Measured memory_bytes: 14396
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  ll a,b,c,d; cin>>a>>b>>c>>d;
  ll x=max(a*c,a*d);
  ll y=max(b*c,b*d);
  ll z=max(x,y);
  cout<<z<<endl;
}


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

int main(){
    string s,t;
    cin >> s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0' ||s[i]=='1') t.push_back(s[i]);
        if(s[i]=='B'&&t.size()>0) t.pop_back(); 
    }
    cout << t;
    return 0;
}

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

int main() {
  int A;
  cin >> A;
  string ans;
  if(A < 1200){
    ans = "ABC";
  }
  else if(A < 2800){
    ans = "ARC";
  }
  
  else{
    ans = "AGC";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int size;
    std::cin >> size;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for (int i = 0; i < size; i++) {
        string name;
        std::cin >> name;
        if (name == "AC") {
            ac++;
        } else if (name == "WA") {
            wa++;
        } else if (name == "TLE") {
            tle++;
        } else if (name == "RE") {
            re++;
        }
    }
    std::cout << "AC x " << ac << std::endl;
    std::cout << "WA x " << wa << std::endl;
    std::cout << "TLE x " << tle << std::endl;
    std::cout << "RE x " << re << std::endl;
}


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

int gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    long long a;
    long long ans=0;
    cin>>a;
    for(long long i=1;i<=a;i++){
        for(long long j=1;j<=a;j++){
            for(long long k=1;k<=a;k++){
                ans+=gcd(i,gcd(j,k));
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3640
import numpy as np        
n, m = map(int, input().split())
a = np.array(list(map(int, input().split())))
bcs = [tuple(map(int, input().split()))[::-1] for _ in range(m)]

a.sort()
bcs = sorted(bcs, reverse=True)

i = 0
for query in bcs:
    a[i:i+query[1]] = np.maximum(a[i:i+query[1]], query[0])
    i += query[1]
    
print(np.sum(a, dtype="int64"))

Measured memory_bytes: 27484
S = input()

count = 0
C = []
for i in range(len(S)):
  C.append(count)
  count = 0
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    count += 1
    if(i == len(S)-1):
      C.append(count)
      break
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
        count += 1
      else: break

print(max(C))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n; scanf("%d", &n);
	int ans = 0;
	while(n--) {
		int a; scanf("%d", &a);
		
		ans += 1 - a % 2;
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 3200
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector<pint> x,y;

struct UnionFind{
   vector<int> par;
   UnionFind(int n):par(n,-1){}
   int find(int x){
       if(par[x]<0)return x;
       return par[x]=find(par[x]);
   }
   bool unite(int x,int y){
       x=find(x);
       y=find(y);
       if(x==y)return false;
       if(par[x]>par[y]){
           par[y]+=par[x];
           par[x]=y;
       }
       else{
           par[x]+=par[y];
           par[y]=x;
       }
       return true;
   }
 
   bool same(int x,int y){
       return find(x)==find(y);
   }
   int size(int x){
       return -par[find(x)];
   }
};

struct edge{int u,v,cost;};
bool comp(const edge& e1, const edge& e2){
  return e1.cost<e2.cost;
}

int V,E;
edge es[200020];

int kruskal(){
  sort(es, es+E, comp);
  UnionFind uf(V);
  int res=0;
  for(int i=0;i<E;i++){
    edge e=es[i];
    if(!uf.same(e.u, e.v)){
      uf.unite(e.u, e.v);
      res+=e.cost;
    }
  }
  return res;
}

int main(){
  int tempx, tempy;
  cin >> V;
  E=2*V-2;
  for(int i=0;i<V;i++){
		cin >> tempx >> tempy;
		x.push_back(pint(tempx, i));
		y.push_back(pint(tempy, i));
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  for (int i=0;i<V-1;i++){
    es[i].u = x[i].second;
    es[i].v = x[i + 1].second;
    es[i].cost = x[i + 1].first - x[i].first;
  }
	for (int i = 0; i < V - 1; i++){
      es[i + V - 1].u = y[i].second;
      es[i + V - 1].v = y[i + 1].second;
      es[i + V - 1].cost = y[i + 1].first - y[i].first;
    }
	int ans;
	ans=kruskal();
	cout << ans << endl;
	return 0;
}

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

int main(){
	long n, a, min, max, sum;
	cin >> n;
	cin >> a;
	min = a;
	max = a;
	sum = a;
	for (int i=1; i<n; i++) {
		cin >> a;
		if (a < min) {
			min = a;
		}
		else if (a > max){
			max = a;
		}
		sum += a;
	}
	cout << min << " " << max << " " << sum << endl;
	return 0;
} 


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

int main(){
        long long int A;
        char B[10];
        cin >> A >> B;
        long long int b = (B[0] - '0') * 100 + (B[2] - '0') * 10 + B[3] - '0';
        cout << (A * b) / 100 << endl;
        return 0;
}


Measured memory_bytes: 3592
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#define LEN 100005
#pragma warning(disable:4996)
using namespace std;

typedef struct pp{
	char name[100];
	int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue(){
	P x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

int min(int a, int b){ return a < b ? a : b; } // ????°?????????????

int main(){
	int elaps = 0, c;
	int i, q;
	P u;
	cin >> n >> q;

	// ??¨??????????????????????????\???????????????????????????
	for(i=1; i<=n; i++){
		cin >> Q[i].name;
		cin >> Q[i].t;
	}
	head = 1;
	tail = n + 1;

	// ????????\??¬????????§???
	while(head != tail){
		u = dequeue();
		c = min(q,u.t); // q????????????????????????u.t?????????????????????
		u.t -= c; // ?????????????????????????¨????
		elaps += c; // ????????????????¨????
		if(u.t > 0) enqueue(u);
		else{
			cout << u.name << " " << elaps << "\n";
		}
	}

	return 0;
}

Measured memory_bytes: 13228
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    6月で水色になるぞ〜!!!
*/

// from std...
use std::cmp::{
    max, min,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, Integer};
use num_rational::Rational;
use num_traits::{one, zero, One, Zero};
use permutohedron::Heap;
use petgraph::unionfind::UnionFind;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;

pub const MOD: usize = 1000000007;
pub const MAX: usize = 1usize << 63usize;
pub const MIN: i64 = i64::MIN;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 'A' as u8;

// code...
// #[fastout]
fn main() {
    input! {
        x: usize,
    }

    let ans = lcm(x, 360) / x;
    println!("{}", ans);
}


Measured memory_bytes: 2128
N,L = list(map(int,input().split()))
A = list(range(L,L+N))
ans = sum(A)
mi = min(list(map(abs,A)))
if abs(A[0])==mi:
  print(ans-A[0])
elif abs(A[N-1])==mi:
  print(ans-A[N-1])
else:
  print(ans-mi)

Measured memory_bytes: 38256
#include<iostream>

using namespace std;
int N, A, B;
int a[50], b[50], c[50];
const int inf=1001001;

int gcd(int a, int b){
   if(a<b) swap(a, b);
   if(b==0) return a;
   else return gcd(b, a%b);
}

int main(){

   cin>> N>> A>> B;
   for(int i=0; i<N; i++){
      cin>> a[i]>> b[i]>> c[i];
   }

   int memo[500][500];
   for(int i=0; i<500; i++){
      for(int j=0; j<500; j++){
         memo[i][j]=inf;
      }
   }
   memo[0][0]=0;
   for(int k=0; k<N; k++){
      for(int i=500-1; i-a[k]>=0; i--){
         for(int j=500-1; j-b[k]>=0; j--){
            memo[i][j]=min(memo[i][j], memo[i-a[k]][j-b[k]]+c[k]);
         }
      }
   }

   int C=inf;
   for(int i=1; i<500; i++){
      for(int j=1; j<500; j++){
         int g=gcd(i, j);
         if(i/g==A&&j/g==B){
            C=min(C, memo[i][j]);
         }
      }
   }

   if(C==inf){
      cout<< -1<< endl;
   }else{
      cout<< C<< endl;
   }

   return 0;
}


Measured memory_bytes: 1280
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

int min(int a,int b){
	return (a>b)? b:a;
}

int main (){
	int NN,MM;
	cin >> NN >> MM;
	int tt[NN+1];
	int tempa,tempb;
	int temp;
	int minn = 10000000;
	// O(N)
	rep(i,NN+1){tt[i] = 100000000;}
	// O(M)
	rep(i,MM){
		cin >> tempa >> tempb;
		if(tempa>tempb){
			temp = tempa;
			tempa = tempb;
			tempb = temp;
		}
		tt[tempa] = min(tt[tempa],tempb);
		minn = min(minn,tempa);
	}
	vector <pair <int ,int > > ttt;
	rep(i,NN){
		if(tt[i]!=100000000){
			ttt.push_back(make_pair(i,tt[i]));
		}
	}
	int ff = ttt[0].first;
	int fb = ttt[0].second;
	int ans = 0;
	rep(i,ttt.size()){
		if( fb <= ttt[i].first ){
			ff = ttt[i].first;
			fb = ttt[i].second;
			ans ++;
		}
		if( fb > ttt[i].second ){
			fb = ttt[i].second;
		}
	}
	cout << ans +1 << endl;
	return 0;

}


Measured memory_bytes: 1912
main :: IO ()
main = do
    [a,b] <- map read . words <$> getLine
    putStrLn . toAnswer $ judge a b

toAnswer :: Ordering -> String
toAnswer LT = "Bob"
toAnswer EQ = "Draw"
toAnswer GT = "Alice"

judge :: Int -> Int -> Ordering
judge a b = rank a `compare` rank b
  where
    rank = (`mod` 13) . subtract 2

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

string s,t;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.size();i++)ans+=s[i]!=t[i];
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3820
#include"bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.141592653589793238

int main() {
	int N;
	cin >> N;
	int height = 0;
	rep(i, N) {
		int H;
		cin >> H;
		if (H - 1 >= height) {
			height = H - 1;
		}
		else if (H >= height) {
			height = H;
		}
		else {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

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

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> a >> b;

	if (a>=13) ans = b;
	else if (a>=6) ans = b/2;
	else ans = 0;
	//vector<ll>	aa(n);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));

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


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);  
    int k , a, b;
    cin >> k >> a >> b;
    repk(i,a,b+1){
        if(i%k==0) {cout << "OK" << endl;return 0;}
    }
    cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    long double a;
    long double b;
    cin >> a >> b;

    ll res = a * b;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3748
M = 1e+9.to_i

s = gets.chomp.to_i

p = s / M
q = s % M

x = 0
y = 0

if q > 0 then
  x = M - q
  y = p + 1
else
  x = 0
  y = p
end

puts [0, 0, M, 1, x, y].map(&:to_s).join(' ')

Measured memory_bytes: 1788
n = gets.strip.to_i
ss=gets.strip

min_l = 0
max_l = n

until min_l+1==max_l
  l = (min_l+max_l)/2
#p [l, min_l, max_l]
  memo = {}
  ok = false
  0.upto(n-l) do |i|
    k=ss[i...i+l]
    if memo[k]
      if memo[k]+l-1 < i
        ok = true
        break
      end
    else
      memo[k] = i
    end
  end
  if ok
    min_l = l
  else
    max_l = l
  end
end

p min_l


Measured memory_bytes: 20220
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000 //1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cout << H << " ";
  debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
typedef pair<int, int> P;
vector<vector<char>> a;
int xsize, ysize;
int bfs(int sx, int sy)
{
  int dx[] = { -1, 0, 1, 0 };
  int dy[] = { 0, 1, 0, -1 };
  int res = -1;
  P s = { sx, sy };
  queue<P> q;
  vector<vector<int>> d(xsize, vector<int>(ysize, -1));
  d[sx][sy] = 0;
  q.push(s);
  while (!q.empty()) {
    P p = q.front();
    q.pop();
    int x = p.first;
    int y = p.second;
    rep(i, 4)
    {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (nx < 0 or ny < 0 or nx >= xsize or ny >= ysize)
        continue;
      if (a[nx][ny] == '#')
        continue;
      if (d[nx][ny] != -1)
        continue;
      d[nx][ny] = d[x][y] + 1;
      res = max(d[nx][ny], res);
      q.push({ nx, ny });
    }
  }
  return res;
}
int main()
{
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cin >> ysize >> xsize;
  vector<P> s;
  a = vector<vector<char>>(xsize, vector<char>(ysize));
  rep(y, ysize)
  {
    rep(x, xsize)
    {
      char temp; cin >> a[x][y];
      if (a[x][y] == '.')
        s.push_back({ x, y });
    }
  }
  int res = -1;
  for (P p : s) {
    res = max(res, bfs(p.first, p.second));
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  int min=1+k*n;
  int i;
  for(i=0;i<n;i++){
    int t=(1<<(n-i))+i*k;
    if(t<min) min=t;
  }
  printf("%d\n",min);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (long long i = 0; i < N; i++)
using ll = long long;
template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INF = 1LL << 60;

int main() {
    ll N;
    cin >> N;
    vector<pair<ll, ll>> XL(N);
    rep(i, N) {
        ll x, l;
        cin >> x >> l;
        XL[i].first = x + l;
        XL[i].second = x - l;
    }
    sort(XL.begin(), XL.end());
    ll max = -INF;
    ll ans = 0;
    rep(i, N) {
        if (max <= XL[i].second) {
            max = XL[i].first;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int N, x;
  cin >> N >> x;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  long long ans = 0;
   if (a[0] > x) {
    ans += a[0] - x;
    a[0] = x;
  }
  for (int i = 0; i < N - 1; i++) {
    if (a[i] + a[i + 1] > x) {
      ans += a[i] + a[i + 1] - x;
      a[i + 1] = x - a[i];
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


def solve(L: int):
    a=L/3-1e-10
    print(a**3)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940