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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    int a, b; cin >> a >> b;
    int ans = a*b;
    print(ans);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3616
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val a = sc.intList()

        var cnt = 0
        var flag = Array(8) { false }

        var f = true
        for (i in 0 until n) {
            if (a[i] < 3200) {
                f = false
                flag[a[i] / 400] = true
            } else {
                cnt++
            }
        }

        if (f) {
            println("1 $n")
        } else {
            val c = flag.count { it }
            val min = c
            val max = c + cnt
            println("$min $max")
        }
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 38248
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int N=3005,Mod=1e9+7;
int dp[N],n,A,B,C,D;
int fac[N],inv[N];
inline int mo(int x){return x<Mod?x:x-Mod;}
inline int qpow(int a,int b){
	int ans=1;
	while (b){
		if (b&1) ans=1ll*ans*a%Mod;
		a=1ll*a*a%Mod,b>>=1;
	}
	return ans;
}
inline void init_binom(){
	fac[0]=1;for (int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%Mod;
	inv[n]=qpow(fac[n],Mod-2);
	for (int i=n-1;i>=0;i--) inv[i]=1ll*inv[i+1]*(i+1)%Mod;
}
inline int Binom(int n,int m){
	return 1ll*fac[n]*inv[m]%Mod*inv[n-m]%Mod;
}
int main (){
	scanf ("%d%d%d%d%d",&n,&A,&B,&C,&D);
	init_binom();
	dp[0]=1;
	for (int i=A;i<=B;i++)
		for (int j=n;j>=0;j--)
			for (int k=C;k<=D&&j+k*i<=n;k++)
				dp[j+k*i]=mo(dp[j+k*i]+
					1ll*dp[j]*Binom(n-j,k*i)%Mod*fac[k*i]%Mod*qpow(inv[i],k)%Mod*inv[k]%Mod
				);
	printf ("%d",dp[n]);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

int N;
char ch[512][512];
bool hb = false, hw = false;
int cr[512];
int cc[513];

int main() {
    scanf("%d\n", &N);
    for (int i = 0; i < N; ++i)
        scanf("%s\n", ch[i]);
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j) {
            if (ch[i][j] == '.')
                hw = true;
            else {
                hb = true;
                cr[i] ++;
                cc[j] ++;
            }
        }
    if (!hb) {
        printf("-1\n");
        return 0;
    }
    if (!hw) {
        printf("0\n");
        return 0;
    }
    int count = 0;
    for (int i = 0; i < N; ++i) {
        if (cc[i] == N)
            count ++;
    }
    int mx = 0;
    for (int i = 0; i < N; ++i)
        if (cc[i] > 0) {
            if (cr[i] > mx)
                mx = cr[i];
        } else {
            if (cr[i] - 1 > mx)
                mx = cr[i] - 1;
        }
    printf("%d\n", N - mx + N - count);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;
const int mod=1000000007;

int main() {
  int n;
  cin>>n;
  int cnt=0;
  rep(i,n) {
    int p;
    cin>>p;
    if (p!=i+1) cnt++;
  }
  if (cnt<=2) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C>
 */

func init() {
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var B [4][3][10]int
	for i := 0; i < n; i++ {
		var b, f, r, v int
		fmt.Scanf("%d%d%d%d", &b, &f, &r, &v)
		b--; f--; r--
		B[b][f][r] += v
	}

	for i:= 0; i < 4;i++{
		for j:=0;j<3;j++{
			for k:=0;k < 10;k++{
				fmt.Printf(" %d",B[i][j][k])
			}
			fmt.Print("\n")
		}
		if i != 3{
			fmt.Println("####################")
		}
	}
}

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

int main() {
  char b; cin >> b;
  if(b=='A') cout << 'T' << endl; 
  if(b=='T') cout << 'A' << endl;
  if(b=='C') cout << 'G' << endl;
  if(b=='G') cout << 'C' << endl; 
}

Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define INF (1LL<<60)

#define VMAX 100100

//C++14 (GCC 5.4.1)
int main() {
    long long N,W;
    cin >>N >>W;
    //D問題とほぼ同じだがWが大きくなる場合の計算量を抑える

    vector<long long> w(N),v(N);
    rep(i,N) cin >> w.at(i) >>v.at(i);
    
    //-----------------------------------
    int Ans=0;
    vector<vector<long long>> dp(N+1,vector<long long>(VMAX+1,INF));
    //初期条件
    dp.at(0).at(0)=0;

    //i番目までの品物から価値がsumv以上になるように選んだときの重さの総和の最小値
    rep(i,N){
        rep(sumv,VMAX){//こっちには+1が必要（先を見たループじゃないので）
            if(sumv >= v.at(i)){//i番目の商品を選ぶ場合
                chmin(dp.at(i+1).at(sumv),dp.at(i).at(sumv-v.at(i))+w.at(i));
            }
            //選ばない場合
            chmin(dp.at(i+1).at(sumv),dp.at(i).at(sumv));
        }
    }

    long long res=0;
    rep(sumv,VMAX){
        if(dp.at(N).at(sumv)<=W){
            res=sumv;
        }
    }
    cout << res<< endl;
}

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

data = []
for i in range(n):
    s, p = input().split()
    data.append([s, -1 * int(p), i + 1])



data.sort(key = lambda x: x[1])
data.sort(key = lambda x: x[0])

for i in data:
    print(i[2])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define M 2005
struct edge{
    int t,nxt;
}e[M*2];
int head[M],tot;
void add(int st,int t) {
    e[++tot].nxt=head[st],e[tot].t=t,head[st]=tot;
}
int n,ans=1e9;
char s[M];
int dis[M],dis2[M],sz[M];
void dfs(int x,int fa) {
    sz[x]=(s[x]=='1');
    int d1,d2=-1;
    for(int i=head[x];i;i=e[i].nxt)
	{
	    int to=e[i].t;
	    if(to==fa) continue ;
	    dfs(to,x);
	    dis[x]+=dis[to]+sz[to];
	    sz[x]+=sz[to];
	    dis2[x]+=dis2[to]+sz[to];
	    if(d2<dis2[to]+sz[to]) d1=dis[to]+sz[to],d2=dis2[to]+sz[to];
	}
    if(d2!=-1)
	{
	    if(d2<=dis2[x]-d2)
		{
		    if(dis2[x]&1) dis2[x]=1;
		    else dis2[x]=0;
		}
	    else
		{
		    int res=2*d2-dis2[x],res2=(dis[x]-d1)-(dis2[x]-d2);
		    if(res&1)
			{
			    if(res-1<=res2) dis2[x]=1;
			    else dis2[x]=res-res2;
			}
		    else
			{
			    if(res<=res2) dis2[x]=0;
			    else dis2[x]=res-res2;
			}
		}
	}
}
void work() {
    for(int i=1;i<=n;i++)
	{
	    memset(dis,0,sizeof(dis));
	    memset(dis2,0,sizeof(dis2));
	    memset(sz,0,sizeof(sz));
	    dfs(i,0);
	    if(dis2[i]) continue ;
	    ans=min(ans,dis[i]/2);
	}
    if(ans==1e9) cout<<-1<<'\n';
    else cout<<ans<<'\n';
}
int main()
{
    cin>>n;
    scanf("%s",s+1);
    for(int i=1,x,y;i<n;i++)
	{
	    cin>>x>>y;
	    add(x,y),add(y,x);
	}
    work();
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string s,t;
    cin>>s>>t;
    if(s.size()+1==t.size()&&s==t.substr(0,s.size())) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3628
a,b,c,d = map(int,input().split())
li = [1]*100
for i in range(a):
    li[i] = 0
for i in range(100-b):
    li[i+b] = 0
for i in range(c):
    li[i] = 0
for i in range(100-d):
    li[i+d] = 0
print(li.count(1))

Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
const int size=1005;
const int inf=1e9;
int visited[size];
vector <int> g[size];
vector <vector<int> > ans;
int par[size];
void check_cycle(int u,int v)
{
    vector <int> tmp;
    while(u!=-1 && u!=v)
    {
        tmp.push_back(u);
        u = par[u];
    }
    tmp.push_back(v);
    ans.push_back(tmp);
}
void dfs(int src)
{
    visited[src] = 1;
    for(auto v:g[src])
    {
//        cout<<src<<" "<<v<<endl;
        if(visited[v]==2)
            continue;
        else if(visited[v]==1)
        {
            check_cycle(src,v);
        }
        else
        {
            par[v] = src;
            dfs(v);
        }
    }
    visited[src]=2;
}
bool check(const vector <int> arr)
{
    set <int> s(arr.begin(),arr.end());
    for(auto u:arr)
    {
        int cnt = 0;
        for(auto v:g[u])
            if(s.count(v))
            cnt++;
        if(cnt>1) return 0;
    }
    return 1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    for(int i=0,u,v;i<m;i++)
        cin>>u>>v,g[u].push_back(v);
    for(int i=1;i<=n;i++)
    {
        if(!visited[i])
        {
//            memset(visited,0,sizeof visited);
            memset(par,-1,sizeof par);
            dfs(i);
        }
    }
    if((int)ans.size()==0)
        return cout<<"-1\n",0;
    int mn = 0;
    for(int i=0;i<ans.size();i++)
    {
        if(check(ans[i]))
        {
            mn = i;
            break;
        }
    }
    cout<<(int)ans[mn].size()<<"\n";
    for(auto i:ans[mn])
        cout<<i<<"\n";
    return 0;
}


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

using namespace std;

int N, X;
int length[104];
int posAfterI[104]; // i번째 bounce를 한 직 후 위치

int main()
{
	scanf("%d %d", &N, &X);

	for (int i = 1; i <= N; i++)
	{
		scanf("%d", &length[i]);
	}

	posAfterI[0] = 0;
	posAfterI[1] = 0;

	for (int i = 2; i <= N + 1; i++)
	{
		posAfterI[i] = posAfterI[i - 1] + length[i - 1];
	}

	for (int i = 2; i <= N + 1; i++)
	{
		if (X >= posAfterI[i - 1] && X < posAfterI[i])
		{
			printf("%d", i - 1);
			return 0;
		}
	}

	printf("%d", N + 1);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 5010;
const int MOD = 1e9 + 7;

int n;
int dp[N][N];
pii hp[N];

bool comp(pii a, pii b)
{
    return min(a.first, b.first - a.second) > min(b.first, a.first - b.second);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> hp[i].first >> hp[i].second;
    sort(hp, hp + n, comp);
    for (int i = 0; i < n; i++) dp[i][1] = hp[i].second;
    int ans = 1;
    for (int j = 2; j <= n; j++)
    {
        int mn = 2e9 + 7;
        for (int i = 0; i < n; i++)
        {
            if (mn <= hp[i].first)
            {
                dp[i][j] = mn + hp[i].second;
                ans = max(ans, j);
            }
            else
            {
                dp[i][j] = 2e9 + 7;
            }
            mn = min(mn, dp[i][j - 1]);
        }
    }
    cout << ans;
}


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

#define input(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;cin>>s;
    if(s.size()==1){
        cout<<"Yes\n";
        return 0;
    }
    string a=s.substr(0,(s.size()-1)/2);
    string b=s.substr(s.size()/2+1,(s.size()-1)/2);
    string c=b;
    reverse(c.begin(),c.end());

    if(a==b&&a==c){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
 
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
 
using namespace std;
 
int main(void) {
	double r, g;
 
	cin >> r >> g;
 
 
	cout << 2 * g - r << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
L1 = [input() for x in range(N)]
L2 = [input() for x in range(M)]
LL = []
for i in range(N-M+1):
    for j in range(N-M+1):
        a = []
        for y in range(M):
            a += [L1[j+y][i:i+M]]
            pass
        LL += [a]
print('Yes' if sum(1 for x in LL if x == L2)>0 else 'No')

Measured memory_bytes: 4468
a_hp,a_power,b_hp,b_power = map(int, input().split())

while a_hp>0 or b_hp>0:
  b_hp = b_hp - a_power
  if b_hp <=0:
    break
  a_hp = a_hp - b_power
  if a_hp <=0:
    break

if a_hp >= b_hp:  
  print('Yes')
else: 
  print('No')

Measured memory_bytes: 8972
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
#include<functional>

using namespace std;

struct edge{
	int t,d,c;
};
typedef long long ll;
typedef pair<ll,int> P;
typedef pair<ll,P> PP;
int n,m;
ll INF=1000000007;
ll d[20001];
vector<edge> G[20001];

void dijk(){
	for(int i=0;i<n;i++)d[i]=INF;
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,0));
	d[0]=0;
	while(que.size()){
		P p=que.top();
		que.pop();
		ll c=p.first;
		int v=p.second;
		if(c>d[v])continue;
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if((ll)c+e.d<d[e.t]){
				d[e.t]=c+e.d;
				que.push(P(c+e.d,e.t));
			}
		}
	}
}

int use[10001];
ll check(){
	priority_queue<P,vector<P>,greater<P> > que;
	for(int i=0;i<n;i++)use[i]=INF,que.push(P(d[i],i));
	while(que.size()){
		P p=que.top();
		que.pop();
		int v=p.second;
		int c=p.first;
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if(c+e.d==d[e.t])use[e.t]=min(use[e.t],e.c);
		}
	}
	int res=0;
	for(int i=1;i<n;i++)res+=use[i];
	return res;
}

int main(void){
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;
		for(int i=0;i<m;i++){
			int f,t;
			edge e;
			scanf("%d%d%d%d",&f,&t,&e.d,&e.c);
			f--,t--;
			e.t=t;
			G[f].push_back(e);
			e.t=f;
			G[t].push_back(e);
		}
		dijk();
		//for(int i=0;i<n;i++)printf("%d%c",d[i],i==n-1?'\n':' ');
		printf("%lld\n",check());
		for(int i=0;i<=n;i++){
			G[i].clear();
		}
	}
	return 0;
}

Measured memory_bytes: 3596
import sys
sys.setrecursionlimit(10070)
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
MOD = 10**9 + 7

def f(s,r):
    sz = len(s)
    n = int(s[0])
    if sz==1:
        sum = 0
        for i in range(n+1):
          if (r-i)%d == 0:
            sum += 1
        return sum
    sum = f(s[1:], (r-n)%d)
    for i in range(n):
        sum += dp[sz-1][(r-i)%d]
        if sum >= MOD:
            sum -= MOD
    return sum

k = input()
d = inn()
e = len(k)
dp = [ [0 for i in range(d)] for j in range(max(2,e)) ]
for i in range(10):
    dp[1][i%d] += 1
for i in range(2,e):
  for j in range(d):
    for m in range(10):
        dp[i][j] += dp[i-1][(j-m)%d]
        if dp[i][j] >= MOD:
            dp[i][j] -= MOD
print((f(k,0)-1)%MOD)


Measured memory_bytes: 249224
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7; //99844353;
const int N = 1e5;
int n, k, s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k >> s;
  int t = s==IINF ? 1 : IINF;
  FOR(i, 0, n) cout << ((i<k) ? s : t) << " "; cout << endl;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+1e4;
int n,E,T,l,r,Temp[N]; ll ans=1e16,a[N],f[N];
int rd(){
	int s=0,ff=1;
	char w=getchar();
	while(!isdigit(w))
		ff^=w=='-',w=getchar();
	while(isdigit(w))
		s=s*10+w-'0',w=getchar();
	return ff?s:-s;
}
int main(){
	n=rd(),E=rd(),T=rd(); l=1,r=0;
	for(int i=1;i<=n;i++) a[i]=rd(),f[i]=1e16;
	Temp[++r]=0;
	for(int i=1;i<=n;i++){
		while(2*a[i]-2*a[Temp[l]+1]>=T&&l<=r)
			ans=min(ans,f[Temp[l]]-2*a[Temp[l]+1]-a[Temp[l]]),l++;
		f[i]=min(f[i],3LL*a[i]+ans);
		if(l<=r) f[i]=min(f[i],f[Temp[l]]+T+a[i]-a[Temp[l]]);
		while(f[i]-a[i]<f[Temp[r]]-a[Temp[r]]&&l<=r) r--; Temp[++r]=i;
	}
	printf("%lld\n",f[n]+E-a[n]);
	return 0;
}

Measured memory_bytes: 2176
import java.io.PrintWriter
import kotlin.math.pow

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun Int.pow(n: Int) = pow(n.toLong())
fun Int.pow(n: Long) = toDouble().pow(n.toDouble()).toLong()
fun Long.pow(n: Int) = pow(n.toLong())
fun Long.pow(n: Long) = toDouble().pow(n.toDouble()).toLong()

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val A = nextIntList()
    val odd = A.count { it and 1 == 1 }
    println(if (odd and 1 == 0) "YES" else "NO")
}

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

typedef long long int lli;

lli solve(lli a,lli b,lli sum){
  if(a == 0 || b == 0) return sum-max(a,b);
  if(a > b){
    return solve(a%b,b,sum+2*b*(a/b));
  }else{
    return solve(a,b%a,sum+2*a*(b/a));
  }
}

int main(){
  lli N,X;
  cin>>N>>X;
  cout<<N + solve(X,N-X,0)<<endl;
  return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
int n,m,i,j,f[505],s[505],c[505],ti;
int main()
{
	cin>>n;n--;
	for (i=1;i<=n;i++)
	{
		cin>>c[i]>>s[i]>>f[i];
	}
	for (i=1;i<=n+1;i++)
	{
		ti=0;
		for (j=i;j<=n;j++)
		{
			ti=max(ti,s[j]);
			while (ti%f[j]!=0)
			{
				ti++;
			}
			ti+=c[j];
		}
		cout<<ti<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
using namespace std;
 
//typedef pair<int,int> P;
typedef map<int,int>P;
int n,m;
map<int,P>g;
int a,b,c;
int d[500];
 
int rec(int v){
  if(d[v]>=0)return d[v];
 
  int res = 0;
	P::iterator it=g[v].begin();
	for(;it!=g[v].end();it++){
    res = std::max(res,it->second + rec(it->first));
  }
  return d[v] = res;
}
 
int main(){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> a >> b >> c;
    g[b][a]=c;
  }
 
  for(int i=0;i<n;i++)d[i]=-1; d[0] = 0;
  cout << rec(n-1) << endl;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
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();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.141592653589793238462643383279;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    ll N,K; cin >> N >> K;

    ll ans = 0;
    for(ll i=K; i<=N+1; i++){
        ll mn = i*(i-1)/2;
        ll mx = N*(N+1)/2 - (N-i)*(N-i+1)/2;
        ans += mx-mn+1;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  bool ok = true;
  rep(i, n) {
    if(n % 2 && a[i] != (i + 1) / 2 * 2)
      ok = false;
    else if(n % 2 == 0 && a[i] != i / 2 * 2 + 1)
      ok = false;
  }
  if(ok) {
    ll mod = 1000000007;
    ll ans = 1;
    rep(i, n / 2) {
      ans *= 2;
      ans %= mod;
    }
    cout << ans << endl;
  } else
    cout << 0 << endl;
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i < (n); i++)
#define CIN(A) int A; cin >> A;
#define CIN2(A, B) int A, B; cin >> A >> B;
#define CIN3(A, B, C) int A, B, C; cin >> A >> B >> C;
#define CINV(A, N) vector<int> L; REP(i, N) { int a; cin >> a; A.emplace_back(a); }
#define ANS(ans) cout << (ans) << endl

int
main()
{
  CIN(N);
  CINV(L, N);

  sort(L.begin(), L.end());
  int length = 0;
  REP(i, L.size() - 1) length += L.at(i);
  if (length <= L.at(N - 1))
    ANS("No");
  else
    ANS("Yes");

  return 0;
}


Measured memory_bytes: 256
import itertools
s=input()
t=len(s)
seq=[0,1]
l=itertools.product(seq,repeat=t-1)
m=[]
for i in l:
  tmp=""
  for j in range(t-1):
    tmp+=s[j]+"+"*i[j]
  tmp+=s[-1]
  m.append(tmp)

ans=0  
for j in m:
  ans+=eval(j)
  
print(ans)

Measured memory_bytes: 3064
while 1:
    n=input()
    if(n==0):break
    a=[]
    for i in range(n):
        a.append(input())
    s=[0]
    for i in range(n):
        s.append(s[-1]+a[i])
    ans=-100001
    for i in range(n):
        for j in range(i+1,n+1):
            ans=max(ans,s[j]-s[i])
    print ans

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

#define y1 as214
#define ii pair < int , int >
#define iii pair < int , ii >
#define iv pair < ii , ii >

#define fi first
#define se second
#define fr front()
#define pb push_back
#define t top()

#define FOR(i , x , n) for(int i = x ; i <= n ; ++i)
#define REP(i , n) for(int i = 0 ; i < n ; ++i)
#define FORD(i , x , n) for(int i = x ; i >= n ; --i)

#define ll long long
#define oo 1e17
#define int long long

const int N = 1e5 + 5;
int n;
int a[N] , dp[N];
/// dp[i] là cái giá nhỏ nhất để tới được cục đá thứ i.

main()
{
   // freopen("A.inp","r",stdin);
    cin >> n;
    FOR(i , 1 , n)
        cin >> a[i];
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    FOR(i , 3 , n)
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]) , dp[i - 2] + abs(a[i] - a[i - 2]));
    cout << dp[n];
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int n, a, b;
string s;

int main()
{
	cin >> n >> a >> b;
	cout << min(b, n * a) << endl;

	return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int a,b;
  cin >> a >> b;
  if(a==1){
    if(b==1){
      cout << "Draw" << endl;
    }else{
      cout << "Alice" << endl;
    }
  }else if(a>b&&b!=1){
    cout << "Alice" << endl;
  }else if(b>a||b==1){
    cout << "Bob" << endl;
  }else{
    cout << "Draw" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
class P{
    static void Main(){
        var s=Console.ReadLine().Split().Select(int.Parse).ToArray();
        int c=0;
        for(int i=0;i<s[0];i++){
            var x=Console.ReadLine().Split().Select(int.Parse).ToArray();
            if(x[0]>=s[1]&&x[1]>=s[2])c++;
        }
        Console.WriteLine(c);
    }
}

Measured memory_bytes: 13396
n,d,a = gets.split.map(&:to_i)
monsters = n.times.map{ gets.split.map(&:to_i) } 

monsters.map!{ |x,h| h = (h+a-1)/a; [x,h] }.sort_by!{ |x,h| x }

deq = []
acc_damage = 0
ans = 0
monsters.each do |x,h|
  
  while deq.size > 0 && deq[0][0] < x do
    acc_damage -= deq[0][1]
    deq.shift
  end
  
  need = h - acc_damage
  need = 0 if need < 0
  
  if need > 0
    acc_damage += need
    ans += need
    deq.push( [x + d*2, need] )
  end
end

puts ans

Measured memory_bytes: 25848
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()
co = 0
for i in range((n-1)//2):
    co += 1
print(co)







Measured memory_bytes: 40044
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

S =  sys.stdin.readline().rstrip()
T =  sys.stdin.readline().rstrip()

cnt = 0

if S[0] == T[0]:
    cnt += 1
if S[1] == T[1]:
    cnt += 1
if S[2] == T[2]:
    cnt += 1

print(cnt)

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

int main(){
  long long N,sum; cin >> N;
  sum=0;
  vector<long long> vec(N+1);
  vector<long long> vek(N);
  
  for(long long i=0;i<N+1;i++){
    cin >> vec.at(i);//kijyuu
  }
  for(long long i=0;i<N;i++){
    cin >> vek.at(i);//yuusya
  }
  for(long long i=0;i<N;i++){
    if(vek.at(i)-vec.at(i)>=0){
      if(vec.at(i+1)-vek.at(i)+vec.at(i)>=0){
        vec.at(i+1)=vec.at(i+1)-vek.at(i)+vec.at(i);
        sum=sum+vek.at(i);
      }
      else{
        sum=sum+vec.at(i)+vec.at(i+1);
        vec.at(i+1)=0;
      }
    }
    else{
      sum=sum+vek.at(i);
    }
  }
  
  cout << sum << endl;
}
      
      


Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll inf = 1e5;
ll w[105], v[105];
ll dp[105][100005];
int main(){
	int a, b;
	cin >> a >> b;
	if ((a == 1 && b == 2)|| (a == 2 && b == 1)){
		cout<<"3"<<endl;
			return 0;
	}
	else if((a == 2 && b == 3) || (a == 3 && b == 2)){
		cout << "1" << endl;
		return 0;
	}
	else {
		cout << "2" << endl;
		return 0;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;

const lint mod = 1e9 + 7;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    
    if(s[0] == '0' || s[n-1] == '1'){
        printf("-1\n");
        return 0;
    }
    
    vector<pii> ans;
    int t = n-1;
    rrep(i, n-1){
        if(s[i] != s[n-2-i]){
            printf("-1\n");
            return 0;
        }
        
        ans.push_back(pii(t+1, i+1));
        if(s[i] == '1') t = i;
    }
    
    for(pii p: ans) printf("%d %d\n", p.fi, p.se);
}

Measured memory_bytes: 2420
package main

import "fmt"

func main() {
	var n int
	var input string
	fmt.Scanf("%d", &n)
	fmt.Scanf("%s", &input)

	if input[0:n/2] == input[n/2:n] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 512
//おまじない
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn=100000;

ll n;
priority_queue<ll> l,r;
vector<ll>rarr,larr;
ll lsum=0,rsum=0;
ll num[3*maxn];
ll ans;

int main(){
    
    cin >> n;
    rep(i,3*n){
        cin >> num[i];
    }
    
    rep(i,2*n){
        if(l.size()<n){
            l.push(-num[i]);
            lsum-=num[i];
        }else{
            if(-num[i]<l.top()){
                lsum = lsum - l.top()-num[i];
                l.pop();
                l.push(-num[i]);
            }
        }
        if(l.size()==n)larr.push_back(-lsum);
    }
    
    reverse(num,num+3*n);
    
    rep(i,2*n){
        if(r.size()<n){
            r.push(num[i]);
            rsum += num[i];
        }else{
            if(num[i]<r.top()){
                rsum = rsum-r.top()+num[i];
                r.pop();
                r.push(num[i]);
            }
        }
        if(r.size()==n)rarr.push_back(rsum);
    }
    
    rep(i,rarr.size()){
        //cout << larr[i]<<' '<<rarr[rarr.size()-1-i]<<endl;
        if(i==0)ans=larr[i]-rarr[rarr.size()-1-i];
        else ans = max(ans,larr[i]-rarr[rarr.size()-1-i]);
    }
    
    cout << ans<<endl;
    
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;

#define sync std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define loopi(n) for(int i=0;i<n;i++)
#define loopj(n) for(int j=0;j<n;j++)
#define loop(a,b,c) for(int i=a;i<=b;i=i+c)

#define     deb(x)      cout<<#x<<"="<<x<<endl
#define     all(x)      (x).begin(),(x).end()
#define     reset(a)    memset(a,0,sizeof(a))
#define     sz(x)       ((int)(x.size()))
#define     pb          push_back
#define     pf          push_front
#define     pob	        pop_back
#define     pof         pop_front
#define     ins         insert
#define     F           first
#define     S           second
#define     mkp         make_pair
#define     mkt         make_tuple
#define     bitcount(x) __builtin_popcountll(x)
#define     gcd(a,b)    (__gcd(a,b))
#define     lcm(a,b)    ((a*b)/gcd(a,b))
#define PI 3.1415926535897932384626
 
const int mod = 1e9+7;
const int N = 1e5+5;

//==========================================//

void solve()
{
	int n;
	cin>>n;
	int a[n];
	loopi(n)	cin>>a[i];
	sort(a,a+n);
	
	set<pair<int,pair<int,int>>> s;
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(a[i]==a[j])
				continue;
			for(int k=j+1;k<n;k++)
			{
				if(a[j]==a[k])
					continue;
				if(a[i]+a[j]>a[k])
					ans++;			
			}
		}
	}
	cout<<ans;
}
int main()
{
	sync;

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
		cout<<endl;
	}
}


Measured memory_bytes: 3644
import sys

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

if a == 0:
    print(0)
    sys.exit()

syou = n // (a+b)
amari = n % (a+b)

if amari <= a:
    print(syou*a + amari)
else:
    print(syou*a + a)

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); // even N_C_2
    int M = sc.nextInt(); // odd M_C_2
    System.out.println(N * (N - 1) / 2 + M * (M - 1) / 2);
  }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll a[10000005];
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
   ll nn=10000005;
   for(int i=0;i<nn;i++)
   {
     a[i]=1;
   } 
   for(int i=2;i<=nn;i++)
   {
    a[i]++;
    for(int j=i+i;j<=nn;j+=i)
    {
      a[j]++;

    }
   }
  /* for(int i=1;i<=15;i++)
   {
    cerr<<i<<" "<<a[i]<<endl;
   }
   cerr<<endl;*/
   ll n,ans=0;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
      ans=ans+(i*a[i]);
   }
   cout<<ans<<endl;
   //cout<<ans*2<<endl;
}
return 0;
}

Measured memory_bytes: 81772
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
const ll MOD = 998244353;
const int N = 200000 + 5;
ll dp[N];

int main() {
    int n, k;
    cin >> n >> k;
    vector<pii> rng(k);
    for (int i = 0; i < k; ++i) {
        cin >> rng[i].first >> rng[i].second;
    }
    dp[1] = 1;
    dp[2] = -1;
    for (int i = 1; i <= n; ++i) {
        dp[i] = (dp[i] + dp[i - 1]) % MOD;
        for (int j = 0; j < k; ++j) {
            int l, r;
            tie(l, r) = rng[j];
            if (i + l <= n) dp[i + l] = (dp[i + l] + dp[i]) % MOD;
            if (i + r <= n) dp[i + r] = (dp[i + r] - dp[i - 1] + MOD) % MOD;
        }
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 4752
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;
// const double eps = 1e-9;

int main()
{
  ll W,H,x,y;
  cin >> W >> H >> x >> y;
  // 面積の大きくない方の面積の最大値 (= ちょうど半分)
  cout << fixed << setprecision(15) << ((double)W / 2) * H << endl;

  // その最大値を達成する (2等分する) 分割の方法が複数あるか？
  bool flag;
  if ((2 * x == W) && (2 * y == H)) flag = true;
  else flag = false; // 1つしかない

  cout << (flag ? 1 : 0) << endl;

  return 0;
}


Measured memory_bytes: 256
import collections
N = int(input())
Map = [[] for j in range(N+1)]

for i in range(N-1):
    u,v,w = map(int,input().split())
    Map[u].append((v,w))
    Map[v].append((u,w))

q = collections.deque()
q.append(1)
ans = [-1 for i in range(N+1)]
ans[1] = 0
while(q):
    v = q.popleft()
    for e,w in Map[v]:
        if ans[e] == -1:
            ans[e] = ans[v]+w
            q.append(e)
for i in range(1,N+1):
    print(ans[i]%2)

Measured memory_bytes: 43120
import sys
from pprint import pprint

def solve(n, k, a):
    aa = a + a
    tr_n_a = 0
    for i in range(0, n-1):
        for j in range(i+1, n):
            if a[i] > a[j]:
                tr_n_a += 1
    # print(tr_n_a)

    tr_n = 0
    s_a = sorted(a, reverse=True)
    for i in range(0, n-1):
        for j in range(i+1, n):
            if s_a[i] > s_a[j]:
                tr_n += 1
    # print(tr_n)

    if tr_n == 0:
        print(0)
    else:
        print((tr_n * k * (k - 1) // 2 + tr_n_a * k) % (10**9 + 7))

if __name__ == '__main__':
  n, k = map(int, sys.stdin.readline().strip().split(" "))
  a = list(map(int, sys.stdin.readline().strip().split(" ")))
  solve(n, k, a)

Measured memory_bytes: 41308
import sys
from collections import deque
from operator import itemgetter
input = sys.stdin.readline
N, M = map(int, input().split())

A = deque()
for i in range(N):
    A.append(list(map(int, input().split())))

A = sorted(A, key=itemgetter(0))

m=0
cost=0

for i in range(N):
    if m >= M:
        break
    buy = min(M - m, A[i][1])
    cost += A[i][0] * buy
    m += buy

print(cost)

Measured memory_bytes: 30224
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))


sorted_a = sorted(a,reverse=True)

bob=0
alice=0

for i in range(0,N):
    if i%2==0:
        alice+=sorted_a[i]
    else:
        bob+=sorted_a[i]

print(alice-bob)

Measured memory_bytes: 3064
from scipy.sparse.csgraph import dijkstra

n, m, r = map(int,input().split())
rs = list(map(int, input().split()))
edge = [[0]*n for i in range(n)]
for i in range(m):
    a, b, c = list(map(int, input().split()))
    a, b = a-1, b-1
    edge[a][b] = c
    edge[b][a] = c
dist = dijkstra(edge, directed=False, indices=[i for i in range(n)])

from itertools import permutations
ans = float("inf")
    
for v in permutations(rs, len(rs)):
    dist_tmp = 0
    for i in range(r-1):
        dist_tmp += dist[v[i]-1][v[i+1]-1]
    ans = min(ans, int(dist_tmp))
print(ans)

Measured memory_bytes: 16336
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

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

    string result;
    int count_AC = 0;
    int count_WA = 0;
    int count_TLE = 0;
    int count_RE = 0;
    FOR(i, N) {
        cin >> result;
        if (result == "AC") {
            count_AC += 1;
        } else if (result == "WA") {
            count_WA += 1;
        } else if (result == "TLE") {
            count_TLE += 1;
        } else if (result == "RE") {
            count_RE += 1;
        }
    }

    cout << "AC x " << count_AC << endl;
    cout << "WA x " << count_WA << endl;
    cout << "TLE x " << count_TLE << endl;
    cout << "RE x " << count_RE << endl;

    return 0;
}


Measured memory_bytes: 3660
import copy

NOT_FOUND = False

# 二分探索
def binarySearch(n, S, t):
     
    left = 0
    right = n
    key = t
    while left < right:
        mid = (left + right) // 2
        if S[mid] == key:
            return True
        elif key < S[mid]:
            right = mid
        else:        
            left = mid + 1
    return NOT_FOUND
 
if __name__ == '__main__':
     
    # 入力
    n = int(input()) # 数列Sに含まれる整数の個数
    S = list(map(int,input().split())) # 整数を含む数列
    q = int(input()) # 数列Tに含まれる異なる整数の個数
    T = list(map(int,input().split())) # 異なる整数を含む数列
     
    # 初期化
    C = 0 # Tに含まれる整数の中でSに含まれるものの個数
     
    # 数列T内の整数を1つずつチェック
    for i in range(q):
        isExist = binarySearch(n, S, T[i])
         
        # 存在してたらカウント
        if isExist :
            C = C + 1
    # 出力
    print(C)


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

using namespace std;

int main() {
    int n,a[100005],k;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>k;
        a[k]=i;
    }
    for(int i=1;i<=n;i++){
        cout<<a[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 1152
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String Ans = null;
        if(S.equals("ABC")){
            Ans = "ARC";
        } else {
            Ans = "ABC";
        }
        
        System.out.println(Ans);
        
    }
}


Measured memory_bytes: 35752
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	long long sum1 = 0, sum2 = 0;
	for (int i = N - 1; i > 0; i--) {
		sum1 = (sum1 + A[i]) % 1000000007;
		sum2 += ((long long)A[i - 1] * sum1) % 1000000007;
		sum2 %= 1000000007;
	}
	cout << sum2 << endl;
}

Measured memory_bytes: 3988