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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll r;
  cin >> r;

  r = r * 2;
  double ans = r * M_PI;
  cout << fixed << setprecision(10);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3788
#include <iostream>

int main()
{
	int m, f, r;	

	while (true) {
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) break;

		if (m == -1 || f == -1) {
			printf("F\n");
			continue;
		}
		int sum = m + f;

		if (sum >= 80) printf("A\n");
		else if (sum >= 65 && sum < 80) printf("B\n");
		else if (sum >= 50 && sum < 65) printf("C\n");
		else if (sum >= 30 && sum < 50) {
			if(r >= 50)
				printf("C\n");
			else
				printf("D\n");
		}
		else if (sum < 30) printf("F\n");
	}

	return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<long long, long long> > vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

vector<vector<int>> G;
int N,K;
ll ans;
vector<int> seen;
vector<int> color;

int main(){

    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);
		
	cin >> N >> K;

	G.resize(N);
	seen.assign(N,0);
	color.assign(N,K-1);

	rep(i,N-1){
		int a,b;
		cin >> a >> b;
		--a;--b;
		G[a].PB(b);
		G[b].PB(a);
	}

	ans = 1;

	int st = 0;
	queue<pii> q;
	q.push(pii(0,K));

	while(!q.empty()){
		pii t = q.front();
		q.pop();
		seen[t.first] = 1;

		ans *= t.second;
		ans %= MOD;
	
		int col = K - (t.first == 0?1:2);

		for(int v:G[t.first]){
			if(!seen[v]){
				q.push(pii(v,col--));
			}
		}
	}

	cout << ans << endl;
	
}


Measured memory_bytes: 7800
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  long long K;
  cin >> S >> K;
  long long count = 0;
  if (S[0] != S[S.size()-1]){
    for (int i = 0; i < S.size()-1; i++){
      if (S[i] == S[i+1]){
        count++;
        S[i+1] = '0';
      }
    }
    count *= K;
    cout << count;
  } else {
    string T = S;
    bool same = true;
    for (int i = 0; i < S.size()-1; i++){
      if (S[i]!=S[i+1]) same = false;
    }
    if (same){
      cout << (S.size()*K)/2;
    } else {
      for (int i = 0; i < S.size()-1; i++){
        if (S[i] == S[i+1]){
          count++;
          S[i+1] = '0';
        }
      }
      count *= K;
      if (S[0] == S[S.size()-1]){
        count = count + K - 1;
        int B=0, E=0;
        for (int i = 0; i < S.size(); i++){
          if (T[i] == T[0]){
            B++;
          } else {
            break;
          }
        }
        for (int i = S.size()-1; i >= 0; i--){
          if (T[i] == T[S.size()-1]){
            E++;
          } else {
            break;
          }
        }
        if (B%2==0 && E%2==1){
          count = count - K + 1;
        }
      }
      cout << count << endl;
    }
  }
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,k;
  cin >> n >> k;
  vector<int32> cnt(n,0);
  REP(i,k){
    int32 d;
    cin >> d;
    REP(j,d){
      int32 a;
      cin >> a;
      a--;
      cnt[a]++;
    }
  }
  int32 ans = 0;
  REP(i,n)if(cnt[i] == 0)ans++;
  ANS(ans);
  return 0;
}

Measured memory_bytes: 3660
using System;

namespace Sample101
{
    class Program
    {

        static void Main(string[] args)
        {
            // 直近は第何回か Nは100から999
            int N = int.Parse(Console.ReadLine());

            int result = 0;
            for (int i = 111; i <= 999; i += 111)
            {
                if (N <= i)
                {
                    result = i;
                    break;
                }
            }
            Console.WriteLine(result);
        }
    }
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
int a[maxn];
int b[maxn];
void run_case()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i] >> b[i];
    }
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n);
    int ans = 0;
    if (n & 1)
    {
        int l = a[n / 2 + 1];
        int r = b[n / 2 + 1];
        ans = r - l + 1;
    }
    else
    {
        int l = a[n / 2] + a[n / 2 + 1];
        int r = b[n / 2] + b[n / 2 + 1];
        ans = r - l + 1;
    }
    cout << ans << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 5180
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>

using namespace std;




int main(int argc, char *argv[])
{
	int a, b, c;

	cin >> a >> b >> c;

	vector<int> v;

	v.push_back(a);
	v.push_back(b);
	v.push_back(c);

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

	int ans = abs(v[0] - v[1]) + abs(v[1] - v[2]);

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int x, y, z;
    cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    printf("%d %d %d", x, y, z);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt;
  double c=0,d=1000000;
  cin>>n;
  double a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    c+=a[i];
  }
  c/=n;
  for(int i=0;i<n;i++){
    if(d>abs(c-a[i])){
      d=abs(c-a[i]);
      cnt=i;
    }
  }
  cout<<cnt;
}

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

using namespace std;
typedef long long ll;
#define MP make_pair

int main(void) {
    int n,num;
    map<string,int> s;
    string tmp;

    cin>>n;

    for (int i = 0; i < n; i++) {
        cin>>tmp;
        if(s.find(tmp)==s.end()){
            s[tmp]=1;
        }
    }

    cout<<s.size()<<"\n";
    
    
    return 0;
}

Measured memory_bytes: 19252
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,k=mis()
    nlis=[0 for _ in range(n+1)]
    for _ in range(k):
        d=ii()
        a=input().split()
        for i in range(d):
            x=int(a[i])
            nlis[x]+=1
    cnt=0
    for i in range(1,n+1):
        if nlis[i]==0: cnt+=1
    print(cnt)



if __name__ == "__main__":
    main()

Measured memory_bytes: 9472
//	-*- mode: C++ -*-
//	Reversing Numbers
//
//		Write a program which reads a sequence and prints it in the reverse order.
//
//	Input
//		The input is given in the following format:
//
//		n
//		a1 a2 . . . an
//		n is the size of the sequence and ai is the ith element of the sequence.
//
//	Output
//		Print the reversed sequence in a line. Print a single space character between adjacent elements (Note that your program should not put a space character after the last element).
//
//	Constraints
//		n ≤ 100
//		0 ≤ ai < 1000
//	Sample Input 1
//		5
//		1 2 3 4 5
//	Sample Output 1
//		5 4 3 2 1
//	Sample Input 2
//		8
//		3 3 4 4 5 8 7 9
//	Sample Output 2
//		9 7 8 5 4 4 3 3

#include <iostream>
#include <list>

int main(int argc,
		 char *argv[])
{
	unsigned int	n	{0};
	std::list<unsigned int>	l	{}; 

	std::cin >> n;

	for(int i = 0; i < n; i++){
		unsigned int	ai	{0};
		std::cin >> ai;

		l.push_front(ai);
	}

	for(auto p = l.begin(); p != l.end(); p++){
		if(p != l.begin()){
			std::cout << ' ';
		}
		std::cout << *p ;
	}

	std::cout << '\n';
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <iomanip>
#include <functional>
#include <array>
#include <memory>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#undef NDEBUG
#include <assert.h>

using namespace std;
typedef long long ll;

int a[500][500];

vector<array<int, 4>> ans;
void oper(int x1, int y1, int x2, int y2) {
	if (!(a[x1][y1] & 1)) return;
	ans.push_back({ x1, y1, x2, y2 });
	// cout << x1 + 1 << ' ' << y1 + 1 << ' ' << x2 + 1 << ' ' << y2 + 1 << '\n';
	a[x1][y1]--, a[x2][y2]++;
}

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

	int n, m;
	cin >> n >> m;

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			cin >> a[i][j];

	for (int i = 0; i < n; ++i) {
		if (i & 1) {
			for (int j = 0; j + 1 < m; ++j)
				oper(i, j, i, j + 1);
			if (i != n - 1)
				oper(i, m - 1, i + 1, m - 1);
		}
		else {
			for(int j = m - 1; j > 0; --j)
				oper(i, j, i, j - 1);
			if (i != n - 1)
				oper(i, 0, i + 1, 0);
		}
	}

	cout << ans.size() << '\n';
	for (auto &&x : ans) {
		for (int i = 0; i < 4; ++i)
			cout << x[i] + 1 << " \n"[i == 3];
	}

	return 0;
}

Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 10010;

int n;
vector<int> G[MAX];
int ans[MAX], c[MAX];
pii E[MAX];

int main(){
    scanf("%d", &n);
    rep(i, n-1){
        scanf("%d%d", &E[i].fi, &E[i].se);
        --E[i].fi; --E[i].se;
    }
    rep(i, n) scanf("%d", &c[i]);
    sort(c, c+n, greater<>());
    memset(ans, 0, sizeof(ans));
    ans[0] = c[0];
    int sum = 0;
    rep(k, n-1){
        rep(i, n-1)if((ans[E[i].fi] != 0) ^ (ans[E[i].se] != 0)){
            if(ans[E[i].fi]) ans[E[i].se] = c[k+1];
            else ans[E[i].fi] = c[k+1];
            sum += c[k+1];
            break;
        }
    }
    printf("%d\n", sum);
    rep(i, n) printf("%d ", ans[i]);
}

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

typedef long long ll;

const int N = 200010;

int n, a[N], h[N];
ll c[N];
#define lowbit(i) (i & -i)
void add(int x, ll v) {
	for(int i = x; i <= n; i += lowbit(i)) c[i] = max(c[i], v);
}
ll query(int x) {
	ll ans = 0;
	for(int i = x; i; i -= lowbit(i)) ans = max(ans, c[i]);
	return ans;
}

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &h[i]);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= n; ++i) {
		add(h[i], query(h[i]) + a[i]);
	}
	printf("%lld\n", query(n));
}

Measured memory_bytes: 3328
# coding: utf-8

n = int(input().rstrip())
s = list(input())

alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

for i , alphabet_name in enumerate(s):
    s[i] = alphabet[ (alphabet.index(s[i])) +n]
    
print("".join(s))

Measured memory_bytes: 3188
#ifdef _DEBUG
#include ".vscode/debug_print.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>

using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1050000000;
constexpr long long INF64 = 4000000000000000000;
constexpr int MOD7        = 1000000007;
constexpr int MOD53       = 998244353;
constexpr long double PI  = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

void vprint() { std::cout << '\n'; }
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}

bool is_rev(string s) {
    auto rev = s;
    reverse(s.begin(), s.end());
    return rev == s;
}

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

    string s;
    scan(s);

    auto rev = s;
    auto N   = s.size();
    auto ss  = s.substr(0, (N - 1) / 2);
    auto sss = s.substr((N + 3) / 2 - 1);
    if (is_rev(s) && is_rev(ss) && is_rev(sss)) {
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}

Measured memory_bytes: 256
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		while(in.hasNext())new AOJ0059().doIt();
	}
	
	class AOJ0059{
		Point2D[] plist1,plist2;
		void doIt(){
			plist1 = new Point2D[4];
			for(int i=0;i<4;i+=2)plist1[i] = new Point2D.Double(in.nextDouble(),in.nextDouble());
			plist1[1] = new Point2D.Double(plist1[0].getX(),plist1[2].getY());
			plist1[3] = new Point2D.Double(plist1[2].getX(),plist1[0].getY());
			plist2 = new Point2D[4];
			for(int i=0;i<4;i+=2)plist2[i] = new Point2D.Double(in.nextDouble(),in.nextDouble());
			plist2[1] = new Point2D.Double(plist2[0].getX(),plist2[2].getY());
			plist2[3] = new Point2D.Double(plist2[2].getX(),plist2[0].getY());
//			System.out.println(Arrays.toString(plist1));
//			System.out.println(Arrays.toString(plist2));
			Line2D[] llist1 = new Line2D[4];
			Line2D[] llist2 = new Line2D[4];
			for(int i=0;i<4;i++){
				llist1[i] = new Line2D.Double(plist1[i], plist1[(i+1)%4]);
				llist2[i] = new Line2D.Double(plist2[i], plist2[(i+1)%4]);
			}
			
			boolean sw = false;
			for(int i=0;i<4;i++)for(int s=0;s<4;s++){
				if(llist1[i].intersectsLine(llist2[s])){
					sw = true;
				}
			}
			int num = 0;
			int num2 = 0;
			for(int i=0;i<4;i++){
				for(int s=0;s<4;s++){
					num+=CCW(plist1[i], plist1[(i+1)%4], plist2[s]);
					num2+=CCW(plist2[i], plist2[(i+1)%4], plist1[s]);
				}
			}
			if(num==16||num2==16)sw=true;
			System.out.println(sw? "YES":"NO");
		}
		int CCW(Point2D a,Point2D b,Point2D target){ //a-bの直線はtargetの右か左か
			Point2D q = new Point2D.Double(b.getX()-a.getX(),b.getY()-a.getY());
			Point2D r = new Point2D.Double(target.getX()-a.getX(),target.getY()-a.getY());
			if(cross(q, r)>0)return -1;//左側
			else if(cross(q,r)<0)return 1;//右側
			else return 0;//重なっている
		}
		double cross(Point2D p1,Point2D p2){
			return p1.getX()*p2.getY()-p1.getY()*p2.getX();
		}
	}
	
}

Measured memory_bytes: 20996
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,M;
	int P[100001],Y[100001];
	vpint kensi[100001];
	pint bango[100001];
	scan(N);scan(M);
	rep(i,M){
		scan(P[i]);scan(Y[i]);
		kensi[P[i]].push_back(mp(Y[i],i));
	}
	rep1(i,N){
		sort(kensi[i].begin(),kensi[i].end());
		rep(j,kensi[i].size()){
			bango[kensi[i][j].second]=mp(i,j+1);
		}
	}
	rep(i,M){
		printf("%06d%06d\n",bango[i].first,bango[i].second);
	}
	return 0;
}


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

int main()
{
    ll N;
    cin>>N;
    int h, n, w;
    for(int i=1;i<=3500;i++)
    {
        for(int j=1;j<=3500;j++)
        {
            ll divisor=4*i*j-N*i-N*j;
            ll divident=N*i*j;
            if(divisor==0)
            {
                continue;
            }
            ll w=divident/divisor;
            if(w>0&&(divident%divisor)==0&&divisor>0)
            {
                cout<<i<<" "<<j<<" "<<w<<endl;
                return 0;
            }
        }
    }



    return 0;
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int W,H,w,h,r,c;
  cin >> r >> c;
  cin >> h >> w;
  int ans = (r*c) - ( (h*c) + ( w*r) - (h*w));
  if(r==h || c == w) ans = 0;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a[55];
	int n,i,sum,j; sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n-1;i++)
		for(j=i+1;j<n;j++)
			sum+=a[i]*a[j];
	printf("%d",sum);
}

Measured memory_bytes: 128
// include
//------------------------------------------

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
// container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
// for
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

// const

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

// debug
//------------------------------------------

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int n; cin >> n;
    int l; cin >> l;
    vector<string> a(n);
    REP(i,n) cin >> a[i];
    SORT(a);
    string s = "";
    REP(i,n) s += a[i];
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=sort([parseInt(readline()) for i in 1:n])
    ans=sum(a)
    if ans%10==0
        if findfirst(x->x%10!=0,a)==0
            println(0)
        else
            println(ans-a[findfirst(x->x%10!=0,a)])
        end
    else
        println(ans)
    end
end
main()

Measured memory_bytes: 113440
#include <stdio.h>

int main()
{
  int c=0, i=0;
  char a[5];
  scanf("%s",a);

  while(a[i]!='\0'){
    if(a[i]=='+')c++;
    else c--;
    i++;
  }
  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define SIZE 200000

int c(const void* a, const void* b) {
	return *(int*)a - *(int*)b;
}

int main() {
	int ml, mr, n, i, t, a[SIZE], b[SIZE];
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &t);
		a[i] = b[i] = t;
	}
	qsort(b, n, sizeof(int), c);
	ml = b[n / 2 - 1]; mr = b[n / 2];
	for (i = 0; i < n; i++) printf("%d\n", (a[i] <= ml) ? mr : ml);
	return 0;
}

Measured memory_bytes: 3692
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;
using ll = long long;

int main(){ 
        int n,x[101],y[101],h[101],cx,cy;
        cin >> n;
        for(int i=0;i<n;i++){
                cin >> x[i] >> y[i] >> h[i];
        }
        for(cx=0;cx<=100;cx++){
                for(cy=0;cy<=100;cy++){
                        int height=-1;
                        for(int i=0;i<n;i++){
                                if(h[i]>0){
                                        int tmp = h[i]+abs(x[i]-cx)+abs(y[i]-cy);
                                        if(height==-1){
                                                height=tmp;
                                        }
                                        else if(height!=tmp){
                                                height=-2;
                                                break;
                                        }
                                }
                        }
                        if(height==-2)  continue;
                        for(int i=0;i<n;i++){
                                if(h[i]==0){
                                        if(height>abs(x[i]-cx)+abs(y[i]-cy)){
                                                height=-2;
                                                break;
                                        }
                                }
                        }
                        if(height==-2)  continue;
                        cout << cx << " " << cy << " " << height << endl;
                        return 0;
                }
        }
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin>>n;
  map<string,int> mp;
  rep(i,n){
    string s;
    cin>>s;
    mp[s]++;
  }
  ll ans = 0;
  for(auto it : mp){
    ans++;
  }
  print(ans);
  return 0;
}

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

using namespace std;

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

	int count = 1;

	for (int i = 0; i < (int)S.size() - 1; i++) {
		if (S[i] != S[i + 1])
			count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << (a-c)*(b-d) << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include<cmath>
#include<queue>
#include<algorithm>
#include<stack>

using namespace std;
using ll=long long;
using db=double;

typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<bool> vbl;

int inf=(1LL<<31)-1;
int MOD=1000000007;

#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define vvii(c,a,b) vector<vector<ii>> c(a,vector<ii>(b,0))
#define vvll(c,a,b) vector<vector<ll>> c(a,vector<ll>(b,0))
#define vvstr(c,a,b) vector<vectorM<string> c(a,vector<string>(b,0))

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

    int n;
    cin >> n;
    stack<ll> st;
    fi(0,n)
    {
        int a;
        cin >> a;
        st.push(a);
    }
    int s=st.size()-1;
    fi(0,s)
    {
        cout << st.top() << " ";
        st.pop();
    }
    cout << st.top() << endl;
    return(0);
}


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

int main() {
	int n;
	cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
    	cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    if (n % 2 == 1) {
    	int maxMedian = b[n / 2];
    	int minMedian = a[n / 2];
    	cout << maxMedian - minMedian + 1 << "\n";
    }
    else {
        int maxMedian = b[n / 2] + b[(n / 2) - 1];
        int minMedian = a[n / 2] + a[(n / 2) - 1];
        cout << maxMedian - minMedian + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  string MAN ="ABC";
  vs S(3); rep(i,3)cin >> S[i];
  int cr = 0;
  
  while(1){
    char c = S[cr][0];
    S[cr].erase(0,1);
    if (c == 'a') cr = 0;
    else if (c == 'b') cr = 1;
    else if (c == 'c') cr = 2;
    else {cout << " error" << endl; return 0;}
    if(S[cr].size()==0) break;
  }           
  cout << MAN[cr] << endl;
  return 0;
}

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

int f(int n) {
  while (n / 10) {
    n /= 10;
  }
  return n;
}

int main() {
  int n;
  cin >> n;
  int a[10][10] = {};
  for (int i = 1; i <= n; i++) {
    a[f(i)][i%10]++;
  }
  int ans = 0;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      ans += a[i][j] * a[j][i];
    }
  }
  cout << ans << endl;
}

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

import sys
import operator
from math import floor


def string_to_list_spliter():
    lst = [i for i in sys.stdin.readline().split()]
    return lst


def main():
    ops = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}

    # TODO Refactor: include the ugly code below into the function above.
    while True:
        lst = string_to_list_spliter()
        if lst[1] == '?':
            break
        elif lst[1] == '+':
            print(ops[lst[1]](int(lst[0]), int(lst[2])))
        elif lst[1] == '-':
            print(ops[lst[1]](int(lst[0]), int(lst[2])))
        elif lst[1] == '*':
            print(ops[lst[1]](int(lst[0]), int(lst[2])))
        elif lst[1] == '/':
            print(floor(ops[lst[1]](int(lst[0]), int(lst[2]))))


if __name__ == '__main__':
    main()

Measured memory_bytes: 7856
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};

const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/

ll N, A, B;

int main(){
  cin >> N >> A >> B;
  if(N < A || N < B){
    cout << -1 << endl;
    return 0;
  }

  ll dec = (N+A-1) / A;
  if(dec > B){
    cout << -1 << endl;
    return 0;
  }

  vector<ll> ans(N);
  rep(i, N) ans[N-i-1] = i + 1;

  rep(i, (N+A-1) / A){
    ll pos = i * A;
    ll n = min(A, N-pos);
    rep(j, n/2) swap(ans[pos+j], ans[pos+n-j-1]);
  }


  for(ll i = 1; i < (N+A-1) / A && dec < B; i++){
    ll pos = i * A;
    ll n = min(A, N-pos);
    ll can = n - 1;
    if(can < B - dec){
      rep(j, n/2) swap(ans[pos+j], ans[pos+n-j-1]);
      dec += can;
    }else{
      rep(j, (B-dec+1)/2) swap(ans[pos+j], ans[pos+B-dec-j]);
      dec += B-dec;
    }
  }
  if(dec != B){
    cout << -1 << endl;
    return 0;
  }

  rep(i, N) cout << ans[i] << " ";
  cout << endl;













}


Measured memory_bytes: 4480
#include <iostream>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)

int main(){
    int price[] = {0, 6000, 4000, 3000, 2000};
    REP(i, 4){
        int t, n;
        std::cin >> t >> n;
        std::cout << price[t] * n << std::endl;
    }
    return 0;
}

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

int main()
{
    int n; cin>>n;
    vector<int> a(n);
    for(auto& e: a) cin>>e;

    int64_t res=0;
    for(int m=0, L=0, R=0; L<n; ++L) {
        for(; R<n && (m^a[R])==(m|a[R]); ++R) {
            res+=R-L+1;
            m^=a[R];
        }
        m^=a[L];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;

# define mp make_pair
# define pb push_back
# define PI acos(-1)
# define ff first 
# define ss second 
# define endl '\n'
# define vt vector
# define all(c) (c).begin(), (c).end()
# define rep(i,a,b) for(int i = a ; i < b ; ++i)

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

template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD = 1e9+9 ;
const ll inf = 1e18 ;  
const ll mod = 1e9+7 ;  

ll nCr(ll n,ll r){ll t=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){t*=(n-i);t/=(i+1);}return t;}
ll power(ll a, ll n) { ll r=1;while(n){if(n&1)r=(r*a)%MOD;n>>=1;a=(a*a)%MOD;}return r%MOD;}



vt<pii> dir =  {{-1,0} , {1, 0} , {0,-1} , {0,1}} ; 

// ==========Start Here==============

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
 	int n , k ;
 	cin >> n >> k ; 
 	vt<int> a(n) ; 
 	rep(i,0,n) cin >> a[i] ; 
 	sort(all(a) , greater<int>()) ; 
 	ll ans= 0 ; 
 	rep(i,k,n) 
 		ans += a[i] ; 
 	cout << ans ;

	return 0 ; 
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, maxn = 5555;
int mul(long long a, long long b){
	return a * b % mod;
}
int pw(int a, int b){
	int r = 1;
	for(; b; b >>= 1, a = mul(a, a)) if(b&1) r = mul(r, a);
	return r;
}
int fat[maxn], ifat[maxn], p2[maxn];
void init(){
	p2[0] = 1;
	for(int i = 1; i < maxn; i++) p2[i] = mul(2, p2[i - 1]);
	fat[0] = 1;
	for(int i = 1; i < maxn; i++) fat[i] = mul(i, fat[i - 1]);
	ifat[maxn - 1] = pw(fat[maxn - 1], mod - 2);
	for(int i = maxn - 2; i >= 0; i--) ifat[i] = mul(i + 1, ifat[i + 1]);
	for(int i = 0; i < maxn; i++) assert(mul(fat[i], ifat[i]) == 1);
}
int ncr(int n, int r){
	if(n < r) return 0;
	return mul(fat[n], mul(ifat[r], ifat[n - r]));
}
int main(){
	init();
	int n, x; cin >> n >> x;
	int ans = 0;
	for(int sum = 0; sum < x; sum++){
		for(int i = 0; i <= n; i++){
			if(i <= sum && sum <= 2 * i){
				ans += mul(ncr(i, sum - i), ncr(n, i));
				if(ans >= mod) ans -= mod;
			}
		}
	}
	for(int i = 0; i <= n; i++){
		for(int j = 1; j + j <= i; j++){
			int can = i - 2 * j;
			int sum = x - 1 - i;
			if(can > sum && sum >= 0){
				ans += mul(ncr(can, sum), ncr(n, i));
				if(ans >= mod) ans -= mod;
			}
		}
	}
	if(x&1){
		for(int i = (x + 1) / 2; i <= n; i++){
			ans += ncr(n, i);
			if(ans >= mod) ans -= mod;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
@dir = [[0, 0, 1], [0, 1, 0], [1, 0, 0],
  [0, 1, 1], [0, 1, -1], [1, 0, 1], [1, 0, -1], [1, 1, 0], [1, -1, 0],
  [1, 1, 1], [1, 1, -1], [1, -1, -1], [1, -1, 1]]
def in_check(dir, x, y, z, n)
  dir[-1].zip([x, y, z]).all?{ |a, b| 0 <= a + b && a + b < n }
end

def check(balls, direction, n)
  n.times do |x|
    n.times do |y|
      n.times do |z|
        direction.each do |dir|
          next unless in_check(dir, x, y, z, n)
          return true if dir.map{ |dx, dy, dz| balls[x + dx][y + dy][z + dz] }.all?
        end
      end
    end
  end
  false
end

loop do
  n, m, p = gets.split.map(&:to_i)
  break if n == 0
  z_plane = n.times.map{ [0] * n }
  ok = false
  direction = @dir.map{ |d| m.times.map{ |i| d.map{ |k| i * k } } }
  balls = 2.times.map{ n.times.map{ n.times.map{ [false] * n } } }
  p.times do |i|
    x, y = gets.split.map(&:to_i)
    z = (z_plane[y - 1][x - 1] += 1)
    balls[i % 2][x  -1][y - 1][z - 1] = true
    next if ok
    if check(balls[i % 2], direction, n)
      printf "%s %d\n" % [['Black', 'White'][i % 2], i + 1]
      ok = true
    end
  end
  puts 'Draw' unless ok
end

Measured memory_bytes: 8852
import java.util.Scanner;

public class Main {

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

		int p =a+b;
		int m =a-b;
		int k = a*b;

		if((p>=m)&&(p>=k)) {
			System.out.println(p);
		}else if((m>=p)&&(m>=k)) {
			System.out.println(m);
		}else if((k>=m)&&(k>=m)) {
			System.out.println(k);
		}

	}

}

Measured memory_bytes: 21972
#include <iostream>

using namespace std;

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

  long long int ans = 10000000000000;
  for (long long int i = 1; i*i <= n; ++i) {
    if (n%i == 0) {
      long long int ans_local = i-1 + n/i-1;
      if (ans_local < ans)
        ans = ans_local;
    }
  }

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


Measured memory_bytes: 384
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=read())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int read(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	if(c^'-')k=1,x=c&15;else k=x=0;
	while(isdigit(Gc(c)))x=(x<<1)+(x<<3)+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
int n,h,lh(1);
signed main(){
	Rd(n);
	while(n--){
		Rd(h);
		if(h<lh)puts("No"),exit(0);
		lh=h>lh?h-1:h;
	}
	puts("Yes"),exit(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cstring>
using namespace std;
int dis[10];
int check(int n);
int main()
{
     int n,k;
     cin >> n >> k;
     memset(dis,0,sizeof(dis));
     int x;
     for(int i = 0;i < k;i++)
        {
         cin >> x;
         dis[x] = 1;
        }
     for(int i = n; ;i++)
        {
         if(check(i))
            {
             cout << i <<endl;
             break;
            }
        }
     return 0;
}
int check(int n)
{
     while(n)
        {
         int yushu = n%10;


         if(dis[yushu])
            {
            return 0;
         }
         n /= 10;
         }
    return 1;
}


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

using namespace std;

const int INF = 1 << 29;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++)
    cin >> H[i];
  vector<int> costs(N, INF);
  costs[0] = 0;
  for (int i = 1; i < N; i++) {
    if (i - 1 >= 0)
      costs[i] = min(costs[i], costs[i - 1] + abs(H[i] - H[i - 1]));
    if (i - 2 >= 0)
      costs[i] = min(costs[i], costs[i - 2] + abs(H[i] - H[i - 2]));
  }
  cout << costs[N - 1] << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(10);

    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && a == c)
    {
        cout << "No" << endl;
        return 0;
    }

    if(a == b || b == c || c == a)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    

    return 0;
}

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

int main()
{
  vector<int> nums {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (auto&& e : a) cin >> e;
  vector<string> dp(n + 7);

  for (int i = 0; i < n; i++) {
    if (i != 0 && dp[i].empty()) continue;
    for (auto&& e : a) {
      string s = dp[i + nums[e]];
      string t = dp[i] + to_string(e);
      if (s.length() > t.length()) continue;
      if (s.length() < t.length() || s < t) {
        dp[i + nums[e]] = dp[i] + to_string(e);
      }
    }
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 33536
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
string calc(string s) {
  stack<int> v;
  for (int i = 0; i < s.length()-1; i++) {
    if (s[i] == '[' || s[i] == '(') {
      v.push(s[i]);
    } else if (s[i] == ']') {
      if (v.size() > 0 && v.top() == '[') {
        v.pop();
      } else {
        return "no";
      }
    } else if (s[i] == ')') {
      if (v.size() > 0 && v.top() == '(') {
        v.pop();
      } else {
        return "no";
      }
    }
  }
  if (v.size() > 0) {
    return "no";
  } else {
    return "yes";
  }
}

signed main() {
  string s;
  while (getline(cin, s), s!=".") {
    cout << calc(s) << endl;
  }
  return 0;
}



Measured memory_bytes: 3136
#include<iostream>
#include<vector>
#include<algorithm>

int main() {
	int n,q=0;
	std::cin >> n;


	std::vector<int> v(n);
	for (int& x : v) {
		std::cin >> x;
	}

	std::sort(v.begin(), v.end());

	for (int i = 0; i < v.size() - 1; i++) {
		q += v[i];
	}

	if (q > v[n - 1]) {
		std::cout << "Yes"<< std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){ 
   int w,a,b;
   cin>>w>>a>>b;

   if(a+w<b) cout<<b-a-w;
   else if(a>b+w) cout<<a-b-w;
   else cout<<0;






return 0;
}

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

int main(void)
{
  std::string str;
  
  std::cin >> str;
  for(int index = 0; str.length() > index; ++index)
  {
    if(('R' == str[index] && 1 == index % 2)
       || ('L' == str[index] && 0 == index % 2))
    {
      std::cout << "No";
      return 0;
    }
  }
  std::cout << "Yes";
  return 0;
}

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

int main() {
int X,Y;
cin>>X>>Y;
for(int i=0;i<X+1;i++){
  int m=X-i;
  if(Y==i*4+m*2){
  cout  <<  "Yes"  <<  endl;
  break;
  }
   else if(i==X){
   cout <<"No"<<endl;
  break;
  }
}
}

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

// flag?????¨????????????????????????
int bubbleSort(int A[], int N){
    int sw = 0;
    bool flag = 1;
    for(int i = 0; flag; i++){
       flag = 0;
       for(int j=N-1; j >= i+1; j--){
           if(A[j] < A[j-1]){
               // ??£??\????´????????????????
               swap(A[j], A[j-1]);
               flag = 1;
               sw++;
           }
       }
    }
    return sw;
}

int main(void){
    int A[100], N, sw;
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    sw = bubbleSort(A, N);
    
    for(int i = 0; i < N; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    
    return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;cin >> a >> b;
    vector<int> c(14);
    REP(i,12){
        c[i+2]=i;
    }
    c[1]=13;
    if(c[a]>c[b]){
        cout << "Alice" << endl;
    }
    else if(c[a]<c[b]){
        cout << "Bob" << endl;
    }
    else{
        cout << "Draw" << endl;
    }
}

Measured memory_bytes: 3584