akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use rand::prelude::*;

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

#[allow(unused)]
fn calc(i: usize, day: usize, s: &Vec<Vec<isize>>, c: &Vec<isize>, last: &mut Vec<usize>) -> isize {
    last[i] = day;
    let up = s[day - 1][i];
    let mut down = 0;

    for j in 0..26 {
        down += (day - last[j]) as isize * c[j];
    }

    up - down
}

fn update(i: usize, j: usize, day: usize, s: &Vec<Vec<isize>>, c: &Vec<isize>) -> isize {
    let mut ans = s[day - 1][j] - s[day - 1][i];
    let c_diff = c[j] - c[i];
    let i = i as isize;
    let j = j as isize;
    ans += c_diff * (j * j - 25 * j - i * i + 25 * i);
    ans
}

fn main() {
    input! {
        d: usize,
        c: [isize; 26],
        s: [[isize; 26]; d],
    }

    // let mut score = 0;
    // let mut last = vec![0; 26];

    let mut tmp_dec_max = (0, 0);
    for e in c.iter().enumerate() {
        if tmp_dec_max.1 < *e.1 {
            tmp_dec_max = (e.0, *e.1);
        }
    }

    let mut contests = vec![];

    for day in 1..=d {
        let mut tmp_inc_max = (0, 0);
        for i in 0..26 {
            if tmp_inc_max.1 < s[day - 1][i] {
                tmp_inc_max = (i, s[day - 1][i]);
            }
        }

        let target: usize;

        if tmp_inc_max.0 == tmp_dec_max.0 {
            target = tmp_inc_max.0;
        } else if tmp_inc_max.1 > tmp_dec_max.1 {
            target = tmp_inc_max.0;
        } else {
            target = tmp_dec_max.0;
        };
        contests.push(target);
        // score += calc(tmp_inc_max.0, day, &s, &c, &mut last);
    }

    let mut rng = rand::thread_rng();
    let ch_contest: Vec<_> = (0..26).collect();
    let ch_day: Vec<_> = (1..=d).collect();

    for _ in 0..1_000_000 {
        if let Some(contest) = ch_contest.choose(&mut rng) {
            if let Some(day) = ch_day.choose(&mut rng) {
                let before = contests[*day - 1];
                if update(before, *contest, *day, &s, &c) > 0 {
                    contests[*day - 1] = *contest;
                }
            };
        };
    }

    for e in contests {
        echo!(e + 1);
    }

    // score += 10_isize.pow(6);
    // score = std::cmp::max(0, score);

    // dbg!(score);
}


Measured memory_bytes: 2764
#include <iostream>


bool diff(int a[5], int k ){
  for(int i=0; i<5; i++){
    for(int j=i+1; j<5; j++){
      if ( !(std::abs(a[i] - a[j]) <= k) ) return false;
    }
  }
  return true;
}

int main (void){
  int x[5];
  for(int i=0; i<5; i++){
    std::cin >> x[i] ;
  }

  int k; std::cin >> k;

  if ( diff(x, k) ) std::cout << "Yay!" << std::endl;
  else std::cout << ":(" << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,i,l,r,s,t;
	bool flag = true;
	ll a[123456],ans=0ll;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	sort(a,a+n);
	l = 0; s = n-1;
	while(s > 2){
		ans -= a[l]*2;
		++l; s-=2;
	}
	r = n-1; t = n-1;
	while(t > 2){
		ans += a[r]*2;
		--r; t-=2;
	}
	if(s==1){
		ans += a[r]-a[l];
	}
	if(s==2){
		ans += max(a[r]+a[r-1]-a[l]*2,a[r]*2-a[l+1]-a[l]);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		cout << min(10 - n / 200, 8) << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3648
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[0]*W for _ in range(H)]
R=[[0]*W for _ in range(H)]
U=[[0]*W for _ in range(H)]
D=[[0]*W for _ in range(H)]
for i in range(H):
    count=0
    for j in range(W):
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        L[i][j]=count
for i in range(H):
    count=0
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        R[i][j]=count
for i in range(W):
    count=0
    for j in range(H):
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        U[j][i]=count
for i in range(W):
    count=0
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        D[j][i]=count
ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(ans)


Measured memory_bytes: 310280
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int>w(n);
  vector<int>e(n);
  int wcount=0;
  int ecount=0;
  rep(i,n){
    if(s.at(i) =='W') wcount++;
    w.at(i) = wcount;
  }
  rep(i,n){
    if(s.at(i) =='E') ecount++;
    e.at(i) = ecount;
  }
  int count = 0;
  int mi = 3000010;
  rep(i,n){
    count = 0;
    if(s.at(i)=='W') count += w.at(i)-1;
    else count += w.at(i);
    count += ecount - e.at(i);
    mi = min(mi,count);
  }
//  cout << wcount << endl;
//  cout << ecount << endl;
  cout << mi << endl;  
}


Measured memory_bytes: 6152
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N+10);
    rep(i,N){
        cin >> A[i];
        A[i]--;
    }
    ll ans = 0;
    rep(i,N){
        if(A[i] == i){
            swap(A[i],A[i+1]);
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1152
#include <stdio.h>

int main(void){
    int n,m,p,i,sum,map[100];
    for(;sum=0,scanf("%d %d %d",&n,&m,&p),n;){
        for(i=0;i<n;i++){
            scanf("%d",&map[i]);
            sum+=map[i];
        }
        sum*=(100-p);
        if(map[m-1] == 0)
            printf("0\n");
        else
            printf("%d\n",sum/map[m-1]);
    }
    return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

int x;

signed main(){
	read(x);
	write(x%100<=x/100*5);
}

Measured memory_bytes: 256
<?php

$n = trim(fgets(STDIN));
$nums = explode(' ', trim(fgets(STDIN)));

$ans = $nums[0];
$count = count($nums);

for ($i = 0; $i < $count - 1; $i++) {
    if ($nums[$i] <= $nums[$i + 1]) {
        $ans += $nums[$i];
    } else {
        $ans += $nums[$i + 1];
    }
}
$ans += $nums[$count - 1];

echo $ans;

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

while True:
    for i in range(len(a)):
        if a[i] % 2 == 0:
            dist = a[i] // 2
            if dist >= 0:
                a[i] = dist
            else:
                print(ans)
                exit()
        else:
            print(ans)
            exit()
    ans += 1



Measured memory_bytes: 2940
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] broken = new int[m];
    for(int i = 0; i < m; i++){
      broken[i] = Integer.parseInt(sc.next());
    }

    boolean possible = true;
    int succesive_safe = 1;
    int succesive_broken = 0;
    Long total_way = 1L;
    int[] fibonatti = {0,0,1};
    int next_broken = 0;

    for(int i = 0; i < n; i++){
      if(m != 0){
        if(i + 1 != broken[next_broken]){
          if(succesive_safe == 0){
            succesive_broken = 0; 
          }
          succesive_safe++;
          
          fibonatti[0] = fibonatti[1];
          fibonatti[1] = fibonatti[2];
          fibonatti[2] = (fibonatti[1] + fibonatti[0]) % 1000000007;
          if(succesive_safe == 1){
            fibonatti[2] = 1;
          }
        }else if(succesive_broken == 0){
          succesive_broken++;
          total_way = total_way * fibonatti[2] % 1000000007;
          succesive_safe = 0;
          fibonatti[0] = 0;
          fibonatti[1] = 0;
          fibonatti[2] = 0;
          if(next_broken != m - 1){
            next_broken++;
          }
        }else{
          possible = false;
          break;
        }
      }else{
        succesive_safe++;
          
        fibonatti[0] = fibonatti[1];
        fibonatti[1] = fibonatti[2];
        fibonatti[2] = (fibonatti[1] + fibonatti[0]) % 1000000007;
      }
    }
    total_way = total_way * fibonatti[2] % 1000000007;
    if(possible){
      System.out.println(total_way);
    }else{
      System.out.println(0);
    }
  }
}

Measured memory_bytes: 43188
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int x;
    vector<int> s;
    s.resize(N);
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    sort(s.begin(),s.end());

    double ans;
    ans = (s[0] + s[1]) / 2.;
    for(int i=2;i<N;i++){
        ans += s[i];
        ans /= 2.;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

signed main(){
	static int A[10],B[10];
	static int C[10];
	REP(i,3){
		cin>>A[i]>>B[i];
		C[A[i]-1]++;
		C[B[i]-1]++;
	}
	int cnt=0;
	REP(i,4){
		if(C[i]==2){
			cnt++;
		}
	}
	if(cnt==2){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}


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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 2010;

int n;
int a[maxn + 5];

bool vis[maxn + 5];

int ans[maxn + 5];

int p[maxn + 5];

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	REP(i, 0, n) scanf("%d", a + i);
	sort(a, a + n);
	memset(p, 0, sizeof p);
	REP(i, 0, n)
	{
		int Maxp = -1;
		int pos = -1;
		REP(j, 0, n) if (!vis[j] && (!~Maxp || p[j] > pos))
		{
			Maxp = j;
			pos = p[j];
			while (pos < i && ans[pos] > a[Maxp]) ++pos;
		}
		vis[Maxp] = 1;
		REP(j, 0, n) if (!vis[j])
		{
			if (p[j] > pos) ++p[j];
			else if (__gcd(a[Maxp], a[j]) > 1) p[j] = pos + 1;
		}
		rotate(ans + pos, ans + i, ans + i + 1);
		ans[pos] = a[Maxp];
	}
	REP(i, 0, n) printf("%d ", ans[i]);
	return 0;
}


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

int main() {
  int64_t H;
  cin >> H;
  int d = 0;
  while(H != 1) {
    d++;
    H /= 2;
  }
  int64_t S = 0;
  for(int i = 0; i < d + 1; i++) {
    S += pow(2, i);
  }
  cout << S << endl;
}

Measured memory_bytes: 384
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int h,w;
  cin >> h >> w;

  vector<string> s(h);
  REP(i,h) cin >> s[i];
  
  int dx[] = {1,1,1,0,0,0,-1,-1,-1}, dy[] = {1,0,-1,1,0,-1,1,0,-1}; 
  char ans[55][55];

  REP(i,h){
    REP(j,w){
      int cnt = 0;
      REP(k,9){
        int x = i+dx[k], y = j+dy[k];
        if(range(x,0,h)&&range(y,0,w)&&s[x][y]=='#') cnt++;
      }
      ans[i][j] = (char)(cnt+'0');
      if(s[i][j]=='#') ans[i][j] = '#';
    }
  }

  REP(i,h){
    REP(j,w) cout <<ans[i][j];
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 59;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>H>>W>>A>>B;
    S = "";
    rep(i,W) S.push_back('0');
    vector<string> ans(H,S);
    rep(i,B){
        reps(j,A,W) ans[i][j] = '1';
    }
    reps(i,B,H){
        rep(j,A) ans[i][j] = '1';
    }
    rep(i,H){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 2304
#include<stdio.h>

int n, A[50];
int solve (int i, int m){
	if ( m == 0 ) return 1;
	if ( i >= n ) return 0;
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
}

int main() {
	int q, M, i;
	
	scanf("%d", &n);
	for( i = 0; i < n; i++) scanf("%d", &A[i]);
	scanf("%d", &q);
	for( i = 0; i < q; i++) {
		scanf("%d", &M);
		if( solve(0, M) ) printf("yes\n");
		else printf("no\n");
	}
	return 0;
}



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

using namespace std;

int main()
{
    int cnt = 0;
    string word;
    string text;
    
    cin >> word;
    for (int i = 0; i < word.length(); i++)
    {
        if ((word[i] >= 'A') && (word[i] <= 'Z'))
        {
            word[i] += 'a' - 'A';
        }
    }
    
    while (cin >> text)
    {
        if (text == "END_OF_TEXT")
        {
            break;
        }
        
        for (int i = 0; i < text.length(); i++)
        {
            if ((text[i] >= 'A') && (text[i] <= 'Z'))
            {
                text[i] += 'a' - 'A';
            }
        }
        
        if (word == text)
        {
            cnt++;
        }
    }
    
    cout << cnt << endl;
    
    return 0;
}



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

namespace AtCoder
{
    class Program
    {
        public static void Main(string[] args)
        {
            int[] l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).OrderBy(x => x).ToArray();
            Console.WriteLine("{0}", l[0] * l[1] / 2);
        }
    }
}

Measured memory_bytes: 13396
const MOD: i64 = 1000000007;

fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let a: Vec<i64> = s.take(n).map(|a| a.parse().unwrap()).collect();
	let sum = a.iter().fold(0, |r, &a| (r + a) % MOD);
	let mut ans = 0;
	for a in a.iter() {
		ans = (ans + sum * a) % MOD;
		ans = (ans + MOD * MOD - a * a) % MOD;
	}
	ans = (ans * (MOD + 1) / 2) % MOD;
	println!("{}", ans);
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    int sum = accumulate(A.begin(), A.end(), 0);

    int ans = 0;
    rep(i, N) {
        if (A[i] * (4*M) >= sum) ans++;
    }

    if (ans < M) {
        cout << "No" << endl;
    } else {
        cout<< "Yes" << endl;
    }
}

Measured memory_bytes: 256
const Main = (input)=>{
	var xs = input.trim().split(' ').map(v=>parseInt(v,10));
    var a = Math.abs(xs[0] - xs[1]);
    var b = Math.abs(xs[0] - xs[2]);
    if(a > b){
    console.log('B');
    }else if(a < b){
    console.log('A');
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
int main(){

  int a;

  cin>>a;

  if(a==25){
    cout<<"Christmas"<<endl;
  }else if(a==24){
    cout<<"Christmas Eve"<<endl;
  }else if(a==23){
    cout<<"Christmas Eve Eve"<<endl;
  }else{
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

// 整数スキャン（複数）
/*
int x;
scanf("%d",&x);
int y;
scanf("%d",&y);
int z;
scanf("%d",&y);

// n個の整数のスキャン
/*
ll a[n] = {};
rep(i,n){
    scanf("%lld",&a[i]);
}
*/

// 文字列スキャン
/*
string s;
cin >> s;
*/


int main() {
    int n;
    scanf("%d",&n);
    int ans = 0;

    if(n%2==0){
        ans = (n*n)/4;
    }else{
        ans = (n/2)*((n+1)/2);
    }




    

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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
//using System.Linq;
class Program
{
	static void Main(string[] args)
	{
		// 入力フェーズ
        string[] input1 = Console.ReadLine().Split(' ');
        string[] input2 = Console.ReadLine().Split(' ');
        string[] input3 = Console.ReadLine().Split(' ');

string ret = "YES";
        // 3本の道に同じ街が三つとも含まれていなければOK
        // 1チェック
        if(
        (input1[0] == "1" || input1[1] == "1")
        && (input2[0] == "1" || input2[1] == "1")
        && (input3[0] == "1" || input3[1] == "1")
        ) ret = "NO";

        if(
        (input1[0] == "2" || input1[1] == "2")
        && (input2[0] == "2" || input2[1] == "2")
        && (input3[0] == "2" || input3[1] == "2")
        ) ret = "NO";

        if(
        (input1[0] == "3" || input1[1] == "3")
        && (input2[0] == "3" || input2[1] == "3")
        && (input3[0] == "3" || input3[1] == "3")
        ) ret = "NO";

        if(
        (input1[0] == "4" || input1[1] == "4")
        && (input2[0] == "4" || input2[1] == "4")
        && (input3[0] == "4" || input3[1] == "4")
        ) ret = "NO";
    // 出力
        Console.WriteLine(ret);
    }
		class myClass{ //自作クラス
			public int ID {set; get;}
			public long Point {set; get;}
		}

		static private long myMethod(int args)
		{
			// 自作メソッド
			long ret = 0;

			return ret;
		}
}


Measured memory_bytes: 11092
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int R = int.Parse(Console.ReadLine());
            if (R < 1200)
            {
                Console.WriteLine("ABC");
            }
            else if (R < 2800)
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("AGC");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  int N, K; std::cin >> N >> K;
  int Mx = N*(N-1)/2, Mt = Mx - (N-1);
  if(K > Mt) fin(-1);
  int ans = Mx - K;

  // gen
  std::cout << ans << "\n";
  for(int i = 2; i <= N; ++i) {
    std::cout << "1 " << i << "\n";
    --ans;
  }

  if(ans) for(int i = 2; i < N; ++i) for(int j = i+1; j <= N; ++j) {
    std::cout << i << " " << j << "\n";
    if(--ans == 0) return 0;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

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

#define MAX 60
#define MOD 1000000007

using namespace std;
typedef long long int lli;

struct matrix
{
	public:

		int N;
		lli v[MAX][MAX];

		matrix(int n)
		{
			N = n;

			for(int g = 1 ; g <= N ; g++)
				for(int h = 1 ; h <= N ; h++)
					v[g][h] = 0;
		}

		matrix operator *(matrix k)
		{
			matrix ans( N );

			for(int l = 1 ; l <= N ; l++)
				for(int c = 1 ; c <= N ; c++)
					for(int g = 1 ; g <= N ; g++)
						ans.v[l][c] = (ans.v[l][c] + (v[l][g] * k.v[g][c]))%MOD;

			return ans;
		}
};

int n;

lli expo;
lli sum;

matrix exponentiation(matrix k, lli e)
{
	if(e == 1) return k;

	matrix aux = exponentiation(k , e/2);
	matrix ans = aux * aux;

	if(e%2 == 0) return ans;
	return ans * k;
}

int main()
{
	scanf("%d %lld",&n,&expo);

	matrix adj(n);

	for(int g = 1 ; g <= n ; g++)
		for(int h = 1 ; h <= n ; h++)
			scanf("%d",&adj.v[g][h]);

	matrix ans = exponentiation(adj , expo);

	for(int g = 1 ; g <= n ; g++)
		for(int h = 1 ; h <= n ; h++)
			sum = (sum + ans.v[g][h])%MOD;

	printf("%lld\n",sum);
}

Measured memory_bytes: 8448
#include <iostream>
using namespace std;
    int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d){
        cout << "Yes" << endl;
    }else if(abs(a-b) <=d && abs(b-c) <=d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



signed main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    string s;
    cin >> s;
    if(s[s.size()-1] == 's') s += "es";
    else s += "s";
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3664
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
  int n,i,a[123];
  cin>>n;
  for(i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  cout<<a[n-1]-a[0]<<endl;
}

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

int main(void){
    int N,K;
    cin>>N>>K;
    vector<int> D(K);
    for(int i=0;i<K;i++) cin>>D[i];
    
    for(int i=0;i<100000;i++){
        int tmp=N+i;
        set<int> se;
        while(tmp>0){
            se.insert(tmp%10);
            tmp/=10;
        }
        
        bool check=false;
        for(int i=0;i<K;i++){
            if(se.count(D[i]))check=true;
        }
        
        if(!check){cout<<N+i<<endl;return 0;}
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<ll> a(n);
	int minus = 0;
	int plus = 0;
	ll ans = 0LL;
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		
		if( a[i] >= 0 ) plus++;
		else minus++;
		
		ans += abs(a[i]);
	}
	
	if( minus % 2 == 0 ) {
		cout << ans << endl;
	} else {
		ll mini = MOD_LL;
		for(int i = 0; i < n; ++i) {
			mini = min(mini, abs(a[i]));
		}
		
		cout << ans - 2LL * mini << endl;
	}
	
	return 0;
}


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

int main() {
	int n;
	cin>>n;
	int a[n][3];
	cin>>a[0][0]>>a[0][1]>>a[0][2];
	for(int i=1;i<n;i++)
	{cin>>a[i][0]>>a[i][1]>>a[i][2];
	a[i][0]+=max(a[i-1][1],a[i-1][2]);
	a[i][1]+=max(a[i-1][0],a[i-1][2]);
	a[i][2]+=max(a[i-1][0],a[i-1][1]);
	}
	cout<<max(a[n-1][0],max(a[n-1][1],a[n-1][2]));
	return 0;
}

Measured memory_bytes: 1536
lines = $stdin.read
 
array = lines.split("\n")
n     = array[0]
lp    = 0
rp    = 0
 
for i in 1..n.to_i
  lr = array[i].split(" ")
  lr.sort!
 
  if lr[0] == lr[1]
    rp += 1
    lp += 1
  elsif lr[1] == array[i].split(" ")[1]
    rp += 3
  else
    lp += 3
  end
end
 
puts "#{lp} #{rp}"

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

int main() {
    int N; cin >> N;
    int T[N];
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }
    int M; cin >> M;
    int ans_arr[M];
    for (int i = 0; i < M; i++) {
        int P, X; cin >> P >> X;
        int ans = 0;
        for (int j = 0; j < N; j++) {
            if (j == P - 1) {
                ans += X;
            } else {
                ans += T[j];
            }
        }
        ans_arr[i] = ans;
    }
    for (int i = 0; i < M; i++) {
        cout << ans_arr[i] << endl;
    }
}


Measured memory_bytes: 3608
from collections import deque

H, W = map(int, input().split())
S = [input() for _ in range(H)]

def solve(x, y):
    offset = [(1, 0), (-1, 0), (0, 1), (0, -1)]
    visited = [[-1] * W for _ in range(H)]
    visited[y][x] = 0
    
    q = deque()
    q.append((x, y))

    while q:
        x, y = q.popleft()

        for u, v in offset:
            if not (0 <= x + u < W) or not (0 <= y + v < H):
                continue

            if visited[y + v][x + u] > -1 or S[y + v][x + u] == "#":
                continue

            visited[y + v][x + u] = visited[y][x] + 1
            q.append((x + u, y + v))
            
    return visited

ans = 0
for y, ss in enumerate(S):
    for x, s in enumerate(ss):
        if s == ".":
            ans = max(ans, max(max(v) for v in solve(x, y)))

print(ans)


Measured memory_bytes: 44508
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int x;
	cin>>x;
	cout<<(x^1)<<'\n';
	
}


Measured memory_bytes: 3592
# N × N のマス目があります。
# このマス目の各マスを白色または黒色に塗ることにしました
# (すべてのマスをどちらか片方の色に塗ります)。
#
# ちょうど Aマスを白色に塗るとき、
# 黒色に塗ることになるマスはいくつあるでしょうか。

# 制約
# 1 ≦ N ≦ 100
# 0 ≦ A ≦ Nの2乗

# 標準入力から N, A の値を取得する
n = int(input())
a = int(input())

# 計算結果を出力する
result = (n * n) - a

print(result)


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

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

  long long ans=0;

  for(int i=0; i<N+1; i++){
    if(!(i%3==0||i%5==0)){
    ans=ans+i;
    }
  }

  cout << (long long)ans << endl;

return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<30;
const ll LLINF = 1LL<<62;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


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

  int h,w;
  static const int size = 50;
  int black[size+2][size+2] = {};
  string S;
  cin >> h >> w;
  REP(i,h){
      cin >> S;
      REP(j,S.size()){      
        if (S[j]=='#'){
            black[i+1][j+1]=1;
        }
      }
  }
  REP(i,h){
      REP(j,w){
        if (black[i+1][j+1] == 1){
            bool flag = false;
            REP(k,4){
                if (black[i+1+DY[k]][j+1+DX[k]]==1)flag = true;
            }
            if (!flag){
                cout << "No" << endl;
                return 0;
            }
        }
      }
  }
  cout << "Yes" << endl;
}


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

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7

n = int(input())
a = list(map(int,input().split()))

b = [0]*(n+1)

for i in range(n//2,n):
    if a[i] == 1:
        b[i+1] = 1

for i in range(1,n//2+1)[::-1]:
    s = 0
    if i == 1:
        if sum(b) == 0 and a[0]:
            b[1] = 1
        elif sum(b) % 2 != a[0]:
            b[1] = 1
        break
    for j in range(2,n):
        if i*j > n:
            break
        if b[i*j] == 1:
            s += 1
    if s % 2:
        if a[i-1] == 1:
            continue
        b[i] = 1
    elif s % 2 == 0 and a[i-1] == 1:
        b[i] = 1

m = sum(b)
if m == 0:
    print(0)
    quit()
else:
    print(m)
    ans = [i for i,v in enumerate(b) if v]
    print(*ans)


Measured memory_bytes: 14780
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n := scanInt(sc)
	count, min := 0, math.MaxInt32
	for i := 0; i < n; i++ {
		v := scanInt(sc)
		if v < min {
			count++
			min = v
		}
	}
	return count
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}

Measured memory_bytes: 3264
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int R[4010], G[4010], B[4010];
int main()
{
	int N;
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; i++) {
		R[i + 1] = R[i];
		G[i + 1] = G[i];
		B[i + 1] = B[i];
		if (S[i] == 'R') R[i + 1]++;
		if (S[i] == 'G') G[i + 1]++;
		if (S[i] == 'B') B[i + 1]++;
	}
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int diff = j - i;
			if (S[i] != S[j]) {
				int num = 0;
				if (S[i] == 'R' && S[j] == 'G') {
					num = B[N] - B[j + 1];
					if (j + j - i < N) {
						if (S[j + (j - i)] == 'B')num--;
					}
				}
				if (S[i] == 'R' && S[j] == 'B') {
					num = G[N] - G[j + 1];
					if (j + j - i < N){
						if (S[j + (j - i)] == 'G')num--;
						}
				}
				if (S[i] == 'G' && S[j] == 'R') {
					num = B[N] - B[j + 1];
					if (j + j - i < N) {
						if (S[j + (j - i)] == 'B')num--;
					}
				}
				if (S[i] == 'G' && S[j] == 'B') {
					num = R[N] - R[j + 1];
					if (j + j - i < N) {
						if (S[j + (j - i)] == 'R')num--;
					}
				}
				if (S[i] == 'B' && S[j] == 'R') {
					num = G[N] - G[j + 1];
					if (j + j - i < N) {
						if (S[j + (j - i)] == 'G')num--;
					}
				}
				if (S[i] == 'B' && S[j] == 'G') {
					num = R[N] - R[j + 1];
					if (j + j - i < N) {
						if (S[j + (j - i)] == 'R')num--;
					}
				}
				ans += num;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3688
#include<stdio.h>

int main(void)
{
  int a,b,c;

  scanf("%d %d %d",&a,&b,&c);

  if(a+b+c==17 && a==5 && b==7 || a+b+c==17 && a==7 && b == 5 ||
    a+b+c==17 && a==5 &&b ==5)
    printf("YES\n");
  else
    printf("NO\n");

    return 0;
}


Measured memory_bytes: 256
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7


if (X + Y) % 3 != 0:
    print(0)
    exit()


X, Y = min(X, Y), max(X, Y)
ALL_MOVE = (X + Y) // 3
for m1 in range(ALL_MOVE):
    m2 = ALL_MOVE - m1

    if (m1 * 2 + m2 == X) and (m1 + m2 * 2 == Y):
        move_1_cnt = m1
        move_2_cnt = m2
        break
else:
    print(0)
    exit()


factorial = [1]
inverse = [1]
for i in range(1, ALL_MOVE + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


print(nCr(ALL_MOVE, move_1_cnt) % MOD)


Measured memory_bytes: 115308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll a, b, x;
  cin >> a >> b >> x;
  ll l, u;
  if(a == 0) l = -1;
  else l = (a-1)/x;
  u = b/x;
  cout << u - l <<endl;
}

Measured memory_bytes: 256
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(hoge != fuga and ans > ((hoge * fuga) % 2019)):
        ans = (hoge * fuga) % 2019
  print(ans)

Measured memory_bytes: 40812
// 6/20
// AGC045 リアルタイム参加
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

mint dp[3010][3010];

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    combination comb(10000);

    memset(dp, 0, sizeof(dp));
    dp[A][B] = 1;

    for (int h = A; h <= C; h++) {
        for (int w = B; w <= D; w++) {
            if (w == B && h == A) {
                continue;
            } else if (w == B) {
                dp[h][w] = dp[h-1][w] * mint(B);
            } else if (h == A) {
                dp[h][w] = dp[h][w-1] * mint(A);
            } else {
                // dp[h][w] = dp[h-1][w-1] * comb(h+w-1, 2);
                // mint mul = 0;
                // mul += (h-1) * (w-1);
                // mul += (h + w - 2);
                // dp[h][w] = dp[h-1][w-1] * mul;

                // dp[h][w] += dp[h-1][w-1] * comb(h+w-1, 2);
                // dp[h][w] += dp[h-2][w-1] * (h-2) * w;
                // dp[h][w] += dp[h-1][w-2] * (w-2) * h;

                dp[h][w] += dp[h-1][w] * w;
                dp[h][w] += dp[h][w-1] * h;
                dp[h][w] -= dp[h-1][w-1] * (h-1) * (w-1);
            }
            // dp[h][w] = dp[h-1][w-1] * (h + w - 1);

            // printf("dp[%d][%d] = %d\n", h, w, dp[h][w]);
        }
    }

    cout << dp[C][D].x << endl;
}

Measured memory_bytes: 74560
# coding: utf-8
# Your code here!
from collections import defaultdict

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0 for i in range(q)]
c = [0 for i in range(q)]
for i in range(q):
    bb,cc = map(int,input().split())
    b[i] = bb
    c[i] = cc

d = defaultdict(int)
sub = 0
for i in range(n):
    d[a[i]] += 1
    sub += a[i]

for i in range(q):
    if b[i] <= c[i]:
        dd = c[i]-b[i]
        sub += d[b[i]] * dd
        d[c[i]] += d[b[i]]
        d[b[i]] = 0
    else:
        dd = b[i]-c[i]
        sub -= d[b[i]] * dd
        d[c[i]] += d[b[i]]
        d[b[i]] = 0
    print(sub)


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


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


  int h,w;
  cin >> h >> w;
  int n;
  cin >> n;
  if(h<w) swap(h,w);
  int ans=0;
  while(n>0){
    n-=h;
    ans++;
  }
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define SORT(v) sort(v.begin(),v.end())
#define fori(i,a,b) for(ll i=a;i<b;i++)
#define M 1000000007
#define deb(x) cout<< #x << " " << x << endl;

double pi=3.14159265358979323846;

typedef pair<int,int> pii;
typedef pair<long long int, long long int>pll;
typedef vector<int>vi;
typedef vector<long long int>vl;
#define MAXN 10000001
 
int main ()
{
    ll T;
    T=1;
   //cin>>T;
    while(T--)
    {	
	ll n,ans=0,t;
	cin>>n;
	for(ll i=1;i<=n;i++){
		t=n/i;
		ans+=(i*((t*(t+1))/2));
	}

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


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

f = [0] * (10 ** 4 + 1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if n <= 10 ** 4:
                f[n] += 1
print(*f[1 : N + 1], sep="\n")



Measured memory_bytes: 68656
#include<stdio.h>
#include<algorithm>
using namespace std;

#define MAX 100

void Print(int A[MAX], int N)
{
    for(int i = 0;i < N;i++) {
        if(i > 0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

int selectionSort(int *A,int N)
{
    int counter = 0;
    for(int i = 0;i < N-1;i++) {
        int minj = i;
        for(int j = i;j < N;j++)
            if(A[j] < A[minj])
                minj = j;
        if(i != minj) {
            swap(A[i],A[minj]);
            counter++;
        }
    }
    return counter;
}

int main()
{
    int N;
    int A[MAX];

    scanf("%d",&N);
    for(int i = 0;i < N;i++)
        scanf("%d",&A[i]);

    int num = selectionSort(A,N);
    Print(A,N);
    printf("%d\n",num);
}



Measured memory_bytes: 2752
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll F[100050];
int main() {
	int N, M, i, j;
	scanf("%d %d", &N, &M);

	F[0] = 1;
	for (i = 1; i <= 100000; i++) F[i] = F[i - 1] * i % MOD;

	int c = 0;
	if (abs(N - M) == 1) c = 1;
	if (abs(N - M) == 0) c = 2;
	return !printf("%lld\n", (c*F[N] * F[M]) % MOD);
}

Measured memory_bytes: 1532
import sys


def get_ngram(n, s):
    return [''.join(s[i:i+n]) for i in range(len(s)-n+1)]


def main():
    S = input()
    chars = {'A', 'C', 'G', 'T'}

    for i in range(len(S), -1, -1):
        for c in get_ngram(i, S):
            if set(c) <= chars:
                print(i)
                sys.exit()


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
n = input()
n = int(n)

pl = []
for i in range(n):
    pl.append(int(input()))

m = pl[0]
M = pl[0]
difM = pl[1]-pl[0]

for i, p in enumerate(pl[1:]):
    if p < m: 
        m = p
        continue
    if p - m > difM:
        difM = p - m

print(difM)
        

Measured memory_bytes: 16964
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main() {
    long long N, A, B;
    cin >> N >> A >> B;

    long long X = N / (A + B);
    long long Y = A * X;
    long long Z = min(N % (A + B), A);
    
   
    cout << Y + Z << endl;
   
    
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e9;

int main()
{
	int n,k,s;
	scanf("%d%d%d",&n,&k,&s);
	for(int i = 1;i <= k;++i) printf("%d%c",s,i == n ?'\n' :' ');
	for(int i = k+1;i <= n;++i){
		if(s == N) printf("%d%c",N-1,i == n ?'\n' :' ');
		else printf("%d%c",s+1,i == n ?'\n' :' ');
	}
	return 0;
}

Measured memory_bytes: 1280