akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

char grid[101][101];

int main() {
    int A, B;
    cin >> A >> B;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) grid[i][j] = '.';
    }
    cout << 100 << ' ' << 100 << endl;
    int row = 0, col = 0;
    for (int i = 0; i < B; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (j == 1 && k == 1) grid[row + j][col + k] = '.';
                else grid[row + j][col + k] = '#';
            }
        }
        col += 4;
        if (col == 100) {
            row += 4;
            col = 0;
        }
    }
    if (A - 1 < B) {
        row = 1, col = 1;
        for (int i = 0; i < B - A + 1; i++) {
            grid[row][col] = '#';
            col += 4;
            if (col >= 99) {
                row += 4;
                col = 1;
            }
        }
    }
    else if (A - 1 > B) {
        if (col == 0) row -= 4;
        row += 3, col = 0;
        grid[row][col] = '#';
        row++;
        for (int i = 0; i < 99; i++) grid[row][i] = '#';
        row++;
        for (int i = 0; i < A - B - 1; i++) {
            for (int j = 0; j < 2; j++) {
                for (int k = 0; k < 3; k++) {
                    if (j == 0 && k == 1) continue;
                    grid[row + j][col + k] = '#';
                }
            }
            col += 3;
            if (col >= 99) {
                row += 2;
                col = 0;
            }
        }
    }
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) cout << grid[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
s = str(input())
word = 'keyence'

ans = 'NO'
if s.startswith('keyence'):
    ans = 'YES'
elif s.endswith('keyence'):
    ans = 'YES'
else:
    for i in range(7):
        if s.startswith(word[:i]):
            postword = word[i:]
            if s.endswith(postword):
                ans = 'YES'
            else:
                 continue

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(void){
    
   string s,t;
   cin>>s>>t;
   sort(s.begin(), s.end());
   sort(t.begin(), t.end(),greater<int>());
   for(int i=0;i<min(t.size(),s.size());i++){
       if(s[i]<t[i]){
           cout<<"Yes"<<endl;
           return 0;
       }
       if(s[i]>t[i]){
           cout<<"No"<<endl;
           return 0;
       }
   }
   if(t.size()>s.size())cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}


Measured memory_bytes: 256
# import sys
# input = sys.stdin.readline

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

n = int(input())
x = list(input())
xc = x.count("1")
xu = []
xd = []
if xc == 0:
    for i in range(n):
        print(1)
        exit()
# t = 1
for i in range(n):
    mod = xc+1
    xu.append(pow(2, i, mod))
    # xu.append(t%mod)
    # t *= 2
    # t %= mod
# t = 1
flag = False
for i in range(n):
    mod = xc-1
    if mod == 0:
        xd.append(0)
        flag = True
    else:
        xd.append(pow(2, i, mod))
        # xd.append(t%mod)
        # t *= 2
        # t %= mod
xu.reverse()
xd.reverse()
s_xu = 0
s_xd = 0
for i in range(n):
    if x[i] == "1":
        s_xu += xu[i]
        s_xd += xd[i]

# print(xu)
# print(xd)

for i in range(n):
    cnt = 1
    if x[i] == "0":
        tar = (s_xu+xu[i])%(xc+1)
        #print(tar)
        while tar != 0:
            b_tar = bin(tar)
            tar %= b_tar.count("1")
            cnt += 1
        print(cnt)
    else:
        if flag:
            print(0)
        else:
            tar = (s_xd-xd[i])%(xc-1)
            #print(tar)
            while tar != 0:
                b_tar = bin(tar)
                tar %= b_tar.count("1")
                cnt += 1
            print(cnt)







Measured memory_bytes: 95960
#line 1 "main_b.cpp"
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */

using i64=std::int_fast64_t;
using u64=std::uint_fast64_t;
 
#define rep(i, a, b) for (i64 i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, u64 b,Num id=1) {
  if(b==0)return id;
  Num x = id;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

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

  i64 n;
  std::cin>>n;

  i64 cnt=0;
  while(n--){
    i64 a,b;
    std::cin>>a>>b;
    if(a==b){
      cnt++;
    }else{
      cnt=0;
    }
    if(cnt>=3){
      std::cout<<"Yes\n";
      return 0;
    }
  }

  std::cout<<"No\n";
  
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include<bits/stdc++.h>
#define lli long long
#define fin  freopen("input.txt","r",stdin);
#define fout freopen("output.txt","w",stdout);
#define ini(a) scanf("%d",&a);
#define ini2(a,b) scanf("%d%d",&a,&b);
#define inl(a) scanf("%lld",&a);
#define inl2(a,b) scanf("%lld%lld",&a,&b);
#define all(a) a.begin(),a.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SIZE 200010
using namespace std;


int main()
{

int k;
cin>>k;
 string s;
 cin>>s;
 if(s.size()<=k)cout <<s;
 else
 {
     string ki=s.substr(0,k);
     ki+="...";
     cout <<ki;
 }

}



Measured memory_bytes: 3600
//$ node 181222B.js < 181222B.txt
function Main(input) {
  input = input.split('\n') // 1行目がinput[0], 2行目がinput[1], …に入る
  for(var i=0;i<input.length;i++){
    var tmp = input[i].split(' ')
    input[i] = []
    for(var ii=0;ii<tmp.length;ii++){
      input[i].push(tmp[ii])
    }
  }
  input = input[0]
  var ans = 0
  var i = 0
  var sec = 0
  while(sec<input[2]*1){
    sec++
    i++
    if(i==input[0]*1){
      ans += input[1]*1
      i=0
    }
  }
  console.log(ans)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
a,b,m = map(int,input().split())
i = list(map(int,input().split()))
j = list(map(int,input().split()))
v = []
for k in range(m):
  x,y,c = map(int,input().split())
  v.append(i[x-1]+j[y-1]-c)
v.append(min(i)+min(j))
print(min(v))

Measured memory_bytes: 18736
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
    }
    
    int min = vec.at(0);
    int max = vec.at(0);
    
    for(int j = 0;j < N;j++){
        if(vec.at(j) <= min) min = vec.at(j);
        else min = min;
        
        if(vec.at(j) >= max) max = vec.at(j);
        else max = max;
    }
    
    cout << max - min << endl;
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}

signed main() {
    int n, m;
    cin >> n >> m;

    int fl[100001];
    memset(fl, 0, sizeof(int) * 100001);

    int pe = 0;
    int ac = 0;

    rep(i, m) {
        int p; string s;
        cin >> p >> s;

        if (s == "AC") {
            if (fl[p] >= 0) {
                ++ac;
                pe += fl[p];
                fl[p] = -1;
            }
        } else {
            if (fl[p] >= 0) ++fl[p];
        }
    }

    cout << ac << " " << pe;

    return 0;
}


Measured memory_bytes: 3988
#include<stdio.h>
int main(void)
{
	int ball[10];
	int i,j;
	int B,C;
	int n,flag;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		flag=1;
		for(j=0;j<10;j++)
		{
			scanf("%d",&ball[j]);
		}
		B=C=0;
		for(j=0;j<10;j++)
		{
			if(B<ball[j])
				B=ball[j];
			else if(C<ball[j])
				C=ball[j];
			else
			{
				flag=0;
				break;
			}
		}
		if(flag==1)
			printf("YES\n");
		else
			printf("NO\n");
		
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

int main() {
  vector<i64> a(12);
  rep(i,0,12) cin >> a[i];
  sort(all(a));
  vector<i64> b;
  rep(i,0,4) b.push_back(a[0]);
  rep(i,0,4) b.push_back(a[4]);
  rep(i,0,4) b.push_back(a[8]);
  if(a == b) {
    cout << "yes" << endl;
  }
  else {
    cout << "no" << endl;
  }
}



Measured memory_bytes: 3152
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011

int n, m, i, x, y;
vector<int> list[maxN];
int col[maxN];
ll ans;
int cnt, cnt1, cnt2, cnt3;
bool ok;

void dfs(int node) {
    cnt++;

    for (auto to : list[node]) {
        if (!col[to]) {
            col[to] = col[node] ^ 3;
            dfs(to);
        } else {
            if (col[to] == col[node])
                ok = false;
        }
    }
}

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d%d", &n, &m);

    for (i = 1; i <= m; i++) {
        scanf("%d%d", &x, &y);
        list[x].pb(y);
        list[y].pb(x);
    }

    for (i = 1; i <= n; i++) {
        if (col[i]) continue;

        ok = true;
        cnt = 0;

        col[i] = 1;
        dfs(i);

        if (cnt == 1) {
            cnt3++;
            continue;
        }

        if (ok)
            cnt1++;
        else
            cnt2++;
    }

    ans = 2LL * cnt1 * cnt1;
    ans += 2LL * cnt1 * cnt2;
    ans += 1LL * cnt2 * cnt2;
    ans += 2LL * cnt3 * (n - cnt3);
    ans += 1LL * cnt3 * cnt3;
    printf("%lld", ans);



    return 0;
}


Measured memory_bytes: 8960
'use strict'

function main(input) {
  const [a, b, t] = input
    .trim()
    .split('\n')
    .map((x) => x.split(' ').map((v) => Number(v)))

  const distance = Math.abs(a[0] - b[0])
  const distance2 = (a[1] - b[1]) * t[0]

  console.log(distance <= distance2 ? 'YES' : 'NO')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 30136
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto abc = readints;
    int a = abc[0], b = abc[1], c = abc[2];

    writeln(b - a == c - b ? "YES" : "NO");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B;
    cin >> A >> B;

    if(A % 2 && B % 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	while (cin >> n >> k, n) {
		vi v(k);
		REP(i, k)cin >> v[i];
		sort(ALL(v));
		bool f = false;
		REP(i, k)if (v[i] == 0)f = true;
		int ans = 0;

		int cnt = 0, prev = 0;
		vector<pii> p;
		FOR(i, f, k) {
			if (v[i] == prev + 1) {
				cnt++;
				prev = v[i];
			}
			else {
				p.push_back({ prev - cnt + 1,prev + 1 });
				prev = v[i];
				cnt = 1;
			}
		}
		p.push_back({ prev - cnt + 1,prev + 1 });
		//REP(i, p.size())cout << p[i].first << " " << p[i].second << endl;
		cnt = 0;
		if (f) {
			REP(i, p.size())chmax(ans, p[i].second - p[i].first + 1);
			REP(i, p.size() - 1) {
				if (p[i].second + 1 == p[i + 1].first) {
					chmax(ans, p[i + 1].second - p[i].first);
				}
			}
		}
		else {
			REP(i, p.size())chmax(ans, p[i].second - p[i].first);
		}
		chmin(ans, n);
		cout << ans << endl;
	}
}


Measured memory_bytes: 3540
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 5005
#define INF 1000000000

using namespace std;

vector <int> vec[SIZE];
int X[SIZE];
int dp[SIZE];
int nap[SIZE];

bool dfs(int v=0,int p=-1)
{
	for(int i=0;i<vec[v].size();i++)
	{
		int to=vec[v][i];
		if(!dfs(to,v)) return false;
	}
	for(int i=0;i<SIZE;i++) nap[i]=0;
	for(int i=0;i<vec[v].size();i++)
	{
		int to=vec[v][i];
		for(int j=SIZE-1;j>=0;j--)
		{
			int mn=INF;
			if(j>=X[to]) mn=min(mn,nap[j-X[to]]+dp[to]);
			if(j>=dp[to]) mn=min(mn,nap[j-dp[to]]+X[to]);
			nap[j]=mn;
		}
	}
	if(nap[X[v]]==INF) return false;
	dp[v]=nap[X[v]];
	return true;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n-1;i++)
	{
		int p;
		scanf("%d",&p);p--;
		vec[p].push_back(i+1);
	}
	for(int i=0;i<n;i++) scanf("%d",&X[i]);
	if(!dfs()) puts("IMPOSSIBLE");
	else puts("POSSIBLE");
	return 0;
}


Measured memory_bytes: 384
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
    for j in range(3):
        if A[i][j] in b:
            A[i][j] = 0

if A[0][0] == A[1][0] == A[2][0]:
    print("Yes")
elif A[0][0] == A[0][1] == A[0][2]:
    print("Yes")
elif A[0][1] == A[1][1] == A[2][1]:
    print("Yes")
elif A[0][2] == A[1][2] == A[2][2]:
    print("Yes")
elif A[1][0] == A[1][1] == A[1][2]:
    print("Yes")
elif A[2][0] == A[2][1] == A[2][2]:
    print("Yes")
elif A[0][0] == A[1][1] == A[2][2]:
    print("Yes")
elif A[0][2] == A[1][1] == A[2][0]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9220
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextInt64() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}


func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func b2i(b bool) int8 {
	if b {
		return 1
	}
	return 0
}

type Int64s []int64
func (f Int64s) Len() int {
	return len(f)
}
func (f Int64s) Less(i, j int) bool {
	return f[i] < f[j]
}

func (f Int64s) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}


func solve(io *Io) {
	m := io.NextInt()
	n := io.NextInt()

	v := make([][]int64, m)

	for i := range v {
		a := io.NextInt64()
		b := io.NextInt64()
		c := io.NextInt64()

		v[i] = []int64{a, b, c}
	}


	ans := int64(0)
	for F := 0; F < 8; F++ {
		val := make([]int64, m)
		for i := range v {
			cur := int64(0)
			for j := 0; j < 3; j++ {
				sign := -1
				if (F >> uint(j)) & 1 == 0 {
					sign = 1
				}

				cur += v[i][j] * int64(sign)
			}
			val[i] = cur
		}
		sort.Sort(sort.Reverse(Int64s(val)))

		cans := int64(0)
		for i := 0; i < n; i++ {
			cans += val[i]
		}

		if ans < cans {
			ans = cans
		}
	}

	io.PrintLn(ans)
}

func main() {
	io := NewIo()
	defer io.Flush()

	solve(io)
}

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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n, t, p, res;
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        if (t < p) {
            res += p - t;
        }
        p = t;
    }
    res += p;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3640
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bfs(nodes, src):
    """ BFS(一般グラフ、重みなし) """
    from collections import deque

    N = len(nodes)
    que = deque([(src, 0)])
    dist = [INF] * N
    dist[src] = 0
    while que:
        u, c = que.popleft()
        for v in nodes[u]:
            if dist[v] != INF:
                continue
            dist[v] = c + 1
            que.append((v, c+1))
    return dist

N, x, y = MAP()
x -= 1; y -= 1

nodes = [[] for i in range(N)]
for i in range(N-1):
    nodes[i].append(i+1)
    nodes[i+1].append(i)
nodes[x].append(y)
nodes[y].append(x)

distx = bfs(nodes, x)
disty = bfs(nodes, y)

G = list2d(N, N, 0)
for i in range(N):
    for j in range(i+1, N):
        G[i][j] = min(j - i, distx[i] + disty[j] + 1, distx[j] + disty[i] + 1)
ans = [0] * N
for i in range(N):
    for j in range(i+1, N):
        ans[G[i][j]] += 1
[print(a) for a in ans[1:]]


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

int main() {
	long long H,W;
	cin >>H>>W;
	if(H!=1&&W!=1){
		cout <<((W-1)/2+1)*((H-1)/2+1)+(W/2)*(H/2);
	}
	else{
		cout <<1;
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ara[200000+23];
ll ara2[200000+23];
int main()
{
    ll k, l, m, n, ans = 1000000000000000;
    scanf("%lld", &n);
    for(ll i = 1; i <= n; i++){
        scanf("%lld", &ara[i]);
    }
    for(ll i = 1; i <= n; i++){
        ara2[i] = ara[i] + ara2[i-1];
    }
    for(ll i = 1; i < n; i++){
        k = ara2[i];
        l = ara2[n] - ara2[i];
        m = abs(k - l);
        ans = min(m, ans);
    }
    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>
#include<string.h>
#include<stdlib.h>


int main() {

	int N;
	int L,i;
	int j,k;
	int a=0;
	char c[40][100];
	int length;
	int flag;
	int A[100];

	for(;;) {

		scanf("%d\n",&N);

		if(N==0)
			break;

		for(j=0;j<40;j++) {
			for(k=0;k<100;k++)
				c[j][k]='\0';
		}

		for(i=0;i<N;i++)
			scanf("%s\n", c[i]);

		for(L=0;L<N;L++) {

			length = 5;
			i = L;
			flag = 0;

			while(length>0) {
				length = length - strlen(c[i]);
				i++;
			}

			if(length==0) flag = 1;

			if(flag==1) {
				length = 7;
				while(length>0) {
					length = length - strlen(c[i]);
					i++;
				}
				if(length==0) flag = 2;
			}

			if(flag==2) {
				length = 5;
				while(length>0) {
					length = length - strlen(c[i]);
					i++;
				}
				if(length==0) flag = 3;
			}

			if(flag==3) {
				length = 7;
				while(length>0) {
					length = length - strlen(c[i]);
					i++;
				}
				if(length==0) flag = 4;
			}

			if(flag==4) {
				length = 7;
				while(length>0) {
					length = length - strlen(c[i]);
					i++;
				}
				if(length==0) flag = 5;
			}

			if(flag == 5) {
				A[a] = L+1;
				a++;
				break;
			}
		}
	}

	for(i=0;i<a;i++)
		printf("%d\n",A[i]);

	return 0;
}

Measured memory_bytes: 620
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const double PI=acos(-1);
struct Point{long long x,y;int id;}P[110];int q[11000],T=0;
bool cmp(Point a,Point b){return a.x==b.x?a.y<b.y:a.x<b.x;}
Point point(long long x,long long y){Point c;c.x=x;c.y=y;return c;}
Point operator +(Point a,Point b){return point(a.x+b.x,a.y+b.y);}
Point operator -(Point a,Point b){return point(a.x-b.x,a.y-b.y);}
long long operator *(Point a,Point b){return a.x*b.x+a.y*b.y;}
long long operator /(Point a,Point b){return a.x*b.y-a.y*b.x;}
bool right(Point a,Point b,Point c){return ((b-a)/(c-a))>=0;}
double mo(Point a){return sqrt((double)(a.x*a.x)+(a.y*a.y));}
double ans[111];
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld%lld",&P[i].x,&P[i].y),P[i].id=i;
	sort(P+1,P+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		while(T-1>0&&!right(P[q[T-1]],P[q[T]],P[i]))T--;
		q[++T]=i;
	}int mid=T;
	for(int i=n-1;i>=1;i--)
	{
		while(T>mid&&!right(P[q[T-1]],P[q[T]],P[i]))T--;
		q[++T]=i;
	}
	q[0]=q[T-1];
	for(int i=1;i<T;i++)
	{
		Point p1=P[q[i]]-P[q[i-1]];
		Point p2=P[q[i]]-P[q[i+1]];
		ans[P[q[i]].id]=(PI-(acos((p1*p2)/mo(p1)/mo(p2))))/(2*PI);
	}
	for(int i=1;i<=n;i++)printf("%.20lf\n",ans[i]);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

void solve() {
    int k, n;
    std::cin >> k >> n;

    int beg;
    std::cin >> beg;

    int prev = beg;
    int ans = 0;
    for (int i = 1; i < n; ++i) {
        int x;
        std::cin >> x;
        ans = std::max(ans, x - prev);
        prev = x;
    }

    ans = std::max(ans, beg + k - prev);
    std::cout << k - ans << std::endl;
}

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

    solve();

    return 0;
}


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

int n, m;

int main()
{
   // freopen("in.txt", "r", stdin);
    int a, b;
    while (~scanf("%d%d", &a, &b))
    {
            int ans = a + b;
    ans = max(ans, a+a-1);
    ans = max(ans, b+b-1);
    printf("%d\n", ans);  
    }
 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 N, A, B;
  cin >> N >> A >> B;
  i64 C = A ^ B;
  vector<i64> on;
  vector<i64> off;
  rep(i,0,N) {
    if(C & (1 << i)) {
      on.push_back(i);
    }
    else {
      off.push_back(i);
    }
  }
  if(on.size() % 2 == 0) {
    cout << "NO" << endl;
    return 0;
  }
  vector<i64> ans;
  {
    i64 x = on.back();
    on.pop_back();
    ans.push_back(0);
    ans.push_back((1 << x));
  }

  while(!on.empty()) {
    i64 x = on.back(); on.pop_back();
    i64 y = on.back(); on.pop_back();
    vector<i64> next;
    rep(i,0,ans.size()) {
      if(i % 2 == 0) {
        next.push_back(ans[i]);
        next.push_back(ans[i] | (1 << x));
      }
      else {
        next.push_back(ans[i] | (1 << x));
        next.push_back(ans[i]);
      }
    }
    for(int i = ans.size(); i --> 0;) {
      next.push_back(ans[i] | (1 << y));
    }
    rep(i,0,ans.size()) {
      next.push_back(ans[i] | (1 << y) | (1 << x));
    }
    swap(next, ans);
  }
  while(!off.empty()) {
    i64 x = off.back(); off.pop_back();
    vector<i64> next;
    rep(i,0,ans.size()) {
      if(i % 2 == 0) {
        next.push_back(ans[i]);
        next.push_back(ans[i] | (1 << x));
      }
      else {
        next.push_back(ans[i] | (1 << x));
        next.push_back(ans[i]);
      }
    }
    swap(next, ans);
  }
  cout << "YES" << "\n";
  rep(i,0,ans.size()) {
    cout << (ans[i] ^ A) << " \n"[i + 1 == ans.size()];
  }
}


Measured memory_bytes: 2220
#include"bits/stdc++.h"

#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 all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n, y;
	int money = 0;
	cin >> n >> y;
	rep(i, n + 1)rep(j, n - i + 1) {
		money = 10000 * i + 5000 * j + 1000 * (n - (i + j));
		if (y == money) {
			cout << i << " " << j << " " << n - (i + j) << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			var Aarray = retreiveLongArray();

			var humidais = new long[N];
			long highest = 0;

			for (int i = 0; i < N; i++) {

				var gap = Math.Max(highest - Aarray[i], 0);
				humidais[i] = gap;
				highest = Math.Max(highest, Aarray[i]);

			}


			//答えの出力
			var ans = humidais.Sum();
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 48464
import java.util.* ;
class Main {
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);

 long s = scan.nextLong();
    long d = scan.nextLong();
    //System.out.println(s+d);
    if(( s+d)  % 2 == 0){
      System.out.println((s+d)/2);
    }else{
      System.out.println("IMPOSSIBLE");
    }
    
  }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int main() {
    int n;
    while (cin >> n) {
        vector<int> a(n), b(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i] >> b[i];
        }
        ll ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            ll d = (a[i] + ans) % b[i];
            ans += (b[i] - d) % b[i];
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1024
import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        long num = scan.nextInt();
        long sum = 0;
        for(int i =1; i <= num; i++){
            if(i % 3 == 0 && i % 5 == 0){
                //System.out.println("FizzBuzz");
            }else if(i % 3 == 0){
                //System.out.println("Fizz");
            }else if(i % 5 == 0){
                //System.out.println("Buzz");
            }else{
                //System.out.println(i);
                sum = sum + i;
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 35728
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()
    o,e=[chomp(readline()) for i in 1:2]
    for i in 1:length(e)
        print(o[i])
        print(e[i])
    end
    if length(o)>length(e)
        print(o[end])
    end
end
main()

Measured memory_bytes: 171868
n, m = map(int, input().split(" "))
path = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split(" "))
    path[u-1].append(v)

s, g = map(int, input().split(" "))
ifReached = [False for _ in range(n)]

def indicate3(start,path):
    for _ in range(3):
        next = []
        for position in start:
            for next_position in path[position-1]:
                next.append(next_position)
        start = list(set(next))
    return start

stack = [s]
ifReached[s-1] = True
count = 0
while True:
    n_stack = list(set(indicate3(stack,path)))

    tmp_stack = []
    for position in n_stack:
        if ifReached[position-1] == False:
            tmp_stack.append(position)
            ifReached[position-1] = True

    if len(tmp_stack) == 0:
        print(-1)
        break

    count += 1
    if g in tmp_stack:
        print(count)
        break
    stack = tmp_stack

Measured memory_bytes: 18904
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

vector<int> v[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int H[100010];
    rep(i, N) cin >> H[i];
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        v[s].push_back(t);
        v[t].push_back(s);
    }
    int ans = 0;
    rep(i, N) {
        bool ok = true;
        for(auto to: v[i])  {
            if(H[i] <= H[to]) ok = false;
        }
        ans += ok;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9164
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

struct UnionFind {
  vector<int> par;

  UnionFind(int N) : par(N) { rep(i, N) par[i] = i; }

  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx==ry) return;
    par[rx] = ry;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }

};

int main() {
  int N, M; cin >> N >> M;
  UnionFind tree(N);
  rep(i, M) {
    int X, Y ,Z; cin >> X >> Y >> Z;
    X--; Y--;
    tree.unite(X, Y);
  }
  int r[N]; rep(i, N) r[i] = tree.root(i);
  sort(r, r+N);
  int result = 1; rep(i, N-1) if (r[i]!=r[i+1]) result++;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1280
import java.util.*;

public class Main{
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        int wa = 0;
        int seki = 0;
        int sa = 0;
        int unko = 0;
        
        wa = A+B;
        seki = A*B;
        sa = A-B;
       	
      /*  if(wa>seki){
        	if(wa>sa){
                System.out.println(wa);
            }else if(seki>){
            	System.out.println(seki);
            }
        }*/
        
        if(wa>seki&&wa>sa){
        	System.out.println(wa);
        }else if(seki>wa&&seki>sa){
        	System.out.println(seki);
        }else{
        	System.out.println(sa);
        }
    }

}

Measured memory_bytes: 21844
loop {
    s = (1..8).map { gets.chomp }.join
    puts case s
        when /110{6}11/;?A
        when /10{7}10{7}10{7}1/; ?B
        when /1111/; ?C
        when /10{6}110{6}1/; ?D
        when /110{7}11/; ?E
        when /10{7}110{7}1/; ?F
        when /110{5}11/; ?G
    end
    break unless gets
}

Measured memory_bytes: 6096
h, w, m = list(map(int, input().split()))
count_row = [0 for _ in range(h)]
count_col = [0 for _ in range(w)]
max_col = 0
max_row = 0
max_row_index = []
max_col_index = []
M = set()
for i in range(m):
    mh, mw = list(map(int, input().split()))
    M.add((mh-1, mw-1))
    count_row[mh-1] += 1
    count_col[mw-1] += 1
    if count_row[mh-1] > max_row:
        max_row = count_row[mh-1]
        max_row_index = [mh-1]
    elif count_row[mh-1] == max_row:
        max_row_index.append(mh-1)
    
    if count_col[mw-1] > max_col:
        max_col = count_col[mw-1]
        max_col_index = [mw-1]
    elif count_col[mw-1] == max_col:
        max_col_index.append(mw-1)
# max_row_index = [i for i, v in enumerate(count_row) if v == max(count_row)]
# max_col_index = [i for i, v in enumerate(count_col) if v == max(count_col)]
# ans = max(count_row) + max(count_col) -1
ans = max_col + max_row -1

if len(max_col_index)*len(max_row_index) > m:
    ans += 1
else:
    flag = False
    for i in max_row_index:
        for j in max_col_index:
            if (i, j) not in M:
                ans += 1
                flag = True
                break
        if flag:
            break
print(ans)

Measured memory_bytes: 173352
class SegmentTree
  def initialize(n)
    @sz=2**(Math.log(n)/Math.log(2)).ceil
    @seg=Array.new(2*@sz-1){0}
    @root=0
    @nil=0
  end

  attr_accessor :seg

  def max(a, b, i=@root, l=0, r=@sz)
    if b<=l or r<=a
      @nil
    elsif a<=l and r<=b
      @seg[i]
    else
      m=(r+l)/2
      vl=max(a, b, 2*i+1, l, m)
      vr=max(a, b, 2*i+2, m, r)
      [vl, vr].max
    end
  end

  def update(i, data)
    i+=@sz-1
    @seg[i]=data
    while i.nonzero?
      i=(i-1)/2
      @seg[i]=[@seg[2*i+1], @seg[2*i+2]].max
    end
  end

  def answer
    @seg[@root]
  end
end

Poyo=Struct.new(:val, :id)

n=gets.to_i
a=[]
n.times do |i|
  v=gets.to_i
  a<< Poyo.new(v, i)
end

b=a.sort do |el, er|
  el.val!=er.val ? el.val<=>er.val : er.id<=>el.id
end

st=SegmentTree.new(n)
b.each do |e|
  i=e.id
  st.update(i, st.max(0, i)+1)
end

puts st.answer

Measured memory_bytes: 19340
import math

from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

def lcm(a, b):

    return a * b // gcd(a, b)

def solve(case_no):

    s = str(input())

    if s[len(s) - 1] == 's':

    	print(s + "es")
    else:

    	print(s + 's')

t = 1

# t = int(input())

for i in range(1, t + 1):

    solve(i)

Measured memory_bytes: 10392
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    h, w, d = ns()
    pos = dict()
    for i in range(h):
        a = na()
        for j, ai in enumerate(a):
            pos[ai] = (i, j)

    cum = [[0] for _ in range(d)]

    for i in range(d):
        x, y = pos[i + 1]
        num = i + 1
        while num + d <= h * w:
            num += d
            xi, yi = pos[num]
            tmp = abs(xi - x) + abs(yi - y)
            cum[i].append(cum[i][-1] + tmp)
            x = xi
            y = yi

    q = ni()
    for _ in range(q):
        l, r = ns()
        l -= 1
        r -= 1
        tmp = cum[l % d][r // d] - cum[l % d][l // d]
        print(tmp)


if __name__ == '__main__':
    main()


Measured memory_bytes: 31556
N=int(input())
count=0
for i in range(1,6):
  if N >= 10**(i):
    if i%2==1:#1,3,5 (10,1000,100000)
      count+=9*10**(i-1)
  else:
    if i%2==1:#1,3,5 (10,1000,100000)
      count+=N-10**(i-1)+1
    break
print(count)

Measured memory_bytes: 8964
#include <bits/stdc++.h>
#define endl '\n'

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);

int n;
int64_t a[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
}

map<int64_t, int> c;

void solve()
{
	int64_t answer = 0;

	c[0]++;
	int64_t sum = 0;

	for(int i = 0; i < n; i++)
	{
		sum += a[i];
		answer += c[sum];
		c[sum]++;
	}

	cout << answer << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	read();
	solve();
	return 0;
}



Measured memory_bytes: 14336
def f(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return 3*n+1


s = int(input())
i = 2
a = s
b = f(s)
d = {s: 1}
while b not in d:
    d[b] = 1
    a = b
    b = f(b)
    i += 1
print(i)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    cout << "ABC" << N << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int nowa,nowb;
    nowa = nowb = 0;
    string ans[n];
    char c;
    rep(i,n){
        cin >> c;
        if(c=='c') ans[i]="No";
        else if(c=='a'){
            if((nowa+nowb)<a+b){
                ans[i]="Yes";
                nowa++;
            }
            else ans[i]="No";
        }
        else{
            if((nowa+nowb)<a+b && nowb<b){
                ans[i]="Yes";
                nowb++;
            }
            else ans[i]="No";
        }
    }
    rep(i,n) cout << ans[i] << endl;
}

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

int main(){
    int d, w;
    while(cin >> d >> w, d){
        vector< vector<int> > e(d, vector<int>(w));
        for(int i = 0 ; i < d ; i++){
            for(int j = 0 ; j < w ; j++){
                cin >> e[i][j];
            }
        }

        int ans = 0;
        for(int u = 0 ; u < d ; u++){
            for(int s = u + 2 ; s < d ; s++){
                for(int l = 0 ; l < w ; l++){
                    for(int r = l + 2 ; r < w ; r++){
                        int outmin = 1000000, inmax = 0, res = 0;
                        for(int i = u ; i <= s ; i++){
                            outmin = min(outmin, e[i][l]);
                            outmin = min(outmin, e[i][r]);
                        }
                        for(int j = l ; j <= r ; j++){
                            outmin = min(outmin, e[u][j]);
                            outmin = min(outmin, e[s][j]);
                        }
                        for(int i = u + 1 ; i < s ; i++){
                            for(int j = l + 1 ; j < r ; j++){
                                inmax = max(inmax, e[i][j]);
                                res += outmin - e[i][j];
                            }
                        }
                        if(outmin > inmax){
                            ans = max(ans, res);
                        }
                    }
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define pb push_back
#define int long long
#define str string
using namespace std;
const int M = 1e9 + 7;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<int> P(a), Q(b), R(c);
    for (int i = 0; i < a; i++) cin >> P[i];
    for (int i = 0; i < b; i++) cin >> Q[i];
    for (int i = 0; i < c; i++) cin >> R[i];
    sort(P.begin(), P.end());
    reverse(P.begin(), P.end());
    sort(Q.begin(), Q.end());
    reverse(Q.begin(), Q.end());
    sort(R.begin(), R.end());
    reverse(R.begin(), R.end());
    vector<int> pp(a+1), qq(b+1), rr(c+1);
    for (int i = 0; i < a; i++) pp[i+1] = P[i] + pp[i];
    for (int i = 0; i < b; i++) qq[i+1] = Q[i] + qq[i];
    for (int i = 0; i < c; i++) rr[i+1] = R[i] + rr[i];
    int up = 0, uq = 0;
    int ans = 0;
    while (up < x || uq < y) {
        if (up == x) {
            uq++;
        } else if (uq == y) {
            up++;
        } else if (P[up] > Q[uq]) {
            up++;
        } else {
            uq++;
        }
        if (c >= x + y - up - uq) {
            ans = max(ans, pp[up] + qq[uq] + rr[x+y-up-uq]);
        }
    }
    cout << ans;
}

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

int main(){
   int x,y,h;
   cin>>x>>y>>h;
   map<int,int> mp;
   mp[x]++;
   mp[y]++;
   mp[h]++;
   cout<<mp.size()<<endl;
   return 0;
}


Measured memory_bytes: 256