akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s1;
    string s2;
    long long int a, b, c;
    cin >> a;
    
    if(a>=1200){
    	cout << "ARC" << "\n";
    }else{
    	cout << "ABC" <<"\n";
    }
    
  


   bye;

}


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

constexpr int MAX_N = 20;

int V[MAX_N], C[MAX_N];

int main() {
  int N;
  cin >> N;
  for (int i{}; i < N; ++i) cin >> V[i];
  for (int i{}; i < N; ++i) cin >> C[i];

  int len{N};

  int ans{};
  for (int i{}; i < (1 << len); ++i) {
    int Z{};
    for (int j{}; j < len; ++j) {
      if (i & (1 << j)) {
        Z += V[j];
        Z -= C[j];
      }
    }
    if (ans < Z) ans = Z;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 main(){
    int n;
    cin>>n;
    V<int> a(n),b(n),c(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++)cin>>c[i];
    ll ans=0;
    sort(all(a));sort(all(c));
    for(int i=0;i<n;i++){
        ll itl=upper_bound(all(a),b[i]-1)-a.begin();
        ll itr=c.end()-lower_bound(all(c),b[i]+1); 
        ans+=itr*itl;
        //cout<<
    }
    cout<<ans<<endl;
    }


Measured memory_bytes: 1408
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var N int64;
    N = nextInt();
    H := make([]int64,N);
    for i := 0 ; i < int(N) ; i++ {
        H[i] = nextInt();
    }
	solve(N, H);

}

func solve(N int64, H []int64){
	for i := int(N)-2; i >= 0; i-- {
		if H[i] <= H[i+1] {
			continue
		}else if H[i]-1 == H[i+1] {
			H[i] --
		}else {
			Println("No")
			return
		}
	}
	Println("Yes")
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int64 {
	a, err := strconv.ParseInt(next(),10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
map<int,int>mp;
int counter=0,i,j,n;
scanf("%d",&n);
for(i=1;i<106;++i){
    for(int j=1;j<106;++j){
        for(int k=1;k<106;++k){
            mp[(i*i)+(j*j)+(k*k)+(i*j)+(i*k)+(j*k)]+=1;
        }
    }
}
for(i=1;i<=n;++i){
    printf("%d\n",mp[i]);
}


    return 0;
}


Measured memory_bytes: 5736
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <cstring>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
    return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
    return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
    return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
    return forall_a_in_P.second > forall_b_in_P.second;
}


int main()
{
    int n,m;
    cin>>n>>m;
    map<int,int>isAC;
    map<int,int>WAcnt;
    vector<int>pena(n);
    rep(i,m){
        int p;
        string s;
        cin>>p>>s;
        p--;
        if(s=="AC"&&isAC[p]==0){
            isAC[p]++;
            pena[p]=WAcnt[p];
        }else{
            WAcnt[p]++;
        }
    }
    int ac=0;
    int pn=0;
    rep(i,n){
        if(isAC[i]){
            ac++;
            pn+=pena[i];
        }
    }
    cout<<ac<<" "<<pn<<endl;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
#define int long long
#define fo(i,n)   for(i=0;i<n;i++)
#define mod       1000000007
using namespace std;

int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("ati.txt", "r", stdin);
	freopen("ato.txt", "w", stdout);
#endif

	int n, m, x, i;
	cin >> n >> m >> x;
	int a[n + 1];
	for (int i = 0; i <= n; i++)
		a[i] = 0;
	int toll[m];

	for (int i = 0; i <  m; i++)
		cin >> toll[i];

	for (int i = 0; i < m; i++)
	{
		a[toll[i]]++;
	}
	int sum1 = 0, sum2 = 0;

	for (int i = x; i >= 0; i--)
	{
		sum1 += a[i];
	}
	for (int i = x; i <= n; i++)
	{
		sum2 += a[i];
	}
	int final = min(sum1, sum2);
	cout << final << endl;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int main() {
   int n;
   cin >> n;
   bool exist = false;
   rep (i, n) {
      char c;
      cin >> c;
      if (c == 'Y') exist = true;
   }
   puts(exist?"Four":"Three");

   return 0;
}

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

int main() {
  long l,r,ans=2100;
  cin >> l >> r;
  if(l+(2019-l%2019)<=r||l%2019==0) {
    cout << 0 << endl;
  } else {
    for(int i=l%2019;i<=r%2019;i++) {
      for(int j=i+1;j<=r%2019;j++) {
        if((i*j)%2019<ans) ans=(i*j)%2019;
      };
    };
    cout << ans << endl;
  };
}

Measured memory_bytes: 256
/* be name khoda */

// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

// -----------------------------------------------------------------------

const ll maxn = 100010;

ll n, grd[maxn];
vi g[maxn];

void dfs(ll x, ll par) {
    for (auto y : g[x]) if (y != par) {
        dfs(y, x);
        grd[x] ^= grd[y] + 1;
    }
}

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

    cin >> n;
    fori (i, n - 1) {
        ll a, b; cin >> a >> b; --a, --b;
        g[a].eb(b), g[b].eb(a);
    }
    dfs(0, 0);
    cout << (grd[0] == 0 ? "Bob\n" : "Alice\n");

}


Measured memory_bytes: 17260
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] H = new int[N];
            for (var i = 0; i < N; i++)
            {
                H[i] = int.Parse(input[i]);
            }
            int ans = 0;
            int ct = 0;
            int prev = H[0];
            for (var i = 1; i < N; i++)
            {
                if (prev >= H[i])
                {
                    ct++;
                    ans = Math.Max(ans, ct);
                }
                else
                {
                    ct = 0;
                }
                prev = H[i];
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 23004
#include<bits/stdc++.h>
#define mx 100000
#define pb push_back
#define siz(v) v.size();
#define print(a) printf("%d",a)
#define sc1(a) scanf("%d",&a)
using namespace std;

typedef unsigned long  ull;
typedef long long int lli;

int main()
{
 
	
	lli x,y;
	cin>>x>>y;
	if (x==0 || x==y)
		cout<<"0\n";
	else if (x<y)
	{
		if (x*2>y)
			cout<<(y-x)<<endl;
		else
			cout<<x<<endl;
	}
		
	else 
	{
		if (x%y==0)
			cout<<"0\n";
		else
		{
			lli mod=(x%y);
			cout<<y-mod<<endl;
		}
	}

	
 return 0;
 }
  

Measured memory_bytes: 256
import bisect

n = int(input())

l = sorted(list(map(int, input().split())))
ans = 0

for i in range(n):
  for j in range(i+1, n):
    k = bisect.bisect_left(l, l[i]+l[j])
    #if k > j:
    ans += k - j - 1

print(ans)


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

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

int a[100002];
int b[100002];

signed main(){
    int n,k;
    cin>>n>>k;
    REP(p,n+2)a[p]=b[p]=1e18;
    int i=0,j=0;
    REP(_iran,n){
        int x;
        cin>>x;
        if(x<0)a[++i]=-x;
        else b[++j]=x;
    }
    reverse(a+1,a+i+1);
    int r=1e18;
    for(int m=1;m<=k-1;m++){
        r=min(r,a[m]+b[k-m]*2);
        r=min(r,a[m]*2+b[k-m]);
    }
    r=min({r,a[k],b[k]});
    cout<<r<<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

int main(){
    int n, m, q;
    while(cin >> n >> m >> q, n||m||q){
        int a[37][1005];
        memset(a, -1, sizeof(a)); //1:テ・ツ渉ッティツδステヲツ?ァテ」ツ?づ」ツつ?0:テ・ツ渉ッティツδステヲツ?ァテ」ツ?ェテ」ツ??-1:テ」ツつ湘」ツ?凝」ツつ嘉」ツ?ェテ」ツ??

        if(q == 0 && n == 1){
            rep(i,m) cout << 0;
            cout << endl;
            continue;
        }
        string sb, bb;
        rep(i,n) sb+='0';
        rep(j,m) bb+='0';
        rep(i,q){
            string s, b;
            cin >> s >> b;
            rep(j,n){
                if(s[j] == '1'){
                    rep(k,m){
                        if(b[k] != bb[k]){
                            //cout << j << ' ' << k << endl;
                            if(a[j][k] != 0) a[j][k] = 1;
                        }else{
                            if(a[j][k] != 0) a[j][k] = 0;
                        }
                    }
                }else{
                    rep(k,m){
                        if(b[k] != bb[k]){
                            //cout << j << ' ' << k << endl;
                            if(a[j][k] != 0) a[j][k] = 0;
                        }else{
                            if(a[j][k] != 0) a[j][k] = 1;
                        }
                    }
                }
            }
            sb = s;
            bb = b;
        //rep(i,3){ rep(j,10){ cout << a[i][j]; } cout << endl; } cout << endl;
        }

        rep(j,m){
            int is_not_zero = 0;
            char c = '?';
            rep(i,n){
                if(a[i][j] != 0) {
                    is_not_zero++;
                    if(c == '?'){
                        if(i >= 0 && i <= 9) c = i + '0';
                        else c = (i - 10) + 'A';
                    }
                }
            }
            if(is_not_zero == 1) cout << c;
            else cout << '?';
        }
        cout << endl;
    }
}

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

using namespace std;

int A, B, V, W, T;

int main() {
  scanf("%d%d%d%d%d", &A, &V, &B, &W, &T);
  if (V <= W)
    puts("NO"); else
    puts((double)abs(A - B) / (V - W) <= T ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <array>
#include <cstdio>
#include <cmath>
#include <vector>

int main() {
  size_t n;
  scanf("%zu", &n);
  std::vector<std::array<double, 2>> xy(n);
  for (size_t i = 0; i < n; ++i) {
    scanf("%lf %lf", &xy[i][0], &xy[i][1]);
  }
  std::vector<size_t> idx(n);
  for (size_t i = 0; i < n; ++i) {
    idx[i] = i;
  }

  double sum = 0.0;
  size_t cnt = 0;
  do {
    for (size_t i = 1; i < n; ++i) {
      double x0 = xy[idx[i - 1]][0];
      double x1 = xy[idx[i]][0];
      double y0 = xy[idx[i - 1]][1];
      double y1 = xy[idx[i]][1];
      sum += std::sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1));
    }
    cnt += 1;
  } while (std::next_permutation(idx.begin(), idx.end()));

  double ans = sum / cnt;
  printf("%.10f\n", ans);
}


Measured memory_bytes: 888
from collections import defaultdict

while True:
    n = int(input())
    if n == 0:
        break
    
    c = input().split()
    d = defaultdict(int)
    d["hoge"] = 0
    flag = False
    for i in range(n):
        d[c[i]] += 1
        ranking = sorted(d.items(), key=lambda x: x[1], reverse=True)
        if ranking[0][1] > ranking[1][1] + (n - 1 - i):
            print(ranking[0][0] + " " + str(i + 1))
            flag = True
            break
    if not flag:
        print("TIE")


Measured memory_bytes: 5996
(defun fact (n)
  (let ((x 1))
    (loop for i from 1 to n
      do (setf x (mod (* x i) 1000000007)))
    x))

(defun func (n m)
  (case (abs (- n m))
    (0 (mod (* (expt (fact n) 2) 2) 1000000007))
    (1 (mod (* (fact n) (fact m)) 1000000007))
    (otherwise 0)))

(format t "~A~%" (func (read) (read)))

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

using namespace std;

const int mod = 998244353;

long long fact[500050],inv[500050];

long long qpow(long long base,int tms)
{
	long long tmp = 1;
	while(tms)
	{
		if(tms & 1) tmp = tmp * base % mod;
		base = base * base % mod;
		tms >>= 1;
	}
	return tmp;
}

int main()
{
	int n,k;
	fact[0] = 1;
	for(int i = 1;i <= 500000; ++ i)
		fact[i] = fact[i - 1] * 1ll * i % mod;
	inv[500000] = qpow(fact[500000],mod - 2);
	inv[0] = 1;
	for(int i = 499999;i >= 1; -- i)
		inv[i] = inv[i + 1] * 1ll * (i + 1) % mod;
	scanf("%d%d",&n,&k);
	long long ans = 0;
	for(int i = n;i <= k; ++ i) ans = (ans + fact[k - 1] * inv[k - i] % mod * inv[i - 1] % mod) % mod;
	printf("%lld\n",(ans) % mod);
	return 0;
}

Measured memory_bytes: 8064
// Organize Your Train part II
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1142&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#include<set>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

string reverse(string train) {
    string res = "";
    for (int i = train.size() - 1; i >= 0; --i) {
        res += train[i];
    }
    return res;
}

int main() {
    int M;
    cin >> M;
    for (int nth = 0; nth < M; ++nth) {
        set<string> result;
        string train;
        cin >> train;

        for (int i = 0; i < train.size(); ++i) {
            string t1 = train.substr(0, i);
            string t2 = train.substr(i);
            string rt1 = reverse(t1);
            string rt2 = reverse(t2);
            result.insert({
                    t1 + t2, 
                    rt1 + t2, 
                    t1 + rt2,
                    rt1 + rt2,
                    t2 + t1,
                    rt2 + t1,
                    t2 + rt1,
                    rt2 + rt1
                    });
        }
        cout << result.size() << endl;
    }
	return 0;
}

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  if(N%2!=0){
    cout << "No" << endl;
  }else{
    if(S.substr(0,N/2)==S.substr(N/2,N/2)){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, l, r;
  cin >> n;

  int ans = 0;
  rep(i, n) {
    cin >> l >> r;
    ans += r - l + 1;
  }

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


Measured memory_bytes: 384
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

import re

def main():
    ipt = re.split('[ .]', input())
    a = int(ipt[0])
    b = int(ipt[1]) * 100 + int(ipt[2])
    print(a * b // 100)

main()

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

using namespace std;

long long k, a[55], x, y;

int main () {
    cin >> k;
    cout << 50 << "\n";
    x = k / 50;
    x += 49;
    y = k % 50;
    for (int i = 0; i < 50; i++) {
        if (i < y) {
            a[i]+= 51;
            for (int j = 0; j < 50; j++) {
                a[j]--;
            }
        }
        a[i] += x;
        //if (a[i] == 49) a[i] = 0;
    }
    for (int i = 0; i < 50; i++) cout << a[i] << ' ';
    /*if (k % 2 == 0) {
        cout << 2 << "\n" << (1 + k / 2) << " " << (1 + k / 2);
    } else {
        cout << 2 << "\n" << (3 + k / 2) << " " << (k / 2);
    }*/
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <algorithm>
#define mp make_pair

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;

const int MAXN = 1e5 + 7;

template<typename T> inline T read() {
	T res = 0, flag = 1; char in = getchar();
	while(!isdigit(in)) { if(in == '-') flag = -1; in = getchar(); }
	while(isdigit(in)) { res = (res << 1) + (res << 3) + in - '0'; in = getchar(); }
	return res * flag;
}

template<typename T> inline void chkmax(T &a, T b) { if(a < b) a = b; }
template<typename T> inline void chkmin(T &a, T b) { if(a > b) a = b; }

int dp[MAXN], h[MAXN], n;

inline void solve() {
	n = read<int>();
	for(int i = 1; i <= n; ++i) h[i] = read<int>();
	memset(dp, 0x3f, sizeof dp);
	dp[0] = dp[1] = 0;
	for(int i = 2; i <= n; ++i) {
		chkmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if(i - 2) chkmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	printf("%d\n", dp[n]);
}

int main() {

	solve();

	return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
int max(int x,int y){
  if(x>y) return x;
  return y;
}
int main(){
  int box[100001]={},maxi=0;
  int n,a,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(a!=0) box[a-1]++;
    box[a]++;
    box[a+1]++;
  }
  for(i=0;i<=100000;i++)
    maxi=max(maxi,box[i]);
  printf("%d\n",maxi);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define mo 998244353
#define M 8005
#define N 205
int ksm(int a,int k) {
    int s=1;
    while(k)
	{
	    if(k&1) s=1ll*s*a%mo;
	    a=1ll*a*a%mo;
	    k>>=1;
	}
    return s;
}
int n,m,ans;
int f[N][M],jc[M],nc[M];
int C(int n,int m) {
    if(n<0||m<0||n<m) return 0;
    return 1ll*jc[n]*nc[m]%mo*nc[n-m]%mo;
}
int lim,r[M*4],l,A[M*4],B[M*4];
void NTT(int *x,int k) {
    for(int i=0;i<lim;i++) if(i<r[i]) swap(x[i],x[r[i]]);
    for(int i=1;i<lim;i<<=1)
	{
	    int y=ksm(3,(mo-1)/(2*i));
	    if(k==-1) y=ksm(y,mo-2);
	    for(int j=0;j<lim;j+=i<<1)
		{
		    int z=1;
		    for(int l=0;l<i;l++,z=1ll*z*y%mo)
			{
			    int d1=x[j+l],d2=1ll*z*x[i+j+l]%mo;
			    x[j+l]=(d1+d2)%mo;
			    x[i+j+l]=(d1-d2+mo)%mo;
			}
		}
	}
    if(k==-1)
	{
	    int inv=ksm(lim,mo-2);
	    for(int i=0;i<lim;i++) x[i]=1ll*x[i]*inv%mo;
	}
}
void work() {
    f[0][0]=1;
    for(int t=1;t<=m;t++)
	{
	    lim=1,l=0;
	    while(lim<=n+n) lim<<=1,l++;
	    for(int i=1;i<=lim;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
	    for(int i=0;i<=n;i++) A[i]=1ll*f[t-1][i]*nc[i]%mo;
	    for(int i=1;i<=n;i++) B[i]=nc[i+2];
	    NTT(A,1),NTT(B,1);
	    for(int i=0;i<lim;i++) A[i]=1ll*A[i]*B[i]%mo;
	    NTT(A,-1);
	    for(int i=1;i<=n;i++) f[t][i]=(1ll*A[i]*jc[i+2]%mo+1ll*(C(i+1,2)+1)*f[t-1][i]%mo)%mo;
	    f[t][0]=1;
	    for(int i=0;i<lim;i++) A[i]=B[i]=0;
	}
    for(int i=0;i<=n;i++) ans=(ans+1ll*f[m][i]*C(n,i)%mo)%mo;
    cout<<ans<<'\n';
}
int main()
{
    jc[0]=1;
    for(int i=1;i<M;i++) jc[i]=1ll*jc[i-1]*i%mo;
    nc[M-1]=ksm(jc[M-1],mo-2);
    for(int i=M-2;i>=0;i--) nc[i]=1ll*nc[i+1]*(i+1)%mo;
    cin>>n>>m;
    work();
    return 0;
}

Measured memory_bytes: 6784
s = gets.chomp.split(//).map(&:to_sym)
t = gets.chomp.split(//).map(&:to_sym)

table = Array.new(s.length){{}}
last = {}
last.default = 0
first = {}
size = s.size
ss = s + s
1.upto(ss.size).each do |i|
  last[ss[i]].upto([i-1, size-1].min).each do |j|
    table[j][ss[i]] ||= i - j
  end
  last[ss[i]] = i
end

size.times do |i|
  first[s[i]] ||= i
end

unless first.has_key? t[0]
  puts -1
  exit
end

ans = first[t[0]]
(t.size-1).times do |i|
  unless first.has_key? t[i+1]
    puts -1
    exit
  end
  ans += table[ans%size][t[i+1]]
end

puts ans + 1


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

int main(){
    int h;
    cin >> h;
    int w;
    cin >> w;
    vector<string> a(h);
    for(int i = 0; i < h; i++) cin >> a[i];
    vector<bool> row(h, false);
    vector<bool> col(w, false);
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(a[i][j] == '#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }
    for(int i = 0; i < h; i++){
        if(row[i]){
            for(int j = 0; j < w; j++){
                if(col[j]){
                    cout << a[i][j];
                }
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T> bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

int main() {
    int a, b;
    cin >> a >> b;
    if (a <= 5)
        cout << 0 << endl;
    else if (a <= 12)
        cout << b / 2 << endl;
    else
        cout << b << endl;
    return 0;
}

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

int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<int> V(N + 1);
  for (int i = 1, cnt = 0; i < N; i++)
    V.at(i + 1) = (S.at(i - 1) == 'A' && S.at(i) == 'C') ? ++cnt : cnt;
  for (int l, r; cin >> l >> r;) cout << V.at(r) - V.at(l) << "\n";
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
# define ll long long 
# define vi vector<int>
# define pii pair<int,int> 
#define mp make_pair
#define pb push_back
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
	ll n , a, b ; 
	cin >> n >> a >> b ;
	ll ans = 1e18 ; 
	if(abs(a-b)%2 == 0)  {
		ans = min(ans , abs(a-b)/2) ; 
	} 
	ans = min(ans, min(a-1, n-b)+1 + (b-a-1)/2) ; 
	cout << ans ; 
	return 0 ; 
}


Measured memory_bytes: 3580
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
using namespace std;
typedef long long ll;
int inf = 1000000000;
template<typename T>
T GCD(T a, T b) {
	while (max(a, b) % min(a, b)) {
		if (a > b)a = a % b;
		else b = b % a;
	}
	return min(a, b);
}
template<typename T>
T LCM(T a, T b) {
	return a / GCD(a, b)*b;
}
ll ruiseki[100010], ruiseki2[100010];
int main() {
	ll n, m, ans = 0;
	cin >> n >> m >> ruiseki[0];
	ruiseki[0] %= m;
	ruiseki2[0] = ruiseki[0];
	for (int i = 1; i < n; i++) {
		int a;
		cin >> a;
		ruiseki[i] = a + ruiseki[i - 1];
		ruiseki[i] %= m;
		ruiseki2[i] = ruiseki[i];
	}
	sort(ruiseki, ruiseki + n);
	for (int i = 0; i < n; i++) {
		ll f = upper_bound(ruiseki, ruiseki + n, ruiseki[i]) - lower_bound(ruiseki, ruiseki + n, ruiseki[i]);
		ans += max((f * (f - 1)) / 2, (ll)0);
		if (i == n - 1)break;
		while (ruiseki[i] == ruiseki[i + 1]) {
			i++;
			if (i == n - 1)break;
		}
	}
	for (int i = 0; i < n; i++) {
		if (ruiseki[i] == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 666666
#define inf 9999999999999
int a[N],b[N];
signed main(){
	int n,m;
	cin>>n>>m;
	int id=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]==1) id=i;
	} 
	int ans=(n-1)/(m-1);
	if((n-1)%(m-1)) ans++;

	cout<<ans;
	return 0;
}
/*
6 2
6 2 1 5 4 3
*/

Measured memory_bytes: 2304
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,i,a[25];
map<pair<pair<long long,long long>,pair<long long,long long> >,long long>mp;
long long dg(long long l,long long r,long long x,long long y){
	if(l+1>=r)
		return 0;
	if(mp[make_pair(make_pair(l,r),make_pair(x,y))]==0){
		long long min1=1000000000000000000LL;
		for(long long j=l+1;j<r;j++)
			min1=min(min1,dg(l,j,x,x+y)+dg(j,r,x+y,y)+(x+y)*a[j]);
		mp[make_pair(make_pair(l,r),make_pair(x,y))]=min1+1;
	}
	return mp[make_pair(make_pair(l,r),make_pair(x,y))]-1;
}
int main(){
   	n=read();
   	for(i=1;i<=n;i++)
   		a[i]=read();
   	pus(dg(1,n,1,1)+a[1]+a[n],2);
    return 0;
}

Measured memory_bytes: 20608
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define MOD 1000000007
#define vec(a) vector<int>a
using namespace std;



int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	ll n,m,i,j,k,l;
	cin>>n>>m;
	ll arr[n+1]={0},z=0,x=0,arr1[n+1]={0};
	for(i=0;i<m;i++)
	{
		string s;
		cin>>k>>s;
		if(arr[k]==0 && s=="WA")
			arr1[k]++;
		else if(arr[k]==0 && s=="AC")
		{
			arr[k]=1;
			x+=arr1[k];
			z++;
		}
	}
	cout<<z<<" "<<x;
}
	

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


int main() {
    int n=3;
    vector<int> v(3);
    rep(i,3){
        cin >> v.at(i);
    }
    sort(v.begin(),v.end());
    int x=2*v.at(2)-v.at(1)-v.at(0);
    if(x%2==1) x+=3;
    cout << x/2 << endl;
}

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 rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	sort(rrng(a));

	ll ans = a[0];
	int cnt = 2;
	for (int i = 1; i < n; ++i) {
		if (cnt == n) break;
		ans += a[i];
		cnt++;
		if (cnt == n) break;
		ans += a[i];
		cnt++;
	}

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


Measured memory_bytes: 4840
#include<iostream>
#include<cstdio>
#include<string.h>
using namespace std;
int x[100005];
int y[100005];
int main()
{
	int n,sum=0,g=0;
	cin>>n;
	cin>>x[0];
	for(int i=1;i<n;i++)
	{
		cin>>x[i];
		if(x[i]<=x[i-1])
		{
			sum++;
		}
		if(x[i]>x[i-1])
		{
			y[g++]=sum;
			sum=0;
		}
		if(i==n-1)
		{
			y[g++]=sum;
		}	
	}
	int max=y[0];
	for(int i=0;i<g;i++)
	{
		if(y[i]>max)
		max=y[i];
	}
	cout<<max;
	
	
	
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
	int a,b,c;
	
    scanf("%d %d %d",&a,&b,&c);
 
    if( (a==5&&b==5&&c==7)||(a==5 && b==7&& c==5)||(a==7&&b==5&&c==5) )
    {
    	printf ("YES\n");
    }
    else
    {
    	printf ("NO\n");
    }
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,a=0,t=0,r=0,w=0;
    cin>>n;
    while(n--)
    {
        string str;
        cin>>str;
        if(str[0]=='A')
        {
            a++;
        }
        else  if(str[0]=='W')
        {
            w++;
        }
        else  if(str[0]=='T')
        {
            t++;
        }
        else
        {
            r++;
        }
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;
    return 0;
}



Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>

int main()
{
	int n;
	char s1[101];
	char p[101];
	char s2[202];
	gets(s1);
	gets(p);
	sprintf(s2, "%s%s", s1, s1);
	if (strstr(s2, p) != NULL) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 964
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		ARC069DSolve system = new ARC069DSolve();
		system.main();
	}
}

class ARC069DSolve {
	
	int N;
	char[] s;
	
	ARC069DSolve() {
		Scanner cin = new Scanner(System.in);
		this.N = cin.nextInt();
		this.s = cin.next().toCharArray();
	}
	
	void main() {
		
		String[] a = new String[]{"00", "01", "10", "11"};
		for (int i = 0; i < 4; i++) {
			int[] arr = new int[N];
			for (int j = 0; j < 2; j++) {
				arr[j] = Integer.valueOf(String.valueOf(a[i].charAt(j)));
			}
			
			for (int j = 1; j < N - 1; j++) {
				char c = s[j];
				int num = arr[j-1] + arr[j];
				if (c == 'o') {
					if (num % 2 == 0) {
						arr[j + 1] = 0;
					} else {
						arr[j + 1] = 1;
					}
				} else {
					if (num % 2 == 0) {
						arr[j + 1] = 1;
					} else {
						arr[j + 1] = 0;
					}
				}
			}
			
			int num = 0;
			char c = 0;
			num = arr[N - 2] + arr[N - 1] + arr[0];
			c = s[N - 1];
			if (c == 'o') {
				if (num % 2 != 0) {
					continue;
				}
			} else {
				if (num % 2 == 0) {
					continue;
				}
			}
			
			num = arr[N - 1] + arr[0] + arr[1];
			c = s[0];
			if (c == 'o') {
				if (num % 2 != 0) {
					continue;
				}
			} else {
				if (num % 2 == 0) {
					continue;
				}
			}
			
			for (int j = 0; j < N; j++) {
				if (arr[j] == 0) {
					System.out.print("S");
				} else {
					System.out.print("W");
				}
			}
			System.out.println();
			return;
		}
		System.out.println(-1);
	}
}


Measured memory_bytes: 36432
#pragma region template 1.0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    ll N;
    cin >> N;
    vi a(N);
    REP(i, N)
    {
        cin >> a[i];
    }

    vector<vector<vector<double>>> dp(N + 1, vector<vector<double>>(N + 1, vector<double>(N + 1)));
    REP(i, N + 1)
    {
        REP(j, N + 1)
        {
            REP1(k, N)
            {
                dp[i][j][k] = N;
                if (i > 0)
                {
                    dp[i][j][k] += i * dp[i - 1][j][k];
                }
                if (j > i)
                {
                    dp[i][j][k] += (j - i) * dp[i][j - 1][k];
                }
                if (k > j)
                {
                    dp[i][j][k] += (k - j) * dp[i][j][k - 1];
                }
                dp[i][j][k] /= k;
            }
        }
    }
    vi c(4);
    REP(i, N)
    {
        ++c[a[i]];
    }
    double ans = dp[c[3]][c[3] + c[2]][N];
#pragma region precision 1.0
    cout << fixed << setprecision(15) << ans << endl;
#pragma endregion precision
}
#pragma endregion template

Measured memory_bytes: 218880
N,M = map(int,input().split())
ab = []
for i in range(N):
    a,b = map(int,input().split())
    ab.append((a,b))
cd = []
for i in range(M):
    c,d = map(int,input().split())
    cd.append((c,d))
ans = []
for i in range(len(ab)):
    aaa = 1000000000
    for j in range(len(cd)):
        man = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if(man < aaa):
            aaa = man
            cnt = j + 1
    ans.append(cnt)
for i in ans:
    print(i)

Measured memory_bytes: 39280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt(),M=sc.nextInt(),ans=0;
		int[] counter = new int[31];
		for(int i=0; i<N;i++) {
			int num = sc.nextInt();
			for(int j=0 ;j<num; j++) {
				counter[sc.nextInt()]++;
			}
		}
		for (int i : counter) {
			if(i == N) ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int a, b;
	int c = 0, d = 0;
	int n = 0;
	while (scanf("%d,%d", &a, &b)!=EOF) {
		c += a*b;
		d += b;
		n++;
	}
	cout << c << endl << int((ld(d)+0.5*n) / n) << endl;
	return 0;
}

Measured memory_bytes: 3092
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func lineToInts(line string) []int {
	var res []int
	for _, s := range strings.Split(line, " ") {
		i, _ := strconv.Atoi(s)
		res = append(res, i)
	}
	return res
}

func calc(as, bs[]int, m, c int) bool {
	num := 0
	for i := 0; i < m; i++ {
		num += as[i] * bs[i]
	}
	num = num + c
	return num > 0
}

func main() {
	input := lineToInts(nextLine())
	n, m, c := input[0], input[1], input[2]
	bs := lineToInts(nextLine())
	result := 0

	for i := 0; i < n; i++ {
		as := lineToInts(nextLine())
		if calc(as, bs, m, c) {
			result++
		}
	}
	fmt.Println(result)
}


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

int main(void) {
	int n, m, tmp;
	vector<int> A, B;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &tmp);
		A.push_back(tmp);
	}
	scanf("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf("%d", &tmp);
		B.push_back(tmp);
	}

	if (includes(A.begin(), A.end(), B.begin(), B.end())) 
		printf("1\n");
	else
		printf("0\n");

}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define P pair<int, int>
struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int n, m;
	cin >> n >> m;
	vector<P> yp[100001];
	P ans[100001] = {};
	int p, y;
	for(int i = 1; i <= m; i++){
		cin >> p >> y;
		yp[p].pb(P(y, i));
		ans[i].first = p;
	}
	for(int i = 1; i <= n; i++){
		sort(yp[i].begin(), yp[i].end());
		for(int j = 0; j < yp[i].size(); j++){
			ans[yp[i][j].second].second = j+1;
		}
	}

	for(int i = 1; i <= m; i++){
		int f = ans[i].first;
		int b = ans[i].second;
		int cpf = f, cpb = b;
		int cnf = 0, cnb = 0;
		while(cpf){
			cnf++;
			cpf /= 10;
		}
		while(cpb){
			cnb++;
			cpb /= 10;
		}
		for(int j = 0; j < 6-cnf; j++)
			cout << 0;
		cout << f;
		for(int j = 0; j < 6-cnb; j++)
			cout << 0;
		cout << b << endl;
	}

	return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
ll dp[1000000][13];

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

    ll x[s.size()];
    rep(i, 0, s.size()){
        if(s[i] == '?'){
            x[i] = -1;
        }else{
            x[i] = s[i] - '0';
        }
    }

    dp[0][0] = 1;

    rep(i, 0, s.size()){
        rep(j, 0, 13){
            if(x[i] == -1){
                rep(k, 0, 10){
                    dp[i + 1][(k + j * 10) % 13] += dp[i][j];
                    dp[i + 1][(k + j * 10) % 13] %= 1000000007;
                }
            }else{
                dp[i + 1][(x[i]+ j * 10) % 13] += dp[i][j];
                dp[i + 1][(x[i]+ j * 10) % 13] %= 1000000007;
            }
        }
    }

    cout << dp[s.size()][5] << endl;
    return 0;
}


Measured memory_bytes: 11520
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
// ユークリッドの互除法で最大公約数を求める
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
// 最小公倍数
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main()
{
  ll a,b,c,d;cin >> a >> b >> c >> d;
  ll an = (a-1)/c+(a-1)/d-(a-1)/lcm(c,d);
  an = a-1-an;
  ll bn = b/c+b/d-b/lcm(c,d);
  bn = b-bn;
  cout << bn-an << "\n";
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
S = input()

now = N
ans = []
while now > 0:
    for i in range(M, 0, -1):
        if now-i >= 0:
            if S[now-i] == '0':
                ans.append(i)
                now -= i
                break
            if i == 1:
                print(-1)
                exit()

print(*ans[::-1])




Measured memory_bytes: 74860
n = int(input())
a = [int(i) for i in input().split()]
b = [0 for i in range(n)]
	
for i in range(n)[::-1]:
	sm = 0
	for j in range(n):
		if (j + 1) * (i + 1) <= n:
			sm += b[(j + 1) * (i + 1) - 1]
		else:
			break
	if sm % 2 != a[i]:
		b[i] += 1

ans = [str(i + 1) for i, bb in enumerate(b) if bb == 1]
nans = len(ans)
print(nans)
if nans != 0:
	print(' '.join(ans))
		
	

Measured memory_bytes: 17204
def main():
    n=int(input())
    h=list(map(int,input().split(' ')))
    dp = [0 for i in range(n)]
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))
    print(dp[n-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 13976
#include<bits/stdc++.h>
using namespace std;
const int N=2005;
int n,b[N][N],flag2[N],a[N],flag[N];
priority_queue<int>q;
vector<int>Ans[N];
void dfs(int x){
	flag2[x]=1;
	for (int i=1;i<=n;i++)
		if (!flag2[i]&&b[x][i]){
			flag[i]++;
			Ans[x].push_back(i);
			dfs(i);
		}
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for (int i=1;i<=n;i++)
		for (int j=i+1;j<=n;j++)
			if (__gcd(a[i],a[j])!=1)b[i][j]=b[j][i]=1;
	for (int i=1;i<=n;i++)
		if (!flag2[i])dfs(i);
	for (int i=1;i<=n;i++)
		if (!flag[i])q.push(i);
	while (!q.empty()){
		int now=q.top();
		q.pop();
		printf("%d ",a[now]);
		for (int i=0;i<Ans[now].size();i++)q.push(Ans[now][i]);
	}
}


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


int main(){
    string s;
    cin >> s;
    for(int i=0; i<(1<<3); i++){
        string ans="";
        int count=s[0]-'0';
        for(int j=0; j<3; j++){
            ans+=s[j];
            if(i&(1<<j)){
                ans+="+";
                //cout << j << endl;
                //cout << s[j+1]-'0' << endl;
                count+=(s[j+1]-'0');
                //cout << count << " ";
            }
            else {
                ans+="-";
                count-=(s[j+1]-'0');
                //cout << count << " ";
            }
        }
        if(count==7){
            ans+=s[3];
            ans+="=7";
            cout << ans << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
 
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  char A, B;
  cin >> A >> B;
  if(A < B) cout << '<' << endl;
  else if(A == B) cout << '=' << endl;
  else cout << '>' << endl;
}

Measured memory_bytes: 256
# 約数列挙(nを含む)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)

            if i != n // i:
                divisors.append(n // i)

    return divisors


def solver(N, A):

    # 答えはA[0]かA[1]の約数
    p0 = make_divisors(A[0])
    p1 = make_divisors(A[1])
    P = list(set(p0 + p1))

    # 約数を大きい方から見る
    for p in sorted(P)[::-1]:
        c = 0
        for a in A:
            if a % p == 0:
                c += 1

        if c == N - 1 or c == N:
            return p


N = int(input())
A = list(map(int, input().split()))

ans = solver(N, A)
print(ans)



Measured memory_bytes: 84484
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
int main() {
  long a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a>=k){
    cout<<k<<endl;
  }
  else if(a+b>=k){
    cout<<a<<endl;
  }
  else{
    cout<<a-(k-a-b)<<endl;
  }
}




Measured memory_bytes: 3676
import java.util.*;
import java.util.HashSet;
import java.util.Set;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        String S=sc.next();
        char[]ss=S.toCharArray();
        int max=0;
        int x=0;
        for(int i=0;i<S.length();i++){
            if(ss[i]=='I'){
                x++;
            }
            if(ss[i]=='D'){
                x--;
            }
            if(max<=x){
                max=x;
            }

        }
        System.out.println(max);

        }
       
        
    }

Measured memory_bytes: 21844
#include <iostream>      
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h> // include all
#define MOD 1000000007
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;


int main(void){

    int N;
    cin >> N;
    int A[N];

    int sum = 0;
    REP(i,N){
        cin >> A[i];
        sum += A[i];
    }
    int Num[N];
    fill(Num,Num+N,0);

    REP(i,N){
        Num[A[i]]++;
    }
    
    FOR(i,1,N){
        if(Num[i] % 2 == 1){
            cout << 0 << endl;
            return 0;
        }
    }
    int ans = 1;
    REP(i,N/2){
        ans *= 2;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
gets.to_i.times do
  n, k = gets.split.map(&:to_i)
  xs = gets.split.map(&:to_i)
  puts (0...n - 1).map {|i| xs[i + 1] - xs[i] }.sort[0..-k].reduce(0) {|acc, x| acc + x }
end

Measured memory_bytes: 21456