akhauriyash/Code-Regression huggingface dataset:
l,r=map(int,input().split())
if(r-l>=2018):
  print(0)
else:
  mi=2018
  res1=l%2019
  for i in range(r-l):
    res2=(i+l+1)%2019
    for j in range(r-l-i):
      if (res1*res2)%2019<mi:
        mi=(res1*res2)%2019
      res2+=1
    res1+=1
  print(mi)

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

int main() {

	int n, k;
	cin >> n >> k;

	int sum = 0;
	int x;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (x < k - x) {
			sum += 2 * x;
		}
		else {
			sum += (2 * (k - x));
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
#!/usr/bin/php
<?php

function judge($n){
  $ma=0;
  $mi=1000;
  $s=0;
  for($i=0;$i<$n;$i++){
    $x=fgets(STDIN)+0;
    if($x<$mi){$mi=$x;}
    if($x>$ma){$ma=$x;}
    $s+=$x;
  }
  print floor(($s-$ma-$mi)/($n-2));
  print "\n";
}

while(1){
  $n=fgets(STDIN);
  if($n==0){break;}
  judge($n);
}
?>

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

typedef long long LL;

const int N = 5e3 + 7;
const int INF = 1e9 + 7;
const double pi = acos(-1.0);
const int MOD = 1e9 + 7;

int main() {
    long long ans = 1;
    int n, x;
    scanf("%d", &n);
    int cnt = 0, out = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &x);
        if (x < (i - out) * 2 + 1) {
            ans *= cnt + 1;
            ans %= MOD;
            out++;
        } else cnt++;
    }
    for (int i = 2; i <= cnt; i++) {
        ans *= i;
        ans %= MOD;
    }
    printf("%d\n", (int)ans);
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        abc: [usize; 3],
    }
    let mut abc = abc;
    abc.sort();
    
    if abc[0] + abc[1] == abc[2] {
        println!("Yes"); 
    } else {
        println!("No"); 
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
main()
{
	int n;
	cin>>n;
	int a[n+1],b[n+1],c[n+1];
	a[0]=b[0]=c[0]=0;
	for(int i=1;i<=n;i++)
	cin>>a[i]>>b[i]>>c[i];
	int dp[n+1][3];
	dp[0][0]=dp[0][1]=dp[0][2]=0;
	for(int i=1;i<=n;i++)
	{
		dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
		dp[i][1]=max(dp[i-1][2]+b[i],dp[i-1][0]+b[i]);
		dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);	
	}
	int ans;
	ans=max(max(dp[n][0],dp[n][1]),dp[n][2]);
	cout<<ans;
}


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

int main() {
    int n, ans=0, a[50], b[50], c[50];
    cin >> n;
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<n; i++) {
        cin >> b[i];
        ans += b[i];
    }
    for(int i=0; i<n-1; i++) cin >> c[i];
    for(int i=0; i<n-1; i++) {
        if(a[i]+1==a[i+1]) {
            ans += c[a[i]-1];
        }
    }
    cout << ans << endl;
}

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

int main() { 
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& x : a) {
    cin >> x;
  }
  int cnt = 0;
  int x = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] == x) {
      ++cnt;
      ++x;
    }
  }
  if (cnt == 0) cout << -1 << endl;
  else cout << n - cnt << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[202020];
ll S[202020];
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i];
		S[i+1]=S[i]+A[i];
	}
	ll T=S[N];
	ll mi=T;
	for(i=1;i<=N;i++) {
		mi=min(mi,abs(S[i]-(T-S[i])));
		
	}
	cout<<mi<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main(void){
   long a,c,i;
   cin>>a;
   long chart[a-1][2];
   long b[a];
   for(i=0;i<a;i++){
       cin>>b[i];
   }
   chart[0][0]=-b[0]-b[1];
   chart[0][1]=b[0]+b[1];
   for(i=0;i<a-2;i++){
       long x=chart[i][0]+2*b[i+1]-b[i+2];
       long y=chart[i][1]-2*b[i+1]-b[i+2];
       if(x>y)
       chart[i+1][0]=x;
       else
       chart[i+1][0]=y;
       x=chart[i][0]+b[i+2];
       y=chart[i][1]+b[i+2];
       if(x>y)
       chart[i+1][1]=x;
       else
       chart[i+1][1]=y;
   }
   if(chart[a-2][0]>chart[a-2][1])
   cout<<chart[a-2][0]<<endl;
   else
   cout<<chart[a-2][1]<<endl;
   return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>
#include<climits>

using namespace std;

namespace MyLib {

//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long

//constant
const int MOD = 1000000007;
const int INF = INT_MAX / 3-1;
const double EPS = 1e-9;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

//typedef
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

}

using namespace MyLib;



int main() {
	int n, m;
	while (cin >> n >> m, n) {
		vector<pair<int, int>> s(100000);
		fill(s.begin(), s.end(), make_pair(0, 0));
		int buff, buf;
		REP(i, n) {
			cin >> buff >> buf;
			s[i] = make_pair(buff, buf);
		}
		sort(s.begin(), s.end(), [](pair<int, int> lef, pair<int, int> rig) {return lef.second > rig.second; });
		for(int i=0;m>0&&i<n;i++)
			if (m - s[i].first >= 0) {
				m -= s[i].first;
				s[i].first = 0;
			}
			else {
				s[i].first -= m;
				m = 0;
			}
		int res=0;
		REP(i, n)
			res += s[i].first*s[i].second;
		cout << res << endl;
																					



	}

	return 0;
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
// for(int i = 0;i < num; i++){}
int main() {
    //
    int num;
    int tmp;
    int cnt = 0;
    cin >> num;

    for(int i = 1;i <= num; i++){
        cin >> tmp;
        if (i % 2 == 0) continue;
        if (tmp % 2 == 0) continue;
        cnt++;
    }
    cout << cnt;
    //
}


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

#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define NUL 0x00

typedef struct cipher
{
	char charcter_change_sign[SIGN_LENGTH];
	char sign_change_charcter[SIGN_LENGTH];
	char charcter;
}CIPHER;

#define TEXT_MAX 100

int main(void)
{
	short i = 0;
	short j = 0;

	short text_length = 0;
	char input_text[TEXT_MAX];
	CIPHER code[CIPHER_NUM] = {
		{"100101","00000",'A'},
		{"10011010","00001",'B'},
		{"0101","00010",'C'},
		{"0001","00011",'D'},
		{"110","00100",'E'},
		{"01001","00101",'F'},
		{"10011011","00110",'G'},
		{"010000","00111",'H'},
		{"0111","01000",'I'},
		{"10011000","01001",'J'},
		{"0110","01010",'K'},
		{"00100","01011",'L'},
		{"10011001","01100",'M'},
		{"10011110","01101",'N'},
		{"00101","01110",'O'},
		{"111","01111",'P'},
		{"10011111","10000",'Q'},
		{"1000","10001",'R'},
		{"00110","10010",'S'},
		{"00111","10011",'T'},
		{"10011100","10100",'U'},
		{"10011101","10101",'V'},
		{"000010","10110",'W'},
		{"10010010","10111",'X'},
		{"10010011","11000",'Y'},
		{"10010000","11001",'Z'},
		{"101","11010",' '},
		{"010001","11011",'.'},
		{"000011","11100",','},
		{"10010001","11101",'-'},
		{"000000","11110",'\''},
		{"000001","11111",'?'}
	};
	
	char barcode[801];
	char code_fivecut[160][5];
	
	for(i = 0; i < TEXT_MAX; i++)
	{
		input_text[i] = NUL;
	}

	for(i = 0; i < 801; i++)
	{
		barcode[i] = NUL;
	}
	
	for(i = 0; i < 160;i++)
	{
		for(j = 0; j < 5; j++)
		{
			code_fivecut[i][j] = '0';
		}
	}
	
	while(gets(input_text) != NULL)
	{
		for(i = 0; i < TEXT_MAX; i++)
		{
			text_length++;
			if(input_text[i] == NUL)
			{
				break;
			}
		}
		
		for(i = 0; i < text_length; i++)
		{
			for(j = 0; j < CIPHER_NUM; j++)
			{
				if(input_text[i] == code[j].charcter)
				{
					strcat(barcode, code[j].charcter_change_sign);
				}
			}
		}
		
		int barcode_length = 0;
		
		for(i = 0; i < 801; i++)
		{
			barcode_length++;
			if( barcode[barcode_length] == '\0')
			{
				break;
			}
		}
		int c = 0;
		
		for(i = 0; i < barcode_length; i++)
		{
			for(j = 0; j < 5; j++)
			{
				if(c < barcode_length)
				{
					code_fivecut[i][j] =  barcode[c];
					c++;
				}
			}
		}
		int count=0;
		for(i = 0;i < 800 ; i+= 5)
		{
			if(barcode_length <= i)
			{
				count = i / 5;
				break;
			}
		}
		
		int k = 0;
		int l = 0;
		int cc = 0;
		for(i = 0; i < count; i++)
		{
			for(k = 0; k < CIPHER_NUM; k++)
			{
				for(l = 0; l < 5; l++)
				{
					if(code_fivecut[i][l] == code[k].sign_change_charcter[l])
					{
						cc++;
					}
				}
				if(cc == 5)
				{
					printf("%c",code[k].charcter);
				}
				cc = 0;
			}
		}
		printf("\n");
		count = 0;
		barcode_length = 0;
		text_length = 0;
		for(i = 0; i < TEXT_MAX; i++)
		{
			input_text[i] = NUL;
		}
		for(i = 0; i < 801; i++)
		{
			barcode[i] = NUL;
		}
		
		for(i = 0; i < 160;i++)
		{
			for(j = 0; j < 5; j++)
			{
				code_fivecut[i][j] = '0';
			}
		}
	}
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <algorithm>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main() {
  int n, m;
  cin >> n >> m;
  mf_graph<int> g(n * m + 2);
  vector <string> map(n);
  
  for (int i = 0; i < n; ++i) {
    cin >> map[i];
  }
  
  int s = n * m, t = n * m + 1;
  
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int v = i * m + j;
      if ((i + j) % 2 == 0) {
        if (map[i][j] == '#') {
          continue;
        }
        g.add_edge(s, v, 1);
        if (i > 0 && map[i - 1][j] == '.') {
          g.add_edge(v, v - m, 1);
        }
        if (i + 1 < n && map[i + 1][j] == '.') {
          g.add_edge(v, v + m, 1);
        }
        if (j > 0 && map[i][j - 1] == '.') {
          g.add_edge(v, v - 1, 1);
        } 
        if (j + 1 < m && map[i][j + 1] == '.') {
          g.add_edge(v, v + 1, 1);
        }
      } else {
        g.add_edge(v, t, 1);
      }
    }
  }
  
  cout << g.flow(s, t) << endl;

  for (auto e : g.edges()) {
    if (e.flow == 0) continue;
    if (e.from == s || e.to == t) continue;
    
  	int f_i = e.from / m, f_j = e.from % m;
    int t_i = e.to / m, t_j = e.to % m;

    if (f_i == t_i) {
      int l = min(f_j, t_j);
      map[f_i][l] = '>';
      map[f_i][l + 1] = '<';
    } else {
      int u = min(f_i, t_i);
      map[u][f_j] = 'v';
      map[u + 1][f_j] = '^';
    }
  }
  
  for (auto str : map) {
    cout << str << endl;
  }
  
  return 0;
}

Measured memory_bytes: 5592
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000
long long ni[2010][2010];
void init(void) {
	ni[0][0] = 1;
	f(i, 2009) {
		ni[i + 1][0] = 1;
		ni[i + 1][i + 1] = 1;
		f(j, i) {
			ni[i + 1][j + 1] = (ni[i][j] + ni[i][j + 1]) % MOD;
		}
}
	return;
}


int main() {
	int a[N];
	f(i, N)a[i] = 0;
	long long n, k;
	long long x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	init();
	scanf("%lld %lld", &n, &k);

	f(i, k) {
		if(i<=(n-k))x = ni[n - k + 1][i + 1];
		else x = 0;
		y = ni[k - 1][i];
		z = (x*y) % MOD;
		printf("%lld\n", z);
	}



	return 0;
}

Measured memory_bytes: 30336
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;

string toString(int n){
  ostringstream oss;
  oss << n;
  return oss.str();
}

vector<int> mod;

int boundary;

bool findMod(int M){
  for(int i = 0 ; i < mod.size() ; i++){
    if(mod[i] == M){
      boundary = mod.size()-i;
      return true;  
    }
  }
  return false;
}

int main(){
  int a, b;
  
  while(cin >> a >> b){
    bool flag = false;
    mod.clear();
    string ans = "";
    a = a % b;
    mod.push_back(a);
    // a *= 10;
    for(; ;){
      a *= 10;
      int c = a / b;
      string s = toString(c);
      ans += s;
      if(a % b == 0){
	flag = true;
	goto END;
      }
      if(findMod(a % b)) goto END;
      mod.push_back(a % b);
      a -= b * c;

    }
  END:;
    if(flag) cout << ans << endl;
    else{
      cout << ans << endl;
      for(int i = 0 ; i < ans.size() - boundary ; i++) cout << ' ';
      for(int i = ans.size() - boundary ; i < ans.size() ; i++) cout << '^';
      cout << endl;
    }
    
  }
  return 0;
}

Measured memory_bytes: 1248
def main():
    s = input()
    tmp1 = 0
    tmp2 = 0
    mae = 0

    for i in range(len(s)):
        if s[i] == mae:
            tmp1 += 1
            if s[i] == "0":
                mae = "1"
            else:
                mae = "0"
        else:
            if s[i] == "0":
                mae = "0"
            else:
                mae = "1"

    mae = 1

    for i in range(len(s)):
        if s[i] == mae:
            tmp2 += 1
            if s[i] == "0":
                mae = "1"
            else:
                mae = "0"
        else:
            if s[i] == "0":
                mae = "0"
            else:
                mae = "1"
    
    print(min(tmp1, tmp2))


if __name__ == "__main__":
    main()

Measured memory_bytes: 9192
n=int(input())-1
A=list(map(int,input().split()))
i=0;x=A[-1]
for j in range(n):
 if A[j]<=x:A[i],A[j]=A[j],A[i];i+=1
A[i],A[n]='['+str(A[n])+']',A[i]
print(*A)


Measured memory_bytes: 16396
S = list(input())
N = len(S)
ret = 0
pre = ""
dpl = [0] * (N+1)
dpr = [0] * (N+1)
tmp = ""
for i in range(1,N+1):
    tmp += S[i-1]
    if tmp == pre:
        dpl[i] = dpl[i-1]
    else:
        pre, tmp = tmp, ""
        dpl[i] = dpl[i-1] + 1

print(dpl[N])

Measured memory_bytes: 13856
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  int a,b,c,d;
  ll s1, s2;
  cin >> a >> b >> c >> d;
  s1 = a*b;
  s2 = c*d;
  if(s1 > s2){
    cout << s1 << endl;
  }else if(s2 > s1){
    cout << s2 << endl;
  }else{
    cout << s1 << endl;
  }
}


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

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int A[m];
    for(int i = 0; i < m; i++){
        cin >> A[i];
    }
    int ac = 0;
    int bc = 0;
    for(int i = 0; i < m; i++){
        if(A[i] < x){
            ac += 1;
        }
    }
    bc = m - ac;
    cout << min(ac,bc) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[305][305];
long long ans = 0;
 
int main()
{
	int n;
	cin>>n;
	int a[n+1],b[n+1];
	b[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[i]=b[i-1]+a[i];
	}
	int mi=100000000;
	for(int i=1;i<=100;i++){
		int s=0;
		for(int j=1;j<=n;j++){
			s+=(fabs(a[j]-i))*(fabs(a[j]-i));
		}
		mi=min(mi,s);
		//cout<<s<<" "<<i<<endl;
	}
	cout<<mi<<endl;
}

Measured memory_bytes: 256
N, A, B, C, D = map(int, input().split())
G = B-A
flag = False
for i in range(N):
    l = C*i-D*(N-1-i)
    r = D*i-C*(N-1-i)
    if l<=G<=r or -r<=G<=-l:
        flag = True
        break
if flag:
    print('YES')
else:
    print('NO')


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= 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
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n, C;
  cin >> n >> C;
  vector<vector<P>> tv(C+1);
  vector<P> event; // in 1, out 0
  rep(i, n) {
    int s, t, c;
    cin >> s >> t >> c;
    tv[c].emplace_back(s, t);
  }
  for(int i = 1; i <= C; ++i) sort(ALL(tv[i]));
  for(int i = 1; i <= C; ++i) {
    for(int j = 0; j < tv[i].size(); ++j) {
      event.emplace_back(tv[i][j].first, 0);
      while(j+1 < tv[i].size() && tv[i][j].second == tv[i][j+1].first) ++j;
      event.emplace_back(tv[i][j].second, 1);
    }
  }
  sort(ALL(event));
  int ch = 0;
  int ans = 0;
  for(auto x : event) {
    if(x.second == 0) ++ch;
    else --ch;
    chmax(ans, ch);
  }
  cout << ans << endl;
}


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

int n,tot,ans;
ll p[3333];
bool tag[3333];
ll a[111111],b[111111];
map<ll,int> m;

void init()
{
    for(int i=2; i<3333; i++)
    {
        if(!tag[i]) p[tot++]=i;
        for(int j=0; j<tot&&i*p[j]<3333; j++)
        {
            tag[i*p[j]]=1;
            if(i%p[j]==0) break;
        }
    }
}

void pre(int id)
{
    ll x=1,y=1;
    for(int i=0; p[i]*p[i]*p[i]<=a[id]; i++)
    {
        int cnt=0;
        while(a[id]%p[i]==0) cnt++,a[id]/=p[i];
        cnt%=3;
        if(cnt==1) x*=p[i],y*=p[i]*p[i];
        else if(cnt==2) x*=p[i]*p[i],y*=p[i];
    }
    if(a[id]!=1)
    {
        x*=a[id];
        ll sq=(ll)sqrt(a[id]);
        if(sq*sq==a[id]) y*=sq;
        else y*=a[id]*a[id];
    }
    a[id]=x,b[id]=y,m[x]++;
}

int main()
{
    init();
    cin>>n;
    for(int i=0; i<n; i++) scanf("%lld",&a[i]),pre(i);
    if(m[1]) ans++,m[1]=0;
    for(int i=0; i<n; i++) if(m[a[i]]) ans+=max(m[a[i]],m[b[i]]),m[a[i]]=m[b[i]]=0;
    cout<<ans;
    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    int A[N + 2] = {};
    int sum = 0;
    for (int i = 1; i <= N; i++)
    {
        cin >> A[i];
        sum += abs(A[i] - A[i - 1]);
    }
    A[N + 1] = 0;
    sum += abs(A[N]);

    for (int i = 1; i <= N; i++)
    {
        cout << sum - (abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i])) + abs(A[i + 1] - A[i - 1]) << endl;
    }
}


Measured memory_bytes: 1664
import numpy as np

n, m, c = map(int, input().split())
b = np.array(input().split(), dtype=np.int32)
a = np.array([input().split() for _ in range(n)], dtype=np.int32)

wk = (a*b).sum(axis=1)+c
ans = len([p for p in wk if p > 0])
print(ans)

Measured memory_bytes: 12448
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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 sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  string ans = "";
  rep(i,sz(s)) {
    ans += (char)(((s[i]-'A')+N)%26+'A');
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  double W,H,x,y,ans;
  int c =0;
  cin >> W >> H >> x >> y;
  if(W/2==x&&H/2==y)
    c = 1;
  ans = W*H/2;
  cout << fixed << setprecision(9) << ans << ' ' << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int MOD = 1000000007;
constexpr int INF = 1e18;

using namespace std;


signed main() {
  int N, Z, W;
  cin >> N >> Z >> W;

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

  if(N == 1) cout << abs(A[0]-W) << endl;
  else  cout << max(abs(A[N-1]-A[N-2]), abs(A[N-1]-W)) << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner num = new Scanner(System.in);
		int n1 = num.nextInt();
		int cnt = 0;

		for(int i = 0; i < n1; i++) {
			int n2 = num.nextInt();
			if(n2 % 2 == 1)
				cnt++;
		}

		if(cnt % 2 == 0 ) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

		num.close();
	}
}


Measured memory_bytes: 32468
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, y = LI()
y //= 1000


def main():
    for i in range(n+1):
        for j in range(n-i+1):
            k = n - i - j
            if i * 10 + j * 5 + k == y:
                return i, j, k
    return -1, -1, -1




i, j, k = main()
print(i, j, k)

Measured memory_bytes: 39536
(n, m, l) = [int(i) for i in input().split()]
A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])
B = []
for mc in range(m):
    B.append([int(i) for i in input().split()])

product = [[0 for d in range(l)] for dd in range(n)]

for nc in range(n):
    for lc in range(l):
        for mc in range(m):
            product[nc][lc] += A[nc][mc] * B[mc][lc]

for r in product:
    print(' '.join([str(d) for d in r]))

Measured memory_bytes: 8856
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int n,a[100005],cnt[100005],mx;

int main(){
    ios_base :: sync_with_stdio(0); cin.tie();
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    for(int i=1;i<n;i++){
        if(a[i]==i && a[i+1]==i+1) swap(a[i],a[i+1]),mx++;
    }
    for(int i=1;i<=n;i++){
        if(a[i]==i) mx++;
    }
    cout << mx;
}


Measured memory_bytes: 640
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s, t;
    cin>>s>>t;
    
    int n = s.size();
    int m = t.size();
    int dp[n + 1][m + 1];
    dp[0][0] = 0;
    for(int i = 0; i <=n; i++){
        dp[i][0] = 0;
    }
    for(int j = 0; j <= m; j++) {
        dp[0][j] = 0;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <=m; j++) {
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            if(s[i - 1] == t[j - 1]) {
                dp[i][j] = max(dp[i][j], 1 + dp[i - 1][j - 1]);
            }
        }
    }
    
    int i = n; int j = m;
    string ans = "";
    while(i > 0 && j > 0) {
        if(dp[i][j] == dp[i - 1][j]) {
            i --;
        } else if(dp[i][j] == dp[i][j - 1]) {
            j --;
        } else {
            ans += t[j - 1];
            i --;
            j --;
        }
    }
    reverse(ans.begin(), ans.end());
    cout<<ans<<"\n";

    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        Solver sol = new Solver();
        sol.Solve();
#if DEBUG
        Console.ReadLine();
#endif
    }
}

class Solver
{
    int H;
    int W;

    public void Solve()
    {
        long ans;
        if (H % 3 == 0 || W % 3 == 0)
        {
            ans = 0;
        }
        else
        {
            ChocolateBar cb1 = new ChocolateBar(H, W);
            long s1 = cb1.DeltaS;
            if (s1 == 0)
            {
                ans = 0;
            }
            else if (H == W)
            {
                ans = s1;
            }
            else
            {
                ChocolateBar cb2 = new ChocolateBar(W, H);
                ans = Math.Min(s1, cb2.DeltaS);
            }
        }

        Console.WriteLine(ans);
    }

    public Solver()
    {
        int[] hw = ReadIntArray();
        H = hw[0];
        W = hw[1];
    }

    static String ReadString() { return Console.ReadLine(); }
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static long ReadLong() { return long.Parse(Console.ReadLine()); }
    static double ReadDouble() { return double.Parse(Console.ReadLine()); }
    static String[] ReadStringArray() { return Console.ReadLine().Split(' '); }
    static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); }
    static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); }
    static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); }
}

// 縦に分割するチョコレートバー.
class ChocolateBar
{
    long H;
    long W;
    // 縦に分割した場合のSmax-Smin.
    public long DeltaS
    {
        get
        {
            long ps = ParallelS;
            if (ps == 0)
            {
                return ps;
            }
            else
            {
                return Math.Min(ps, VerticalS);
            }
        }
    }
    // 垂直に分割したときのSmax-Smin.
    long VerticalS
    {
        get
        {
            long min = SplitVerticalWith(1);
            for (int w = 2; w < W; w++)
            {
                long cur = SplitVerticalWith(w);
                if (cur < min)
                {
                    min = cur;
                }
                else
                {
                    break;
                }
            }
            return min;
        }
    }
    // 3つを並行に分割したときのSmax-Smin.
    long ParallelS
    {
        get
        {
            if (W % 3 == 0)
            {
                return 0;
            }
            else
            {
                return H;
            }
        }
    }
    public ChocolateBar(int h, int w)
    {
        H = h;
        W = w;
    }

    // 1つ目をH*wとし、残りをそれと垂直に分割したときのSmax-Sminを返す.
    long SplitVerticalWith(int w)
    {
        long s1 = H * w;
        long s2 = (H / 2) * (W - w);
        long s3 = (H - H / 2) * (W - w);
        //Console.WriteLine("{0},{1}", w, Math.Max(s1, s3) - Math.Min(s1, s2));
        return Math.Max(s1, s3) - Math.Min(s1, s2);
    }
}


Measured memory_bytes: 13268
import java.util.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    static int dx[]={-1,0,1,0};
    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        
//        int n=sc.nextInt();
        long n=sc.nextLong();
        long p=sc.nextLong();
        long r=1;
        for (long i = 2; i*i <= p; i++) {
			long c=0;
			while(p%i==0) {p/=i; c++;}
			while(c>=n) {r*=i;c-=n;}
		}
        if(p!=1 && n==1)r*=p;
        
        out.println(r);
        out.flush();
    }


    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}


//class P implements Comparable<P>{
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//    public int compareTo(P p){
//        return d-p.d; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 24660
/*******************************************c#
* 20.04.16 AtCoder Beginner Contest 159. C - Maximum Volume
*
*
*********************************************/
/*********************************************

::test input::

*********************************************/
using System; //Console, IComparable
using System.IO; //StreamWriter 
using System.Linq; //Select(), Where(), OrderBy(), Count()
using System.Collections.Generic; //List<T>
using System.Reflection; //PropertyInfo[], GetProperties[]
using static System.Console; using static IOmacro.CInput;

namespace tempName {
    public class CRun{
        private static class gv{
            public static int R;
            public static readonly double pi = 3.1415926535897932384;
        }
    
        public void build(){            
            gv.R = _int;
        }
    
        public void solve(){
            double ans = 2*gv.pi*gv.R;
            
            WriteLine(ans.ToString("F20"));
            
        }
    }

    class Program { 
        static void Main() { 
            var run = new CRun();
            run.build();
            run.solve();
        } 
    }
}

namespace IOmacro {
    public static class CInput {
        public static StreamWriter _writer = new StreamWriter(Console.OpenStandardOutput());
        public static string _string{get{return Console.ReadLine();}}
        public static string[] _stringa{get{return (Console.ReadLine().Split());}}
        public static int _int{get{return int.Parse(Console.ReadLine());}}
        public static int[] _inta{get{return Console.ReadLine().Split().Select(x=>int.Parse(x)).ToArray();}}
        public static long _long{get{return long.Parse(Console.ReadLine());}}
        public static long[] _longa{get{return Console.ReadLine().Split().Select(x=>long.Parse(x)).ToArray();}}    
    }
}


Measured memory_bytes: 27620
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <functional>

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;

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

    std::vector<std::pair<int, int>> ps(n);
    for (auto& p : ps) {
        std::cin >> p.first >> p.second;
    }
    std::sort(ps.begin(), ps.end());

    std::vector<int> xs(n), bs(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        std::tie(xs[i], bs[i]) = ps[i];
    }
    for (int i = n; i > 0; --i) {
        bs[i] ^= bs[i - 1];
    }

    Graph<> graph(n + 1);
    for (int i = 0; i < m; ++i) {
        int l, r;
        std::cin >> l >> r;
        int u = std::lower_bound(xs.begin(), xs.end(), l) - xs.begin(),
            v = std::upper_bound(xs.begin(), xs.end(), r) - xs.begin();
        graph[u].emplace_back(u, v, i);
        graph[v].emplace_back(v, u, i);
    }

    std::vector<bool> visited(n, false), assign(m, false);
    std::function<int(int)> dfs =
        [&](int v) {
            visited[v] = true;
            for (auto e : graph[v]) {
                if (visited[e.dst]) continue;
                int res = dfs(e.dst);
                assign[e.cost] = res;
                bs[v] ^= res;
            }
            return bs[v];
        };

    for (int v = 0; v < n; ++v) {
        if (visited[v]) continue;
        if (dfs(v) != 0) {
            std::cout << -1 << std::endl;
            return;
        }
    }

    std::vector<int> ans;
    for (int i = 0; i < m; ++i) {
        if (assign[i]) ans.push_back(i);
    }

    std::cout << ans.size() << std::endl;
    for (auto i : ans) std::cout << i + 1 << " ";
    std::cout << std::endl;
}

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

    solve();

    return 0;
}


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

#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int N = 200001;


void solve() {
    ll n , k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i = k ; i <= n + 1 ;  i ++) {
        ll sum = i * (i - 1) / 2;
        ll sum2 = (n - i) * (n - i + 1) / 2;
        ll sum3 = n * (n + 1) / 2;
        sum3 -= sum2;
        ans = (ans + (sum3 - sum + 1 + mod) % mod + mod) % mod ;
        
    }
    cout << ans;
}

/*
 */

int main()
{
    fastio
    int testcase = 1;
    //cin >> testcase ;
    
    while(testcase --) {
        solve();
        cout << '\n';
    }
    
    return 0;
}
 



Measured memory_bytes: 3648
n = int(input())
d = {'M': 0,'A': 0, 'R': 0, 'C': 0, 'H': 0}
for _ in range(n):
    s = str(input())
    if s[0] in d:
        d[s[0]] += 1
L = list(d.values())
cnt = 0
for i in range(3):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            cnt += L[i] * L[j] * L[k]
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int m, d;
int main() {
	cin >> m >> d;
	int cnt = 0;
	for (int i = 1; i <= m; i ++) {
		for (int j = 1; j <= d; j ++) {
			int x = j % 10;
			int y = j / 10;
			if (x * y == i && x >= 2 && y >= 2) cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
n += 1
s = list(input())
dp = [0] * n
for i in range(1, n):
    if i - m < 0 and s[n - i - 1] == "0":
        dp[i] = 1
    elif s[n - i - 1] == "1":
        dp[i] = -1
    else:
        for j in range(i - m, i):
            if not dp[j] == -1:
                dp[i] = dp[j] + 1
                break
t = [0] * n
j = 0
x = dp[n - 1] + 1
for i in range(n - 1, -1, -1):
    if dp[i] == x - 1:
        t[j] = i
        j += 1
        x -= 1
    elif dp[i] == 0:
        print(-1)
        exit()
ans = [t[i] - t[i + 1] for i in range(j - 1)]
print(*ans)

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

int main() {
    int n,a,b,q=1;
    long long h=0;
    cin >> n >> a >> b;
    vector<long long> u(n);
    rep(i,n) {cin >> u.at(i);
    
    }
    sort(u.begin(),u.end());
    reverse(u.begin(),u.end());
    int o=1;
    int ii=1;
    for (int i=0;i<a;i++){
        h=h+u.at(i);
        if (i!=0){
        if (u.at(i-1)==u.at(i)) {q++;}
            else {q=1;ii=0;}
        }
        if (i!=0) {
            if (u.at(i)==u.at(i-1)) o++;
            else o=1;
        }
    }
    for(int i=a;i<n;i++){
        if (u.at(i)==u.at(i-1)) o++;
        else break;
    }
    cout << h/a;
    double ll=h%a;
    double p=ll/a;
    cout << ".";
    int t=10;
    rep(i,7){
        int ppp=p*t;
        ppp=ppp%10;
        cout << ppp;
        t*=10;
    }
    cout << endl; 
    if (ii==0) {
        long long rr=1,ans=0;
        for (int i=1;i<q+1;i++){
        rr=rr*(o-i+1);
        rr=rr/i;
    }
    cout << rr << endl;
        return 0;}
    long long ans=0;
    for (int j=0;j<b-a+1;j++){
    long long rr=1;
    if (j>o) break;
    for (int i=1;i<q+j+1;i++){
        rr=rr*(o-i+1);
        rr=rr/i;
    }
    ans+=rr;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
ll pown(ll fi,ll se){
  ll ans=1;
  rep(i,se){
    ans*=fi;
  }
  return ans;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}

/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
  ll n;
  cin>>n;
  vec(h,n);
  rep(i,n){
    cin>>h[i];
  }
  ll max=0;
  ll cnt=0;
  rep(i,n){
    if(h[i]>=max){
      cnt++;
      max=h[i];
    }
  }
  op(cnt);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int H,W,N;
int sx,sy;
string S,T;

int main(){
  cin>>H>>W>>N;
  cin>>sx>>sy;
  cin>>S;
  cin>>T;

  int lx=1,rx=H,ly=1,ry=W;
  for(int i=N-1;i>=0;i--){
      if(T[i]=='U') rx=min(rx+1,H);
      else if(T[i]=='D') lx=max(lx-1,1);
      else if(T[i]=='L') ry=min(ry+1,W);
      else ly=max(ly-1,1);

      if(S[i]=='U') lx++;
      else if(S[i]=='D') rx--;
      else if(S[i]=='L') ly++;
      else ry--;

      if(lx>rx||ly>ry){
          cout<<"NO"<<endl;
          return 0;
      }
  }

  if(lx<=sx&&sx<=rx&&ly<=sy&&sy<=ry) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 776
N, M = map(int, input().split())# guu ki

ki_ki = M*(M-1)/2
guu_guu = N*(N-1)/2
if ki_ki<0:
    ki_ki = 0
if guu_guu < 0:
    guu_guu = 0

print(int(ki_ki +guu_guu))


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

// #define ANS  //for answer
#define CMP  //for compe
#ifdef CMP
using namespace std;
#else
#endif

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define nv(x) #x, (x)
#define ncv(x) #x, ":", (x)
#define ncvc(x) #x, ":", (x), ","
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
void pPRINT(std::ostream& ost) {}
template <class T, class... U>
void pPRINT(std::ostream& ost, const T t, const U... u) {
  ost << t << " ";
  pPRINT(ost, u...);
}
template <class... T>
void PRINT(const T... t) { pPRINT(std::cout, t...); }
template <class... T>
void PRINTl(const T... t) {
  pPRINT(std::cout, t...);
  std::cout << "\n";
}
template <class T>
void PRINTa(const T* const t, const ll size) {
  REP(i, size)
  PRINT(t[i]);
  PRINTl();
}
template <class T>
void PRINTal(const T* const t, const ll size) {
  REP(i, size)
  PRINTl(i, ":", t[i]);
}
#ifndef DBG
#define DEBUG(...)
void init() {}
#else
#define DEBUG(...)                                                     \
  {                                                                    \
    PRINT("##DEBUG##", "file :", __FILE__, ", line :", __LINE__, "["); \
    PRINT(__VA_ARGS__);                                                \
    PRINTl("]");                                                       \
  }
void init() {
  DEBUG("INIT");
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#endif
#ifdef ANS
#else
#endif

void solve();

int main(int argc, char* argv[]) {
  DEBUG("MAIN");
  init();
  solve();

  return 0;
}

ll fnums[10000];
ll factors[10000];
ll findex = 0;

void solve() {
  DEBUG("SOLVE START");

  ll n;
  cin >> n;

  ll factor = sqrt(n);
  while (n % factor != 0) {
    factor--;
  }

  PRINT(factor + n / factor - 2);

  return;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a [] = new int [3];
        for(int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int ans = 0;
        if(a[0]==a[1]) {
            ans = a[2];
        } else {
            ans = a[0];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22100
#include <iostream>

using namespace std;

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

   int minus = L;

   int sum = 0;
   int taste[N];
   for (int i = 0; i < N; i++)
   {
       taste[i] = L;
       if (L == 0)
       {
           minus = 0;
       }
       else if (i == (N-1) && L < 0)
       {
           minus = L;
       }
       
       sum += L;
       L++;
   }

   cout << sum-minus << endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>


#define N 45
int F[N];

int fibonacci(int n){
    int i;
    F[0]=F[1]=1;
    for(i = 2;i <= n;i++){
        F[i] = F[i- 2] + F[i -1];
    }
    return F[n];
}


int main(){
    int n;

    scanf("%d",&n);
    printf("%d\n",fibonacci(n));

    return 0;
}




Measured memory_bytes: 2108
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

A, B = MI()

print(lcm(A, B))


Measured memory_bytes: 43376
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 100005
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, cnt, ans, a[MAXN], b[MAXN];
LL suma, sumb, t[MAXN];

int main()
{
    scanf("%d", &n);
    ans=n;
    for(rint i=1; i<=n; ++i) scanf("%d", &a[i]), suma+=a[i];
    for(rint i=1; i<=n; ++i)
    {
	scanf("%d", &b[i]);
	sumb+=b[i];
	if(a[i]>=b[i]) t[++cnt]=a[i]-b[i];
    }
    LL res=suma-sumb;
    if(res<0) {printf("-1\n"); return 0;}
    sort(t+1, t+cnt+1);
    for(rint i=1; i<=cnt; ++i)
	if(res>=t[i]) res-=t[i], ans--;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1664