akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Node[] heap = new Node[n + 1];
		heap[0] = new Node();
		for (int i = 1; i < n + 1; i++) {
			heap[i] = new Node();
			heap[i].id = i;
			heap[i].key = sc.nextInt();
		}

		buildMaxHeap(heap, n);
		for(int i = 1;i < n+1;i++){
			System.out.print(" "+heap[i].key);
		}
		System.out.println();
	}

	static void maxHeapify(Node A[], int i, int n) {
		int l = 2 * i;
		int r = 2 * i + 1;
		int max = i;
		//System.out.println(l+" "+r);
		if (l <= n && A[l].key > A[max].key)max = l;
		if (r <= n && A[r].key > A[max].key)max = r;
		if (max != i) {
			int temp = A[i].key;
			A[i].key = A[max].key;
			A[max].key = temp;
			maxHeapify(A, max, n);
		}

	}

	static void buildMaxHeap(Node A[], int n){
		for(int i = n/2;i > 0;i--){
			maxHeapify(A, i, n);
		}
	}
}

class Node {
	int id;
	int key;
	int p;
	int l;
	int r;

	Node() {
		id = Integer.MIN_VALUE;
		key = Integer.MIN_VALUE;
		p = Integer.MIN_VALUE;
		l = Integer.MIN_VALUE;
		r = Integer.MIN_VALUE;
	}
}

Measured memory_bytes: 185272
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

long long A, B, C;
long long D;

int main()
{
	scanf("%lld %lld %lld %lld", &A, &B, &C, &D);
	if((abs(A - B) <= D && abs(B - C) <= D) || abs(C - A) <= D) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
// B - Counting Roads
#include <bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<(n);++i)

int main(){
	int N, M; cin>>N>>M;
	vector<int> C(N);
	rp(i,M){
		int a,b; cin>>a>>b;
		C[a-1]++; C[b-1]++;
	}
	rp(i,N)cout<<C[i]<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <map>
#include <algorithm>
#include <vector>
#include <queue>

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

int abs(int x){
  return x > 0 ? x : -x;
}

int length(char c[]){
  int cnt=0;
  for(cnt=0;c[cnt]!='\0';cnt++){
  }
  return cnt;
}

int n,z,w;
int a[2000];

int main(){
  scanf("%d %d %d",&n,&z,&w);
  REP(i,n) scanf("%d", &a[i]);
  int x,y;
  int ans = 0;
  int ma=0,mi=INF;
  REP(i,n){
    ma = max(ma,a[i]);
    mi = min(mi,a[i]);
  }
  if(n==1){
    printf("%d\n",abs(a[0]-w));
    return 0;
  }
  printf("%d\n", max(abs(w-a[n-1]),abs(a[n-1]-a[n-2])));
}


Measured memory_bytes: 128
import java.util.*;
import java.util.regex.Pattern;
public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		for(int i = 0; i < 3; i++){
			int start = getS(sc.nextInt(), sc.nextInt(), sc.nextInt());
			int end = getS(sc.nextInt(), sc.nextInt(), sc.nextInt());
			int rawtime = end - start;
			int [] time = getT(rawtime);
			System.out.println(time[0] + " " + time[1] + " " + time[2]);
		}
	}
	private int [] getT(int rawtime) {
		int [] res = new int[3];
		res[0] = rawtime / 60 / 60;
		res[1] = (rawtime % 3600) / 60;
		res[2] = rawtime % 60;
		return res;
	}
	private int getS(int h, int m, int s){
		int res = h * 60 * 60 + m * 60 + s;
		return res;
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 12000
/*input
10 58
9 1 6 7 8 4 3 2 10 5
695279662 988782657 -119067776 382975538 
-151885171 -177220596 -169777795 37619092 
389386780 980092719
*/

#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, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    rep(i, n) cin >> p[i], --p[i];
    rep(i, n) cin >> c[i];
    ll ans = c[0];
    rep(i, n) {
        int prv = i, rl = 0;
        ll rs = 0;
        do {
            rl++;
            rs += c[prv = p[prv]];
        } while (prv != i);
        int mj = min(rl, k);
        rs = max(rs, 0LL);
        ll s = 0;
        prv = i;
        for (int j = 1; j <= mj; j++) {
            s += c[prv = p[prv]];
            ans = max(ans, s+(k-j)/rl*rs);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int N = 40;
int a[N][N];
LL f[N][N][N];
LL solve(int l, int r, int m) {
    assert(0 <= l && l <= m && m <= r && r <= 39);
    if (f[l][r][m] != -1)
        return f[l][r][m];
    if (l == r)
        return f[l][r][m] = 1;
    LL result = 0;
    for (int i = l; i < m; ++i)
        for (int j = m + 1; j <= r; ++j)
            if (a[i][j] == 1)
                for (int x = i; x < m; ++x)
                    for (int y = m + 1; y <= j; ++y)
                        result += solve(l, x, i) * solve(y, r, j) * solve(x + 1, y - 1, m);
    return f[l][r][m] = result;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    memset(f, -1, sizeof(f));
    int n;
    cin >> n;
    for (int i = 0; i < 2 * n; ++i) {
        for (int j = 0; j < 2 * n; ++j) {
            char c;
            cin >> c;
            a[i][j] = c - '0';
        }
    }
    LL ans = 0;
    for (int i = 1; i < 2 * n; ++i)
        if (a[0][i] == 1)
            ans += solve(1, 2 * n - 1, i);
    cout << ans << endl;
    return 0;
}

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

int main() {
	char A[105], B[105];
	scanf("%s %s", A, B);
	int i, test, test1;
	int A_len = strlen(A);
	int B_len = strlen(B);
	
	if (A_len == B_len) {
		for (i = 0; i < A_len; i++) {
			if (A[i] > B[i]) {
				printf("GREATER\n");
				break;
			} else if (A[i] < B[i]) {
				printf("LESS\n");
				break;
			} else {
				printf("EQUAL\n");
				break;
			}
		}
	} else if (A_len > B_len) {
		printf("GREATER\n");
	} else if (A_len < B_len) {
		printf("LESS\n");
	}
	return 0;
}

Measured memory_bytes: 128
using System;
class Program
{
	static void Main(string[] args)
	{
		int a = int.Parse(Console.ReadLine());
		int b = int.Parse(Console.ReadLine());
		int c = int.Parse(Console.ReadLine());
		int X = int.Parse(Console.ReadLine());
		int sum = 0;
		int counter = 0;

		for (int i = 0; i <= a; i++)
		{
			for (int j = 0; j <= b; j++)
			{
				for (int k = 0; k <= c; k++)
				{
					sum = (500 * i) + (100 * j) + (50 * k);
					if (sum == X) counter++;
				}
			}
		}

		//出力
		Console.WriteLine(counter);
	}
}

Measured memory_bytes: 11092
n = int(input())
li = list(map(int,input().split()))
first = 0
goukei = sum(li)
ans = goukei

for i in range(n):
    first += li[i]
    rest = goukei - first
    if abs(first-rest) < ans:
        ans =  abs(first-rest)
print(ans)


Measured memory_bytes: 26060
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

A,B,C,D=map(int,input().split())
Cdiv = B // C - (A-1) // C
Ddiv = B // D - (A-1) // D
cddiv = (C*D) // gcd(C, D)
CDdiv = B // (cddiv) - (A-1) // cddiv

print( (B-A+1) - Cdiv - Ddiv + CDdiv )

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S; cin >> S;
    if(S == "ABC") Out("ARC");
    else Out("ABC");

    return 0;
}


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

#define REP(i, n) for (int i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int x[4] = {-1, 1, 0, 0};
int y[4] = {0, 0, -1, 1}; 

int main() { 

    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w,0));

    REP(i,h)
    {
        REP(j,w)
        {
            cin >> s[i][j];
        }
    }

    //自分が'#', 四方4マスが'.'
    REP(i,h)
    {
        REP(j,w)
        {
            if(s[i][j] == '#')
            {
                bool flag = false;
                REP(k, 4)
                {
                    int ido_y = i + y[k];
                    int ido_x = j + x[k];
                    if(ido_y < 0 || ido_y >= h || ido_x < 0 || ido_x >= w)continue;
                    if(s[ido_y][ido_x] == '#')
                    {
                        flag = true;
                    }
                }
                if(!flag)
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "Yes" << endl;
    return 0;

}

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


int main() {
  
  int k,a,b;
  cin >> k >> a >> b;

  int i = 1;
  for(int i = 1;k*i <= b;i++) {
    if(a <= k*i && k*i <= b) {
      cout << "OK" << endl;
      return 0;
    }
  }

  cout << "NG" << endl;

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,i,j;
    cin>>a>>b;

    for(i=min(a,b);i<=max(a,b);i++)
    {
        if(abs(a-i)==abs(b-i))
        {
            cout<<i<<endl;
            return 0;
        }
    }

    cout<<"IMPOSSIBLE\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pr pair<int, int>
#define v1d vector<int>
#define mp make_pair
#define pb push_back
#define v1p vector<pr>
#define vb vector<bool>
#define v2d vector<vector<int>>
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define S(v) sort(v.begin(), v.end())
#define RS(v) sort(v.rbegin(), v.rend())
#define eb emplace_back
#define endl "\n"
#define MOD 1000000007
#define pqx priority_queue <int>
#define pqn priority_queue <int, v1d, greater<int> >
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};

int32_t main() {
    fio
    int a, b; cin >> a >> b;
  cout << a * b ;
    
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
// Custom Header <<<
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD  = int(1e9) + 7;
// >>>


signed main()
{
    int x, a;
    cin >> x >> a;

    if (x < a) {
        cout << 0 <<endl;
    } else {
        cout << (10) << endl;
    }
    return 0;
}

/* vim:set foldmethod=marker foldmarker=<<<,>>> : */


Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

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

for i in range(K,N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')
    






Measured memory_bytes: 50020
#double linked list
#using collection dequeue
from collections import deque

n = int(input())
que = deque()
command = ""
key = 0
for i in range(n):
    line = input()
    if " " in line:
        command, key = line.split()
    else:
        command = line

    if command == "insert":
        que.appendleft(key)
    elif command == "delete":
        try:
            que.remove(key)
        except:
            pass
    elif command == "deleteFirst":
        que.popleft()
    elif command == "deleteLast":
        que.pop()
print(" ".join(que))




Measured memory_bytes: 69740
/*
ID: Aman Raj
LANG: C++
TASK: subset
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
//hr
using namespace std;
using namespace __gnu_pbds;
//hy
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
  //# define mod 1e9+7
   ll gcd(ll a,ll b)
   {
       if(a==0)return b;
       return gcd(b%a,a);
   }
//kj
int main()
{
    ll n;cin>>n;
     vector<ll> v(n);
     ll a=0,b=0;
      for(ll i=0;i<n;i++){cin>>v[i];if(v[i]>=a){b=a;a=v[i];}else b=max(b,v[i]);  }
      for(ll i=0;i<n;i++)
      {
          if(v[i]==a)cout<<b<<endl;
           else cout<<a<<endl;
      }

      return 0;
}


Measured memory_bytes: 3200
n= int(input())
A = list(map(int, input().split()))
B = [0]*(n+1)
B_sum = [0]*(n+1)
count = 0

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

    j = 1
    while (n-i+1)*j <= n:
        B_sum[n-i+1] += B[(n-i+1)*j]
        j += 1
    if B_sum[n-i+1] % 2 != A[n-i]:
        B[n-i+1] = 1
        count += 1
print(count)
for i in range(1,n+1):
    
    if B[i]==1:
        print(str(i) + " ", end = "")








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


int main() {
  int A[3][3];
  int N,flag=0;
  
  for (int i=0; i<3; i++){
    for (int j=0; j<3; j++){
      cin >> A[i][j];
    }
  }

  cin >> N;
  int b[N];
  for (int i=0; i<N; i++) cin >> b[i];
  
  for (int k=0; k<N; k++){
    for (int i=0; i<3; i++){
      for (int j=0; j<3; j++){    
        if (b[k] == A[i][j]) A[i][j] = -1;
      }
    }
  }
  
  for (int i=0; i<3; i++){
    if ((A[i][0] == -1) && (A[i][1] == -1) && (A[i][2] == -1)) flag = 1;
    if ((A[0][i] == -1) && (A[1][i] == -1) && (A[2][i] == -1)) flag = 1;
  }
  if ((A[0][0] == -1) && (A[1][1] == -1) && (A[2][2] == -1)) flag = 1;
  if ((A[2][0] == -1) && (A[1][1] == -1) && (A[0][2] == -1)) flag = 1;
  
  if (flag == 1) cout << "Yes" << endl;
  else  cout << "No" << endl;
}

Measured memory_bytes: 256
let (N, K) = {a in (Int(a[0])!, Int(a[1])!)}(readLine()!.split(separator: " "))
var aru = Array(repeating: false, count: N)

for _ in 0..<K {
    let _ = readLine()!
    let A = readLine()!.split(separator: " ").map{e in Int(e)!}
    for e in A {
        aru[e - 1] = true
    }
}

print(aru.filter{x in !x}.count)



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

int main()
{
    unsigned long long N;
    cin >> N;
    int ans = 0;
    int count = 0;
    for (int n = 1; n <= sqrt(N); ++n)
    {
        if (N % n == 0)
        {
            int B = N / n;
            for (int i = 0; i < 10; ++i)
            {
                B /= 10;
                if (B == 0)
                {
                    count = i + 1;
                    break;
                }
            }
            if (ans == 0)
            {
                ans = count;
            }
            else
            {
                ans = min(ans, count);
            }
        }
    }
    cout << ans << endl;
}

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

import sys
from collections import deque

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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = 3
# グリッドを最初から文字列として1次元で保持する
grid = '*' * (N+2)
for i in range(N):
    grid += '*' + input().replace(' ', '') + '*'
grid += '*' * (N+2)
start = grid.find('0')

# 完成形の盤面
goal = '******123**456**780******'
que = deque()
que.append((grid, 0, start))
# その盤面に至る移動コスト
memo = {}
while len(que):
    grid, cost, cur = que.popleft()
    if grid in memo:
        continue
    memo[grid] = cost
    grid = list(grid)
    # 4方向見る
    for direction in (-1, 1, -(N+2), N+2):
        nxt = cur + direction
        if grid[nxt] != '*':
            grid[cur], grid[nxt] = grid[nxt], grid[cur]
            que.append((''.join(grid), cost+1, nxt))
            grid[cur], grid[nxt] = grid[nxt], grid[cur]

print(memo[goal])



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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

int main()
{
	int a , b,  c, x,  y;
	cin >> a >> b>>  c>> x>>  y;
	ll ans = INF; ;
	for(int i = 0 ; i <=  max(x,y) ; i++ ){
		//2i個のcを買う
		ll tmp = 0;
		tmp += 2*c * i ;
		tmp += max(0,x-i) * a  + max(0,y-i) * b;
		chmin(ans,tmp);
	}
	cout << ans << endl;
}


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


int main(){
	long long int n,*N;
	cin >> n;
	N = new long long int[n];
	N[0] = 2;
	N[1] = 1;
	if (n == 0) {
		cout << 2 << endl;
	}else if (n == 1) {
		cout << 1 << endl;
	}else {
		for (int i = 2; i <= n;i++) {
			N[i]=(N[i - 2]) + (N[i - 1]);
		}
		cout << N[n] << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == 1)
	{
		cout << "YES" << endl;
		return 0;
	}
	for(int i = 1; i <= 99; i++)
	{
		if (a * i % b == c)
		{
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    else
    {
        return gcd(b, a % b);
    }
}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

ll mod_add(ll a, ll b)
{
    if (a % b == 0)
    {
        return a;
    }
    else
    {
        return a + (b - a % b);
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll lcm_cd = lcm(C, D);

    ll num_div_c = B / C - mod_add(A, C) / C + 1;
    ll num_div_d = B / D - mod_add(A, D) / D + 1;
    ll num_div_cd = B / lcm_cd - mod_add(A, lcm_cd) / lcm_cd + 1;
    ll ans = (B - A + 1) - (num_div_c + num_div_d - num_div_cd);
    cout << ans << endl;

 //   system("pause");
    return 0;
}

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

#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define fill(a,v)  memset(a, v, sizeof (a))
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define FORD(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N=501000;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll LINF = LLONG_MAX;
ll powmod(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}

int main()
{
	faster;

	int n;
	vi dp(3, 0);

	cin >> n;
	cin >> dp[0] >> dp[1] >> dp[2];
	for(int i = 1; i < n; ++i){
		vi cur(3), nDp(3);

		for(int i = 0; i < 3; ++i)	cin >>cur[i];

		for(int i = 0; i < 3; ++i){
			for(int j = 0; j < 3; ++j){
				if(i != j){
					nDp[i] = max(nDp[i], cur[i] + dp[j]);
				}
			}
		}
		for(int i = 0; i < 3; ++i)	dp[i] = nDp[i];
	}
	cout << max(dp[0], max(dp[1], dp[2]));

	return 0;
}

// READ
// THINK
// CODE
// DEBUG
// AC


Measured memory_bytes: 384
// 8/29 リアルタイム参加
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;

int main() {
    string S, T;
    cin >> S >> T;

    int ns = S.size();
    int nt = T.size();

    int max_count = 0;

    for (int i = 0; i < ns - nt + 1; i++) {
        int count = 0;
        for (int j = 0; j < nt; j++) {
            if (S[i + j] == T[j]) count++;
        }
        max_count = max(count, max_count);
    }

    cout << nt - max_count << endl;
    return 0;
}

Measured memory_bytes: 3640
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Ball[] arr = new Ball[n];
		for (int i = 0; i < n; i++) {
			Ball b = new Ball();
			b.x = sc.nextLong();
			b.y = sc.nextLong();
			arr[i] = b;
		}
		sc.close();

//		Arrays.parallelSort(arr);

		int max = 0;
		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				long p = arr[i].x - arr[j].x;
				long q = arr[i].y - arr[j].y;
				int cnt = 0;
				Set<Integer> set1 = new HashSet<Integer>();
				Set<Integer> set2 = new HashSet<Integer>();
				for (int k = 0; k < n; k++) {
					if (set1.contains(k)) {
						continue;
					}
					for (int k2 = 0; k2 < n; k2++) {
						if (k == k2) {
							continue;
						}
						if (set2.contains(k2)) {
							continue;
						}
						long dx = arr[k].x - arr[k2].x;
						long dy = arr[k].y - arr[k2].y;
						boolean flgX = false;
						boolean flgY = false;
						if (dx == p) {
							flgX = true;
						}
						if (dy == q) {
							flgY = true;
						}
						if (flgX && flgY) {
							cnt++;
							set1.add(k);
							set2.add(k2);
						}
					}
				}
				max = Math.max(max, cnt);
			}
		}
		System.out.println(n - max);
	}

	static class Ball implements Comparable<Ball>{
		long x, y;
		public int compareTo(Ball o) {
			if (o.x == x) {
				return 0;
			} else if (o.x < x) {
				return 1;
			} else {
				return -1;
			}
		}
	}
}


Measured memory_bytes: 29064
#include<stdio.h>

int main()
{
	int t,h,m,s;
	scanf("%d",&t);
	h = t/3600;
	m = (t-h*3600)/60;
	s = t-h*3600-m*60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
typedef long long       ll;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define fore(i, b, e)      for(int i = b; i < e; i++)
#define forr(i, b, e)      for(int i = b; i < e; i++)
#define forg(i, b, e, m)  for(int i = b; i < e; i+=m)
#define F first
#define S second
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<int, int>  ii;
typedef pair<int, ii>  iii;
typedef vector<int>     vi;

typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
const double PI = acos(-1);
const double EPS = 1e-9;
#define tam 1234567

int main()
{
   string txt;
   cin>>txt;
   int queries;
   cin>>queries;
   bool rev,bbegin;
   rev=bbegin=0;
   int tipo;char chr;
   deque<char> cola;
   forr(i,0,txt.size())
   cola.push_back(txt[i]);
   forr(i,0,queries)
   {
        cin>>tipo;
        if (tipo==1)
            rev^=1;
        else
        {
            cin>>tipo>>chr;
            bbegin=(tipo==1);
            bbegin^=rev;
            if (bbegin)
                cola.push_front(chr);
            else
                cola.push_back(chr);
        }
   }
   if (rev)
    reverse(cola.begin(),cola.end());
   for(char bal:cola)
    cout<<bal;
    
}
// PLUS ULTRA!

Measured memory_bytes: 896
#include <iostream>
using namespace std;
int main(void){
    int H, W;
    while(true){
        cin >> H >> W;
        if(H==0 && W==0) break;
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if((i%2==0 && j%2==0) || (i%2==1 && j%2==1)){
                    cout << "#";
                }
                else{
                    cout << ".";
                }
            }
            cout << endl; 
        }
        cout << endl;
    }
}



Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    ll N, K, S;
    cin >> N >> K >> S;

    vector<ll> A(N);
    REP(i, K) A[i] = S;
    if (S != 1e9) for(int i = K; i < N; i++) A[i] = S+1;
    else for(int i = K; i < N; i++) A[i] = S-1;

    REP(i, N) cout << A[i] << " ";
    cout << endl;



    return 0;
}


Measured memory_bytes: 2048
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 510000;
ll const MOD = 1000000007;

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


    ll ans = 0;
    rep(i, N) {
        ans += (a[i] - 1);
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
    int H,W,i,c,a;
    for(a=0; ;a++){
                scanf("%d %d",&H,&W);
            if(H==0&&W==0){
                    break;}

    for(i=0;i<H;i++){
        for(c=0;c<W;c++){
            printf("#");


    }
    printf("\n");
    }
    printf("\n");
    }
    return 0;
    }



Measured memory_bytes: 2000
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int n, m, q;
V<int> a, b, c, d;
ll ans = 0;
V<int> tmpa;

void calc() {
    ll tmpc = 0;
    for (int i = 0; i < q; i++) {
        if (tmpa[b[i]] - tmpa[a[i]] == c[i]) tmpc += (ll)d[i];
    }
    chmax(ans, tmpc);
}

void dfs(int tmpn) {
    if (tmpn == n) {
        calc();
    } else {
        int start = (tmpa.empty() ? 1 : tmpa.back());
        for (int i = start; i <= m; i++) {
            tmpa.push_back(i);
            dfs(tmpn + 1);
            tmpa.pop_back();
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> q;
    a.resize(q), b.resize(q), c.resize(q), d.resize(q);
    for (int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--, b[i]--;
    }
    
    dfs(0);
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int N;
    int A[114514],B[114514],C[114514]={};
    cin >> N;
    int Ans=0;
    REP(i,N){cin >> A[i] >> B[i];C[i]=A[i]+B[i];Ans+=A[i];Ans-=B[i];}
    sort(C,C+N,greater<>());
    REP(i,N){
        if(i%2==0){
            Ans+=C[i];
        }else{
            Ans-=C[i];
        }
    }
    cout << Ans/2 << endl;
    
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
//#include "atcoder/all"
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
const ll mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;

  string s = "ACL";

  for (int i = 0; i < n; i++) cout << s;
}

Measured memory_bytes: 3608
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long cnt[300000] = {};
long long moving[300000] = {};
long long nya[300000] = {};
int main() {
#define int long long
	long long total = 0;
	int n, m;
	cin >> n >> m;
	vector<int> hoge;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		hoge.push_back(tmp);
	}
	for (int i = 0;i < n-1;++i) {
		cnt[hoge[i] + 1] += 1;
		if (hoge[i] <= hoge[i + 1]) {
			cnt[hoge[i + 1]] -= 1;
			moving[hoge[i + 1] + 1] -= hoge[i + 1] - hoge[i] - 1;
			total += hoge[i + 1] - hoge[i];
		}
		else {
			cnt[hoge[i + 1] + m] -= 1;
			moving[hoge[i + 1] + m + 1] -= (hoge[i + 1] + m) - hoge[i] - 1;
			total += (hoge[i + 1] + m) - hoge[i];
		}
	}
	long long let = 0;
	long long neko = 0;
	for (int i = 0;i <= 250000;++i) {
		neko += let;
		neko += moving[i];
		nya[i] = neko;
		let += cnt[i];
	}
	for (int i = m + 1;i <= 250000;++i) {
		if (i % m != 0) {
			nya[i%m] += nya[i];
		}
		else nya[m] += nya[i];
	}
	long long fia = 0;
	for (int i = 1;i <= m;++i) {
		fia = max(fia, nya[i]);
	}
	cout << total - fia << endl;
	return 0;
}

Measured memory_bytes: 7284
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
#define ls k<<1,l,mid
#define rs k<<1|1,mid+1,r
#define mp(x,y) make_pair(x,y)
#define r(x) read(x)
#define rrr(x,y,z) read(x);read(y);read(z)
#define FOR(i,l,r) for(int i=l;i<=r;i++)
using namespace std;
typedef long long LL;
typedef pair<int,int> pt;
const int N=2e5+5;
const int M=2e3+5;
const int INF=0x7fffffff;
const int mod=1e9+7;
const double eps=1e-8;
const double pi=acos(-1);
LL n,m;
int f[N];
template<class T>
inline void read(T &x)
{
    char c; x=1;
    while((c=getchar())<'0'||c>'9') if(c=='-') x=-1;
    T res=c-'0';
    while((c=getchar())>='0'&&c<='9') res=res*10+c-'0';
    x*=res;
}
int main()
{
    r(n);
    FOR(i,1,n) r(f[i]);
    sort(f+1,f+n+1);
    int nn=unique(f+1,f+n+1)-f-1;
    if(n==nn) cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

vector<int> g[200200];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w,n; cin >> h >> w >> n;
    for(int i=0;i<n;i++){
        int x,y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
    }
    int r=0;
    for(int i=1;i<h;i++){
        sort(g[i].begin(),g[i].end());
        if(g[i].size()&&g[i][0]<=r){
            cout << i << endl;
            return 0;
        }
        if(g[i].size()==0||g[i][0]>r+1){
            r++;
        }
    }
    cout << h << endl;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD = 1e9 + 7;

int t[100011];
int a[100011];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	t[0] = 0;
	a[0] = MOD;
	t[n+1] = MOD;
	a[n+1] = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> t[i+1];
	}
	for(int i = 0; i < n; i++)
	{
		cin >> a[i+1];
	}
	ll ans = 1;
	for(int i = 1; i <= n; i++)
	{
		if((t[i]>t[i-1])&&(a[i]>a[i+1]))
		{
			if(a[i]!=t[i])
			{
				cout<<0<<'\n';
				return 0;
			}
		}
		else if(t[i]>t[i-1])
		{
			if(t[i]>a[i])
			{
				cout<<0<<'\n';
				return 0;
			}
		}
		else if(a[i]>a[i+1])
		{
			if(a[i]>t[i])
			{
				cout<<0<<'\n';
				return 0;
			}
		}
		else
		{
			ans = (ans*min(t[i],a[i]))%MOD;
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0

for i in range(n):
  ans += b[i]
for j in range(n-1):
  if a[j] == a[j+1] -1:
    ans += c[(a[j]-1)]

print(ans)

Measured memory_bytes: 9200
# your code goes here
H,W = map(int,input().split())
canvas = [input() for i in range(H)]

dx = [1,0,-1,0]
dy = [0,1,0,-1]
flag = False

for i in range(H):
	for j in range(W):
		if flag:
			break
		if canvas[i][j] == '.':
			continue
		flag = True
		for k in range(4):
			if i+dy[k] >= 0 and i+dy[k] < H and j+dx[k] >= 0 and j+dx[k] < W and canvas[i+dy[k]][j+dx[k]] == '#':
				flag = False
				break
	if flag:
		break

if flag:
	print('No')
else:
	print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define lol long long
using namespace std;
int main(){
    int a,b,c[7]={1,3,5,7,8,10,12},d[4]={4,6,9,11},ai=0,bi=0;
    string s,t,q;
    cin>>a>>b;
    for(int i=0;i<7;i++){
        if(a==c[i])ai++;
        if(b==c[i])bi++;
    }
    if(ai==0 && bi==0){
        for(int i=0;i<4;i++){
            if(a==d[i])ai++;
            if(b==d[i])bi++;
        }
    }
    if(ai==bi) cout<<"Yes\n";
    else cout<<"No\n";
    return(0);
}

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

H_list = [int(s) for s in input().split()]

tenboudai = [1] * (N+1)
tenboudai[0] = 0

# print(tenboudai)

for i in range(M):
    A, B = map(int, input().split())
    # print(H_list[A-1],H_list[B-1])
    if H_list[A-1] <= H_list[B-1]:
        tenboudai[A] = 0
    if H_list[A-1] >= H_list[B-1]:
        tenboudai[B] = 0

print(sum(tenboudai))

Measured memory_bytes: 20116
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, X, Y = mapint()
X, Y = X-1, Y-1
dist = [0]*(N-1)
for i in range(N-1):
    for j in range(i+1, N):
        d = min(j-i, abs(i-X)+abs(j-Y)+1, abs(i-Y)+abs(j-X)+1)
        dist[d-1] += 1
for k in range(N-1):
    print(dist[k])

Measured memory_bytes: 75088
S=input()
if(S=="hi"):
  print("Yes")
elif(S=="hihi"):
  print("Yes")
elif(S=="hihihi"):
  print("Yes")
elif(S=="hihihihi"):
  print("Yes")
elif(S=="hihihihihi"):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
def solver(hh, ww, h, w):
    return hh * ww - h * ww - w * hh + h * w

if __name__ == '__main__':

    hh,ww = map(int, input().split())
    h,w = map(int, input().split())

    ans = solver(hh, ww, h, w)
    print(ans)


Measured memory_bytes: 2940
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: u128,
        b: u128,
        c: u128,
        d: u128
    };

    let start_to_a_with_c = (a - 1) / c;
    let start_to_b_with_c = b / c;

    let start_to_a_with_d = (a - 1) / d;
    let start_to_b_with_d = b / d;

    let x = start_to_b_with_c - start_to_a_with_c + start_to_b_with_d - start_to_a_with_d;

    let lcm_cd = lcm(c, d);

    let start_to_a_with_cd = (a - 1) / lcm_cd;
    let start_to_b_with_cd = b / lcm_cd;

    let y = start_to_b_with_cd - start_to_a_with_cd;

    println!("{}", (b - a + 1) - (x - y));
}

fn lcm(a: u128, b: u128) -> u128 {
    let mut a = a;
    let mut b = b;

    let x = a * b;

    if a > b {
        let tmp = a;
        a = b;
        b = tmp;
    }

    let mut r = a % b;

    while r != 0 {
        a = b;
        b = r;
        r = a % b;
    }

    return x / b;
}


Measured memory_bytes: 2176
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    # x = int(stdin.readline().rstrip())
    a,b,c,d = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    A = a * c
    B = b * d
    C = a * d
    D = b * c
    print(max(A,B,C,D))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9184
#include <cstdio>

int main(void)
{
    int n, i, a, ans = 0;

    scanf("%d" ,&n);
    for (i = 0; i < n; i++)
	{
        scanf("%d" ,&a);

        if (a == ans + 1)
			++ans;
	}

	printf("%d" ,n - ans == n ? -1 : n - ans);
	return 0;
}

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

matrix = [[0] * 10 for i in range(10)]

for n in range(1, N + 1):
    # nの先頭桁
    n_head = int(str(n)[0])
    # nの末尾桁
    n_tail = int(str(n)[-1])
    matrix[n_head][n_tail] += 1

answer = 0
for n in range(1, N + 1):
    # nの先頭桁
    n_head = int(str(n)[0])
    # nの末尾桁
    n_tail = int(str(n)[-1])
    answer += matrix[n_tail][n_head]

print(answer)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>
#include <atcoder/all>

using namespace std;

int op(int a, int b) { return max(a, b); }
int e() { return 0; }

int main()
{
    int n, k, a, ans = 0;
    cin >> n >> k;
    atcoder::segtree<int, op, e> seg(300010);

    for (int i = 0; i < n; i++) {
        cin >> a;
        int tmp = seg.prod(max(a - k, 0), min(a + k, 300000) + 1) + 1;
        ans = max(ans, tmp);
        seg.set(a, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8572
s=str(input())

ans=int(s[0])
a=ans
for i in range(2):
    ans=a
    if i==0:
        ans+=int(s[1])
        i='+'
    else:
        ans-=int(s[1])
        i='-'
    b=ans
    for j in range(2):
        ans=b
        if j==0:
            ans+=int(s[2])
            j='+'
        else:
            ans-=int(s[2])
            j='-'
        c=ans
        for k in range(2):
            ans=c
            if k==0:
                ans+=int(s[3])
                k='+'
            else:
                ans-=int(s[3])
                k='-'
            if ans==int(7):
                print(s[0]+str(i)+s[1]+str(j)+s[2]+str(k)+s[3]+'=7')
                break
        else:
            continue
        break
    else:
        continue
    break



Measured memory_bytes: 3188
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

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

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

    bool arr[4];
int main() {
    ios_base::sync_with_stdio(false);

    for(int i = 0; i < 2; i++) {
        int x;
        cin >> x;
        arr[x] = true;
    }
    for(int i = 1; i <= 3; i++) {
        if(!arr[i]) {
            cout << i << endl;
            return 0;
        }
    }

}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// 01Trie BIT CHT DFT FFT avl cmd cusum dijkstra dinic geo2 gin graph kruskal lca lcm matrix ncm next_combination ppuf segtree st tmp topcoder uf vi 

int fact[10145140];

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

int extgcd(int a, int b, int &x, int &y)
{
    int d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else { x = 1; y = 0; }
    return d;
}

int repow(int x, int n, int mod)
{
    if (n == 0) return 1;
    int res = repow(x * x % mod, n / 2, mod);
    if (n & 1) res = res * x % mod;
    return res;
}

int mod_inverse(int a, int m)
{
    int x, y;
    extgcd(a, m, x, y);
    return ( m + x % m ) % m;
}

int table(int n, int p)
{
    int sum = 1;
    fact[0] = 1;
    Rep(i, n+2) {
        sum *= i;
        sum %= p;
        fact[i] = sum;
    }
    return 0;
}

int mod_fact(int n, int p, int &e)
{
    e = 0;
    if (n == 0) return 1;
    int res = mod_fact(n / p, p, e);
    e += n / p;

    if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
    return res * fact[n % p] % p;
}

int mod_comb(int n, int k, int p) {
    if (n < 0 || k < 0 || n < k) return 0;
    int e1, e2, e3;
    int a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n-k, p, e3);
    if (e1 > e2 + e3) return 0;
    return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

signed main()
{
    table(10001000, MOD);

    Int(n);
    string st;
    cin >> st;
    int k = st.size();

    int len = n + k;

    int ans = repow(26, len, MOD);

    rep(i, k) {
        ans = (ans - (repow(25, len - i, MOD) * mod_comb(len, i, MOD) % MOD) + MOD) % MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 83472