akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define sy first.first
#define ey first.second
#define nm second

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int n, q; cin >> n >> q, n;){
        vector< pair<pii, string> > years(n);
        rep(i, n){
            string name;
            int eby, wy;
            cin >> name >> eby >> wy;

            years[i] = mp(mp(wy - eby + 1, wy), name);
        }
        sort(all(years));

        rep(i, q){
            int y; cin >> y;

            bool ok = false;
            rep(j, n){
                if(years[j].sy <= y && y <= years[j].ey){
                    cout << years[j].nm << " " << y - years[j].sy + 1 << endl;
                    ok = true;
                    break;
                }
            }
            if(!ok) cout << "Unknown" << endl;
        }
    }

	return 0;
}

Measured memory_bytes: 1284
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
    	InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        long n = Long.parseLong(br.readLine());
        String[] input = br.readLine().split(" ");
        long m = Long.parseLong(input[0]);
        long mm = Long.parseLong(input[0]);
        long sum = 0;
        for(int x = 0 ; x < n ; x++){
        	int a = Integer.parseInt(input[x]);
        	m = Math.max(m, a);
        	mm = Math.min(mm, a);
        	sum = sum + a;
        }
        System.out.println(mm + " " + m + " " + sum);
    }
}

Measured memory_bytes: 28628
#include <stdio.h>

int main(void)
{
	long long n,kazu,max,min,i,goukei;
	max = -10000000;
	goukei = 0;
	min = 1000000;


	scanf("%lld", &n);


	for (i = 0; i < n; i++)
	{
		scanf("%lld", &kazu);
		if (kazu > max)
		{
			max = kazu;
		}
		if (kazu < min)
		{
			min = kazu;
		}
		goukei = goukei + kazu;
	}
	printf("%lld %lld %lld\n", min, max, goukei);

	return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int ans[MAXN];
int main()
{
    for(int i=1;i<=100;i++)
        for(int j=1;j<=100;j++)
            for(int k=1;k<=100;k++)
            {
                int res=i*i+j*j+k*k+i*j+i*k+j*k;
                if(res<=10000) ans[res]++;
            }
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 3744
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {
    input!{
        H:usize,
        W:usize,
    }
    let mut ans = H*W;

    for i in 1..H{
        let S0 = i*W;
        let (S1,S2) = f(H-i,W);
        let m = min(S0,S1);
        let M = max(S0,S2);
        ans = min(ans,M-m);
    }
    for j in 1..W{
        let S0 = j*H;
        let (S1,S2) = f(H,W-j);
        let m = min(S0,S1);
        let M = max(S0,S2);
        ans = min(ans,M-m);
    }

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

fn f(h:usize,w:usize)->(usize,usize){
    if h%2==0 || w%2==0{
        return (w*h/2,w*h/2)
    }
    let a = min(h,w);
    let b = max(h,w);
    let c = b/2;
    let d = b-c;
    (a*c,a*d)
}

Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P; 


int main(){
    int n;
    while(cin >> n,n){
        vector<int> count(26,0);
        vector<char> c(n);
        for (int i = 0; i < n; i++) {
            cin >> c[i];
        }
        bool f=false;
        P p[2]={{0,-1},{0,0}};
        char a;
        int b;
        for (int i = 0; i < n; i++) {
            count[c[i]-'A']++;
            int t = c[i]-'A';
            if(count[t]>=p[0].first){
                if(p[0].second!=t){
                    p[1]=p[0];
                }
                p[0]=make_pair(count[t],t);
            }
            else if(p[1].first<count[t]){
                p[1]=make_pair(count[t],t);
            }
            if(p[0].first > n-1-i+p[1].first){
                a=(char) (p[0].second+'A');
                b=i+1;
                break;
            }

        }
        if(p[0].first==p[1].first){
            puts("TIE");
        }
        else{
            cout << a << " " << b << endl;
        }
    }
    return 0;
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int n;
  string s;
  cin >> n >> s;
  ll res = 0;
  ll sum = 0;
  REP(i,n){
    s[i] == 'I' ? sum++ : sum--;
    res = max(res,sum);
  }
  cout<< res << endl;




  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
typedef long long ll;
int main()
{
    ll n,a[N],ans;
    ans=0;
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i],a[i]-=i+1;
    sort(a,a+n);
    ll t=a[n/2];
    for(int i=0;i<n;i++) a[i]-=t,ans+=abs(a[i]);
    cout << ans << endl;
}


Measured memory_bytes: 1792
use permutohedron::heap_recursive;
use proconio::{fastout, input};
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        n: usize,
        xy: [(f64,f64); n]
    }
    let mut average = 0.;
    let mut pats = Vec::new();
    let mut tmp: Vec<usize> = (0..n).collect();
    heap_recursive(&mut tmp, |permutation| pats.push(permutation.to_vec()));
    for pat in pats.iter() {
        let mut dis = 0.;
        for i in 1..n {
            let a = pat[i - 1];
            let b = pat[i];
            dis += calc_dis(xy[b], xy[a]);
        }
        average += dis;
    }
    let res = average / (pats.len() as f64);
    println!("{:.12}", res);
}

fn calc_dis(a: (f64, f64), b: (f64, f64)) -> f64 {
    let xdis = (a.0 - b.0).abs();
    let ydis = (a.1 - b.1).abs();
    (xdis * xdis + ydis * ydis).sqrt()
}


Measured memory_bytes: 6036
#include<iostream>
using namespace std;
int main(){
int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ans = 0;
  for(int i = 0;i <= a;i++){
    for(int j = 0;j <= b;j++){
      for(int k = 0;k <= c;k++){
		if(d == 500*i+100*j+50*k) ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main() {
	int N, M; cin >> N >> M;
	multiset <int> a;
	int x = 0, y = 0;
	for (int i = 0; i < M; i++) {
		int v, w; cin >> v >> w;
		if (v == 1) {
			a.insert(w);
			if (a.count(w) == 2) {
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
		if (w == N) {
			a.insert(v);
			if (a.count(v) == 2) {
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
		
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 9600
def main():
    n, m = [int(i) for i in input().split()]
    l_max, r_min = 0, 10**6
    for i in range(m):
        l, r = [int(j) for j in input().split()]
        l_max = max(l, l_max)
        r_min = min(r+1, r_min)
    if r_min-l_max <= 0:
        print(0)
    else:
        print(r_min-l_max)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
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> v(n);
    rep(i, n)   cin >> v[i];
    int ans = 0;
    while(1){
        rep(i, n){
            if(v[i] % 2 == 0){
                v[i]/=2;
            }
            else{
                cout << ans << endl;
                return 0;
            }
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
	#include <string>
	#include <cstring>
	#include <iostream>
	#include <algorithm>
	
	using namespace std;
	
	const int maxn = 1e5 + 10;
	
	struct node {
		int t,x,y;
	}dot[maxn];
	
	bool cmp(node a,node b) {
		return a.x != b.x ? a.y < b.y : a.x < b.x;
	}
	
	int u[maxn],v[maxn];
	
	int n;
	
	int main(void) {
		scanf("%d",&n);
		for(int i = 1; i <= n; i ++) {
			scanf("%d%d%d",&dot[i].t,&dot[i].x,&dot[i].y);
		} 
		bool flag = true;
		for(int i = 1; i <= n; i ++) {
			if(abs(dot[i].x - dot[i -1].x ) + abs(dot[i].y - dot[i - 1].y ) > dot[i].t - dot[i - 1].t) {
				flag = false;
				break;
			}
			if((abs(dot[i].x - dot[i -1].x ) + abs(dot[i].y - dot[i - 1].y ) )% 2 != (dot[i].t - dot[i - 1].t )% 2) {
				flag = false;
				break;
			}
		
		}
		if(flag) puts("Yes");
		else puts("No");
		return 0;
	} 

Measured memory_bytes: 1408
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));

int main() {

	int n, mini = 100;
	cin >> n;

	vector<int> h(n);
	rep(i, 0, n) {
		cin >> h[i];
		mini = min(mini, h[i]);
	}

	int ans = h[0];

	rep(i, 1, n) {
		if (h[i] > h[i - 1]) ans += h[i] - h[i - 1];
	}

	cout << ans << endl;

	return 0;
}

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

int prime(int n){
    if(n == 2){
        return 1;
    }else{
        int t = 1;
        for(int i = 2; i <= (int)sqrt(n); i++){
            if(n % i == 0){
                t = 0;
                break;
            }
        }
        return t;
    }
}

int main(void){

    int N;

    scanf("%d", &N);

    int c[N+1], d[N+1];

    for(int i = 1; i <= N; i++){
        d[i] = i;
        c[i] = 0;
    }

    for(int i = 2; i <= N; i++){
        if(prime(i) == 1){
            for(int j = 1; j <= N; j++){
                while(d[j] % i == 0){
                    d[j] /= i;
                    c[i]++;
                }
            }
        }
    }

    long long ans = 1;

    for(int i = 2; i <= N; i++){
        ans = ans * (c[i] + 1) % 1000000007;
    }

    printf("%lld\n", ans);

    return 0;
}

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

double abs(double a){ return a>0 ? a : -a; }

int main()
{
        double a, b, c, d, e, f;
        double det;
        double x, y;
        
        while( scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF ){
                det = a*e - b*d;
                x = (e*c-b*f)/det;
                y = (a*f-c*d)/det;
                if( abs(x) < 0.0001 ){ x = 0.0; }
                if( abs(y) < 0.0001 ){ y = 0.0; }
                printf("%.3lf %.3lf\n",x ,y);
        }
        return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
int main()
{
	int A,B,C,D,L,R;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	
	L=A+B;
	R=C+D;
	
	if(L>R) printf("Left\n");
	if(L<R) printf("Right\n");
	if(L==R) printf("Balanced\n");
	
	
	return 0;
}

Measured memory_bytes: 2088
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MAX 1000

int LCS(char*, char*);

int main(void){
  int i, j, q, sharerow;
  char X[MAX], Y[MAX];

  scanf("%d", &q);
  for(i=0; i<q; i++){
    scanf("%s%s", X, Y);
    printf("%d\n", LCS(X, Y));
  }

  return 0;
}

int LCS(char *X, char *Y){
  int i, j;
  int x = strlen(X), y = strlen(Y);
  int Z[MAX+1][MAX+1];

  for(i=1; i<=x; i++){
    for(j=1; j<=y; j++){
      if(X[i-1] == Y[j-1]) Z[i][j] = Z[i-1][j-1] + 1;
      else if(Z[i-1][j] >= Z[i][j-1]) Z[i][j] = Z[i-1][j];
      else Z[i][j] = Z[i][j-1];
    }
  }

  return Z[x][y];
}

Measured memory_bytes: 4524
from math import log2, ceil

a, b, c = map(int, input().split())
k = int(input())
# n >= log2((a+1)/b)
bi = ceil(log2((a+1) / b))
bi = max(bi, 0)
b *= pow(2, bi)
ci = ceil(log2((b+1) / c))
ci = max(ci, 0)
if bi + ci <= k:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9224
s = input()
l = s.split()   #スペースで区切る 

A = int(l[0])
B = int(l[1])
C = int(l[2])
D = int(l[3])

if A + B > C + D:
    print('Left')
elif A + B < C + D:
    print('Right')
else:    
    print('Balanced')

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {

  int a, b, c;
  string mrPolpo;
  cin >> mrPolpo;// *Banana Gun's head and brain spills out
  if(mrPolpo[0] == mrPolpo[1] || mrPolpo[1] == mrPolpo[2] || mrPolpo[2] == mrPolpo[3]){
    cout << "Bad";
  }else{
    cout << "Good";//It's not my fault if my eye just happens to go near this keyhole Nice...
  }
  return 0;
}


Measured memory_bytes: 3628
//abc143_e.cpp
//Sun Oct 20 15:54:31 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 21474836
#define LLINF 922337203685477580
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n,m,l;
	cin >> n >> m >> l;

	ll G[n][n];
	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			if (i==j){
				G[i][j] = 0;
			}else {
				G[i][j] = 1100000000;
			}
//			cout << G[i][j] << " ";
		}
//		printf("\n");
	}

	for (int i=0;i<m;i++){
		ll a,b,c;
		cin >> a >> b >> c;
		a--;b--;
		G[a][b] = c;
		G[b][a] = c;
	}

	for (int k=0;k<n;k++){
		for (int i=0;i<n;i++){
			for (int j=0;j<n;j++){
				G[i][j] = min(G[i][j],G[i][k]+G[k][j]);
			}
		}
	}

	int G2[n][n];

	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			if (i==j){
				G2[i][j] = 0;
			}else if (G[i][j]<=l){
				G2[i][j]=1;
			}else {
				G2[i][j]=INTINF;
			}
//			cout << G[i][j] << " ";
		}
//		printf("\n");
	}

	for (int k=0;k<n;k++){
		for (int i=0;i<n;i++){
			for (int j=0;j<n;j++){
				G2[i][j] = min(G2[i][j],G2[i][k]+G2[k][j]);
			}
		}
	}	

	int q;
	cin >> q;
	for (int i=0;i<q;i++){
		int s,t;
		cin >> s >> t;
		s--;t--;
		if (G2[s][t]-1>=INTINF-5){
			cout << -1 << endl;
		}else {
			cout << G2[s][t]-1 << endl;
		}
	}

}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
string s[]={"ABC","DEF","GHI"},t;
int dx[]={-1,0,1,0},dy[]={0,-1,0,1};
main(){
  for(int i=0;i<1000;++i){
    cin>>t;
    int z=1;
    for(int j=1;j<t.size();++j){
      int k,l;
      for(k=0;k<3;++k){
        for(l=0;l<3;++l)
          if(t[j-1]==s[k][l])break;
        if(t[j-1]==s[k][l])break;
      }
      
      for(int m=0;m<4;++m){
        if(k+dy[m]<0||k+dy[m]>2||l+dx[m]<0||l+dx[m]>2)continue;
        if(t[j]==s[k+dy[m]][l+dx[m]]){
          z++;
          break;
        }
      }
    }
    if(z==t.size())cout<<t<<endl;
  }
}

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

long long a, v, b, w, t;

int main(){
	cin>>a>>v>>b>>w>>t;
	long long x = v - w;
	if(x < 0){
		cout<<"NO"<<endl;
	}
	else if((long long)(x * t) >= abs(b - a)){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}


//5 3 - (v - w) = 2 * 5 = 11, (b - a) ok
//0, 11
//5 14
//10 17
//15 20
//20 23
//25 26


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

int main(void) {
	int n;

	scanf("%d", &n);

	if(n < 111 || n > 999) {
		exit(0);
	}
	
	if(n/100 == 1) {
		printf("9");
	} else {
		printf("1");
	}

	n = n % 100;

	if(n/10 == 1) {
		printf("9");
	} else {
		printf("1");
	}

	n = n % 10;

	if(n == 1) {
		printf("9");
	} else {
		printf("1");
	}

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

Measured memory_bytes: 128
_n = gets.chomp
s = gets.chomp.chars

answer = s.dup
count = 0
s.each do |t|
    if t == "("
        count += 1
    elsif t == ")"
        count -= 1
        if count == -1
            answer.unshift("(")
            count = 0
        end
    end
end
count.times do
    answer << ")"
end

puts answer.join


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <sstream>
#define ull unsigned long long
#define ll long long
#define INF 1000000007
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a;
    int s=0,e=0,n=0,w=0;
    cin >> a;
    for(int i=0;i<a.size();i++){
        if(a[i]=='S'){s++;}
        else if(a[i]=='E'){e++;}
        else if(a[i]=='N'){n++;}
        else if(a[i]=='W'){w++;}
    }
    if((n!=0 && s==0) || (s!=0 && n==0) || (w!=0 && e==0) || (e!=0 && w==0)){
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int N, a[3030], dp[2][3030][3030];

int dfs(int p, int l, int r)
{
    if(~dp[p][l][r]){
        return dp[p][l][r];
    }
    if(l == r){
        int res;
        if(p % 2 == 0){
            res = a[l];
        }
        else {
            res = -a[l];
        }
        return dp[p][l][r] = res;
    }
    int res;
    if(p % 2 == 0){
        res = dfs(1, l + 1, r) + a[l];
        res = max(res, dfs(1, l, r - 1) + a[r]);
    }
    else {
        res = dfs(0, l + 1, r) - a[l];
        res = min(res, dfs(0, l, r - 1) - a[r]);
    }
    return dp[p][l][r] = res;
}

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << dfs(0, 0, N - 1) << endl;

    return 0;
}
/*



*/



Measured memory_bytes: 143872
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll INF=1e6;
const int Nmax=2e5+1;
const int Nd=61;



int main(){
  int n ;cin>>n;
  vector<ll> l(n);
  rep(i,n){
    cin>>l[i];
  }
  sort(l.begin(),l.end());
  int ans=0;

  rep(i,n){
    for(int j=i+1;j<n;j++){
      if(l[i]==l[j]){
        continue;
      }
      for(int k=j+1;k<n;k++){
        if(l[j]!=l[k] && l[i]+l[j]>l[k]){
          ans++;
        }
      }
    }
  }
cout<<ans;



}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{
	cin>>a;
	for(register int i=0;i<=a.length()-1;i++)
	if(a[i]=='9')
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

bool dp[80][80][6400];

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A, B;
    for (int i = 0; i < H; i++) {
        vector<int> l;
        for (int j = 0; j < W; j++) {
            int x;
            cin >> x;
            l.push_back(x);
        }
        A.push_back(l);
    }
    for (int i = 0; i < H; i++) {
        vector<int> l;
        for (int j = 0; j < W; j++) {
            int x;
            cin >> x;
            l.push_back(x);
        }
        B.push_back(l);
    }

    //memset(dp, 0, sizeof dp);
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) for (int k = 0; k < 6400; k++)
        dp[i][j][k] = false;


    dp[0][0][abs(A[0][0] - B[0][0])] = true;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i == 0 && j == 0)
                continue;
            int d = abs(A[i][j] - B[i][j]);
            if (i-1 >= 0) {
                for (int k = 0; k < 6400; k++) {
                    if (dp[i-1][j][k]) {
                        int k1 = abs(k+d);
                        int k2 = abs(k-d);
                        if (k1 < 6400)
                            dp[i][j][k1] = true;
                        if (k2 < 6400)
                            dp[i][j][k2] = true;
                    }
                }
            }
            if (j-1 >= 0) {
                for (int k = 0; k < 6400; k++) {
                    if (dp[i][j-1][k]) {
                        int k1 = abs(k+d);
                        int k2 = abs(k-d);
                        if (k1 < 6400)
                            dp[i][j][k1] = true;
                        if (k2 < 6400)
                            dp[i][j][k2] = true;
                    }
                }
            }
        }
    }

    for (int k = 0; k < 6400; k++) {
        if (dp[H-1][W-1][k] == true) {
            cout << k << endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 40320
#define _USE_MATH_DEFINES

#pragma GCC optimize("Ofast,no-stack-protector") 
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") 
#pragma GCC optimize("unroll-loops") 
#pragma GCC optimize("fast-math")
 
#include <bits/stdc++.h> 
  
using namespace std;
  
#define $(x) (int)	((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second    
// #define int long long
#define double long double       
  
#ifdef LOCAL
    #define dbg(x) cerr << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
    cout.setf(ios::fixed); cout.precision(9);    
    solve();               	
    return 0;
} 

const int MOD = 998244353, MAXN = 100 + 10, INF = 1e9 + 10;
 
void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    map<int, int> mp1, mp2;
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) {
            mp1[a[i]] = n / 2;
        }
        else {
            mp2[a[i]] = n / 2;
        }
    }
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) {
            mp1[a[i]]--;
        }
        else {
            mp2[a[i]]--;
        }
    }

    vector<pair<int, int>> v1, v2;
    while (!mp1.empty()) {
        auto it = *mp1.begin();
        mp1.erase(mp1.begin());
        v1.push_back({it.y, it.x});
    }
    while (!mp2.empty()) {
        auto it = *mp2.begin();
        mp2.erase(mp2.begin());
        v2.push_back({it.y, it.x});
    }
    sort(all(v1));
    sort(all(v2));

    if ($(v1) == 1 && $(v2) == 1) {
        if (v1[0].y == v2[0].y) {
            cout << n / 2 << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else if ($(v1) == 1 && $(v2) != 1) {
        if (v1[0].y != v2[0].y) {
            cout << v1[0].x + v2[0].x << endl;
        }
        else {
            cout << min(v1[0].x + v2[1].x, n / 2 + v2[0].x) << endl;
        }
    }
    else if ($(v1) != 1 && $(v2) == 1) {
        if (v1[0].y != v2[0].y) {
            cout << v2[0].x + v1[0].x << endl;
        }
        else {
            cout << min(n / 2 + v1[0].x, v1[1].x + v2[0].x) << endl;
        }
    }
    else {
        if (v1[0].y != v2[0].y) {
            cout << v1[0].x + v2[0].x << endl;
        }
        else {
            cout << min(v1[0].x + v2[1].x, v1[1].x + v2[0].x) << endl;
        }
    }
}

Measured memory_bytes: 6524
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    if (N == 1 && M == 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> digit(N, -1);
    for (int i = 0; i < M; i++) {
        int s, c;
        cin >> s >> c;
        if (digit[s - 1] != -1 && digit[s - 1] != c) {
            cout << -1 << endl;
            return 0;
        } else if (s == 1 && c == 0 && N != 1) {
            cout << -1 << endl;
            return 0;
        } else {
            digit[s - 1] = c;
        }
    }

    int output = 0;
    for (int i = 0; i < N; i++) {
        if (digit[i] == -1 && i == 0) {
            output += pow(10, N - i - 1);
        } else if (digit[i] != -1) {
            output += pow(10, N - i - 1) * digit[i];
        }
    }

    cout << output << endl;

    return 0;
}


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

int main(){
	string X;
	cin >> X;
	int s=0,erase=0;
	for(int i=0;i<X.size();i++){
		if(X[i]=='S')s++;
		else{
			if(s>0){
				erase+=2;
				s--;
			}
		}
	}
	cout << X.size()-erase << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
//defines
typedef long long ll;

    
ll solve(ll t)
{/*hon when the digit in the one's place of 
N
 is 
2
, 
4
, 
5
, 
7
, or 
9
;
pon when the digit in the one's place of 
N
 is 
0
, 
1
, 
6
 or 
8
;
bon when the digit in the one's place of 
N
 is 
3
.*/
    string s;cin>>s;
    ll n=s.size()-1;
    if(s[n]=='0' or s[n]=='1' or s[n]=='6' or s[n]=='8')cout<<"pon";
    else if(s[n]=='3')cout<<"bon";
    else cout<<"hon";
 if(t>0)cout<<"\n";
return 0;
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
   // cin>>t;
    while(t--)
    {
        solve(t);
    }
    
        
    return 0;
}

Measured memory_bytes: 3652
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0]);

  console.log(N + N*N + N*N*N);

}
// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29552
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;

#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)

long long t, n, m, u, v, q, k, s;
const int N = 2e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;

long long arr[N];
string str, ss;
long long a[N], b[N];
multiset <int> aa, bb;
map <int, int> M;
vector <int> adj[N];
bool vis[N];
void dfs(int i) {
   if (vis[i]) return;
   vis[i] = true;
   for (int u : adj[i])
   dfs(u);
}
int main() {
   csl;
   cin >> n;
   int x = 0;
   for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      x ^= a[i];
      M[a[i]];
      aa.insert(a[i]);
   }
   a[0] = x;
   M[x];
   aa.insert(x);
   x = 0;
   for (int i = 1; i <= n; ++i) {
      cin >> b[i];
      x ^= b[i];
      M[b[i]];
      bb.insert(b[i]);
   }
   b[0] = x;
   M[x];
   bb.insert(x);
   if (aa != bb) {
      cout << -1 << '\n';
      return 0;
   }
   int h = 0;
   for (auto &u : M) {
      u.second = ++h;
   }
   int e = 0;
   for (int i = 0; i <= n; ++i) {
      a[i] = M[a[i]];
      b[i] = M[b[i]];
      //cout << a[i] << " " << b[i] << endl;
      if (a[i] != b[i]) {
         adj[a[i]].push_back(b[i]);
         adj[b[i]].push_back(a[i]);
         ++e;
      }
   }
   if (e == 0) {
      cout << 0 << '\n';
      return 0;
   }
   int c = 0;
   for (int i = 1; i <= h; ++i) {
      if (vis[i] || adj[i].size() == 0) continue;
      ++c;
      dfs(i);
   }
   int ans = e - c;
   //cout << e << " " << c << endl;
   if (adj[a[0]].size() != 0) {
      ans += 2 * (c - 1);
      if (a[0] == b[0]) ++ans;
   }
   else {
      ans += 2 * c;
   }
   cout << ans << endl;
   return 0;
}




























Measured memory_bytes: 28672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  string s;
  cin >> s;
  if (s == "AAA" || s == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;



template<typename T>
class Wgraph{
public:
    //隣接行列の入力を受ける
    Wgraph(int _n){
        n = _n;
        mat.resize(n, vector<int>(n));
        colors.resize(n);
        min_weis.resize(n);
        parents.resize(n);
        REP(i,n){
            REP(j,n){
                scanf("%d", &mat[i][j]);
                if(mat[i][j]==-1){
                    mat[i][j] = inf;
                }
            }
        }

    }

    long long int prim(){
        REP(i,n){
            colors[i] = 0;
            parents[i] = -1;
            min_weis[i] = inf;
        }
        int u,mincost;
        min_weis[0] = 0;
    

        while(1){
            mincost = inf;
            u = -1;
            REP(i,n){
                if(colors[i]!=2&&min_weis[i]<mincost){
                    mincost = min_weis[i];
                    u = i;
                }
            }

            if(u==-1){
                break;
            }

            colors[u] = 2;
            REP(i,n){
                if(colors[i]!=2){
                    if(mat[u][i]<min_weis[i]){
                        min_weis[i] = mat[u][i];
                        parents[i] = u;
                        colors[i] = 1;
                    }
                }
            }
        }
        int sum = 0;
        REP(i,n){
            if(parents[i]!=-1){
                sum += mat[i][parents[i]];
            }
        }
        return sum;
    }

private:
    vector<vector<int>> mat;
    int n;

    vector<int> colors,min_weis, parents;
};


int main(){

    int n;
    cin>>n;
    unique_ptr<Wgraph<int>> wg(new Wgraph<int>(n));

    cout << wg->prim() << endl;
    return 0;
}



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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  int g[101][101], h[101][101];
  fill(g[0], g[101], inf);
  fill(h[0], h[101], inf);
  rep(i, 101) g[i][i] = h[i][i] = 0;
  rep(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    g[a][b] = g[b][a] = h[a][b] = h[b][a] = c;
  }
  rep(i, n) rep(j, n) rep(k, n) {
    g[j][k] = min(g[j][k], g[j][i] + g[i][k]);
  }
  int ans = 0;
  rep(i, n) reps(j, i+1, n) {
    if(h[i][j] == inf) continue;
    if(g[i][j] != h[i][j]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int a[101];
	int total = 0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		total += a[i];
	}
	//cout << total << endl;
	int b = 0;
	sort(a, a+n);
	for(int i=n-2;i>=0;i=i-2){
		b += a[i];
	}
	int alice = total-b;
	cout << alice-b << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・大きいKから見る
・a_N <= S//K：全て取り切れて、S//Kが解
・a_N > S/K：a_Nは常に選ぶとしてよい。K-1枚でa_{N-1}までのゲームに帰着
"""

from collections import Counter

N,*A = map(int,read().split())

counter = Counter(A)
C = list(counter.values())
C.sort()
S = sum(C)

answer = []
removed = 0
for K in range(1,N+1):
    rest = K - removed
    while C and C[-1] > S//rest:
        S -= C[-1]
        C.pop()
        removed += 1
        rest -= 1
    answer.append(S//rest)

print('\n'.join(map(str,answer)))

Measured memory_bytes: 51500
#include <stdio.h>

int main(void){
    int N, T;
    scanf("%d %d", &N, &T);
    int t[N+1];
    for(int i=0; i<N; i++){
        scanf("%d", &t[i]);
    }
    //FR

    t[N] = t[N-1]+T;
    unsigned long long X=0;
    for(int i=0; i<N; i++){
        int dif = t[i+1] - t[i];
        if(T < dif){
            X += T;
        }
        else{
            X += dif;
        }
    }

    printf("%llu", X);
    return 0;
}

Measured memory_bytes: 896
str = gets.chomp
n = gets.to_i
n.times{
    order,a,b,rep = gets.chomp.split(" ")
    a = a.to_i
    b = b.to_i
    
    case order
    when "print"
        puts str[a..b]
    when "replace"
        str[a..b] = rep
    when "reverse"
         str[a..b]  = str[a..b].reverse
    end
}

Measured memory_bytes: 8724
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
// #include <priority_queue>
#include <algorithm>

using namespace std;

int main() {

	int n;
	cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	} else {
		int a,b;
		cin >> a >> b;
		cout << a+b << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int k,a,b;
int main(){
	scanf("%d%d%d",&k,&a,&b);
	  int num  =  a;
	  if(k==1){
	  	cout<<"OK"<<endl;
	  	return 0;
	  }else {
	  	 for(int i=num;i<=b;i++){
	  	 	if(i%k==0){
	  	 		cout<<"OK"<<endl;
	  			return 0;
			   }else{
			   	continue;
			   }
		   }
			cout<<"NG"<<endl;
	  		return 0;
		}
	  }

Measured memory_bytes: 3688
L, R = map(int, input().split())
mod = 10 ** 9 +7
l = '{:060b}'.format(L)
r = '{:060b}'.format(R)

memo = [[[[-1]*2 for i in range(2)] for j in range(2)] for k in range(60)]
def f(pos, flagL, flagR, flagM):
    if pos == 60:
        return 1
    if memo[pos][flagL][flagR][flagM] != -1:
        return memo[pos][flagL][flagR][flagM]
    ret = 0
    #(0, 0)
    if flagL or l[pos] == '0':
        ret+=f(pos+1, flagL, 1 if r[pos]=='1' else flagR, flagM)
    #(0, 1)
    if flagM and (flagL or l[pos]=='0') and (flagR or r[pos]=='1'):
        ret += f(pos+1, flagL, flagR, flagM)
    #(1, 1)
    if flagR or r[pos]=='1':
        ret += f(pos+1, 1 if l[pos]=='0' else flagL, flagR, 1)
    memo[pos][flagL][flagR][flagM] = ret%mod
    return ret%mod
print(f(0, 0, 0, 0)%mod)        

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    int l=0, r=0;
    int ans;
    for(int i = 1; i < n; i++){
        if(s[i] == 'E'){r++;}
    }
    ans = l + r;
    for(int i = 1; i < n; i++){
        if(s[i-1]=='W'){l++;}
        if(s[i]=='E'){r--;}
        ans = min(ans, l+r);
    }


    cout << ans << endl;



    return 0;

}


Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
int a[200010], b[200010];
int main()
{
	int n, m, x, y;
	
	scanf("%d%d", &n, &m);
	while (m--) {
		scanf("%d%d", &x, &y);
		if (x == 1) a[y] = 1;
		if (x == n) b[y] = 1;
		if (y == 1) a[x] = 1;
		if (y == n) b[x] = 1; 
	}
	int fg = 0;
	for (int i = 2; i < n; i++) {
		if (a[i] && b[i]) {
			fg = 1;
			break;
		}
	}
	puts(fg ? "POSSIBLE" : "IMPOSSIBLE");
}

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

int main(){
    long long N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    long long bottleneck = min({A, B, C, D, E});
    long long bottleneck_time = N / bottleneck + (N%bottleneck != 0);
    cout << bottleneck_time + 4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

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

Measured memory_bytes: 3624
a=[]
i=0
while input = gets
  a << input.split.map(&:to_i)
end
while i < a[0][0]
  i+=1
  a[i].sort!
  if a[i][0]**2 + a[i][1]**2 == a[i][2]**2
    puts "YES"
  else
    puts "NO"
  end
end


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 2 * 100005;

/* ...o(^-^)o... */

int main(){
    int n; lint d, a;
    cin >> n >> d >> a; d *= 2;
    vector<P> vp;
    rep(i, n){
        lint x, h; cin >> x >> h;
        x--; h = (h+a-1)/a;
        vp.push_back(P(x,h));
    }
    sort(all(vp));

    lint c[MAX];
    rep(i, n){
        if(i == 0){ c[i] = vp[i].se; continue; }
        auto itr = lower_bound(all(vp), P(vp[i].fi - d, 0));
        lint r;
        if(itr == vp.begin()){
            r = c[i-1];
        }
        else{
            itr--;
            r = c[i-1] - c[itr - vp.begin()];
        }
        c[i] = c[i-1] + max(vp[i].se - r, 0LL);
    }
    out(c[n-1]);
}

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

const int len = 2e3+5;
char str[len];
int arr[len][len], pref[3][len];
int tree[3][len][4*len];

void update(int t1, int t2, int p, int l, int r, int i, int v){
    //printf("l = %d, r = %d\n", l, r);
    if (l == r)
        tree[t1][t2][p] = v;
    //printf("heyeye\n");
    else{
        int mid = (l+r)/2;
        if (i <= mid) update(t1, t2, 2*p, l, mid, i, v);
        else update(t1, t2, 2*p+1, mid+1, r, i, v);
        tree[t1][t2][p] = tree[t1][t2][2*p]+tree[t1][t2][2*p+1];
    }
}

int query(int t1, int t2, int p, int l, int r, int i, int j){
    if (i <= l && r <= j)
        return tree[t1][t2][p];
    if (r < i || j < l)
        return 0;

    int mid = (l+r)/2;
    return query(t1, t2, 2*p, l, mid, i, j)+query(t1, t2, 2*p+1, mid+1, r, i, j);
}

int main(){
    int n, m, q;
    scanf("%d %d %d", &n, &m, &q);
    for (int i = 1; i <= n; i++){
        scanf("%s", &str);
        for (int j = 1; j <= m; j++)
            arr[i][j] = str[j-1]-'0';
    }

    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            //printf("number 0\n");
            pref[0][j] = pref[0][j-1];
            if (arr[i][j] == 1 && arr[i][j-1] == 0) pref[0][j]++;
            update(0, j, 1, 1, n, i, pref[0][j]);

            //printf("number 1\n");
            pref[1][j] = pref[1][j-1];
            if (arr[i][j] == 1 && arr[i][j+1] == 0) pref[1][j]++;
            update(1, j, 1, 1, n, i, pref[1][j]);

            //printf("number 2\n");
            if (i != 1){
                pref[2][j] = pref[2][j-1];
                if (arr[i][j] == 1 && arr[i-1][j] == 1) pref[2][j]++;
                update(2, j, 1, 1, n, i, pref[2][j]);
            }
        }
    }

    //printf("before queria\n");
    while (q--){
        int x1, y1, x2, y2;
        scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
        int ans = query(0, y2, 1, 1, n, x1, x2) - query(1, y1-1, 1, 1, n, x1, x2);
        //printf("first ans = %d\n", ans);
        if (x1 < x2)
            ans -= query(2, y2, 1, 1, n, x1+1, x2) - query(2, y1-1, 1, 1, n, x1+1, x2);

        printf("%d\n", ans);
    }
    return 0;
}


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

int main() {
  vector<char> vec(19);
  
  for (int i=0; i<19; i++){
    cin >> vec.at(i);
  }
  
  vec.at(5) = ' ';
  vec.at(13) = ' ';
  
  for (int i=0; i<19; i++){
    cout << vec.at(i);
  }
  
  cout << endl;
}

Measured memory_bytes: 256
main :: IO ()
main = do
  [a, b, c, d] <- getInts
  let areaA = a * b
  let areaB = c * d
  if areaA > areaB
    then print areaA
    else print areaB

getInts :: IO [Int]
getInts = map read . words <$> getLine
 


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int a = 0, z = 0;
  bool check = true;
  
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'A' && check == true) {
      a = i;
      check = false;
      continue;
    }
    if (s.at(i) == 'Z') {
      z = i;
    }
  }
  cout << z - a + 1 << endl;
    
}

Measured memory_bytes: 640
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
I=h*w
d=[I]*I
d[~w+a*w+b]=1
q=[(a-1,b-1)]
for s,t in q:
 p=d[s*w+t]+1
 for y,x in(1,0),(-1,0),(0,1),(0,-1):
  for z in range(k):
   i,j=s+y*~z,t+x*~z;l=i*w+j
   if(h>i>-1<j<w)-1or'.'<m[i][j]or d[l]<p:break
   if d[l]==I:q+=(i,j),;d[l]=p
print(d[~w+f*w+g]%I-1)

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	vector <int> dp, cnt;
	int n; ll k;
	cin >> s >> k; n = s.size();
	dp.resize(n); cnt.resize(n);
	for (int i=n-2; i>=0; i--) {
		cnt[i] = cnt[i+1];
		if (s[i] != s[i+1]) {
			cnt[i] ++;
		}
	}
	int tec = 0;
	for (int i=1; i<n-1; i++) {
		if (!cnt[i] || cnt[i] == cnt[0]) continue;
		dp[i] = dp[i-1];
		if (s[i] != s[i-1]) {
			dp[i] += tec>>1;
			tec = 1;
		} else {
			tec ++;
		}
		if (!cnt[i+1]) {
			dp[i] += tec>>1;
		}
	}
	ll ans;
	if (!cnt[0]) {
		ans = k*n>>1;
		cout << ans;
		return 0;
	}
	int first = 1;
	for (int i=1; i<n; i++) {
		if (s[i] != s[i-1]) {
			break;
		}
		first ++;
	}
	int last = 1;
	for (int i=n-2; i>=0; i--) {
		if (s[i] != s[i+1]) {
			break;
		}
		last ++;
	}
	ans = k*(*max_element(dp.begin(), dp.end())) + (first>>1) + (last>>1);
	if (s[0] == s.back()) {
		ans += ((last+first)>>1)*(k-1);
	} else {
		ans += ((last>>1)+(first>>1))*(k-1);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256