akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 100000000000000;
const double PI = acos(-1);


int main() {
	LL a, b;
	cin >> a >> b;
	if (abs(a - b) <= 1) {
		cout << "Brown" << endl;
	}
	else {
		cout << "Alice" << endl;
	}
}

Measured memory_bytes: 256
N = int(input())

G = [[0] * N for _ in range(N)]
time = 0
times = [{'s': 0, 'f': 0} for _ in range(N)]

for _ in range(N):
    u, n, *K = map(int, input().split())
    for k in K:
        G[u - 1][k - 1] = 1

def dfs(u):
    global time
    time += 1
    times[u]['s'] = time
    for i in range(N):
        if G[u][i] == 1 and times[i]['s'] == 0:
            dfs(i)
    else:
        time += 1
        times[u]['f'] = time

for i in range(N):
    if times[i]['s'] == 0:
        dfs(i)

for i, time in enumerate(times):
    print(i + 1, *time.values())



Measured memory_bytes: 5800
#include <stdio.h>
int main()
{
  int x,y,tray[3000],box[3000];
  for(x=0;x<3000;x++)
  {
    scanf("%d %d",&tray[x],&box[x]);
    if(tray[x]==0 && box[x]==0)break;
    else if(tray[x]>=0 && box[x]>=0 && tray[x]<=10000 && box[x]<=10000)
    {
      if(tray[x]>box[x])printf("%d %d\n",box[x],tray[x]);
      else printf("%d %d\n",tray[x],box[x]);
    }
  }
  return 0;
}

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

using namespace std;

long long n, s, cann;

bool kiemtra(long long x){
    if (x<2) return false;
    long long sum = 0;
    long long tmp = n;
    while (tmp != 0){
        sum += tmp%x;
        tmp/=x;
    }
    if (sum == s) return true;
    return false;
}

int main()
{
    cin >> n >> s;
    if (n<s) {
        cout << -1;
        return 0;
    }
    else{
    for (long long i=1; i*i<=n; i++)
        if ((n-s)%i == 0){
            if (kiemtra(i+1)){
                cout << i+1;
                return 0;
            }
        }
    for (long long i = sqrt(n-s); i>0; i--)
        if ((n-s)%i==0)
            if (kiemtra((n-s)/i+1)){
                cout << (n-s)/i+1;
                return 0;
            }
    if (kiemtra(n-s+1)) cout << n-s+1;
    else if (n == s) cout << n+1;
    else if (s == 1) cout << n;
    else cout << -1;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1e9+7;

map<ll,ll> prime_factor(ll n) {
  map<ll,ll> res;
  for(ll i=2;i*i<=n;i++) {
    while(n%i==0) {
      res[i]++;
      n/=i;
    }
  }
  if(n!=1) {
    res[n]++;
  }
  return res;
}

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x;
    }
    x=x*x;
    n>>=1;
  }
  return ans;
}

int main() {
  ll n,p;
  cin >> n >> p;
  ll ans=1;
  map<ll,ll> c=prime_factor(p);
  for(auto p:c) {
    ll temp=p.second/n;
    ans*=mpow(p.first,temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import Data.List
main = do
  s <- getLine 
  let [n,m,l] = map read . words $ s ::[Int]
  ss <- getContents
  let vv = map (map (read::String->Int) . words) . lines $ ss
  let a = take n vv
  let b = drop n vv
  mapM_  putStrLn $ map (unwords . map show) $  mmul a b

mmul :: [[Int]] -> [[Int]] -> [[Int]]
mmul a b = transpose (map (\y-> map (\x -> ip x y) a) b')
  where b' = transpose b
        ip::[Int] -> [Int] -> Int  
        ip a b = sum $ (zipWith (*) a b)

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if (N == 1)
    {
        cout << "Hello World" << endl;
    }
    else
    {
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
    return 0;
}

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

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var map = new int[h, w];
        var scount = 0;
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            for (int j = 0; j < w; j++)
                if (s[j] == '#') { map[i, j] = -1; scount++; }
        }
        goBfs(map);

        Console.WriteLine(map[h - 1, w - 1] == 0 ? -1 : h * w - map[h - 1, w - 1] - scount);
    }
    public static void goBfs(int[,] map)
    {
        var dx = new int[] { 0, 1, 0, -1 };
        var dy = new int[] { 1, 0, -1, 0 };
        var h = map.GetLength(0);
        var w = map.GetLength(1);
        var q = new Queue<P>();
        q.Enqueue(new P { x = 0, y = 0 });
        map[0, 0] = 1;
        while (q.Count() > 0)
        {
            var t = q.Dequeue();
            if (t.x == h && t.y == w) continue;
            for (int i = 0; i < 4; i++)
            {
                var nx = t.x + dx[i];
                var ny = t.y + dy[i];
                if (nx >= 0 && nx < h && ny >= 0 && ny < w && map[nx, ny] == 0)
                { q.Enqueue(new P { x = nx, y = ny }); map[nx, ny] = map[t.x, t.y] + 1; }
            }
        }
    }
}


Measured memory_bytes: 11348
export class Main {
  private static chr: string[] = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"];
  static main(input: string): void {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp.shift().split(" ")[0]);
    Main.culc(n, new Set(), "");
  }

  static culc(maxKeta: number, syurui: Set<string>, acc: string): void {
    if (acc.length == maxKeta) {
      console.log(acc);
      return;
    }
    const size: number = syurui.size;
    const max = Math.min(acc.length + 1, size + 1);
    for (let i = 0; i < max; i++) {
      const str = Main.chr[i];
      const set = new Set(syurui);
      set.add(str);
      Main.culc(maxKeta, set, acc + str);
    }
  }
}
Main.main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 12644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        int n = in.intNext();
        Map<String, Integer> seen = new HashMap<>();
        int maxVal = 0;
        for (int i = 0; i < n; i++) {
            String word = in.next();
            seen.merge(word, 1, Integer::sum);
            maxVal = Math.max(maxVal, seen.get(word));
        }

        ArrayList<String> strs = new ArrayList<>();
        for (String s: seen.keySet()) {
            if (seen.get(s) == maxVal) strs.add(s);
        }
        Collections.sort(strs);
        StringBuilder result = new StringBuilder();
        for (String s: strs) result.append(s + "\n");
        out.println(result);

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 78872
n=int(input())
l_list=[int(i) for i in input().split()]
l_list.sort()

count=0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            li=l_list[i]
            lj=l_list[j]
            lk=l_list[k]
            if li!=lj and li!=lk and lj!=lk:
                if lk<li+lj:
                    count+=1
            
print(count)


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

vector<int> A;

int main(){
  int N, mon, yu;
  long count=0;
  cin >> N;
  for(int i=0; i<=N; i++){
    cin >> mon;
    A.push_back(mon);
  }
  for(int i=0; i<N; i++){
    cin >> yu;
    if(A[i]>=yu){
      count+=yu;
    }
    else{
      count+=A[i];
      yu = yu-A[i];
      if(A[i+1]>=yu){
        count+=yu;
        A[i+1]-=yu;
      }
      else{
        count+=A[i+1];
        A[i+1]=0;
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
long long n,a[100010],ans;
long long gcd(long long a, long long b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int main(){
	cin>>n;
	for (long long i=0;i<n;i++) cin>>a[i];
	ans=a[0];
	for (int i=1;i<n;i++) ans=gcd(ans,a[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
  
using namespace std;
//using namespace boost;
//using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

template <class A, class B> inline int Max(const A &a, const B &b){ return (a < b ? b : a); }
template <class A, class B> inline int Min(const A &a, const B &b){ return (a > b ? b : a); }

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


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

    vector<int> a(n+1);

    int res = 1, nd = 1, sum = 0;

    rep(i,n+1){
        cin >> a[i];
        sum += a[i];
    }

    if(a[0] > 0 && n != 0){
        return cout << -1 << '\n', 0;
    }
    if(n == 0){
        if(a[0] == 1){
            cout << 1 << '\n';
        }else{
            cout << -1 << '\n';
        }
        return 0;
    }

    reps(i, n){
        if(nd * 2 <= sum){
            nd *= 2;
        }else{
            nd = sum;
        }
        res += nd;
        if(a[i] > 0){
            nd -= a[i];
            sum -= a[i];
        }
        if(nd < 0){
            return cout << -1 << '\n', 0;
        }
    }

    cout << res << '\n';
 
    return (0);
}


Measured memory_bytes: 3988
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Mon Dec 24 23:48:54 2018
//
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	n := b - a

	fmt.Println(n*(n+1)/2 - b)
}


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

using namespace std;

long long prime = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long n, a, b;
    cin >> n >> a >> b;
    long long x = 0;
    x += n / (a + b) * a;
    n %= a + b;
    x += min(n, a);
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace atcoder151
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            new MainClass().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string[] array = Console.ReadLine().Split(' ').ToArray();
            int H = int.Parse(array[0]);
            int N = int.Parse(array[1]);

            int[] num_array = cin.ReadIntArray(N);
            int n = 0;
            int sum = 0;
            bool ok = false;
            while (n < N) {
                sum+=num_array[n];
                if (sum>= H) {
                    ok = true;
                    WriteLine("Yes");
                    break;
                }
                n++;
            }
            if (!ok) {
                WriteLine("No");
            }
            

        }



        public class ConsoleInput
        {
            //string[] arr;
            //int x;
            //int y;
            //        for (int i = 0; i<n; i++)
            //        {
            //            arr = Console.ReadLine().Split(' ').ToArray();
            //x = int.Parse(arr[0]);
            //y = int.Parse(arr[1]);
            //var power = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
            //            if (power <= d)
            //            {
            //                counter++;
            //            }
            //        }
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }

        }
    }
}


Measured memory_bytes: 37788
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
ll add(ll x,ll y)
{
return (x%hell+y%hell)%hell;
}
ll mul(ll x,ll y)
{
return ((x%hell)*(y%hell))%hell;
}
ll sub(ll x,ll y)
{
return (x-y+hell)%hell;
}
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    for(int ok=1;ok<=t;ok++)
    {
        
        string s;
        cin>>s;
        if(s[0]=='7'||s[1]=='7'||s[2]=='7')
        {
            cout<<"Yes";
        }
        else
            cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3672
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N, M = in_nn()
    if N == 1 and M == 1:
        ans = 1
    elif N == 1 and M > 1:
        ans = M - 2
    elif N > 1 and M == 1:
        ans = N - 2
    else:
        ans = (N - 2) * (M - 2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int A;
int B;
int main(){
  int i;
  rd(A);
  rd(B);
  for(i=(0);i<(10000);i++){
    if(i*8/100 == A && i*10/100 == B){
      wt_L(i);
      wt_L('\n');
      return 0;
    }
  }
  wt_L(-1);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200303-1 [beta]

// --- original code ---
// int A, B;
// {
//   rd(A,B);
//   rep(i,10000){
//     if(i*8/100 == A && i*10/100 == B) wt(i), return 0;
//   }
//   wt(-1);
// }


Measured memory_bytes: 256
#include<iostream>
#include<string> 
using namespace std;
long long n,ans,a,b;
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		int h=i,k=0;
		while(h!=0)
		{
			k+=(h%10);
			h/=10;
		}
		if(k>=a && k<=b)
			ans+=i;
	}	
	cout<<ans<<endl;
} 

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

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

const int N = 1000001;
const int MOD = 998244353;

const int oo = 1e9;


ll n , p;
bool mark[N];

int main() {
  cin >> n >> p;
  ll ans = 1;
  for(ll i = 2 ; i <= 1000000;++i){
    if(mark[i])continue;
    for(ll j = i ; j <= 1000000;j +=i)mark[j]=1;

    int cnt = 0;
    while(p%i==0){
      cnt++;
      p/=i;
    }
    cnt /= n;
    while(cnt--)ans *= i;
  }
  if(p>1){
    if(n==1)ans *= p;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1280
from bisect import bisect_left

N = int(input())
A = [int(input()) for _ in range(N)]

color = [-1]*N

ans = 0
l = N

for i in range(N):
    pos = bisect_left(color, A[i])
    if pos == l:
        ans += 1
    color[pos-1] = A[i]

ans = len([c for c in color if c != -1])
print(ans)

Measured memory_bytes: 8616
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
/*
	http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B&lang=jp

	0-1ナップサック問題。

	超有名なDP問題。
	個数制限なしのナップサック問題。

	参考：蟻本 p59 
*/

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int MAX_N = 100;
const int MAX_W = 10000;
const int INF = 10001;
int N, W;

int v[MAX_N+1], w[MAX_N+1];
int dp[MAX_N+1][MAX_W+1];

int solve (void ){
	rep (i, MAX_N+1 ) rep (j, MAX_W+1 ) dp[i][j] = -INF;

	dp[0][0] = 0;
	rep (i, N ){
		for (int j = 0; j <= W; j++ ){
			dp[i+1][j] = max (dp[i+1][j], dp[i][j] );
			if (j - w[i] >= 0 ){
				dp[i+1][j] = max (dp[i+1][j], dp[i+1][j-w[i]] + v[i] );
			} // end if
		} // end for
	} // end for

	int res = 0;
	rep (j, W + 1 ) res = max (res, dp[N][j] );

	return res;
}

int main()
{
	memset (v, 0, sizeof (v ) );
	memset (w, 0, sizeof (w ) );

	ios_base::sync_with_stdio(0);
	cin >> N >> W;
	rep (i, N ) cin >> v[i] >> w[i];

	int res = solve ();
	cout << res << endl;
		
	return 0;
}

Measured memory_bytes: 5140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    int N, K;
    string S;
    cin >> N >> K >> S;
    
    int ans = 0;
    int tmp = 0;
    for(int i = 1; i < N; i++){
        if(S[i-1] == S[i]) ans++;
        else tmp++;
    }

    cout << ans + min(tmp, 2*K) << "\n";
    return 0;
}


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


long sumdist(int m, vector<int> v){
  double ans = 0;
  for(int i = 0; i < v.size(); i++){
    ans += (v.at(i) - m ) * (v.at(i) - m );
  }

  return(ans);

}

int main(){
  int N;
  cin >> N;
  vector<int> v(N);

  int mean = 0;
  for(int i = 0; i < N; i++){
    cin >> v.at(i);
    mean += v.at(i);
  }
  mean = mean / N;

  long ans;
  ans = min(sumdist(mean, v), sumdist(mean-1, v));
  ans = min(ans, sumdist(mean+1, v));

  cout << ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
//1232
int a,b,c,n,m,l[100000110],o[100010],k,i,d,dx[10]={0,1,-1,0,0,-1,-1,1,1},dy[10]={0,0,0,-1,1,1,-1,1,-1};
long long x,y,z[100010];
stack<int> s;
struct P
{
    int x;
    int y;
    bool operator<(const P &a)const
    {
        return y>a.y;
    }
};
 //map<int, int> p;
queue<P> q;
priority_queue<int> q1;
string r;
vector<int> v[200010];

bool sdf(P a,P b){return a.y<b.y;}



int main()
{
    scanf("%d",&a);
    for(int t=1;t<=a;t++)
    {
        scanf("%d",&b);
        if(b%2==1)
            k++;
    }
    if(k%2==1)
        puts("NO");
    else
        puts("YES");
    return 0;
}

Measured memory_bytes: 4992
using System;

class Program {
  static void Main() {
    int n = int.Parse(Console.ReadLine());
    var s = Console.ReadLine();
    int x = 0, a = 0;
    foreach (var c in s) {
      if (c == 'I') x++;
      else x--;
      a = Math.Max(a, x);
    }
    Console.WriteLine(a);
  }
}

Measured memory_bytes: 11092
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args)throws Throwable {
		MyScanner sc=new MyScanner();
		PrintWriter pw=new PrintWriter(System.out);
		
		n=sc.nextInt();
		adj=new ArrayList [n];
		for(int i=0;i<n;i++)
			adj[i]=new ArrayList<Integer>();
		int [] x=new int [n-1];
		int [] y=new int [n-1];
		int [] z=new int [n-1];
		for(int i=0;i<n-1;i++){
			x[i]=sc.nextInt()-1;
			y[i]=sc.nextInt()-1;
			z[i]=sc.nextInt();
			adj[x[i]].add(y[i]);
			adj[y[i]].add(x[i]);
		}
		preProcessing();
		for(int i=0;i<n-1;i++)
			if(level[x[i]]>level[y[i]])
				cost[x[i]]=z[i];
			else
				cost[y[i]]=z[i];
		dfs2(0);
		int q=sc.nextInt();
		k=sc.nextInt()-1;
		while(q-->0){
			int u=sc.nextInt()-1;
			int v=sc.nextInt()-1;
			pw.println(path_len(u, k, query(u, k))+path_len(v, k, query(v, k)));
		}
		
		pw.flush();
		pw.close();
	}
	
	static long path_len(int u,int v,int l){
		return cost[u]+cost[v]-2*cost[l];
	}
	
	static int n,k;
	static int [][] ansector;
	static int [] parent,level;
	static long [] cost;
	static ArrayList<Integer> [] adj;
	
	static void preProcessing(){
		parent=new int [n];
		level=new int [n];
		cost=new long [n];
		parent[0]=-1;
		dfs(0, 0);
		int log=(int)Math.ceil(Math.log(n)/Math.log(2));
		ansector=new int [n][log];
		for(int [] x : ansector)
			Arrays.fill(x, -1);
		for(int i=0;i<n;i++)
			ansector[i][0]=parent[i];				
		for(int j=1;(1<<j)<n;j++)
			for(int i=0;i<n;i++)
				if(ansector[i][j-1]!=-1)
					ansector[i][j]=ansector[ansector[i][j-1]][j-1];
	}
	
	public static void dfs(int u,int h){
		level[u]=h;
		for(int v : adj[u])
			if(v!=parent[u]){
				parent[v]=u;
				dfs(v, h+1);
			}
	}
	
	static void dfs2(int u){
		for(int v : adj[u])
			if(v!=parent[u]){
				cost[v]+=cost[u];
				dfs2(v);
			}
	}
	
	public static int query(int u,int v){
		if(level[u]<level[v]){
			int tmp=u;
			u=v;
			v=tmp;
		}
		int log=1;
		for(log=1;(1<<log)<=level[u];log++);
		log--;
		
		for(int i=log;i>=0;i--)
			if(level[u]-(1<<i)>=level[v])
				u=ansector[u][i];
		
		if(u==v)
			return u;
		
		for(int i=log;i>=0;i--)
			if(ansector[u][i]!=-1 && ansector[u][i]!=ansector[v][i]){
				u=ansector[u][i];
				v=ansector[v][i];
			}
		return parent[u];
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {while (st == null || !st.hasMoreElements()) {
			try {st = new StringTokenizer(br.readLine());}
			catch (IOException e) {e.printStackTrace();}}
		return st.nextToken();}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine(){String str = "";
		try {str = br.readLine();}
		catch (IOException e) {e.printStackTrace();}
		return str;}
	}
}

Measured memory_bytes: 108772
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;

  int r, g;
  cin >> r >> g >> b;
  if((r*100+g*10+b)%4==0) cout <<"YES\n";
  else cout <<"NO\n";
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int n;
  cin >> n;
  map<string, int> dict;
  int max_dict=0;
  rep(i,n){
    string s;
    cin >> s;
    dict[s] +=1;
    max_dict=max(max_dict,dict[s]);
  }
  //cout << max_dict;
  map<string,int>::iterator p;
  for (p=dict.begin(); p!=dict.end(); p++) {
    if(p->second==max_dict){
      cout << p->first << endl;
    }
  }

}

Measured memory_bytes: 25216
#include <stdio.h>
#include <algorithm>
#include <complex>

int main()
{
    char s[8];
    int cnt{};
    scanf("%s", s);
    for (int i = 0; i < 3; ++i)
        cnt += s[i] - '0';
    printf("%d\n", cnt);
 
    return 0;
}

Measured memory_bytes: 128
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <time.h>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <list>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
const int maxn=200005;
ll sum[maxn],a[maxn];
ll n,b,c,d,e;
ll ans=1e15+7;
bool check(ll x,ll y,int i)
{
    if(abs((x+a[i])-(y-a[i]))<abs(x-y))
    return 1;
    return 0;
}
int main()
{
    cin>>n;
    ll s=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
        sum[i]=s;
    }
    int j=0,k=2;
    for(int i=1;i<n-2;i++)
    {
        b=sum[j];
        c=sum[i]-sum[j];
        d=sum[k]-sum[i];
        e=sum[n-1]-sum[k];
        while(check(b,c,j+1) && j+1<i)
        {
            j++;
            b=sum[j];
            c=sum[i]-sum[j];
        }
        while(check(d,e,k+1) && k+1<n-1)
        {
            k++;
            d=sum[k]-sum[i];
            e=sum[n-1]-sum[k];
        }
        ll test[10];
        test[0]=b;test[1]=c;
        test[2]=d;test[3]=e;
        sort(test,test+4);
        ans=min(ans,test[3]-test[0]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rp(i, n) for(int i = 0; i < n; i++)
#define rp2(i, a, n) for(int i = a; i < n; i++)

using namespace std;
using ll = long long;

const int INF = 1001000000;

int main(){
    int x, y;
    cin >> x >> y;
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> p(a), q(b), r(c);
    rp(i, a) cin >> p[i];
    rp(i, b) cin >> q[i];
    rp(i, c) cin >> r[i];
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    vector<int> d;
    rp(i, x) d.push_back(p[i]);
    rp(i, y) d.push_back(q[i]);
    rp(i, c) d.push_back(r[i]);
    sort(d.rbegin(), d.rend());
    ll ans = 0;
    rp(i, x+y) ans += d[i];
    cout << ans << endl;
    return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  int n;
  cin >> n;
  cout << n / 2 + (n & 1) << endl;

  return 0;
}


Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    for (int i=0; i<s.size(); i++){
        if (s==t){cout << "Yes" << endl;
        return 0;}
        s = s[s.size()-1] + s.substr(0,s.size()-1);
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
/**
 * @brief  : c++ code for AtCoder
 * @author : rk222
 * @created: 2019.06.29 20:35:45
 */

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

#define disp(x) cout << #x << ": " << x << endl
#define disp_vec(v)                                                                           \
    cout << #v << ":";                                                                        \
    rep(i, v.size()) cout << " " << v[i];                                                     \
    cout << endl

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

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

    bool b = false;
    if ((s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) ||
        (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) ||
        (s[0] == s[3] && s[1] == s[2] && s[0] != s[1])) {
        b = true;
    }

    if (b) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    /* --------------------------------- */
    return 0;
}

Measured memory_bytes: 256
n,d = map(int,input().split())
s = [0 for i in range(n)]
for i in range(n):
    a = list(map(int,input().split()))
    s[i] = a
ans = 0
for i in range(n):
    for j in range(i+1,n):
        p = 0
        for k in range(d):
            p += (s[i][k]-s[j][k])**2
        if (p**0.5).is_integer():
            ans += 1
print(ans)     

Measured memory_bytes: 38256
def solve(quota, items)
  time = 0
  until items.empty?
    item = items.shift
    if item[:val] > quota
      item[:val] -= quota
      items.push(item)
      time += quota
    else
      time += item[:val]
      puts "#{item[:name]} #{time}"
    end
  end
end
size, quota = gets.split(" ").map(&:to_i)
items = Array.new(size) { name, val = gets.split(" "); {name: name, val: val.to_i}}
solve(quota, items)



Measured memory_bytes: 20208
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
using ll = long long;
int main()
{
	ll x, k, d;
	cin >> x >> k >> d;

	ll res = 1e15;
	
	if (x > 0)
	{
		ll cnt = x / d;

		ll cnt2 = cnt + 1;

		if ((k - cnt) % 2 == 0 && k >= cnt)
		{
			res = min(res, abs(x - cnt * d));
		}
		else if (k < cnt)
		{
			res = min(res, abs(x - k * d));
		}

		if ((k - cnt2) % 2 == 0 && k >= cnt)
		{
			res = min(res, abs(x - cnt2 * d));
		}
		else if (k < cnt)
		{
			res = min(res, abs(x - k * d));
		}
	}
	else
	{
		ll t = abs(x);
		ll cnt = t / d;

		ll cnt2 = cnt + 1;

		if ((k - cnt) % 2 == 0 && k >= cnt)
		{
			res = min(res, abs(x + cnt * d));
		}
		else if (k < cnt)
		{
			res = min(res, abs(x + k * d));
		}
		
		if ((k - cnt2) % 2 == 0 && k >= cnt2)
		{
			res = min(res, abs(x + cnt2 * d));
		}
		else if (k < cnt)
		{
			res = min(res, abs(x + k * d));
		}
	}

	printf("%lld\n", res);

	return 0;
}

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

const int MAX = 10;
int val[10][5];

int main()
{
	int H;
	while(cin >> H, H){
		for(int i = 0;i < H;i++){
			for(int j = 0;j < 5;j++){
				cin >> val[i][j];
			}
		}
		int res = 0;
		bool flag;
		do{
			flag = false;
			for(int i = 0;i < H;i++){
				int x = val[i][2];
				if(x == 0) continue;
				int l = 2, r = 3;
				while(l >= 0 && val[i][l] == x) l--;
				l++;
				while(r < 5 && val[i][r] == x) r++;
				if(r - l < 3) continue;
				flag = true;
				for(int j = l;j < r;j++){
					res += val[i][j];
					val[i][j] = 0;
				}
			}
			for(int k = 0;k < 5;k++){
				for(int i = H - 1, j = H - 1;i >= 0;i--){
					if(val[i][k] > 0){
						if(i != j) swap(val[i][k], val[j][k]);
						j--;
					}
				}
			}
		} while (flag);
		cout << res << endl;
		for(int i = 0;i < H;i++){
			for(int j = 0;j < 5;j++){
				val[i][j] = 0;
			}
		}
	}
}


Measured memory_bytes: 3048
// #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using V = vector<int>;
using VV = vector<V>;

template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//~ int A = (1<<2) | (1<<3) | (1<<5) | (1<<7);
//~ for (int bit=A; ; bit=(bit-1)&A){
//~ if (!bit) break;
//~ }
int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
//~ int n=5;
//~ int k=3; // nCkの組み合わせ、ただしk=0には対応してない
//~ int bit=(1<<k)-1; // 1000 -> 0111
//~ for(; bit < (1<<n); bit=nex_combination(bit){
//~ }
bool isPrime(int a) {
    if (a == 2) return true;
    if (a <= 1 || a % 2 == 0) return false;

    for (int i = 3; i * i <= a; i += 2) {
        if (a % i == 0) return false;
    }
    return true;
}
//~ vector<int> a = {1, 14, 32, 51, 51, 51, 243, 419, 750, 910};
vector<int> aaa;
// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (aaa[index] >= key)
        return true;
    else
        return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1;  //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok =
        (int)aaa
            .size();  // 「index =
                      // a.size()-1」が条件を満たさないこともあるので、初期値は
                      // a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key))
            ok = mid;
        else
            ng = mid;
    }
    return ok;
}

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;
}

//~ int v[100100];
//~ int INF = 1 << 30;
//~ vector<vector<int>> dp(310, vector<int>(310));
//~ ll dp[110][100100];
//~ vector<int> dp(100100, 0));

//~ int seen[110];
//~ int ans[110][2];
//~ ll MOD = 1e9 + 7;

void memo() {
    int n = 100;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }

    vector<int> ans(n);
    iota(ans.begin(), ans.end(), 0);
    sort(ans.begin(), ans.end(), [&](int i, int j) { return a[i] < a[j]; });

    double t1 = 0.1;
    cout << fixed << setprecision(6) << t1 << endl;
}

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

    vector<int> a(m);
    rep(i, m) cin >> a[i];

    int l = lower_bound(a.begin(), a.end(), x) - a.begin();

    int ans = min(l, m - l);

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, x, y;
  cin >> n >> x >> y;
  x--, y--;
  vl ans(n, 0);
  rep(i, n - 1) rep2(j, i + 1, n) {
    ll d = j - i;
    d = min(d, abs(i - x) + abs(j - y) + 1);
    ans[d]++;
  }
  rep2(i, 1, n) cout << ans[i] << '\n';
}

Measured memory_bytes: 3584
import java.util.Scanner;

public class Main{
       public static void main(String[] args){
       int i,j,k,a,b,c;
    	String[] data;
 
        Scanner scan = new Scanner(System.in);
        k = scan.nextInt();
        data = new String[k];
        i = 0;
        while(i < k){
        	a = scan.nextInt();
        	b = scan.nextInt();
        	c = scan.nextInt();
        	a=a*a;
        	b=b*b;
        	c=c*c;
        	if(a>b && a>c){
        		b = b + c;
        		if(a == b){
        			data[i]="YES";
        		}else{
        			data[i]="NO";
        		}
        	}else if(b>a && b>c){
        		a = a + c;
        		if(b == a){
        			data[i]="YES";
        		}else{
        			data[i]="NO";
        		}
        	}else if(c>a && c>b){
        		a = a + b;
        		if(c == a){
        			data[i]="YES";
        		}else{
        			data[i]="NO";
        		}
        	}else{
        		data[i]="NO";
        	}
        	i++;
        }
        
        
        j = 0;
        while(j < i){
        	System.out.println(data[j]);
        	j++;
       		}
       		}
}

Measured memory_bytes: 33456
#include<stdio.h>
#include<string.h>
#define LEN 100005

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

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

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

int min(int a,int b){
if(a < b)
return a;
else 
return b;
}

int main(){
int elaps = 0,c;
int i,q;
P u;
scanf("%d %d", &n,&q);

for(i=1;i <= n;i++){
scanf("%s",Q[i].name);
scanf("%d",&Q[i].t);
}

head = 1;
tail = n+1;

while(head != tail){
    u = dequeue();
    c = min(q, u.t);

    u.t -= c;

    elaps += c;

    if(u.t > 0)enqueue(u);
    
    else
    {
        printf("%s %d\n",u.name, elaps);
    }
    
}
return 0;
}




Measured memory_bytes: 11840
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ac, ad, bc, bd, max;
    ac = a * c;
    ad = a * d;
    bc = b * c;
    bd = b * d;
    max = ac;
    if(max < ad){
        max = ad;
    }
    if(max < bc){
        max = bc;
    }
    if(max < bd){
        max = bd;
    }
    cout << max << endl;
}


Measured memory_bytes: 3592
import numpy as np

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

lst.insert(0, 0)
lst.append(0)
arr = np.array(lst)

# インデックスごとに進んだ場合
order = np.abs(np.roll(arr, -1) - arr)
order = np.delete(order, -1)
sum_order = np.sum(order)
#print(order)

# iを飛ばして進んだ場合
skip = np.abs(np.roll(arr, -2) - arr)
skip = np.delete(skip, -1)
skip = np.delete(skip, -1)
#print(skip)

for i in range(N):
  cost = sum_order - order[i] - order[i+1] + skip[i]
  print(cost)
  
  

Measured memory_bytes: 22876
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
print(n*(n-1)//2)

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

int main(void) {
	int i, j;
	int pair;
	int c[3];
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	c[0] = atoi(ch);
	ch = strtok(NULL, " ");
	c[1] = atoi(ch);
	ch = strtok(NULL, " ");
	c[2] = atoi(ch);

	pair = 0;
	for(i = 0; i < 3; i += 1) {
		for(j = 0; j < i; j += 1) {
			if(c[i] == c[j]) {
				pair += 1;
			}
		}
	}
	if(pair == 3) {
		pair -= 1;
	}

	printf("%d\n", 3 - pair);

	return 0;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

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

    int n;
    cin >> n;
    vector<int> v(n + 1, 0);
    for(int i = 1; i <= n; i ++)
        cin >> v[i];

    int ans = 1e9;
    for(int p = 1; p < n; p ++) {
        int sum = 0;
        for(int i = 1; i <= p; i ++)
            sum += v[i];
        for(int i = p + 1; i <= n; i ++)
            sum -= v[i];
        sum = max(sum, -sum);
        ans = min(ans, sum);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
from sys import stdin
import numpy as np
n = int(stdin.readline().rstrip())
ary = np.array([int(stdin.readline().rstrip()) for _ in range(n)])
m = ary.argmax()
mv = ary.max()
for i in range(n):
    if i == m:
        if i == 0:
            print(np.amax(ary[i + 1:]))
        elif i == n - 1:
            print(np.amax(ary[:i]))
        else:
            print(max(np.amax(ary[:i]), np.amax(ary[i + 1:])))
    else:
        print(mv)




Measured memory_bytes: 21844
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

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

    int nowxor = 0;
    set<int> se;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        nowxor ^= a;
        se.insert(a ^ (a - 1));
    }

    vector<int> v;
    for (auto x:se)v.push_back(x);
    sort(v.begin(), v.end(), greater<>());

    int ret = 0;
    for (auto x:v) {
        if (nowxor > (nowxor ^ x)) {
            nowxor ^= x;
            ret++;
        }
    }
    cout << (nowxor == 0 ? ret : -1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  string s;
  cin >> s;
  if ((s[0] == s.back()) ^ (s.size() % 2 == 0)) {
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
  }
  return 0;
}

Measured memory_bytes: 512