akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=500005,mod=998244353;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
int n,k;
int Fac[N],Inv[N];
void prework(){
	int n=N-1;
	Fac[0]=1;
	For(i,1,n)
		Fac[i]=(LL)Fac[i-1]*i%mod;
	Inv[n]=Pow(Fac[n],mod-2);
	Fod(i,n,1)
		Inv[i-1]=(LL)Inv[i]*i%mod;
}
int C(int n,int m){
	if (m<0||m>n)
		return 0;
	return (LL)Fac[n]*Inv[m]%mod*Inv[n-m]%mod;
}
int main(){
	prework();
	n=read(),k=read();
	int ans=0;
	For(r,0,k){
		int b=k-r;
		if (r<b||r<n)
			continue;
		int t=r-(n-1);
		if (r==b)
			Add(ans,Del(C(k-1,r)-C(k-1,r+t)));
		else
			Add(ans,Del(C(k,r)-C(k,r+t)));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>

using namespace std;
using ll = long long;

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

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

  int ans = max(a + b, a - b);
  ans = max(ans, a * b);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL (1LL<<62) // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    // 初期入力
    Init();
    ll n;
    cin >> n;
    vi a(n);
    map<ll, ll> cnt;
    pair<ll, ll> maxNum = {-INFLL, -1}, minNum = {INFLL, -1};
    rep(i, n){
        cin >> a[i];
        cnt[a[i] == 0 ? 0 : a[i]/abs(a[i])]++;
        if(a[i] > maxNum.first) maxNum = make_pair(a[i], i);
        if(a[i] < minNum.first) minNum = make_pair(a[i], i);
    }

    // 操作の記録
    vector<pair<ll, ll>> ans;

    // 正と負の値が混在している場合
    if(cnt[1] != 0 && cnt[-1] != 0){
        // 初期要素のうち、最大値の絶対値が最小値の絶対値より大きい場合は、
        // 全ての要素に最大値を加算することで全て正にできる
        if(abs(maxNum.first) >= abs(minNum.first)){
            for(ll i=0; i<n; i++) if(i != maxNum.second) ans.emplace_back(maxNum.second, i);
            ans.emplace_back(maxNum.second, maxNum.second);
            cnt[1] = n, cnt[-1] = 0, cnt[0] = 0;
        }
        // 最大値の絶対値より最小値の絶対値のほうが大きいまたは等しい場合は、
        // 全ての要素に最小値（負値）を加算することで負or0にできる
        else{
            for(ll i=0; i<n; i++) if(i != minNum.second) ans.emplace_back(minNum.second, i);
            ans.emplace_back(minNum.second, minNum.second);
            cnt[1] = 0, cnt[-1] = n, cnt[0] = 0;
        }
    }

    // 正なら先頭から、負なら末尾から累積和を求める
    if(cnt[1] + cnt[0] == n) for(ll i=0; i<n-1; i++) ans.emplace_back(i, i+1);
    else for(ll i=n-1; i>=1; i--) ans.emplace_back(i, i-1);

    // 答えの出力
    cout << ans.size() << endl;
    for(ll i=0; i<(ll)ans.size(); i++){
        cout << ans[i].first+1 << " " << ans[i].second+1 << endl;
        a[ans[i].second] += a[ans[i].first];
    }

    // bool ok = true;
    // rep(i, n){
    //     cout << a[i] << " ";
    //     if(i != n-1){
    //         if(a[i] > a[i+1]) ok = false;
    //     }
    // }
    // cout << endl;
    // ok ? YES() : NO();
    
}

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

const int N = (int) 1e5 + 10;
const int inf = (int) 2e9 + 10;

long long arr[N];

int main() {
//    freopen("in.txt", "r", stdin);
    int n; scanf("%d", &n);
    long long sum = 0L;
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &arr[i]);
        sum += arr[i];
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += arr[i] * (sum - arr[i]);
    }
    printf("%lld\n", ans / 2L);
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <vector>
 
int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> ac(n, 0), wa(n, 0);
  for (int i = 0; i < m; i++) {
	int p;
    std::string str;
    std::cin >> p >> str;
	--p;
	if (ac.at(p) != 0) continue;
    if (str == "AC") {
	  ac.at(p)++;
    } else if (str == "WA") {
      wa.at(p)++;
    }
  }
  
  int ac_sum = 0;
  int wa_sum = 0;
  for (int i = 0; i < n; i++) {
	if (ac.at(i) == 1) {
      ac_sum++;
      wa_sum += wa.at(i);
    }
  }
  std::cout << ac_sum << " " << wa_sum << std::endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        double moto = 100;
        long x = Long.valueOf(mylist.get(0));
        int cnt = 0;
//        System.out.println(x);

        while (moto < x) {

            moto = Math.floor(moto * 1.01);
            cnt += 1;
        }
        System.out.println(cnt);

    }

}


Measured memory_bytes: 32660
#include<bits/stdc++.h>
using namespace std;
#define int  long long 
#define speedrap ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int be(int a,int b,int mod) {if(b == 0) return 1; if(b%2 == 1) return (a*be(a,b-1,mod))%mod; else return (be(a,b/2,mod)*be(a,b/2,mod))%mod;}
const int mod = 1e9+7;
#define PI 3.14159265359
#define pf push_front
#define pb push_back
#define bitcount __builtin_popcount
#define sc(a) scanf("%d", &a);
#define sz(s) (int)s.size()
#define eb emplace_back
#define pf push_front
#define mkp(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
const int siz = 2*(2500 + 1);
const int logi = 21;
const double epsilon = 1e-6;
int prime[siz];
bool cmp(const int &a,const int &b)
{
  return (abs(a-b)>1);
}

signed main()
{
	
	speedrap
	int t;
	t = 1;
	//cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		int a[n+1];
		int has[n+1];
		memset(has,0,sizeof(has));
		for(int i = 2;  i <= n ; i++)
		{
			cin>>a[i];
			has[a[i]]++;
		}

		for(int i = 1 ; i <= n ; i++)
		{
			cout<<has[i]<<"\n";
		}
	}
}

Measured memory_bytes: 6740
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

ul N, M, T, H, W;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  if (H > N || W > N) {
    cout << 0 << endl;
    return 0;
  }
  cin >> N;
  cin >> H;
  cin >> W;
  cout << (N - H + 1) * (N - W + 1) << endl;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            if(ret != null) Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        var co = 0;

        for(int i = 0; i<n; i++) {
            var spl = input.ReadLine().Split(' ');
            var a = int.Parse(spl[0]);
            var b = int.Parse(spl[1]);

            if(a == b){
                co++;
                if(co == 3) return Yes;
            } else {
                co = 0;
            }
        }

        return No;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> c(4, 0);
    string s;
    for (int i=0; i<n; i++) {
        cin>>s;
        if (s == "AC") c[0]++;
        else if (s == "WA") c[1]++;
        else if (s == "TLE") c[2]++;
        else c[3]++;
    }
    cout << "AC x " << c[0] << '\n';
    cout << "WA x " << c[1] << '\n';
    cout << "TLE x " << c[2] << '\n';
    cout << "RE x " << c[3] << '\n';
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
typedef long long int ll;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("o.txt","w",stdout);
    int n,k;
    cin>>n;
    k=n/2;
    if(n%2==0) {
        cout<<k*k;
    }
    else cout<<(k+1)*k;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k = Integer.parseInt(sc.next());
		int s = Integer.parseInt(sc.next());
		int count = 0;
      	for(int i = 0; i <= k; i++){
          	for(int j = 0; j <= k; j++){
          		int z = s-i-j;
          		if(z >=0 && z<=k) {
          			count++;
          		}
          	}
      	}
      			System.out.println(count);
	}
}

Measured memory_bytes: 35764
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

#define PI 3.141592653589793238
#define INF 1050000000

using namespace std;



//cout << fixed << setprecision(15) << << endl;
//cout << << endl;

int main() {

	int X, A, B;

	cin >> X >> A >> B;

	if (X >= A) {
		if (X >= B) {
			cout << A + B << endl;
		}
		else {
			cout << A + X << endl;
		}
	}
	else {
		if (A >= B) {
			cout << X + B << endl;
		}
		else {
			cout << A + X << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 256
program golf
  implicit none
  integer :: k, x, y, s, m, i, sx = 1, sy = 1, ix = 1, iy = 2
  integer :: v(1000000,2) = 0, r, d
  read(*,*) k
  read(*,*) x, y
  if (x < 0) then
    x = -x
    sx = -1
  end if
  if (y < 0) then
    y = -y
    sy = -1
  end if
  s = x+y
  if (mod(s,2) == 1 .and. mod(k,2) == 0) then
    write(*,'(i0)') -1
    stop
  end if
  if (s == k) then
    write(*,'(i0)') 1
    write(*,'(i0,x,i0)') sx*x, sy*y
    stop
  end if
  if (x < y) then
    m = x
    x = y
    y = m
    ix = 2
    iy = 1
  end if
  m = (s+k-1)/k
  if (m < 2) m = 2
  if (mod(s,2) /= mod(m*k,2)) m = m+1
  if (m == 3 .and. x < k) then
    v(1,:) = (/ x, -(k-x) /)
    v(2,:) = (/ x+(k+x-y)/2, -(k-x)+(k-x+y)/2 /)
    v(3,:) = (/ x, y /)
  else
    r = (m*k-s)/2
    do i = 1, m
      d = i*k
      if (d <= y+r) then
        v(i,:) = (/ 0, d /)
      else if (d <= y+r+x) then
        v(i,:) = (/ d-y-r, y+r /)
      else
        v(i,:) = (/ x, y+(m-i)*k /)
      end if
    end do
  end if
  write(*,'(i0)') m
  do i = 1, m
    write(*,'(i0,x,i0)') sx*v(i,ix), sy*v(i,iy)
  end do
  stop
end program golf

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

MOD_CONST = 10 ** 9 + 7

if N <= 2:
    print(0)
    exit()

res = [1] * N
res[0] = res[1] = 0

for i in range(5, N):
    res[i] = res[i - 4] + res[i - 3] + res[i - 2]

print(res[N-1] % MOD_CONST)



Measured memory_bytes: 9152
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin >> a >> b >> c;
    if(a<b){
        if(b<c){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3084
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m, A, B;
  scanf("%d%d%d%d", &n, &m, &B, &A);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int x = (i < A && j < B) || (i >= A && j >= B);
      printf("%d", x);
    }
    puts("");
  }
  return 0;
}


Measured memory_bytes: 1280
#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 <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
#define int long long
	int test_case;
	cin >> test_case;
	for (int hoge = 0; hoge < test_case; ++hoge) {
		long long a, b, c, d;
		cin >> a >> b >> c >> d;
		if (a < b) {
			cout << "No" << endl;
			continue;
		}
		if (b > d) {
			cout << "No" << endl;
			continue;
		}
		if (c >= b) {
			cout << "Yes" << endl;
			continue;
		}
		a %= b;
		d %= b;
		long long left = max(-1LL, c - a);
		long long right = b - a;
		long long mod = b;
		int aa = 0;
		vector<long long> gea;
		gea.push_back(d);
		while (d >= 1) {
			if ((left == -1&&right != 0)||right - left >= d + 1) {
				cout << "No" << endl;
				aa = 1;
				break;
			}
			long long geko = mod / d * d;
			geko %= mod;
			if ((geko + d) % mod < geko % mod) {
				geko += d;
			}
			geko %= mod;
			if (geko == 0) break;
			d = geko; 
			gea.push_back(d);
		}
		if (aa == 1) continue;
		if (d == 0) {
			if (left < 0 && right > 0) {
				cout << "No" << endl;
				continue;
			}
			cout << "Yes" << endl;
			continue;
		}
		if (right - left >= d + 1) {
			cout << "No" << endl;
			continue;
		}
		vector<int> asa;
		for (int i = 0; i < gea.size(); ++i) {
			asa.push_back(i);
		}
		do {
			int now_left = left;
			int now_right = right;
			for (int i = 0; i < asa.size(); ++i) {
				now_right -= now_left / (gea[asa[i]]) * gea[asa[i]];
				now_left -= now_left / gea[asa[i]] * gea[asa[i]];
				if (now_left - gea[asa[i]] < 0&&now_right - gea[asa[i]] > 0) {
					now_left -= gea[asa[i]];
					now_right -= gea[asa[i]];
				}
			}
			if (now_left < 0 && now_right > 0) {
				cout << "No" << endl;
				aa = 1;
				break;
			}
		} while (next_permutation(asa.begin(), asa.end()));
		if (aa == 0) {
			cout << "Yes" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }

const int INF = 1e9;

int h, w;
vector< vector<int> > magic(10, vector<int>(10, 0));
vector< vector<int> > dp(10, vector<int>(10, INF));

int main() {
    cin >> h >> w;
    for(int i = 0; i < 10; ++i) {
        for(int j = 0; j < 10; ++j) {
            cin >> magic.at(i).at(j);
        }
    }

    for(int i = 0; i < 10; ++i) {
        for(int j = 0; j < 10; ++j) {
            if(i == j) dp[i][j] = 0;
            else dp[i][j] = magic.at(i).at(j);
        }
    }

    for(int k = 0; k < 10; ++k) {
        for(int i = 0; i < 10; ++i) {
            for(int j = 0; j < 10; ++j) {
                chmin(dp[i][j], dp[i][k]+dp[k][j]);
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            int a;
            cin >> a;
            if(a != -1) ans += dp[a][1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int  i,j,H,W; 
    while(1){ 
        scanf("%d %d",&H,&W); 
        if(H==0 && W==0)break; 
        for(i=0; i<H; i++){ 
            for(j=0; j<W; j++){ 
                if(i==0||i==H-1||j==0||j==W-1){ 
                    printf("#"); 
                }else{ 
                    printf("."); 
                } 
            } 
            printf("\n"); 
        } 
        printf("\n"); 
    } 
    return 0;
}



Measured memory_bytes: 2036
N, K = gets.split.map(&:to_i)
ary = gets.split.map(&:to_i)
K.times do 
    b = Array.new(N, 0)
    ary.each_with_index do |n, i|
        l = [0, i-n].max
        r = [i+n, N-1].min
        b[l] += 1
        b[r+1] -= 1 if r+1 < N
    end
    max_flag = b[0] == N ? 1 : 0
    1.upto(N-1) do |i|
        b[i] += b[i-1]
        max_flag += 1 if b[i] == N
    end
    ary = b
    break if max_flag == N
end
puts ary.join(' ')

Measured memory_bytes: 80728
#include <iostream>

using namespace std;

int main()
{
    int pts[101] = {};
    int n;
    cin >> n;

    int const rn = n * ( n - 1 ) / 2;
    for( int i=0; i<rn; ++i ) {
        int ca, cb, pa, pb;
        cin >> ca >> cb >> pa >> pb;
        if ( pa > pb ) {
            pts[ca-1] += 3;
        } else if ( pb > pa ) {
            pts[cb-1] += 3;
        } else if ( pa == pb ){
            pts[ca-1] += 1;
            pts[cb-1] += 1;
        }
    }

    int rank[101] = {};
    int last = -1, rk=0, tr = 1;
    for( int i=0; i<n; ++i ) {
        int mm = 0, r = -1;
        for( int j=0; j<n; ++j ) {
            if ( pts[j] > mm ) {
                mm = pts[j];
                r = j;
            }
        }
        if ( mm == last ) {
            ++tr;
        } else {
            rk += tr > 0 ? tr : 1;
            tr = 1;
        }
        rank[r] = rk;
        last = mm;
        pts[r] = -1;
    }

    
    for( int i=0; i<n; ++i ) {
        cout << rank[i] << endl;
    }
}

Measured memory_bytes: 1164
import sys
input=sys.stdin.readline
import numpy as np
from numpy.fft import rfft,irfft

n,m=[int(j) for j in input().split()]
l=np.array([int(j) for j in input().split()])

a=np.bincount(l)

fft_len=1<<18
fft = np.fft.rfft
ifft = np.fft.irfft
Ff = fft(a,fft_len)
x=np.rint(ifft(Ff * Ff,fft_len)).astype(np.int64)
p=x.cumsum()
i=np.searchsorted(p,n*n-m)

q=n*n-m-p[i-1]

ans=(x[:i]*np.arange(i,dtype=np.int64)).sum()+i*q

print(int(l.sum()*2*n-ans))




Measured memory_bytes: 32816
import sys
input = sys.stdin.readline
inf = float('inf')
mod = 10**9+7


def INT_(n): return int(n)-1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [input() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    A, B = MI()

    if A >= 13:
        print(B)
    elif A < 6:
        print(0)
    else:
        print(B//2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip> 
using namespace std;
#define int long long
#define rep(i,n) for(int i=0; i<n; i++)

int a=0,b=0,c=0;
signed main(){
    cin>>a>>b>>c;
    int d=0;
    if(a%b==0){
        d=a/b;
    }else
    {
        d=a/b+1;
    }
    cout<<d*c<<endl;
}

Measured memory_bytes: 3140
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return a % 1000000007;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  ll n,m; cin >> n >> m; vl candy(n);
  rep(i,n){ ll x; cin >> x; candy[i] = x; }
  
  sort(all(candy));
  
  ll sum = 0; ll count = 0;
  
  for(ll x : candy){
    sum += x;
    if(sum > m) break;
    count++;
  }
  
  if(sum == m) cout << n << endl;
  else if(sum < m) cout << count - 1 << endl;
  else cout << count << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    bool ans = true;
    rep(i,n){
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0){
                ans = false;
            }
        }
    }
    if(ans){
        cout<<"APPROVED"<<endl;
    }
    else{
        cout<<"DENIED"<<endl;
    }
}

Measured memory_bytes: 256
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
ans=[-1]*(n)
flag=True

for i in sc:
  if ans[i[0]-1]==-1:
    ans[i[0]-1]=i[1]
  elif ans[i[0]-1]!=-1 and ans[i[0]-1]!=i[1]:
    flag=False
    break
for i in range(n):
  if i==0 and ans[i]==-1:
    if n==1:
      ans[i]=0
    else:
      ans[i]=1
  elif ans[i]==-1:
    ans[i]=0
if flag and (ans[0]!=0 or n==1):
  print("".join(map(str,ans)))
else:
  print(-1)

Measured memory_bytes: 9240
def d():
    s = input()
    count = 0
    for i in range(1, 60):
        ans = 2019 * i
        if '0' not in str(ans):
            count += 1
            print(i, ans)

    print(count)

def c():
    n = int(input())
    s = ['']*n
    for i in range(n):
        s[i] = input()
    s.sort()
    count = 1
    for i in range(1, n):
        if s[i - 1] != s[i]:
            count += 1
    print(count)

def b():
    n, k = map(int, input().split())
    check = [0] * n
    for i in range(k):
        input()
        for j in list(map(int, input().split())):
            check[j - 1] = 1
    print(check.count(0))
    


def a():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print('ABC')



b()

Measured memory_bytes: 9196
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func rScan() []rune {
	return []rune(Scan())
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func mod(x, d int) int {
	x %= d
	if x < 0 {
		x += d
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := -int(1e+18)
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := int(1e+18)
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}
func bPrint(f bool, x string, y string) {
	if f {
		fmt.Println(x)
	} else {
		fmt.Println(y)
	}
}
func iSSPrint(x []int) {
	fmt.Println(strings.Trim(fmt.Sprint(x), "[]"))
}

var lp1 int = 1000000007
var lp2 int = 998244353

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, lp1)
	sc.Split(bufio.ScanWords)
	k := iScan()
	fmt.Println(strings.Repeat("ACL", k))
}


Measured memory_bytes: 1772
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;

vector<tuple<int, int, int>> pyramid;
vector<tuple<int, int, int>> measure;

void init_pyramid()
{
  for (auto y = 0; y <= 100; y++) {
    for (auto x = 0; x <= 100; x++) {
      pyramid.emplace_back(make_tuple(x, y, 0));
    }
  }
}

void read_measure_data()
{
  int n;
  cin >> n;
  for (auto i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    measure.emplace_back(make_tuple(a, b, c));
  }
}

void check1()
{
  for (auto&& m : measure) {
    for (auto&& p : pyramid) {
      if (get<2>(p) < 0) continue;
      if (get<2>(m) == 0) continue;
      int guess = get<2>(m) + abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));
      if (get<2>(p) == 0) {
	get<2>(p) = guess;
      } else if (get<2>(p) != guess) {
	get<2>(p) = -1;
      }
    }
  }
}

void check2()
{
  for (auto&& m : measure) {
    for (auto&& p : pyramid) {
      if (get<2>(p) < 0) continue;
      if (get<2>(m) != 0) continue;
      int guess = abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));
      if (guess - get<2>(p) < 0) {
	get<2>(p) = -1;
      }
    }
  }
}

void print_ans()
{
  for (auto&& p : pyramid) {
    if (get<2>(p) > 0) {
      cout << get<0>(p) << " " << get<1>(p) << " " << get<2>(p) << endl;
    }
  }
}

int main()
{
  init_pyramid();
  read_measure_data();
  check1();
  check2();
  print_ans();
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
using namespace std;
int prime[100][2] = {};
int N; int num = 0;

int main() {
	cin >> N;
	for (int i = 2; i <= N; i++) {  //素数テーブル
		bool flag = 0;
		for (int j = 2; j <= sqrt(i); j++) {
			if (i%j == 0) {
				flag = 1;
				break;
			}
		}
		if (!flag) {
			prime[num][0] = i;
			//cout << prime[num][0] << endl;
			num++;
		}
	}

	int prime_num = 0;
	for (int i = 0; i < 100; i++) {  //素数が何個か
		if (prime[i][0] == 0) break;
		prime_num++;
	}
	//cout << prime_num;

	for (int i = 2; i <= N; i++) { //素因数分解
		int x = i;
		//cout << "'" << x << "'" << endl;
		for (int j = 0; j < prime_num; j++) {
			//cout << prime[j][0] << endl;
			while (x%prime[j][0] == 0 && x != 1) {
				prime[j][1]++;
				x /= prime[j][0];
				//cout <<"'" << x <<"'" << endl;
			}
			if (x == 1) break;
		}
	}

	int m = 0, n = 0, n15 = 0, n25 = 0, n75=0 ;
	for (int i = 0; i < prime_num; i++) {
		if (prime[i][1] >= 2) 	n++;
		if (prime[i][1] >= 4)	m++;
		if (prime[i][1] >= 14)	n15++;
		if (prime[i][1] >= 24) n25++;
		if (prime[i][1] >= 74) n75++;
	}

	int ans = (n - 2)*m*(m - 1) / 2;
	ans += n15 * (m - 1) + n25 * (n - 1) + n75;
	cout << ans << endl;




	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int n, k, temp, sum = 0, bag[100000], min;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> bag[i];
		sum += bag[i];
	}
	
	min = ceil((double)sum / k);

	int i, j;
	bool first = true, inc = false, dec = false;
	while (1) {
		i = j = 0;
		sum = 0;
		while (1) {
			if (sum + bag[i] > min) {
				sum = 0;
				j++;
			}
			else {
				sum += bag[i++];
			}

			if (i == n || j > k) {
				j++;
				break;
			}
		}

		if (j <= k) { //??§??????
			if (inc == true) {
				break;
			}
			min--;
			if (first == true) {
				dec = true;
				first = false;
			}
		}
		else {
			min++;
			if (dec == true) {
				break;
			}
			if (first == true) {
				inc = true;
				first = false;
			}
		}
	}
	cout << min << endl;

	return 0;
}

Measured memory_bytes: 1556
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <vector>

constexpr std::int64_t INF = 1ull << 50;

auto main() -> int {
  int A, B, Q;
  std::cin >> A >> B >> Q;

  // 神社
  std::vector<std::int64_t> ss(A);
  for (auto i = 0; i < A; ++i) {
    std::cin >> ss[i];
  }
  // 寺
  std::vector<std::int64_t> ts(B);
  for (auto i = 0; i < B; ++i) {
    std::cin >> ts[i];
  }

  for (auto i = 0; i < Q; ++i) {
    std::int64_t xi;
    std::cin >> xi;

    // xi から近い神社
    std::int64_t s1, s2;
    {
      const auto i1 = std::upper_bound(ss.cbegin(), ss.cend(), xi);
      const auto i2 = i1 - 1;
      s1 = i1 >= ss.cend() ? INF : *i1;
      s2 = i2 < ss.cbegin() ? INF : *i2;
    }

    // xi から近い寺
    std::int64_t t1, t2;
    {
      const auto i1 = std::upper_bound(ts.cbegin(), ts.cend(), xi);
      const auto i2 = i1 - 1;
      t1 = i1 >= ts.cend() ? INF : *i1;
      t2 = i2 < ts.cbegin() ? INF : *i2;
    }

    const auto s1t1 = std::abs(s1 - t1);
    const auto s1t2 = std::abs(s1 - t2);
    const auto s2t1 = std::abs(s2 - t1);
    const auto s2t2 = std::abs(s2 - t2);

    const auto ans = std::min({
        std::abs(xi - s1) + s1t1,
        std::abs(xi - s1) + s1t2,
        std::abs(xi - s2) + s2t1,
        std::abs(xi - s2) + s2t2,
        std::abs(xi - t1) + s1t1,
        std::abs(xi - t1) + s2t1,
        std::abs(xi - t2) + s1t2,
        std::abs(xi - t2) + s2t2,
    });
    std::cout << ans << '\n';
    // std::cout << "> " << xi << ' ' << ans << '\n';
  }
}


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

const int N = 305;
const int INF = (int) 1e9 + 9;

#define st first
#define nd second

int n, m;
int a[N][N];
int cnt[N];
vector <pair <int, int> > sports;
bool del[N];

int main() {
	//freopen(".inp", "r", stdin); freopen(".out", "w", stdout);
	ios_base :: sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) cin >> a[i][j];
	for (int i = 1; i <= n; i++) cnt[a[i][1]]++;
	for (int i = 1; i <= m; i++) sports.push_back(make_pair(cnt[i], i));
	int ans = INF;
	int res = 0;
	for (int i = 1; i <= m; i++) res = max(res, cnt[i]);
	ans = min(ans, res);
	//cout << ans << endl;
	sort(sports.begin(), sports.end());
	while (true) {
		int out = 0;
		vector <pair <int, int> > tmp;
		memset(cnt, 0, sizeof cnt);
		int sz = sports.size();
		del[sports[sz - 1].nd] = true;
		for (int i = 1; i <= n; i++) 
			for (int j = 1; j <= m; j++)
				if (del[a[i][j]] == false) {
					out++;
					cnt[a[i][j]]++;
					break;
				}
		if (out == 0) break;
		sports.clear();
		for (int i = 1; i <= m; i++) sports.push_back(make_pair(cnt[i], i));
		sort(sports.begin(), sports.end());
		sz = sports.size();
		ans = min(ans, sports[sz - 1].st);
	}
	cout << ans << "\n";
	return 0;
}

/*
4 5
5 1 3 4 2
2 5 3 1 4
2 3 1 4 5
2 5 4 3 1
*/

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

int main() {
  string s; cin>>s;
  int n=s.size();
  vector<int> a(26);
  rep(i, n) {
    int x=s[i]-'a';
    a[x]++;
  }
  bool frag=true;
  rep(i, 26) {
    if (a[i]%2==1) frag=false;
  }
  if (frag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
path = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    path[a - 1].append(b - 1)
    path[b - 1].append(a - 1)
q = int(input())
query = []
for i in range(q):
    v, d, c = map(int, input().split())
    query.append((i+1, v - 1, d, c))
dp = [[0] * 11 for i in range(n)]
def paint(v, d, i, dp, path):
    if dp[v][d] == 0:
        dp[v][d] = i
        if d > 0:
            paint(v, d - 1, i, dp, path)
            for u in path[v]:
                paint(u, d - 1, i, dp, path)
    return

for i, v, d, c in query[::-1]:
    paint(v, d, i, dp, path)
for i in range(n):
    if dp[i][0] == 0:
        print(0)
    else:
        print(query[dp[i][0]-1][3])


Measured memory_bytes: 60704
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    now = c
    a = list(map(int, input().split()))
    for j in range(m):
        now += a[j] * b[j]
    ans += now > 0
print(ans)


Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long int ll;


int main() {
  int n;
  cin >> n;
  if (n>999)
    cout << "ABD" << endl;
  else
    cout << "ABC" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,d,e;cin>>a>>b>>c>>d>>e;
    cout<<15-a-b-c-d-e<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<cmath>
#include<string>
using namespace std;
bool solve(string s,string t)
{
	
int l=t.length();
l=l-1;
t.resize(l);

if(s.length()==l)
{

	if(s.compare(t)==0)
	return true;
	else
	return false;
}
else
return false;	
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
string s,t;
cin>>s>>t;
if(solve(s,t)==true)
cout<<"Yes";
else
cout<<"No";

}


Measured memory_bytes: 3620
/*#include <bits/stdc++.h>
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef pair<int,int> pii;
int n,k,arr[101010];

main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		scanf("%d",arr+i);
	} sort(arr,arr+n);
	
}*/
#include <bits/stdc++.h>
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef pair<int,int> pii;
int n,k,arr[101010];
double enclosing_sphere(vector<double> x, vector<double> y){
  int n = x.size();
  auto hyp = [](double x, double y){
    return x * x + y * y;
  };
  double px = 0, py = 0;
  for(int i=0; i<n; i++){
    px += x[i];
    py += y[i];
  }
  px *= 1.0 / n;
  py *= 1.0 / n;
  double rat = 0.1, maxv;
  for(int i=0; i<10000; i++){
    maxv = -1;
    int maxp = -1;
    for(int j=0; j<n; j++){
      double tmp = hyp(x[j] - px, y[j] - py);
      if(maxv < tmp){
        maxv = tmp;
        maxp = j;
      }
    }
    px += (x[maxp] - px) * rat;
    py += (y[maxp] - py) * rat;
    rat *= 0.998;
  }
  return sqrt(maxv);
}
main()
{
	cin>>n; vector<double> xx,yy;
	for(int i=0;i<n;i++)
	{
		double p,q;
		scanf("%lf %lf",&p,&q);
		xx.push_back(p); yy.push_back(q);
	} printf("%lf",enclosing_sphere(xx,yy));
	
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val s = sc.next()
    val ans =
      ("abcdefghijklmnopqrstuvwxyz".toCharArray.filter(m => !s.contains(m)))
    if (ans.length == 0) {
      println("None")
    } else {
      println(ans.head)
    }
  }
}


Measured memory_bytes: 29976
#include<iostream>
using namespace std;
int A[100][100];
int B[100];
int Calc(int i,int m)
{
	int value=0;
	for(int j=0;j<m;j++){
		value+=B[j]*A[i][j];
	}
	return value;
}

int main()
{
	int n,m,value;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>A[i][j];
		}
	}
	for(int i=0;i<m;i++)
		cin>>B[i];
	for(int i=0;i<n;i++){
		cout<<Calc(i,m)<<endl;			
	}
	//cout<<Calc(n-1,m);	
	
	return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
float temp(int t, int h);

int main(){
    int n, k;
    cin >> n >> k;
    int h[n], dp[n];
    
    for(int i=0; i<=n; i++){
	cin >> h[i];	
    }
    dp[0] = 0;

    for(int i = 1; i<n; i++){
	dp[i] = dp[i-1]+abs(h[i] - h[i-1]);
	for(int j = 2; j<=k && j<=i; j++){
	    dp[i] = min(dp[i-j]+abs(h[i] - h[i-j]), dp[i]);
	}
    }
    cout << dp[n-1] << endl;
        
}


Measured memory_bytes: 1024
using System;
using System.Linq;

class IDONTKNOWCSHARP
{
    public static void Main()
    {
        string[] values = GetLines();
        long A = long.Parse(values[0]);
        int B = (int)(decimal.Parse(values[1]) * 100);
     //   Console.WriteLine(B);
       // string a = ;
        Console.WriteLine((A * B) / 100);
    ///    Console.ReadKey();
    }

    static string[] GetLines()
    {
        return Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
    }

}

Measured memory_bytes: 27504
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
//https://qiita.com/ofutonfuton/items/92b1a6f4a7775f00b6ae
 
using namespace std;
typedef long long ll;
 
const ll M = 998244353;


int main()
{
    ll H, W;
    cin >> H >> W;
    ll** a = new ll*[H];
    for(ll i = 0; i < H; i ++){
        a[i] = new ll[W];
        for(ll n = 0; n < W; n ++){
            cin >> a[i][n];
        }
    }

    vector<ll*> result;

    
    for(ll i = 0; i < H - 1; i ++){
        for(ll n = 0; n < W; n ++){
            if(a[i][n] % 2 != 0){
                ll* sousa = new ll[4];
                sousa[0] = i;
                sousa[1] = n;
                sousa[2] = i + 1;
                sousa[3] = n;
                result.push_back(sousa);
                a[i][n] --;
                a[i + 1][n] ++;
            }
        } 
    }

    for(ll n = 0; n < W - 1; n ++){
        if(a[H - 1][n] % 2 != 0){
            ll* sousa = new ll[4];
            sousa[0] = H - 1;
            sousa[1] = n;
            sousa[2] = H - 1;
            sousa[3] = n + 1;
            result.push_back(sousa);
            a[H - 1][n] --;
            a[H - 1][n + 1] ++;
        }
    }

    cout << result.size() << endl;
    for(ll* re: result){
        cout << re[0] + 1 << " "<< re[1] + 1 << " "<< re[2] + 1 << " "<< re[3] + 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 11252
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define ll long long
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

int main(){
  int n,x=0,maxi=0;
  string s;
  cin>>n>>s;
  rep(i,n){
    if(s[i]=='I')x++;
    else x--;
    maxi=max(maxi,x);
  }
  cout<<maxi<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args:Array<String>) {
    val N = 1000000
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toInt() }
    val ac = a.groupBy { it }.toSortedMap()
    val erato : MutableList<Boolean> = MutableList(N+1) { false }
    var ans = 0
    ac.forEach {
        if (it.value.size == 1 && !erato[it.key]) ans += 1
        for (i in it.key..N step it.key) erato[i] = true
    }

    println(ans)

}

Measured memory_bytes: 108836
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007

using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    std::vector<int> A(N);
    for (int i = 0; i < N; i++) {
        std::cin >> A[i];
    }

    std::set<int> values;
    for (int i = 0; i < N; i++) {
        if (values.count(A[i]) == 0) {
            values.insert(A[i]);
        } else {
            values.erase(A[i]);
        }
    }

    std::cout << values.size() << std::endl;
    return 0;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int check(int s,int r){
 	return (3 - (s+r));
}
int main(){
 	int n,k,i,j;
  	string s;
  	cin>>n>>s;
  	long long int ans = 0;
  	int cnt[n+1][3];
  	memset(cnt,0,sizeof(cnt));
  	for(i=1;i<=n;++i){
      	if(s[i-1] == 'R'){
          	cnt[i][0] = cnt[i-1][0] + 1;
			cnt[i][1] = cnt[i-1][1];
          	cnt[i][2] = cnt[i-1][2];
        }
      	else if(s[i-1] == 'G'){
          	cnt[i][0] = cnt[i-1][0];
			cnt[i][1] = cnt[i-1][1] + 1;
          	cnt[i][2] = cnt[i-1][2];
        }
      else{
       		cnt[i][0] = cnt[i-1][0];
			cnt[i][1] = cnt[i-1][1];
          	cnt[i][2] = cnt[i-1][2]+1; 
      }
    }
  	map<char,int> mp;
  	mp['R'] = 0;
  	mp['G'] = 1;
  	mp['B'] = 2;
  	
  	for(i=1;i<=n;++i){
      for(j=i+1;j<=n;++j){
      		if(s[i-1] != s[j-1]){
      			
      			ans += (cnt[n][check(mp[s[i-1]],mp[s[j-1]])] - cnt[j][check(mp[s[i-1]],mp[s[j-1]])] );
      			if(s[i-1] != s[j+j-i-1] &&  s[j+j-i-1] != s[j-1] && j+j-i<=n){
      				ans -= 1;
      			}
      		}
      }
    }
  	cout<<ans<<"\n";
}			


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define int long long int

#undef int
int main()
{
#define int long long int
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n, k;
	cin>>n>>k;
	vector<int> v(n), dp(n);
	for(int i = 0;i<n;i++)
		cin>>v[i];
	dp[1] = abs(v[0]-v[1]);
	for(int i = 2;i<n;i++)
	{
		dp[i] = INT_MAX;
		for(int j = 1;j<=k && i-j>=0;j++)
			dp[i] = min(dp[i-j]+abs(v[i]-v[i-j]), dp[i]);
	}
	cout<<dp[n-1]<<endl;
	
	return 0;
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int t = sc.nextInt();
        int x = sc.nextInt();
        System.out.println((double)t / x);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

int n, k;
ll x[52], y[52];
ll ans = 8e18;

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
	for (int p = 0; p < n; ++p) {
		for (int q = p; q < n; ++q) {
			for (int r = 0; r < n; ++r) {
				for (int s = r; s < n; ++s) {
					int c = 0;
					for (int i = 0; i < n; ++i) {
						if (min(x[p], x[q]) <= x[i] && x[i] <= max(x[p], x[q])) {
							if (min(y[r], y[s]) <= y[i] && y[i] <= max(y[r], y[s])) ++c;
						}
					}
					if (c >= k) ans = min(ans, abs(x[q] - x[p])*abs(y[s] - y[r]));
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int a, b, c, d;
int main()
{
	scanf("%d%d%d%d", &a, &b, &c, &d);
	if (a > c)
	{
		swap(a, c);
		swap(b, d);
	}
	if (min(b, d) < c) printf("0\n");
	else printf("%d\n", min(b, d)-c); 
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int m, f, r;
    int s;
 
    while (1) {
        scanf("%d%d%d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1) break;
 
        if (m < 0 || f < 0) puts("F");
        else {
            s = m + f;
            if (s >= 80) puts("A");
            else if (s >= 65) puts("B");
            else if (s >= 50) puts("C");
            else if (s < 30) puts("F");
            else puts(r >= 50 ? "C" : "D");
        }
    }
    return 0;
} 


Measured memory_bytes: 2060
#include <bits/stdc++.h>
#include <tuple>
using namespace std;
using ll = long long;

int main()
{
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &e : v)
    cin >> e;
  unordered_map<int, int> o, t;
  for (int i = 0; i < n; ++i)
  {
    if (i % 2 == 0)
      o[v[i]]++;
    else
      t[v[i]]++;
  }
  int cnta = -1, cntb = -1;
  int a = v[0], b = v[1];
  vector<int> aa, bb;
  for (auto &e : o)
  {
    aa.push_back(e.second);
    if (e.second > cnta)
    {
      cnta = e.second;
      a = e.first;
    }
  }
  for (auto &e : t)
  {
    bb.push_back(e.second);
    if (e.second > cntb)
    {
      cntb = e.second;
      b = e.first;
    }
  }
  sort(aa.begin(), aa.end(), greater<int>());
  sort(bb.begin(), bb.end(), greater<int>());
  int sum = cnta + cntb;
  if (a == b)
  {
    if ((cnta + cntb) == n)
      sum = cnta;
    else
    {
      sum = max(aa[0] + bb[1], aa[1] + bb[0]);
    }
  }
  cout << n - sum << endl;

  return 0;
}


Measured memory_bytes: 5400
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pi acos(-1)
#define cross(a,b) (conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define vec(a,b) b-a
#define Reka ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int w[100 +1 ];
ll p[100 +1 ];
int l,n;
ll c[100 +1 ][100000 +9];
ll solve(int ind , int sum)
{
    if(ind == n || sum == l )
        return c[ind][sum] = 0;
     ll r,rr,ans;
     if(c[ind][sum]!=-1)
        return c[ind][sum];
     if(w[ind]+sum>l){
        ans = solve(ind+1,sum);
     }
    else {
     ans = max(solve(ind+1,sum+w[ind])+p[ind],
               solve(ind+1,sum));
    }
    return c[ind][sum] = ans;
}

int main()
{
    Reka
    memset(c,-1,sizeof(c));
   cin>>n>>l;
   for(int i=0;i<n;i++)
   {
     cin>>w[i]>>p[i];
   }
   cout<<solve(0,0);
   return 0;
}


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

int main(){
    ll a,b; cin>>a>>b;
    ll m=min(a,b),M=max(a,b);
    for (ll i = 0; i < M; i++){
        cout<<m;
    }
    cout<<endl;
    
}

Measured memory_bytes: 3576
import math
def solve(n,h):
    dp = [10**18]*(n+2)
    dp[0]= 0

    for i in range(1,n):
        dp[i] = min(dp[i],dp[i-1]+ abs(h[i] - h[i-1]))
        if i > 1 :
            dp[i] = min(dp[i],dp[i-2]+ abs(h[i] - h[i-2]))

    return dp[n-1]


def main():
    n = int(input())
    h = list(map(int,input().split()))

    ans = solve(n,h)
    print(ans)


main()


Measured memory_bytes: 14104
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int  n, k, ans = 0; 
    cin >> n >> k ;
    for (int b=1;b<=n;b++ ) {
        int m=n/b;
        ans += m*max(0LL,b-k); 
        ans += max(0LL,(n%b)-k+1);
    } 
    if (k==0) ans = n*n;
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3640