akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

map<lli,lli> dd;

int main(){

    string s;
    cin>>s;

    dd[0]=1;
    lli now = 0;
    lli ten = 1;

    reverse(s.begin(),s.end());
    REP(i,0,s.size()){
        
        now %= 2019;
        ten %= 2019;
        now += (s.at(i)-'0')*ten;
        ten *= 10;
        ten %= 2019;
        now %= 2019;
        LOG(now);
        dd[now]++;
    }
    
    lli ans = 0;
    for(auto e:dd){
        ans += (e.second*(e.second-1))/2;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3764
#include<stdio.h>
int m[30][30];
int a,b;
int solve(int i,int j){
	if(j==b){
		return solve(i+1,0);
	}
	if(i==a)return 1;
	if(m[i][j])return solve(i,j+1);
	//for(int k=0;k<a;k++){
	//	for(int l=0;l<b;l++){
	//		printf("%d ",m[k][l]);
	//	}
	//	printf("\n");
	//}
	//printf("\n");
	int ret=0;
	if(i<a-1&&!m[i+1][j]){
		if(i==0||((j==0||m[i-1][j-1]!=3)&&(j==b-1||(m[i-1][j]<2||m[i-1][j+1]%2!=1)))){
			m[i][j]=2;
			m[i+1][j]=3;
			ret+=solve(i,j+1);
			m[i][j]=m[i+1][j]=0;
		}
	}
	if(j<b-1&&!m[i][j+1]){
		if(i==0||((j==0||m[i-1][j-1]!=3)&&(j==b-2||(m[i-1][j+1]<2||m[i-1][j+2]%2!=1)))){
			m[i][j]=1;
			m[i][j+1]=3;
			ret+=solve(i,j+1);
			m[i][j]=m[i][j+1]=0;
		}
	}
	return ret;
}
int main(){
	//int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<30;i++)
			for(int j=0;j<30;j++)
				m[i][j]=0;
		printf("%d\n",solve(0,0));
	}
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
const int maxn=1<<18+5;
typedef long long ll;
const int inf=1e9;
string s;
int main(){
	cin>>s;
	int len=0;
	for(int i=0;s[i]!='\0';i++)
	len++;
	int ans=0;
	for(int i=0;i<len;i++){
		if(s[i]!=s[len-1-i])ans++;
	}
	cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        
        int min = 2000000000;
        for (int i = 0; i < n - (k-1); i++) {
            min = Math.min(min, array[i+k-1] - array[i]);
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 48872
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(vec) vec.begin(), vec.end()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define repc(bit, k, n) for (ll bit = (1 << k) - 1; bit < (1 << n); bit = next_combination(bit))
#define repi(itr, vec) for (auto itr = vec.begin(); itr != vec.end(); ++itr)
using namespace std;

ll dp[100000];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];
  sort(ALL(a));
  sort(ALL(b));
  sort(ALL(c));
  ll ans = 0;
  rep(i, n)
  {
    dp[i] = c.end() - upper_bound(ALL(c), b[i]);
  }
  rep(i, n - 1) dp[n - i - 2] += dp[n - i - 1];
  repi(itr, a)
  {
    ans += dp[upper_bound(ALL(b), *itr) - b.begin()];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5288
#include <iostream>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = a - b;
  int y = b * c;
  int z = x * d;
  if (a - b > 0) {
    cout << y + z;
  }
  else {
    cout << a * c;
  }
}

Measured memory_bytes: 3548
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))

n = ini()
ans = n % 1000
print(0 if ans == 0 else 1000 - ans)

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    double START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n; cin >> n;
    string s; cin >> s;
//    i32 rs = 0, ws = 0;
//    for(auto ch :s) {
//        if(ch == 'W') ++ ws;
//        else ++rs;
//    }
//    // initiallu ok?
//    bool can = 1;
//    for(i32 i = 0; i < n-1; ++i) {
//        if(s[i] == 'W' && s[i+1] == 'S') can = 0;
//    }
//    if(!can) {
//        cout << 0 << '\n';
//        return 0;
//    }
//    if(rs < ws) cout << rs << '\n';
//    else cout << ws << '\n';

    i32 cnt = 0;
    for(i32 idx1 = 0, idx2 = n-1; idx1 < idx2; ++idx1, --idx2) {
        if(s[idx1] == 'W' && s[idx2] == 'R') {  // swap
            char tmp = s[idx1];
            s[idx1] = s[idx2];
            s[idx2] = tmp;
            ++cnt;
        }
        else if(s[idx2] == 'W') {  //iteration cancel
            --idx1;
        }
        else if(s[idx1] == 'R') {
            ++idx2;
        }
    }

    cout << cnt << '\n';

//     printf("ElapsedTime: %5.3f ms\n",1000*((clock()-START_TIME)/CLOCKS_PER_SEC));
}


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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream &operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }
template<typename T>
T lcm(T a, T b) { if(a==0 or b==0) return 0; return a/gcd(a, b)*b; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 1e15;
const int modn = 1e9+7;
const int maxn = 2e5+3;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
    int n,m;
    cin>>n>>m;
    vi a(n);
    int sum = 0;
    for(int i=0 ;i<n; i++) {
        cin>>a[i];
        sum += a[i];
    }
    sort(all(a));
    int cnt = 0;
    for(int i=n-1; i>=0; i--) {
        if(a[i]*4*m >= sum) {
            cnt++;
        }
    }
    if(cnt>=m) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}



Measured memory_bytes: 256
use std::io::BufRead;
use std::str::FromStr;
use std::fmt::Debug;

struct Scanner<R: BufRead> {
    buf_reader: R,
}

impl<R: BufRead> Scanner<R> {
    fn new(buf_reader: R) -> Self {
        Scanner {buf_reader: buf_reader}
    }
    fn read_line<T>(&mut self) -> Vec<T> where T: FromStr, <T as FromStr>::Err: Debug {
        let mut line = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        line.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
    }
    fn read_single_value<T>(&mut self) -> T where T: FromStr, <T as FromStr>::Err: Debug {
        let mut line = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        let sv: Vec<&str> = line.trim().split_whitespace().collect();
        sv[0].parse::<T>().unwrap()
    }
    fn read_line0(&mut self) -> Vec<String> {
        let mut line: String = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        line.trim().split_whitespace().map(|c| c.to_string()).collect()
    }
}

fn gcd(x: u32, y: u32) -> u32 {
    if x < y {
        gcd(y, x)
    }
    else if x % y == 0 {
        y
    }
    else {
        gcd(y, x%y)
    }
}

fn is_prime(p: u32) -> bool {
    if p <= 1 {
        return false;
    } else if p <= 3 {
        return true;
    }

    let mut q: u32 = ((p as f64).sqrt() + 1.0) as u32;
    while q > 1 {
        if gcd(p, q) != 1 {
            return false;
        }
        q -= 1;
    }
    true
}

fn main() {
    let stdin = std::io::stdin();
    let mut scanner = Scanner::new(stdin.lock());
    let n = scanner.read_single_value::<u32>();
    let mut cnt = 0;
    for i in 0..n {
        let p = scanner.read_single_value::<u32>();
        if is_prime(p) {
            cnt += 1;
        }
    } 
    println!("{}", cnt);
}



Measured memory_bytes: 5044
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "bits/stdc++.h"
#define pi (3.141592653589)
#define mod 1e9 + 7
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define mint(a, b, c) min(c, min(a, b))
#define minf(a, b, c, d) min(d, min(c, min(a, b)))
#define maxt(a, b, c) max(c, max(a, b))
#define maxf(a, b, c, d) max(d, max(c, max(a, b)))
#define vi vector<int>
#define vul vector<unsigned long long int>
#define vll vector<long long int>
#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace __gnu_pbds;
using namespace std;
typedef unsigned long long int ul;
typedef long long int ll;
int main()
{
    fast;
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    int i = 0;
    while (b <= a)
    {
        b = b * 2;
        i++;
    }
    while (c <= b)
    {
        c = c * 2;
        i++;
    }
    if (i <= k)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	vector<int>a(n);
	rep(i,n){
		cin>>a[i];
	}
	rep(i,n){
		if(a[i]%2==0){
			if(a[i]%3==0||a[i]%5==0);
			else {
				cout<<"DENIED"<<endl;
				return 0;
			}
		}
	}
	cout<<"APPROVED"<<endl;
	return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a < b&&a < c){
		printf("%d ", a);
		if (b < c){
			printf("%d %d\n", b, c);
		}
		else{
			printf("%d %d\n", c, b);
		}
	}
	else if (b < a&&b < c){
		printf("%d ", b);
		if (a < c){
			printf("%d %d\n", a, c);
		}
		else{
			printf("%d %d\n", c, a);
		}
	}
	else{
		printf("%d ",c);
		if (b<a){
			printf("%d %d\n",b,a);
		}
		else{
			printf("%d %d\n",a,b);
		}
	}
	return 0;
}

Measured memory_bytes: 1024
x=int(input())
a=0
while True:
    for b in range(10**3):
        if a**5-b**5==x:
            print(a,b)
            exit()
        elif a**5+b**5==x:
            print(a,-b)
            exit()
        elif -a**5+b**5==x:
            print(-a,-b)
            exit()
    a+=1

Measured memory_bytes: 9180
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (n, sum) = get!(i64, i64);
    if n == 1 {
        println!("{}", sum);
        return;
    }
    let mut i = 1;
    let mut d = 1 << 60;
    while i * i <= sum {
        if sum / i < n {
            break;
        }
        if sum % i == 0 {
            d = std::cmp::min(d, sum / i);
            if n <= i {
                d = i;
                break;
            }
        }
        i += 1;
    }
    if d == 0 {
        println!("1");
    } else {
        println!("{}", sum / d);
    }
}


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

numTr = []

for i in range(5):
  numTr.append(int(input()))
  
numTr.sort()

miniNum = N // numTr[0]
remNum = N % numTr[0]

if remNum != 0:
  miniNum += 1
  
minutes = miniNum + 4

print(minutes)

Measured memory_bytes: 3060
N,K=map(int,input().split())
x=list(map(int,input().split()))
plusdis=[]
minusdis=[]
l=[]
for i in range(N):
    if x[i]<0:
        minusdis.append(abs(x[i]))
    else:
        plusdis.append(x[i])
minusdis.sort()
#print(minusdis,plusdis)
minum=0
plnum=0
mindist=float("inf")
for i in range(K+1):
    minum=i
    plnum=K-i
    #print(minum,plnum)
    if (minum<=len(minusdis))and(plnum<=len(plusdis)):
        if minum==0:
            mindist=min(plusdis[plnum-1],mindist)
        elif plnum==0:
            mindist = min(minusdis[minum - 1], mindist)
        else:
            mindist = min(plusdis[plnum - 1]+minusdis[minum - 1]+min(plusdis[plnum-1],minusdis[minum - 1]), mindist)
        #print(mindist)
    #input()
print(mindist)

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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  string S, T;
  cin >> S >> T;

  int minCost = T.size();
  for (int i = 0; i < S.size() - T.size() + 1; i++) {
    int cost = 0;
    for (int j = i; j < i + T.size(); j++) {
      if (S[j] != T[j - i])
        cost++;
    }
    minCost = min(minCost, cost);
  }

  cout << minCost;
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // cout << nl;
  // }

  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
ll mod=1e9+7;
#define PI acos(-1)
struct edge{int from, to;};

int main(){
    int n,q;
    ll k;
    cin>>n>>k>>q;
    int a[q];
    rep(i,q) cin>>a[i];
    ll score[n];
    rep(i,n) score[i]=k-q;

    for(int i=0;i<q;i++){
        score[a[i]-1]++;
    }
    for(int i=0;i<n;i++){
        if(score[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>


int main()
{
	int n;
	int i,k;
	int data[12][12];
	while(1){
		scanf("%d", &n);
		if(n==0){
			break;
		}
		for(i=0; i<12; i++){					//初期化
			for(k=0; k<12; k++){
				data[i][k]=0;
			}
		}
		for(i=0; i<n; i++){						//入力
			for(k=0; k<n; k++){
				scanf("%d", &data[i][k]);
			}
		}
		for(i=0; i<n; i++){						//合計値の計算
			for(k=0; k<n; k++){
				data[n][k]+=data[i][k];			//その行の合計
				data[i][n]+=data[i][k];			//その列の合計
				data[n][n]+=data[i][k];			//すべての合計
			}
		}
		for(i=0; i<=n; i++){					//出力
			for(k=0; k<=n; k++){
				/*if(k>0){
					printf(" ");
				}*/
				printf("%5d", data[i][k]);
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 616
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  int a[3];
  
  rep(i,0,3){
    C(a[i]);
    //P(a[i]);
  }
 
  
  int max=0;
  int max_i;
  
  rep(i,0,3){
    if(max < a[i]){
      max = a[i];
      max_i = i;
    }
  }
  
  //P(max);
  int sum = 0;
  
  rep(i,0,3){
    if(i != max_i)
      sum += a[i];
  }

  P(sum);

    

  
  ret 0;
}

Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#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 all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll r) { cout << r * r << endl; }

int main() {
  ll r;
  scanf("%lld", &r);
  solve(r);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  scanf("%d %d", &N,&K);
  string X;
  cin >> X;
  if(X[K-1] == 'A') X[K-1] = 'a';
  else if(X[K-1] == 'B') X[K-1] = 'b';
  else X[K-1] = 'c';
 
  cout << X << endl;
 
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

# A - Candy Distribution Again
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
candies = 0
ans = 0

for ai in a:
	if candies < x:
		candies += ai
		ans += 1
	else:
		break

if candies != x:
	ans -= 1

print(ans)
	


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

void simulate(int cells[5][5][5],
	      int days,
	      int birth_condition_num,int birth_conditions[50],
	      int dead_condition_num,int dead_conditions[50]
){
  for(int i=0;i<days;i++){
    int tmp[5][5][5];
    memcpy(tmp,cells,sizeof(int)*5*5*5);

    for(int x=0;x<5;x++){
      for(int y=0;y<5;y++){
	for(int z=0;z<5;z++){
	  int live=0,die=0;
	  for(int tx=-1;tx<=1;tx++){
	    for(int ty=-1;ty<=1;ty++){
	      for(int tz=-1;tz<=1;tz++){
		if(tx == ty && ty == tz && tz == 0) continue;

		int dx = x + tx;
		int dy = y + ty;
		int dz = z + tz;
		if(dx < 0 || dy < 0 || dz < 0 
		   || dx >=5 || dy >=5 || dz >=5) continue;
		if(cells[dx][dy][dz] == 1) live++;
	      }
	    }
	  }
	  if(cells[x][y][z] == 0){

	    bool islive = false;
	    for(int i=0;i<birth_condition_num;i++){
	      if(birth_conditions[i] == live){
		islive = true;
		break;
	      }
	    }

	    if(islive) tmp[x][y][z] = 1;
	  }
	  else if(cells[x][y][z] == 1){
	    bool isdie = true;
	    for(int i=0;i<dead_condition_num;i++){
	      if(dead_conditions[i] == live){
		isdie = false;
	      }
	    }

	    if(isdie) tmp[x][y][z] = 0;
	  }
	}
      }
    }

    memcpy(cells,tmp,sizeof(int)*5*5*5);
  }
}

void print_cage(int cells[5][5][5]){
  for(int z=0;z<5;z++){
    for(int y=0;y<5;y++){
      for(int x=0;x<5;x++){
	printf("%d",cells[x][y][z]);
      }
      printf("\n");
    }
    if(z <= 3)printf("\n");
  }
}

int main(){
  int simulation_days;
  int case_num = 1;
  while(~scanf("%d",&simulation_days)){
    if(simulation_days == 0) break;
    int cells[5][5][5];
    for(int z=0;z<5;z++){
      for(int y=0;y<5;y++){
	string str;
	cin >> str;
	for(int x=0;x<5;x++){
	  cells[x][y][z] = str[x]-'0';
	}
      }
    }
    int birth_condition_num,dead_condition_num;
    int birth_conditions[50],dead_conditions[50];

    scanf("%d",&birth_condition_num);
    for(int i=0;i<birth_condition_num;i++){
      scanf("%d",birth_conditions + i);
    }

    scanf("%d",&dead_condition_num);
    for(int i=0;i<dead_condition_num;i++){
      scanf("%d",dead_conditions + i);
    }
    simulate(cells,simulation_days,
	     birth_condition_num,birth_conditions,
	     dead_condition_num,dead_conditions);

    if(case_num != 1) printf("\n");
    printf("Case %d:\n",case_num);
    case_num++;

    print_cage(cells);
  }
}

Measured memory_bytes: 1244
#include<stdio.h>
typedef long long LL;
LL a[100005],d[100005];

int main()
{
    int i;
    LL N,t,S=0,S0,n;
    scanf("%lld", &n);
    S0=n*(n+1)/2;
    for(i=1;i<=n;i++){
        scanf("%lld", &a[i]);
        S+=a[i];
    }
    if(S%S0){
        printf("NO");
        return 0;
    }
    N=S/S0;
    for(i=1;i<=n;i++){
        d[i]=a[i%n+1]-a[i];
        t=N-d[i];
        if(t%n||t<0){
            printf("NO");
            return 0;
        }
    }
    printf("YES");
    return 0;
}


Measured memory_bytes: 1664
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() 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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    s = input()
    ans = 0
    for i in range(n-1):
        if s[i] == s[i+1]:
            ans += 1
    print(min(ans+2*k,n-1))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 39360
#include <iostream>
#include <algorithm>

#define INF 50

using namespace std;

int main(){
  int n; cin >> n;
  string str[n];
  int cnt[26],mincnt[26];
  for(int i=0;i<26;i++) mincnt[i]=INF;
  for(int i=0;i<n;i++){
    cin >> str[i];
  }
  for(int i=0;i<n;i++){
    for(int k=0;k<26;k++) cnt[k]=0;
    for(int j=0;j<str[i].size();j++){
      char c=str[i][j];
      cnt[c-'a']++;
    }
    for(int k=0;k<26;k++){
      mincnt[k]=min(cnt[k],mincnt[k]);
    }
  }
  for(int i=0;i<26;i++){
    while(mincnt[i]>0){
      cout << (char)(i+'a');
      mincnt[i]--;
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k;
    if (e - a <= k) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair

bool ans=true;

const ll MaxN=100001;
vector<P> d[MaxN];

ll D[MaxN];
bool Used[MaxN];

void solve(ll y){
    Used[y]=true;
    ll K=d[y].size();
    if(K==0) return;
    if(!ans) return;
    rep(i,K){
        ll X=d[y].at(i).first, Y=d[y].at(i).second;
        if(D[Y]!=INF){
            if(D[Y]!=X+D[y]) {ans=false; return;}
        }
        else {
            D[Y]=X+D[y];
            solve(Y);
        }
        
    }
    //if(!ans) break;
    return;
}



int main(){
    ll N,M; cin>>N>>M;
    rep(i,MaxN) Used[i]=true;
    rep(i,MaxN) D[i]=INF;
    rep(i,M){
        ll L,R,DD; cin>>L>>R>>DD;
        Used[L]=false;
        Used[R]=false;
        d[L].pb(mp(DD,R));
        d[R].pb(mp(-DD,L));
    }
    rep(i,N+1) if(!Used[i]) {
        D[i]=0;
        solve(i);
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

int n, m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
  fast();
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n);
  cout << a[n / 2] - a[n / 2 - 1];

  return 0;
}


Measured memory_bytes: 4016
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int W = sc.nextInt();
        int H = sc.nextInt();
        int N = sc.nextInt();
        boolean[][] board = new boolean[H][W];
        for (int i = 0; i < N; i++) {
            int qx = sc.nextInt();
            int qy = sc.nextInt();
            int a = sc.nextInt();
            switch (a) {
            case 1:
                for (int y = 0; y < H; y++) {
                    for (int x = 0; x < W; x++) {
                        if (qx > x)
                            board[y][x] = true;
                    }
                }
                break;
            case 2:
                for (int y = 0; y < H; y++) {
                    for (int x = 0; x < W; x++) {
                        if (qx <= x)
                            board[y][x] = true;
                    }
                }
                break;
            case 3:
                for (int y = 0; y < H; y++) {
                    for (int x = 0; x < W; x++) {
                        if (qy > y)
                            board[y][x] = true;
                    }
                }
                break;
            case 4:
                for (int y = 0; y < H; y++) {
                    for (int x = 0; x < W; x++) {
                        if (qy <= y)
                            board[y][x] = true;
                    }
                }
                break;
            }
        }

        for (int y = 0; y < H; y++) {
            // System.out.println(Arrays.toString(board[y]));
            for (int x = 0; x < W; x++) {
                if (!board[y][x])
                    ans++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23424
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c,h;
  cin>>n>>c;
  h=100000;
  vector<vector<int>> d(c,vector<int>(h,0));
  for(int _=0;_<n;_++){
    int s,t,ci;
    cin>>s>>t>>ci;
    s--;
    t--;
    ci--;
    d.at(ci).at(s)++;
    d.at(ci).at(t)--;
  }
  int r=0;
  int m=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<c;j++)
      r+=max(d.at(j).at(i),0);
    m=max(m,r);
    for(int j=0;j<c;j++)
      r+=min(d.at(j).at(i),0);
  }
  cout<<m<<endl;
}

Measured memory_bytes: 15372
#!/usr/bin/perl
use Data::Dumper;

my ($n,$m,$k) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @p = (); $#p = $n - 1;

my @con = (); $#con = $n - 1;
my @n_con = (); $#n_con = $n - 1;
my @dis = (); $#dis = $n - 1;

my @ngn = (); $#ngn = $n;

for(my $i=0;$i<$n;$i++){
  $con[$i] = +{};
}

for(my $i=0;$i<$m;$i++){
  my ($aa,$bb) = map { $_ - 1 } split(/\s+/,<STDIN>);
  $con[$aa]->{$bb} = 1;
  $n_con[$aa]++;
  $con[$bb]->{$aa} = 1;
  $n_con[$bb]++;
}

my $gn = 1;
for(my $i=0;$i<$n;$i++){
  if( $p[$i] == 0 ){
    &fn($i,$gn);
    $gn++;
  }
}

for(my $i=0;$i<$k;$i++){
  my ($aa,$bb) = map { $_ - 1 } split(/\s+/,<STDIN>);
  if( $p[$aa] == $p[$bb] ){
    $dis[$aa]++;
    $dis[$bb]++;
  }
}

for(my $i=0;$i<$n;$i++){
  my $gn1 = $p[$i];
  my $ngn1 = $ngn[$gn1];
  my $n_con1 = $n_con[$i];
  my $dis1 = $dis[$i];
  my $r = $ngn1 - 1 - $n_con1 - $dis1;
  #print "$ngn1 $n_con1 $dis1\n";
  $r = ' ' . $r if $i>0;
  print "$r";
}
print "\n";
exit(0);

sub fn {
  my $i = shift;
  my $gn = shift;
  
  my @q = ($i);
  
  while(@q){
    my @nq = ();
    for(my $j=0;$j<@q;$j++){
      my $ii = $q[$j];
      next unless $p[$ii] == 0;
      $p[$ii] = $gn;
      $ngn[$gn]++;
      my @ky = map {$_ - 0 } keys %{$con[$ii]};
      push( @nq, @ky );
    }
    @q = @nq;
  }
}




Measured memory_bytes: 73100
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF = 100000010

int main(){
    ll N;
    cin >> N;
    if(N%2==1){
        cout << 0 << endl;
        return 0;
    }
    ll sum=0;
    for(ll x=10;x<=N;x*=5){
        sum += (ll)N/x;
    }
    cout << sum << endl;

}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
class suffix_array{
  private:
    string s; // suffix_array の対象
    ll n, k; // n : sの長さ
    vll sa, tmp, rank; // sa : sufffixの開始位置

  public:

    suffix_array(string &str){
      s = str;
      n = s.size();

      sa.resize(n+1);
      rank.resize(n+1);
      tmp.resize(n+1);

      for(ll i=0;i<=n;i++){
        sa[i] = i;
        rank[i] = i < n ? (ll)s[i] : -1;
      }

      auto compare_sa = [&](ll i, ll j){
        if(rank[i] != rank[j]) return rank[i] < rank[j];
        else{
          ll ri = i + k <= n ? rank[i + k] : -1;
          ll rj = j + k <= n ? rank[j + k] : -1;
          return ri < rj;
        }
      };

      for(k=1;k<=n;k*=2){
        sort(sa.begin(),sa.end(), compare_sa);

        tmp[sa[0]] = 0;

        for(ll i=1;i<=n;i++){
          tmp[sa[i]] = tmp[sa[i-1]] + (compare_sa(sa[i-1], sa[i]) ? 1 : 0);
        }
        for(ll i=0;i<=n;i++){
          rank[i] = tmp[i];
        }
      }
    }

    // [lb,ub) の各要素はtを部分文字列として含む
    pll range(string &t){
      ll m = t.size();
      ll ub, lb;
      ll lef, rig, mid;
      
      lef = 0; rig = n+1; // sa[0]は空 サイズがn+1

      while(rig - lef > 1){
        mid = (lef + rig) / 2; 
        string subs = s.substr(sa[mid],m);
        if(t <= subs) rig = mid;
        else lef = mid;
      }
      lb = rig;

      lef = 0; rig = n+1; // sa[0]は空 サイズがn+1

      while(rig - lef > 1){
        mid = (lef + rig) / 2;
        string subs = s.substr(sa[mid],m);
        if(t < subs) rig = mid;
        else lef = mid;
      }
      ub = rig;

      return make_pair(lb, ub);
    }

    // 何箇所tを含むか
    ll cnt(string &t){
      pll res = range(t);
      return res.second - res.first;
    }
};
//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  string t;
  cin >> t;

  suffix_array sarray(t);

  ll q;
  cin >> q;
  REP(i,q){
    string p;
    cin >> p;
    ll a = sarray.cnt(p);
    cout << (a != 0) <<endl;
  }


    
  return 0;
}




Measured memory_bytes: 28400
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
const int N = 3e5 + 87;
int op(int a, int b)
{
    return max(a, b);
}
int e()
{
    return 0;
}
segtree<int, op, e> seg(N);
int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        int l = max(0, a - k);
        int r = min(N, a + k + 1);
        int k = seg.prod(l, r) + 1;
        ans = max(ans, k);
        seg.set(a, k);
    }
    cout << ans << '\n';
}


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

int main(void){
    int n;
    cin >> n;
    long long int a[n],sum = 0;
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n;i++){
        int b = 0;
        while( 1 ){
            if(a[i] % 2 == 1)break;
            a[i] /= 2;
            b++;
        }
        sum += b;
    }
    cout << sum << endl;
}

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

int main(){
    ll n; 
    cin>>n;
    
    ll dp[n+1];             //dp[i] denotes the no.of ways to get sum = i
    memset(dp,0,sizeof(dp));
                        
    dp[0] = 1;          // when there is no sum, there is still a way, take nothing
    for(int sum=1;sum<=n;++sum){
        for(int coin=3;coin<=sum;++coin){        //question demands value>=3 
            dp[sum] = dp[sum] + dp[sum-coin];       
            dp[sum] = dp[sum]%mod;          // question demands
        }
    }
    cout<<dp[n];
}





Measured memory_bytes: 3644
#define SuC_VaT              Doc_code_ban_khac
#define Nhan_cach_bang_0     Doc_code_ban_khac

//

#include <iostream>
#include <map>
#include <set>
#include <deque>
#include <vector>
#include <list>
#include <string>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ldb;
typedef pair<int,int> ii;
typedef pair<ll, pair<ll,ll> > iii;

const int kn = 2e6 + 5, N = 1e5+5;
const ll mod = 1e9 + 7, mod2 = 1e9+9;
const ll base = 31, base1 = 37;

//#define x first
//#define y second
#define lwb lower_bound
#define upb upper_bound
#define _it iterator

#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front

#define log2(X) (31-__builtin_clz(X))
#define log2ll(X) (63-__builtin_clzll(X))
#define numbit(X) __builtin_popcount(X)
#define numbitll(X) __builtin_popcountll(X)

#define ms(val,a) memset(a,val,sizeof(a))

#define ff(i,n) for(int i=1;i<=n;i++)
#define _ff(i,n) for(int i=n;i>=1;i--)
#define f(i,a,b) for(int i = a; i <=b; i++)
#define _f(i,a,b) for(int i = b; i>=a;i--)

#define In(X) freopen(X,"r",stdin)
#define Out(X) freopen(X,"w",stdout)

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll n,m,k,a[kn];
ll x,y,z;
string L;

ll binpow(ll u, int v)
{
	if(v==0) return 1;
	if(v==1) return u;
	ll T = binpow(u,v/2);
	T = T*T; if(T>=mod) T%=mod;
	if(v&1) return (T*u)%mod;
	return T;
}

ll cac;

int main() {
	cin >> L;
	ll ans = 0, cur = 1; 
	for(int i = 0; i<L.size();i++)
	{
		if(L[i] == '0') continue;
		cac += (1<< (L.size()-i-1)) ;
		ll tmp = cur*binpow(3,L.size()-i-1); tmp%=mod;
		ans += tmp; if(ans>mod) ans%=mod;
		if(L[i] == '1') cur = (cur*2)%mod;
	}
	ans = (ans+cur)%mod;
	cout << ans ; 
}
//hahahahahahahahahhahahahahahaahahahahhahahahahahahah


Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);

    int a = s.nextInt();
    int b = s.nextInt();
    int c = s.nextInt();
    int d = s.nextInt();

    int e = a-c;
    int f = b-d;
    System.out.println(e*f);
  }
}


Measured memory_bytes: 23124
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<i32>();
  let mut value = vec![];
  let mut cost = vec![];


  for _ in 0..n {
    let v = read::<i32>();
    value.push(v)
  }
  for _ in 0..n {
    let c = read::<i32>();
    cost.push(c)
  }

  let mut answer = 0;
  for i in 0..n {
    let v = value[i as usize] - cost[i as usize];
    if v > 0 {
      answer += v
    }
  }

  println!("{}", answer);
}



Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,n) for(int i=0;i<n;i++)
#define PRINT(a) cout<<a<<"\n"
 
int main(){

	int a,b,c,d;
	
	cin>>a>>b>>c>>d;

	PRINT(max(a*b,c*d));
	

	return 0;
}

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

typedef unsigned long long int ull;

ull Tpower(ull k) {
	ull res = 1;
	for (ull i = 0; i < k; i++) {
		res *= 2;
	}
	return res;
}

int main (void) {
	ull N, P;
	cin >> N >> P;
	ull count = 0;
	for (ull i = 0; i < N ; i++) {
		ull temp;
		cin >> temp;
		if (temp % 2) count++;
	}
	if (!count) {
		if (count % 2 == P) cout << Tpower(N) << endl;
		else cout << 0 << endl;
	} else cout <<Tpower(N - 1) << endl;
	return 0;
}


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

int d[6] = {5,4,3,2,1,0};

int main(){
    int x;
    cin >> x;
    int s = x/100;
    x %= 100;
    rep(j,s){
        rep(i,6){
            if(x >= d[i]){
                x -= d[i];
                break;
            }
        }
    }
    if(x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}


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

int main(){
    int i, j;
    int a[3], b[3], c[3][3];
    for(i=0; i<3; i++){
        for(j=0; j<3; j++){
            cin >> c[i][j];
            if(i == 0){
                b[j] = c[i][j];
            }
        }
    }
    a[0] = 0;
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];
    for(i=0; i<3; i++){
        for(j=0; j<3; j++){
            cin >> c[i][j];
            if(a[i] + b[j] != c[i][j]){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define pb push_back 
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)

using namespace std;

int main()
{
    IOS;
    int n;
    cin >> n;
    int minim = n+1;
    int ans = 0;
    int p[n+1];
    for(int i = 1;i<=n;i++)
    {
        int x;
        cin >> x;
        p[x] = i;
    }
    for(int i = 1; i<=n;i++)
    {
        minim = min(minim,p[i]);
        if(minim >= p[i])
            ans++;
    }
    cout << ans;
}

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

int main(){
	int n,m,k,a,b;
	scanf("%d%d",&n,&k);
	m=(n+n%2)/2;
	for(int i=0;i<k;i++){
		scanf("%d%d",&a,&b);
		a=min(min(a,b),n-max(a,b)+1)%3;
		if(a==0)a=3;
		printf("%d\n",a);
	}
}

Measured memory_bytes: 1172
//G-Longest-path
#include<bits/stdc++.h>
using namespace std;

vector<int>v[100001];
int dp[100001];

int  dfs(int x)
{
	if(dp[x]!=-1)
		return dp[x];
	int temp=0;
	for(auto z:v[x])
	{
		temp=max(temp,dfs(z)+1);
	   	
	}
	dp[x]=temp;
	return temp;
}

int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		v[x].push_back(y);
	}
	
	
	for(int i=1;i<=n;i++)
	dp[i]=-1;
	int ans=INT_MIN;
	for(int i=1;i<=n;i++)
		ans=max(ans,dfs(i));
	
	cout<<ans<<endl;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A(N);
    for(auto& i : A)cin >> i;
    const auto S = accumulate(A.begin(), A.end(), 0UL);
    if(S % (N * (N + 1) / 2))return 0 & puts("NO");
    const auto K = S * 2 / N / (N + 1);
    A.push_back(A[0]);
    unsigned long cnt{0};
    for(unsigned long i{0}; i < N; ++i){
        if(K + A[i] < A[i + 1] || (K + A[i] - A[i + 1]) % N)return 0 & puts("NO");
        cnt += (K + A[i] - A[i + 1]) / N;
    }
    if(cnt != K)return 0 & puts("NO");
    puts("YES");
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define pii pair<int,int>
#define se second
using namespace std;
void solve()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int com=a[n-1];
    int x=n-2,cnt=2;
    for(int i=n-3;i>=0;i--){
        com+=a[x];
        cnt--;
        if(cnt==0){
            cnt=2;
            x--;
        }
    }
    cout<<com;
}
int32_t main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 5204
N = int(input())
T, A = map(int, input().split())
h=list(map(int, input().strip().split()))
tlis=[0]*N

for i in range(N):
    tlis[i]=abs(A-(T-0.006*h[i]))
 
#print(tlis)
print(tlis.index(min(tlis))+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define f first
#define s second
#define mp make_pair
#define sz size()
#define ll long long
int n;
int dp[(int)1e5+10][4];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		dp[i][1] = max(dp[i - 1][2], dp[i - 1][3]) + a;
		dp[i][2] = max(dp[i - 1][1], dp[i - 1][3]) + b;
		dp[i][3] = max(dp[i - 1][1], dp[i - 1][2]) + c;
	}
	cout << max(max(dp[n][1], dp[n][2]), dp[n][3]);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

struct {
  auto &operator>>(int &x) {
    char c;
    do
      c = std::cin.rdbuf()->sbumpc();
    while (!isdigit(c));
    for (x = 0; isdigit(c); c = std::cin.rdbuf()->sbumpc())
      x = x * 10 + (c ^ 48);
    return *this;
  }
} io;

const int MAX_W = 100000;

long long f[MAX_W + 1];

int main() {
  int N, W;
  io >> N >> W;
  for (int i = 0, w, v; i < N; ++i) {
    io >> w >> v;
    for (int j = W; j >= w; --j) f[j] = std::max(f[j], f[j - w] + v);
  }
  std::cout << f[W];
  return 0;
}

Measured memory_bytes: 1024
using System;

class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        string output = (a * b % 2 == 0) ? "Even" : "Odd";
        Console.WriteLine(output);
    }
}

Measured memory_bytes: 11092
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

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

    private void run() {
        switch (sc.next()) {
            case "SUN":
                System.out.println(7);
                break;
            case "MON":
                System.out.println(6);
                break;
            case "TUE":
                System.out.println(5);
                break;
            case "WED":
                System.out.println(4);
                break;
            case "THU":
                System.out.println(3);
                break;
            case "FRI":
                System.out.println(2);
                break;
            case "SAT":
                System.out.println(1);
                break;
        }

    }
}



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

int main(void) {
    char c[2][3];
    bool flag;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }
    for (int i = 0; i < 3; i++) {
        if (c[0][i] == c[1][2 - i]) flag = true;
        else {
            flag = false;
            break;
        }
    }
    cout << (flag ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256