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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w;
    cin >> h >> w;
    
    //孤立してる黒点を探す。
    string camvas[h];
    
    rep(i, h)   cin >> camvas[i];
    
    bool island = false;
    rep(i, h){
        rep(j, w){
            if(camvas[i][j] == '#'){
                island = true;
                rep(k, 4){
                    int col = i + dy[k];
                    int row = j + dx[k];
                    if(0 <= col && col <= h - 1 && 0 <= row && row <= w - 1){
                        if(camvas[col][row] == '#'){
                            island = false;
                        }   
                    }
                }
                if(island == true)   goto OUT;
            }
        }
    }
    OUT:
    
    if(island)    cout << "No" << endl;
    else    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int sum = 1;

    if (a != b)
    {
        sum++;
    }
    if (a != c && b != c)
    {
        sum++;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]

fn main() {
    input!{
        n: usize,
        k: usize,
        trees: [i64; n],
    }
    trees.sort();
    let mut ans = i64::MAX;
    for i in 0..(n - k + 1) { ans = min(ans, trees[i + k - 1] - trees[i]); }
    println!("{}", ans);
}



Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 long long int gcd(long long int m,long long int n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
long long int lcm(long long int number1,long long int number2){
	return number1 * number2 / gcd(number1,number2);	

}
int main(){
  
  ll X,Y;
  cin>>X>>Y;
  
ll ans=1;
  
  while(X*power(2,ans)<=Y){
    ans++;
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec(5);
  int a;
  for (int i = 0; i < 5; i++) {
    cin >> vec.at(i); 
  }
  cin >> a;
  sort(vec.begin(), vec.end());
  if (vec[4] - vec[0] <= a) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll

int cnt[55];
ll t[55];

signed main(){
  t[0]=1;
  for(int i=1;i<55;i++){
    t[i]=t[i-1]*2;
  }

  int N;
  ll K;
  cin>>N>>K;
  ll A[110000],ans=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    ans+=K^A[i];
  } 
  for(int i=0;i<55;i++){
    for(int j=0;j<N;j++){
      if(bit(A[j],i)) cnt[i]++;
    }
  }
  for(int i=54;i>=0;i--){
    if(bit(K,i)==0) continue;
    ll s=0;
    s=t[i]*cnt[i];
    for(int j=i-1;j>=0;j--){
      s+=t[j]*max(cnt[j],N-cnt[j]);
    }
    for(int j=54;j>=i+1;j--){
      if(bit(K,j)==0) s+=t[j]*cnt[j];
      else s+=t[j]*(N-cnt[j]);
    }
    //cout<<i<<" "<<s<<endl;
    chmax(ans,s);
  }
  cout<<ans<<endl;
  

}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#define pb push_back
#define mp make_pair
using namespace std;
const int N = 2e5 + 5;

int n;
int a[N];

int nxt[N];

long long ans;
int check(int id)
{
    int i;
    int mask = 0, res = 0;

    for(i = id; i <= n; i = nxt[i])
    {
        if(mask & a[i])
        {
            res = i - id;
            break;
        }

        mask ^= a[i];
    }
    if(i == n + 1)
        res = n - id + 1;

    return res;
}

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


   int i;

   cin >> n;
   for(i = 1; i <= n; i++)
   {
       cin >> a[i];
       nxt[i] = i + 1;
   }

   for(i = n - 1; i >= 1; i--)
   {
       if(a[i + 1] == 0)
        nxt[i] = nxt[i + 1];
   }

   for(i = 1; i <= n; i++)
   {
       ans += check(i);
   }

   cout << ans << endl;

   return 0;
}

/*

4
2 0 0 6


*/

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define x             first
#define y             second
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define PI            3.14159265358979
#define N             200005

int solve(){
    int n; cin>>n;
    int ac=0,wa=0,tle=0,re=0;
    while(n--){
        string s; cin>>s;
        if(s=="AC") ac++;
        else if(s=="WA") wa++;
        else if(s=="TLE") tle++;
        else re++;
    }
    cout<<"AC x "<<ac<<"\n";
    cout<<"WA x "<<wa<<"\n";
    cout<<"TLE x "<<tle<<"\n";
    cout<<"RE x "<<re<<"\n";
    return 0;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
char in[110];
int h[1100];
int g[1100];
int type[1100];
int v[1100];
int s[1100];
int sum[1100];
int L[1100];
int R[1100];
int t[1100];
int u[1100];
int c[1100];
int main(){
	int a;
	while(scanf("%d",&a),a){
		map<string,int>m1;
		int n1=0;
		map<string,int>m2;
		int n2=0;
		for(int i=0;i<a;i++)v[i]=0;
		for(int i=0;i<1100;i++)s[i]=t[i]=u[i]=sum[i]=R[i]=0;
		for(int i=0;i<1100;i++)L[i]=99999999;
		for(int i=0;i<a;i++){
			scanf("%s",in);
			string A=in;
			scanf("%s",in);
			
			if(in[0]=='B')type[i]=1;
			else type[i]=0;
			scanf("%s",in);
			string B=in;
			scanf("%d",c+i);
			if(m1.count(A))h[i]=m1[A];
			else{
				m1[A]=n1;
				h[i]=n1++;
			}
			if(m2.count(B))g[i]=m2[B];
			else{
				m2[B]=n2;
				g[i]=n2++;
			}
		}
	//	for(int i=0;i<a;i++)printf("%d %d %d %d\n",h[i],type[i],g[i],c[i]);
		for(int i=0;i<a;i++){
			if(v[i])continue;
			if(type[i]){
				int at=-1;
				int val=99999999;
				for(int j=0;j<i;j++){
					if(v[j]||h[i]==h[j])continue;
					if(g[i]==g[j]&&type[j]==0&&c[j]<=c[i]&&val>c[j]){
						val=c[j];at=j;
					}
				}
				if(!~at)continue;
				v[at]=v[i]=1;
				int tmp=(val+c[i])/2;
				sum[g[i]]++;
				s[g[i]]+=tmp;
				L[g[i]]=min(L[g[i]],tmp);
				R[g[i]]=max(R[g[i]],tmp);
				t[h[i]]+=tmp;u[h[at]]+=tmp;
			}else{
				int at=-1;
				int val=0;
				for(int j=0;j<i;j++){
					if(v[j]||h[i]==h[j])continue;
					if(g[i]==g[j]&&type[j]==1&&c[i]<=c[j]&&val<c[j]){
						val=c[j];at=j;
					}
				}
				if(!~at)continue;
				v[at]=v[i]=1;
				int tmp=(val+c[i])/2;
				sum[g[i]]++;
				L[g[i]]=min(L[g[i]],tmp);
				R[g[i]]=max(R[g[i]],tmp);
				s[g[i]]+=tmp;
				t[h[at]]+=tmp;u[h[i]]+=tmp;
			}
		}
		for(map<string,int>::iterator it=m2.begin();it!=m2.end();it++){
			string name=(*it).first;
			int num=(*it).second;
			if(!sum[num])continue;
			printf("%s %d %d %d\n",name.c_str(),L[num],s[num]/sum[num],R[num]);
		}
		printf("--\n");
		for(map<string,int>::iterator it=m1.begin();it!=m1.end();it++){
			string name=(*it).first;
			int num=(*it).second;
			printf("%s %d %d\n",name.c_str(),t[num],u[num]);
		}
		printf("----------\n");
	}
}

Measured memory_bytes: 1144
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 2; i <= sqrt(n); i++) {
        int c = 0;
        while (n % i == 0) {
            n /= i;
            c++;
        }
        int l = 0, h = c;
        int ans = 0;
        while (l <= h) {
            int mid = (l + h) / 2;
            if (mid * (mid + 1) / 2 <= c) {
                ans = mid;
                l = mid + 1;
            }
            else h = mid - 1;
        }
        cnt += ans;
    }
    if (n > 1) cnt++;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
int main(){
	int k, a, b;
	cin >> k >> a >> b; 

	bool flg=0;
	for(int i=1; i<=1000; ++i){
		if(a<=k*i && k*i<=b){
			flg=1;
			break;
		}
	}
	cout << (flg ? "OK" : "NG") << endl;
}

Measured memory_bytes: 3596
/* 
容易发现这么几个性质：
(1)1一定在基环树的环上。否则在环上的点无法到达1
(2)当环的大小n >= 2时，给每个点按照顺序在mod n意义下标号，那么i + K != j + K(mod n)   <=>   i != j(mod n)。所以环的大小 = 1
那么最终一定呈现这样的结构：1往1连一个自环，剩下的点形成以1为根的深度<= K的树
把1的边连向1得到一棵树，剩下的点从下往上做，当一个点中的叶子不满足条件时接向根 
*/

#include <cstdio>
#include <algorithm>

using namespace std;
const int Max_N(100050);

int N, K, Ans, Father[Max_N], Head[Max_N], To[Max_N], Next[Max_N];

int dfs(int u)
{
	int Dep(0);
	for (int i = Head[u], v, dep;i;i = Next[i])
	{
		dep = dfs(v = To[i]) + 1;
		if (dep >= K && u != 1)
			++Ans;
		else
			Dep = max(Dep, dep);
	}
	return Dep;
}

int main()
{
	scanf("%d%d", &N, &K);
	for (int i = 1;i <= N;++i)
	{
		scanf("%d", Father + i);
		if (i == 1)
		{
			if (Father[i] != 1)
				++Ans;
		}
		else
			To[i] = i, Next[i] = Head[Father[i]], Head[Father[i]] = i;
	}
	dfs(1);
	printf("%d", Ans);
	return 0;
}

Measured memory_bytes: 4864
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();
        int c = sc.NextInt();
        int x = sc.NextInt();
        int y = sc.NextInt();

        int answer = int.MaxValue;
        for (int i = 0; i <= Math.Max(x, y) * 2; i += 2)
        {
            int countA = Math.Max(0, x - i / 2);
            int countB = Math.Max(0, y - i / 2);
            answer = Math.Min(answer, countA * a + countB * b + i * c);
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define st first
#define N 1000005
using namespace std;
typedef long long int lo;
const int mod=1000000007;
lo a,b,c,d,e,f,g,h[200005],arr[200005];
string s;
vector<lo>v[200005];
char ch;

void dfs(lo x,lo y){
	arr[x]=arr[y]+h[x];
	for(lo i=0;i<v[x].size();i++){
		if(v[x][i]!=y){
			dfs(v[x][i],x);
		}
	}
}

int main(){
	// freopen("in.txt","r",stdin);
 //    freopen("out.txt","w",stdout);
    cin >> a >> b;
    for(lo i=1;i<a;i++){
    	lo x,y;
    	cin >> x >> y;
    	v[x].pb(y);
    	v[y].pb(x);
    }
    for(lo i=1;i<=b;i++){
    	lo x,y;
    	cin >> x >> y;
    	h[x]+=y;
    }
    dfs(1,0);
    for(lo i=1;i<=a;i++){
    	cout << arr[i] <<' ';
    }
}

Measured memory_bytes: 25600
N,D = gets.chomp.split.map(&:to_i)
points = Array.new(N) do
  gets.chomp.split.map(&:to_i)
end


count = 0
points.each_with_index do |point, i|
  points.slice((i+1...points.length)).each do |point_compare|
    total = [point, point_compare].transpose.reduce(0) do |sum, n|
      sum + (n.first - n.last) ** 2
    end

    distance = Math.sqrt(total)
    count += 1 if distance.modulo(1).zero?
  end
end

puts count


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

const int N = 500010;
const int mod = 998244353;

typedef long long LL;

inline int Pow(int x, int y) {
    int res = 1;
    for (; y; y >>= 1, x = (LL)x * x % mod) if (y & 1) res = (LL)res * x % mod;
    return res;
}

int frac[N], inv[N];

inline int C(int n, int r) {
    if (r > n) return 0;
    return (LL)frac[n] * inv[r] % mod * inv[n - r] % mod;
}

int main() {
    int n, k, res = 0; cin >> n >> k; 
    frac[0] = inv[0] = 1;
    for (int i = 1; i <= k; i++) frac[i] = (LL)frac[i - 1] * i % mod, inv[i] = Pow(frac[i], mod - 2);
    for (int R = n; R <= k; R++) 
        res = (res + C(k, R) - C(k, R * 2 - n + 1)) % mod;
    printf("%d\n", (res + mod) % mod);
    return 0;
}//

Measured memory_bytes: 4096
#include <iostream>
using namespace std;
using LL = long long int;

int main() {
	int N;
	LL K;
	cin >> N >> K;
	
	for (LL a = 0; a <= N; a++) {
		for (LL b = 0; b <= N - a; b++) {
			//cout << a << " " << b << endl;
			LL temp_ = K - 10000 * a;
			LL temp = K - 10000 * a;
			temp = temp - 5000 * b;
			LL diff = temp - (N - a - b) * 1000;
			if (diff == 0) {
				cout << a << " " << b << " " << N - a - b << endl;
				return 0;
			}
		}
	}


	cout << "-1 -1 -1" << endl;
	return 0;


}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"io"
	"os"
	"sort"
)

type Number struct {
	S int
	C int
}

type Numbers []Number

func (n Numbers) Len() int {
	return len(n)
}

func (n Numbers) Swap(i, j int) {
	n[i], n[j] = n[j], n[i]
}

func (n Numbers) Less(i, j int) bool {
	return n[i].S < n[j].S
}

func run(input io.Reader, output io.Writer) int {
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)
	sc := make(Numbers, m)
	for i := 0; i < m; i++ {
		fmt.Scanf("%d %d\n", &sc[i].S, &sc[i].C)
	}

	sort.Sort(sc)

	if len(sc) > 0 {
		if n > 1 && sc[0].S == 1 && sc[0].C == 0 {
			fmt.Println("-1")
			return 0
		}
	}
	newSC := make(Numbers, 0)
	for i := 0; i < len(sc); i++ {
		if i != 0 && sc[i-1].S == sc[i].S {
			if sc[i-1].C != sc[i].C {
				fmt.Println("-1")
				return 0
			}
		} else {
			newSC = append(newSC, sc[i])
		}
	}

	for i := 0; i < n; i++ {
		found := false
		for _, v := range newSC {
			if v.S == i+1 {
				fmt.Print(v.C)
				found = true
				break
			}
		}
		if !found {
			if n > 1 && i == 0 {
				fmt.Print("1")
			} else {
				fmt.Print("0")
			}
		}
	}
	fmt.Println()

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef long long ll;


int gcd(int n1,int n2)
{
    int keep,r;
    if(n1<n2)
    {
        keep=n1;
        n1=n2;
        n2=keep;
    }
    if(n2==1)
    {
        return 1;
    }
    else
    {
    r=n1%n2;
    while(r!=0)
    {
        n1=n2;
        n2=r;
        r=n1%n2;
    }
    return n2;
    }
}

int main()
{
    int k;
    ll ans=0;
    
    scanf("%d",&k);

    for(int a=1;a<k+1;a++)
    {
        for(int b=1;b<k+1;b++)
        {
            for(int c=1;c<k+1;c++)
            {
                ans=ans+gcd(a,gcd(b,c));
            }
        }
    }

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

Measured memory_bytes: 1728
def encode(string, a, b):
    ret = ''
    for x in string:
        tmp = ord(x) - ord('a')
        if 0 <= tmp <= 26:
            ret += chr((a * tmp + b) % 26 + ord('a'))
        else:
            ret += x
    return ret


n = input()
for t in xrange(n):
    line = raw_input()
    for i in xrange(1, 10000):
        f = False
        if not (26 % i and i % 26):
            continue
        for j in xrange(26):
            txt = encode(line, i, j)
            if 'that' in txt or 'this' in txt:
                print txt
                f = True
                break
        if f:
            break

Measured memory_bytes: 4232
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val ans = a.reduce(::gcd)
    println(ans)
}

fun gcd(a: Int, b: Int): Int {
    if (b == 0) return a
    return gcd(b, a % b)
}

Measured memory_bytes: 53544
n = int(input())
a = list(map(int, input().split()))
mn = a[0]
mx = a[0]
sum = a[0]
for i in range(1, n):
	mn = min(mn, a[i])
	mx = max(mx, a[i])
	sum += a[i]
print(mn, mx, sum)


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

using namespace std;

int main() {
    int N, L;
    cin >> N >> L;
    string A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A, A+N);
    for (int i = 0; i < N; i++) {
        cout << A[i];
    }
    return 0;
}


Measured memory_bytes: 3568
#include<stdio.h>
#include<stdlib.h>
#define MAX (int)(1e+4)
int hon[10]={0,2,5,5,4,5,6,3,7,6};

int comp_int(const void *a,const void *b){
  return *(int *)b-*(int *)a;
}

int main(){
  int debug=1e9;
  int n,m,a[9],i;
  scanf("%d%d",&n,&m);

  for(i=0;i<m;i++)
    scanf("%d",&a[i]);
  int dp[MAX+1];
  dp[0]=0;
  for(i=1;i<=n;i++)
    dp[i]=-1;
  int j;
  for(i=1;i<=n;i++){
    debug--;if(debug<0)break;
    for(j=0;j<m;j++){
    debug--;if(debug<0)break;
      if(hon[a[j]]<=i && dp[i-hon[a[j]]]>=0 && dp[i]<1+dp[i-hon[a[j]]])
	dp[i]=1+dp[i-hon[a[j]]];
    }
  }
  qsort(a,m,sizeof(int),comp_int);

  /*  printf("debug:%d\n",debug);
  for(i=0;i<n;i++)
    printf(" %d",dp[i]);
  printf(":dp\n");
  for(i=0;i<m;i++)
    printf(" %d",a[i]);
  printf(":a\n");
  */
  i=n;
  while(i){
    debug--;if(debug<0)break;
    for(j=0;j<m;j++){
      debug--;if(debug<0)break;
      if(i<hon[a[j]] || dp[i-hon[a[j]]]<dp[i]-1) continue;
      printf("%d",a[j]);
      i-=hon[a[j]];
      break;
    }
  }
  debug--;if(debug<0){printf("\nerr.\n");}

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	char c[8][8];
	rep(i, 0, 8)rep(j, 0, 8)cin >> c[i][j];
	cout << 90 << endl;	rep(i, 0, 8) { rrep(j, 0, 8)cout << c[j][i]; cout << endl; }
	cout << 180 << endl; rrep(i, 0, 8) { rrep(j, 0, 8)cout << c[i][j]; cout << endl; }
	cout << 270 << endl; rrep(i, 0, 8) { rep(j, 0, 8)cout << c[j][i]; cout << endl; }
	return 0;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	int count = 0;
	while (1) {
		n /= k;
		count++;
		if (n == 0)break;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Measured memory_bytes: 2940
import sys

W = sys.stdin.readline().strip()
num = 0

while True:
    T = sys.stdin.readline().strip()
    if T == 'END_OF_TEXT':
        break
    t = T.lower()
    T_line = t.split()
    for i in T_line:
        if W == i:
            num += 1

print(num)


Measured memory_bytes: 5560
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

h1, m1, h2, m2, k = MAP()
time1 = h1*60+m1
time2 = h2*60+m2
print(time2-time1-k)

Measured memory_bytes: 72804
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in) ;
	public static void main(String[]args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		int l = sc.nextInt();
		
		long[] a = new long[l];
		for(int i = 0 ; i < l ; i++) {
			a[i] = sc.nextInt();
		}
		
		
		long[][] dp = new long[l+1][5];
		
		for(int i=0 ; i<l ; i++) {
			
			dp[i+1][0] = dp[i][0] + a[i];

			long p2 = a[i] == 0 ? 2 : a[i] % 2;
			dp[i+1][1] = min(dp[i], 2) + p2;
			dp[i+1][2] = min(dp[i], 3) + (a[i] + 1)% 2;
			dp[i+1][3] = min(dp[i], 4) + p2;
			dp[i+1][4] = min(dp[i], 5) + a[i];
		}
		
		System.out.println(min(dp[l],5));
		
	}
	
	long min(long[] ls, int to) {
		long res = Long.MAX_VALUE/2;
		for(int i = 0 ; i < to ; i ++) {
			res = Math.min(res, ls[i]);
		}
		return res;
	}
}


Measured memory_bytes: 97268
#include <stdio.h>
#define max(a, b) a>b?a:b

int main(void)
{
    long long a, b, c;
    scanf("%lld %lld %lld",&a, &b, &c);
    if (a % 2 && b % 2 && c % 2) {
        if (b < a) {
            long long tmp = a;
            a = b;
            b = tmp;
        }
        if (c < b) {
            long long tmp = b;
            b = c;
            c = tmp;
        }
        printf("%lld\n", a*b);
    } else {
        puts("0");
    }
    return 0;
}


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

long kaijo(long a){
  long div= 1000000007;
  long s=1;
  for(int i=1;i<=a;i++){
    s *=i;
    s %= div;
  }
  return s;
}

int main() {
  int N,M;
  cin>>N>>M;
  long div= 1000000007;
  if(abs(N-M)>=2){
    cout<<0<<endl;
    return 0;
  }
  long ans;
  if(abs(N-M)==1){
    ans = (kaijo(N)%div*kaijo(M)%div)%div;
  }
  if(abs(N-M)==0){
    ans = (kaijo(N)%div*kaijo(M)%div)%div*2%div;
  }


  cout<<ans<<endl;
}


Measured memory_bytes: 256
def main():
    s = str(input())
    sLen = len(s)
    for i in range(sLen - 2):
        if s[i] == s[i + 1]:
            print(i + 1, i + 2)
            return
        elif s[i] == s[i + 2]:
            print(i + 1, i + 3)
            return
    if s[sLen - 2] == s[sLen - 1]:
        print(sLen - 1, sLen)
        return

    print("-1 -1")


if __name__ == "__main__":
    main()


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

const int INF=1e9;

int main()
{
	//1.输入 
	int n,m;
	scanf("%d%d",&n,&m);
	set<pair<int,int> > se;//记录起点,记录横向移动距离 
	multiset<int> ans;//竖直移动距离 
	//set<pair<int,int> >::iterator it; 
	//2.起点初始化 
	for(int i=1;i<=m;++i)
	{
		se.insert({i,i});
		ans.insert({0});
	}
	//3.
	for(int i=1;i<=n;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if(y == m) y=INF;
		auto it=se.lower_bound({x,0});
		int t=-1;
		for( ;it != se.end() && it->first<=y;)
		{
			ans.erase(ans.find(it->first - it->second));
			t=max(t,it->second);
			it=se.erase(it);//删除当前迭代器指向的元素并指向下一个 
		}
		if(t>-1)
		{
			ans.insert(y+1-t);
			se.insert({y+1,t});
		}
		int r= *ans.begin();
		if(r>m) cout<<"-1\n";
		else printf("%d\n",r+i);
	} 
	return 0;
}

Measured memory_bytes: 22544
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int m = 0;
    int l = 0; 
    string n;
    cin >> n;
    n += 'p';
    for(int i = 0; i < n.size(); i++){
        if(n.at(i) == 'A' || n.at(i) == 'C' || n.at(i) == 'G' || n.at(i) == 'T'){
            m = 0;
            for(int j = 0; j + i < n.size(); j++ ){
                if(n.at(i + j) == 'A' || n.at(i + j) == 'C' || n.at(i + j) == 'G' || n.at(i + j) == 'T'){
                    m++;
                    }else{       
                    if(m > l){
                        l = m;
                    }
                    break;
                }
            }
        }
    }cout << l << endl;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();
        boolean[] b = new boolean[h];
        int[][] g = new int[h][w];
        int c = 0;
        for(int i=0; i<h; i++) {
            char[] s = sc.next().toCharArray();
            for(int j=0; j<w; j++) {
                if(s[j] == '#') {
                    c++;
                    g[i][j] = c;
                }
            }
        }

        for(int i=0; i<h; i++) {
            for(int j=1; j<w; j++) {
                if(g[i][j] == 0) {
                    g[i][j] = g[i][j-1];
                }
            }
            for(int j=w-2; j>=0; j--) {
                if(g[i][j] == 0) {
                    g[i][j] = g[i][j+1];
                }
            }
        }
        for(int j=0; j<w; j++) {
            for(int i=1; i<h; i++) {
                if(g[i][j] == 0) {
                    g[i][j] = g[i-1][j];
                }
            }
            for(int i=h-2; i>=0; i--) {
                if(g[i][j] == 0) {
                    g[i][j] = g[i+1][j];
                }
            }
        }
        for(int i=0; i<h; i++) {
            for(int j=0; j<w; j++) {
                if(j>0) {
                    System.out.print(" ");
                }
                System.out.print(g[i][j]);
            }
            System.out.println();
        }

    }

}


Measured memory_bytes: 47388
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;

    int long long total=0;
    if(a+b>2*c){
        total = min(x,y)*c*2;
        if(x>y){
            if(2*c<a){
                total = max(x,y)*c*2;
            }
            else{
                total += (x-y)*a;
            }
        }
        else{
            if(2*c<b){
                total = max(x,y)*c*2;
            }
            else{
                total += (y-x)*b;
            }
        }
    }
    else{
        total = a*x + b*y;
    }
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

from collections import Counter
def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    ld = rli()
    if ld[0] != 0:
        print(0)
        return
    counter = Counter()
    for d in ld:
        counter[d] += 1
    cnt = 0
    ans = 1
    bef = 1
    be = -1
    for e, c in sorted(counter.items()):
        if e-be > 1:
            print(0)
            return
        if e == 0 and c > 1:
            print(0)
            return
        ans *= pow(bef, c)
        ans %= 998244353
        cnt += c
        # print(be, e, c, pow(bef, c))
        be = e
        bef = c
    print(ans)





if __name__ == '__main__':
    main()


Measured memory_bytes: 21460
import Data.List
import Control.Monad
import Data.Bits

foldlState :: (c -> a -> b -> (c, a)) -> c -> a -> [b] -> a
foldlState f s a l = snd $ foldl (\(s,a) -> f s a) (s, a) l

check :: [[Int]] -> Int -> Bool
check q i = foldl step True q
    where step a [x,y] = a && (i .&. (2^(x-1)) == y * (2^(x-1)))

checkAll :: [[[Int]]] -> Int -> Bool
checkAll qs i = foldlState step 0 True qs
    where step k a q = (k + 1, a && (i .&. 2^k == 0 || check q i))

bitCount :: Int -> Int
bitCount 0 = 0
bitCount 1 = 1
bitCount i = (if mod i 2 == 1 then 1 else 0) + bitCount (div i 2)

count :: Int -> [[[Int]]] -> Int
count n qs = foldl max 0 $ map bitCount $ filter (checkAll qs) [0..2^n-1]

main = do
  n <- readLn :: IO Int
  qs <- replicateM n readPerson :: IO [[[Int]]]
  putStrLn $ show $ count n qs
    where readPerson = do
            a <- readLn :: IO Int
            replicateM a (map read . words <$> getLine)


Measured memory_bytes: 1020
#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main(){

    long long a;
    double b;

    cin >> a >> b;
    long long ib = b*100+0.5;
    a *= ib;
    a/= 100;
    cout << a << endl;

    return 0;
    
}

Measured memory_bytes: 3736
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	ints := []int{a, b, c}
	sort.Ints(ints)
	if ints[0] == 5 && ints[1] == 5 && ints[2] == 7 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>

int main() {
	char A[12], B[12];
	char U[12];
	int n, m;
	scanf("%s %s", &A, &B);
	scanf("%d %d", &n, &m);
	scanf("%s", &U);
	if (strcmp(A, U) == 0 && n > 0) n--;
	if (strcmp(B, U) == 0 && m > 0) m--;
	printf("%d %d", n, m);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int h,w;
string s[2005];
long long mem[2006][2006];
long long swim(int x = 0 , int y = 0)
{
    if(s[y][x] == '#')
        return 0;
    if (x == w || y == h)
        return 0;
    if (x == w - 1 && y == h - 1)
        return 1;
    long long &r = mem[y][x];
    if(~r)
        return r;
    return r =  (swim(x + 1, y) + swim(x, y + 1))%int(1e9+7);
}

int main()
{
    cin>>h>>w;
    memset(mem,-1,sizeof(mem));
    for(int i = 0 ; i < h; ++i)
        cin>>s[i];
    cout<<swim()<<endl;
    return 0;
}


Measured memory_bytes: 32896
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
using namespace std;
const LL INF = 0x3f3f3f3f3f3f3f3f;

LL n,m;
char p[505][505] = {0},k;
int r[505][505] = {0},b[505][505] = {0};

int main(){
	cin >> n >> m;
	for(int i = 1;i <= n;i ++){
		for(int j = 1;j <= m;j ++){
			cin >> k;
			if(k == '#') r[i][j] = b[i][j] = p[i][j] = 1;
		}
	}
	for(int i = 1;i <= n;i ++) r[i][1] = b[i][m] = 1;
	for(int i = 1;i <= n;i ++){
		for(int j = 2;j < m;j ++){
			if(i & 1) r[i][j] = 1;
			else b[i][j] = 1;
		}
	}
	for(int i = 1;i <= n;i ++){
		for(int j = 1;j <= m;j ++){
			printf("%c",r[i][j] ? '#' : '.');
		}
		printf("\n");
	}
	printf("\n");
	for(int i = 1;i <= n;i ++){
		for(int j = 1;j <= m;j ++){
			printf("%c",b[i][j] ? '#' : '.');
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    vector<vector<pair<int, int>>> v(n);
    rep(i, 0, n) {
        int a;
        cin >> a;
        rep(j, 0, a) {
            int x, y;
            cin >> x >> y;
            x--;
            v[i].push_back(make_pair(x, y));
        }
    }
    int ans = 0;
    rep(i, 0, (1 << n)) {
        bool ok = true;
        int h[n] = {};
        rep(j, 0, n) {
            if (i & (1 << j)) h[j] = 1;
        }
        rep(j, 0, n) {
            if (h[j] == 1) {
                for (auto k : v[j]) {
                    int f = k.first;
                    int s = k.second;
                    if (s == 1) {
                        if (h[f] == 0) {
                            ok = false;
                            break;
                        }
                    } else {
                        if (h[f] == 1) {
                            ok = false;
                            break;
                        }
                    }
                }
            }
        }
        if (ok) {
            int cnt = 0;
            rep(i, 0, n) cnt += h[i];
            ans = max(ans, cnt);
        };
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from  functools import reduce
def gcd(v1,v2):
  v=v1%v2
  if v==0:
    return v2
  else :
    return gcd(v2,v)
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=[i//2 for i in a]
#print(a)
lc=reduce(lambda x,y: (x*y)//gcd(x,y) , a)
#print(lc)
flag=True
for i in a:
  if (lc//i)%2==0:
    flag=False
    break
if flag==False:
  print(0)
else:
  x=m//lc
  print(x//2) if (x%2)==0 else print((x//2)+1)


Measured memory_bytes: 14748
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int M = 100000;
int A[M + 5], n;
void fix_up(int x)
{
	int par = x / 2;
	while(A[par] < A[x])
	{
		swap(A[par], A[x]);
		x = par;
		par = x / 2;
	}
}
void fix_down(int x)
{
	while(x * 2 <= n)
	{
		int ls = x * 2, rs = x * 2 + 1;
		if(A[ls] < A[rs]) swap(rs, ls);
		if(A[ls] > A[x])
		{
			swap(A[x], A[ls]);
			x = ls;
		}
		else break;
	}
}
int main()
{
	int m;
	cin >> n >> m;
	for(int i = 1; i <= n; i++) scanf("%d", &A[i]);
	for(int i = n / 2; i >= 1; i--) fix_down(i);
	for(int i = 0; i < m; i++)
	{
		//cout << "out " << A[1] << endl;
		int x = A[1] / 2;
		A[1] = A[n--];
		fix_down(1);
		A[++n] = x;
		fix_up(n);
	}
	long long sum = 0;
	for(int i = 1; i <= n; i++) sum += A[i];
	cout << sum << endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetLongNumArray();
            var L = N[0];
            var R = N[1];
            var d = N[2];
            var ansList = new List<int>();

            while (L <= R)
            {
                if (L % d == 0)
                {
                    ansList.Add((int)L);
                }
                L++;
            }

            Console.WriteLine(ansList.Count);
        }

        private static long[] GetLongNumArray()
        {
            var input = Console.ReadLine().Split(' ');
            return input.Select(x => long.Parse(x)).ToArray();
        }

        private static long GetLongNum()
        {
            return long.Parse(Console.ReadLine());
        }

        private static string[] GetStringArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static string GetString()
        {
            return Console.ReadLine();
        }
    }
}


Measured memory_bytes: 28232
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	A, B := getInt(), getInt()
	out((A + B) % 24)
}


Measured memory_bytes: 640
package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	sc     = bufio.NewScanner(os.Stdin)
)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	X := ReadInt()

	switch {

	case X >= 30:
		fmt.Println("Yes")
	default:
		fmt.Println("No")
	}
	return
}


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

int main()
{
	
	int a, b, c;
	char op;
		while (cin >> a >> op >> b){
			if (op == '+') {
				c = a + b;
			}
			
			else if (op == '-'){
				c = a - b;
			}else if (op == '/') {
				c = a / b;
			}else if (op == '*') {
				c = a * b;
			}else{
				break;
			}
			cout << c << endl;
		}
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


template <class T>
T gcd(T a, T b)
{
	if (a < b) return gcd(b, a);
	if (b) return gcd(b, a % b);
	else return a;
}
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

int main()
{
	int a, b;
	while (~scanf("%d%d", &a, &b))
		printf("%d %d\n", gcd(a, b), lcm(a, b));
}

Measured memory_bytes: 0
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] l = new long[n];
        for (int i = 0; i < n; i++) {
            l[i] = Long.parseLong(sc.next());
        }
        sc.close();

        // 主処理
        int result = 0;
        for (int i = 0; i < n - 2; i++) {
            for (int j = i + 1; j < n - 1; j++) {
                for (int k = j + 1; k < n; k++) {
                    boolean isNotSame = l[i] != l[j] && l[i] != l[k] && l[j] != l[k];
                    boolean canMakeTriangle = l[i] < l[j] + l[k] && l[j] < l[i] + l[k] && l[k] < l[i] + l[j];
                    if (isNotSame && canMakeTriangle) {
                        result++;
                    }
                }
            }
        }

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 36452
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> x(N+1);
    int sum=0;
    for (int i=1; i<N+1; i++) {
        cin >> x[i];
        if (x[i]<=abs(K-x[i])) sum+=x[i]*2; 
        else sum+=abs(K-x[i])*2;
    }
    cout << sum << endl;
} 

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
int dp[401][401];
int a[40], b[40], c[40];
int main() {
	int N, Ma, Mb;
	cin >> N >> Ma >> Mb;
	rep(i, N) {
		cin >> a[i] >> b[i] >> c[i];
	}
	fill((int*)dp, (int*)(dp + 401), 1 << 30);
	dp[0][0] = 0;
	rep(i, N) {
		for (int j = 400; j >= a[i]; j--) {
			for (int k = 400; k >= b[i]; k--) {
				if (dp[j - a[i]][k - b[i]] == 1 << 30) continue;
				dp[j][k] = min(dp[j][k], dp[j - a[i]][k - b[i]] + c[i]);
			}
		}
	}
	int ans = 1 << 30;
	REP(i,1,401) {
		REP(j,1,401) {
			if (i*Mb == j*Ma) ans = min(ans, dp[i][j]);
		}
	}
	if (ans == 1 << 30) cout << -1 << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 896
ans = []
flag = True
for i in range(3):
    ans.append(list(map(int,input().split())))
for i in range(2):
    diff1 = ans[i][0]-ans[i+1][0]
    diff2 = ans[i][1]-ans[i+1][1]
    diff3 = ans[i][2]-ans[i+1][2]
    if diff1!=diff2 or diff2!=diff2 or diff3!=diff1:
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ri register
#define int long long
using namespace std; const int N=210;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
int n,book[N],g[N];
int f[N][N],res;
struct Node { int x,y; }a[N],b[N];
int DFS(int x)
{
    for(ri int i=1;i<=n;i++)
    {
        if(!book[i]&&f[x][i])
        {
            book[i]=1;
            if(g[i]==-1 || DFS(g[i]))
            {
                g[i]=x;
                return 1;
            }
        }
    }
    return 0;
}
signed main()
{
    n=read();
    for(ri int i=1;i<=n;i++) a[i].x=read(), a[i].y=read();
    for(ri int i=1;i<=n;i++) b[i].x=read(), b[i].y=read();
    for(ri int i=1;i<=n;i++)
    for(ri int j=1;j<=n;j++)
    if(a[i].x<b[j].x && a[i].y<b[j].y) f[i][j]=1;
    memset(g,-1,sizeof(g));
    for(ri int i=1;i<=n;i++)
    {
        memset(book,0,sizeof(book));
        if(DFS(i)) res++;
    }
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 3916
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		double tot=0;
		for(int i=0;i<n;i++) {
			double x=scn.nextDouble();
			String str=scn.next();
			if(str.startsWith("BTC")) {
				tot+=x*380000.0;
			}else {
				tot+=x;
			}
		}
		System.out.println(tot);
	}

}


Measured memory_bytes: 25172
#include <iostream>
using namespace std;
int main()
{
  long long X;
  cin >> X;
  long long year = 0;
  long long money = 100;
  for (;;) {
    money *= 1.01;
    year++;
    if (money >= X) {
      break;
    }
  }
  cout << year << endl;
  return 0;
}

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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_debug(...) do { printf("DEBUG: line %d: %s: ", __LINE__, __PRETTY_FUNCTION__); printf(__VA_ARGS__); } while(0)
  #define pr_vars(...) do { pr_debug(" "); pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_debug(...) do { } while(0)
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;
#define X first
#define Y second
#define pb push_back

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fout << vec[i] << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cout << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cout << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr double INF = 2e18;
constexpr ll MOD = 1e9 + 7;

using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

constexpr ll MAX = 1e5 + 5;

int main()
{
    ll res = 0;
    ll a, b; cin >> a >> b;
    for (ll i = a; i <= b; i++) {
        string s = to_string(i);
        if (s == string(s.rbegin(), s.rend()))
            res++;
    }
    cout << res << endl;
    return 0;
}


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


using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int h,a;
	cin>>h>>a;
	if(h%a==0){
		cout<<(int)(h/a)<<'\n';
	}
	else{
		cout<<(int)(h/a) + 1<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
 
  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
//   typedef string str;
//   typedef unsigned long long ull;
  ll INF = INT_MAX;
  ll mod = 1000000007;
  // lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;
  
 

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     
   ll x;
   cin>>x;
   for (ll a = -123; a<=123;a++){
    for (ll b = -123; b<=123; b++){
      if (a*a*a*a*a - b*b*b*b*b == x){
        cout<<a<<" "<<b<<"\n";
        return 0;
      }
    }
   }
}
  

Measured memory_bytes: 3140