akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, T;
  cin >> N >> T;
  vector<int> a0;
  vector<pair<int, int>> a1;
  vector<ll> dp(30, T + 1);
  while (N--) {
    int a, b;
    cin >> a >> b;
    b += a + 1;
    if (a == 0)
      a0.push_back(b);
    else
      a1.emplace_back(a, b);
  }
  sort(a1.begin(), a1.end(), [&](const pair<int, int>& lhs, const pair<int, int>& rhs) { return (lhs.second) * (ll)rhs.first < lhs.first * (ll)(rhs.second); });
  dp[0] = 0;
  for (const auto& pr : a1) {
    for (int i = 29; i > 0; --i)
      dp[i] = min(dp[i], dp[i - 1] * (ll)(pr.first + 1) + pr.second);
  }
  sort(a0.begin(), a0.end());
  int ans = 0;
  for (int i = 0; i <= 29; ++i) {
    ll cur = T - dp[i];
    if (cur < 0) break;
    for (int j = 0; j < a0.size(); ++j)
      if ((cur -= a0[j]) < 0) {
        ans = max(ans, i + j);
        break;
      }
    if (cur >= 0) ans = max(ans, i + (int)a0.size());
  }
  cout << ans << '\n';

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
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>;
const int INFTY =2147483647;
int main(){
    int k,sum=9;
    cin>>k;
    vi A[11];
    if(k<10){
        cout<<k<<endl;
        return 0;
    }
    A[10].push_back(0);
    FOR(i,0,10) A[i].push_back(1);
    int j=0,a;
    while(sum<k){
        A[10].push_back(0);
        FOR(i,0,10){
            if(i==0) A[0].push_back(A[0][j]+A[1][j]);
            else A[i].push_back(A[i-1][j]+A[i][j]+A[i+1][j]);
            if(i>0)sum+=A[i][j+1];
            a=i;
            if(sum>=k) break;
        }
        j++;
    }
    k-=(sum-A[a][j]);
    cout<<a;
    while(j>0){
        sum=0;
        j--;
        a=max(0,a-1);
        while(sum<k){
            sum+=A[a][j];
            a++;
        }
        a--;
        cout<<a;
        k-=(sum-A[a][j]);
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <vector>
int lst[2005], to[4005], pre[4005], tot;
int near[2005][2005], from[2005][2005], que[2005];
bool in[2005][2005];
inline void add_edge(int u, int v)
{
	to[tot] = v;
	pre[tot] = lst[u];
	lst[u] = tot++;
}
void add(int u, int v)
{
	if (u == v)
		return;
	if (~near[u][v])
	{
		add(near[u][v], v);
		return;
	}
	if (~near[v][u])
	{
		add(u, near[v][u]);
		return;
	}
	in[u][v] = in[v][u] = true;
	near[u][v] = v;
	near[v][u] = u;
	std::vector<std::pair<int, int> > seq;
	for (int t = 0; t < 2; t++)
	{
		int he = 0, ta = 0;
		que[ta++] = v;
		while (he < ta)
		{
			int x = que[he++];
			for (int i = lst[x]; ~i; i = pre[i])
			{
				int y = to[i];
				if (y == from[u][x])
					continue;
				if (-1 == near[u][y])
				{
					near[u][y] = v;
					que[ta++] = y;
				}
				else if (in[u][y])
				{
					in[u][y] = in[y][u] = false;
					seq.emplace_back(v, y);
				}
			}
		}
		std::swap(u, v);
	}
	for (auto &it : seq)
		add(it.first, it.second);
}
void init(int u, int rt, int fa = -1)
{
	from[rt][u] = fa;
	for (int i = lst[u]; ~i; i = pre[i])
	{
		if (to[i] != fa)
			init(to[i], rt, u);
	}
}
int dfs(int u, int v, int fa = -1)
{
	int res = 0;
	if (near[v][u] == u)
	{
		v = u;
		res++;
	}
	for (int i = lst[u]; ~i; i = pre[i])
	{
		if (to[i] != fa)
			res += dfs(to[i], v, u);
	}
	return res;
}
int main()
{
	// freopen("AGC033-F.in", "r", stdin);
	memset(lst, -1, sizeof(lst));
	memset(near, -1, sizeof(near));
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i < n; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		add_edge(--u, --v);
		add_edge(v, u);
	}
	for (int i = 0; i < n; i++)
		init(i, i);
	while (m--)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		add(--u, --v);
	}
	int ans = 0;
	for (int u = 0; u < n; u++)
	{
		for (int i = lst[u]; ~i; i = pre[i])
			ans += dfs(to[i], u, u);
	}
	printf("%d\n", ans / 2);
	return 0;
}


Measured memory_bytes: 35840
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                if (i * j == n) {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    string s;
    cin>>s;
    cout<<(s[2]==s[3]&&s[4]==s[5]?"Yes":"No")<<endl;
    return 0;
}

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

int main(void){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  int min = *min_element(a.begin(), a.end());
  int max = *max_element(a.begin(), a.end());
  cout << max-min << endl;
  return 0;
}


Measured memory_bytes: 256
class Node
  attr_accessor :key, :left, :right, :parent
  def initialize key
    @key = key
  end
  def inorder
    left.inorder if left
    print ' ', key
    right.inorder if right
  end
  def preorder
    print ' ', key
    left.preorder if left
    right.preorder if right
  end
  def in
    left.in if left
    $a << self
  end
end

def insert
  z = Node.new $key
  x = $root
  while x
    y = x
    x = z.key < x.key ? x.left : x.right
  end
  z.parent=y
  unless y
    $root = z
  else
    z.key < y.key ? y.left = z : y.right = z
  end
end

def find root
  if root == nil
    puts 'no'
  elsif $key == root.key
    puts 'yes'
  elsif $key < root.key
    find root.left
  else
    find root.right
  end
end

def delete root
  left = root.left
  right = root.right
  if $key == root.key
    parent = root.parent
    if (left || right) == nil
      if parent.left
        $key == parent.left.key ? parent.left = nil : parent.right = nil
      else
        parent.right = nil
      end
    elsif left && right
      $a=[]
      right.in
      root.key = $key = $a[0].key
      delete $a[0]
    elsif left
      if parent
        if parent.left
          $key == parent.left.key ? parent.left = left : parent.right = left
        else
          parent.right = left
        end
      else
        $root = left
      end
      left.parent = parent
    else
      if parent
        if parent.left
          $key == parent.left.key ? parent.left = right : parent.right = right
        else
          parent.right = right
        end
      else
        $root = right
      end
      right.parent = parent
    end
  elsif $key < root.key
    delete left
  else
    delete right
  end
end
gets.to_i.times {
    command, $key = gets.split
    $key=$key.to_i
    case command
    when 'insert'
      insert
    when 'find'
      find $root
    when 'delete'
      delete $root
    else
      $root.inorder
      puts
      $root.preorder
      puts
    end
}

Measured memory_bytes: 158592
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        long L;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
        }
        double c = (double) L / 3;
        double M = c * c * c;
        System.out.println(String.format("%.8f",M));
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define forn(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;



int pgcd(int x,int y,int z){
  int pg=1;
  int mini = min(min(x,y),z);
  for(int i=1; i<=mini ; i++){
    if(x%i==0 && y%i==0 && z%i==0)pg = i;
  }
  return pg;
}

int main()
{
  int k,a,b,c,sum=0 ;

 cin >> k ;
  for(a=1 ; a<= k ; a++ ){
    for(b=1 ; b<=k ; b++){
      for(c=1 ; c<=k ; c++){
        sum += pgcd(a,b,c) ;
      }
    }
  }
cout << sum ;





  return 0 ;
}


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

int main() {
long long int A, B, K;
cin >> A >> B;

if((A % 2 == 0 && B % 2 !=0) || (B % 2 == 0 && A %2 != 0)){cout << "IMPOSSIBLE" << endl;return 0;}
K = (A+B)/2;
cout << K << endl;
return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
if h % 3 == 0 or w % 3 == 0:
  print(0)
  exit()
ans = 10000000000
for change in range(2): #heightとwidthを入れ替えてもう一回実行する
  #二分割
  for ty in range(1,h):
    ans = min(ans, max(ty*w, int(w/2)*(h-ty), (w-int(w/2))*(h-ty)) - min(ty*w, int(w/2)*(h-ty), (w-int(w/2))*(h-ty)))
  a = round(w/3 + 0.1)
  ans = min(ans, h*(max(a, w-a*2) - min(a, w-a*2)))
  temp = h
  h = w
  w = temp
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
char s[11];
int d, e;
int main() {
	scanf(" %s", s);
	while (s[d] != NULL)d++;
	for (int i = 0; i < d; i++) {
		if (i % 2) {
			if (s[i] != 'i')e = 1;
		}
		else {
			if (s[i] != 'h')e = 1;
		}
	}
	if (d % 2)e = 1;
	if (e)printf("No\n");
	else printf("Yes\n");
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

set<ll> a;

ll gcd(ll a, ll b)
{
  if(a < b) {
    ll c = a;
    a = b;
    b = c;
  }
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(void)
{
  ll n, k, a1;
  cin >> n >> k;
  ll agcd, amax = 0;
  REP(i, n) {
    cin >> a1;
    if(i > 0) {
      agcd = gcd(agcd, a1);
    } else {
      agcd = a1;
    }
    if(a1 > amax) amax = a1;
    a.insert(a1);
  }
  if(k % agcd == 0 && k <= amax) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 4992
import java.io.PrintWriter;
import java.util.*;

public class Main {
    Scanner in = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);

    public void run() {
        int Q = in.nextInt();

        boolean[] isPrime = new boolean[100100];
        Arrays.fill(isPrime, true);
        isPrime[0] = isPrime[1] = false;
        for (int i = 2; i < isPrime.length; i++) {
            if (!isPrime[i]) continue;
            for (int j = i + i; j < isPrime.length; j += i) {
                isPrime[j] = false;
            }
        }

        int[] imos = new int[100100];
        for (int i = 2; i < imos.length; i++) {
            imos[i] = (isPrime[i] && isPrime[(i+1)/2]) ? 1 : 0;
        }
        for (int i = 2; i < imos.length - 1; i++) {
            imos[i+1] += imos[i];
        }

        for (int q = 0; q < Q; q++) {
            int l = in.nextInt(), r = in.nextInt();
            out.println(imos[r] - imos[l-1]);
        }
        out.flush();
    }


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


Measured memory_bytes: 70012
#include "bits/stdc++.h"
using namespace std;
const long long INF = 1ll << 60;

int main() {
 	long long N, X, D;
	cin >> N >> X >> D;
	
	if (0 == D) {
		if (0 == X) {
			cout << 1 << endl;
		}
		else {
			cout << N + 1 << endl;
		}
		return 0;
	}
	map<int, vector<pair<long long, long long>>>mp;
	for (int i = 0 ;i < N+1;++i) {
		long long s = X * i;
		long long l = (long long)i*(i - 1) / 2;
		long long r = l + (long long)i*(N - i);
		s += l * D;
		r -= l;
		mp[(s%D+D)%D].emplace_back(s,r);
	}

	long long ans = 0;
	for (auto p :mp) {
		auto a = p.second;
		int m = a.size();
		for (int i = 0;i<m;++i) {
			a[i].first = (a[i].first-p.first) / D;
		}
		vector<pair<long long, long long>>ev;
		for (int i = 0;i < m;++i) {
			ev.emplace_back(a[i].first,1);
			ev.emplace_back(a[i].first+a[i].second + 1, -1);
		}
		sort(ev.begin(), ev.end());
		long long cnt = 0, pre = -INF;
		for (auto e : ev) {
			long long len = e.first - pre;
			if (cnt) ans += len;
			cnt += e.second;
			pre = e.first;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 25448
h,w = map(int,input().split())
line = [input() for i in range(h)]
alist = [list(line[i]) for i in range(h)]

zlist = []
for i in range(h+2):
    zlist.append([])
    for j in range(w+2):
        zlist[i].append(0)
#print(zlist)

shp = []
for i in range(h):
    
    for j in range(w):
        x = i + 1
        y = j + 1
        if alist[i][j] == "#":
            shp.append([i,j])
            
            zlist[x-1][y-1] += 1#１つ前の行x3
            zlist[x-1][y  ] += 1
            zlist[x-1][y+1] += 1
            
            zlist[x][y-1]   += 1#現在の行x2
            zlist[x][y+1]   += 1
            
            zlist[x+1][y-1] += 1#１つ後の行x3
            zlist[x+1][y  ] += 1
            zlist[x+1][y+1] += 1

for ele in shp:
    x = ele[0]
    y = ele[1]
    zlist[x+1][y+1] = "#"

for i in range(h):
    for j in range(w):
        print(zlist[i+1][j+1],end="")
    print()

Measured memory_bytes: 3700
# https://atcoder.jp/contests/abc122/tasks/abc122_b


S = input()
SPECIAL = ["A", "C", "G", "T"]

ans = 0
n = 0
for s in S:
    if s in SPECIAL:
        n += 1
    else:
        if ans < n:
            ans = n
        n = 0
if ans < n:
    ans = n

print(ans)


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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

int m[105];
int mi = 100000;
int main() {
    int n, x;
    cin >> n >> x;

    int sum = 0;

    rep(i,n){
        cin >> m[i];
        if (mi > m[i]) {
            mi = m[i];
        }
        sum += m[i];
    }

    int ans = n;

    x -= sum;
    ans += x/mi;
    cout << ans << endl;


}



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))

typedef long long LL;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  int zouka=0;
  int ans=1;
  for(int i=1;i<n;i++){
    if(a[i-1]<a[i]){
      if(zouka==-1){
        zouka=0;
        ans++;
      }else{
        zouka=1;
      }
    }else if(a[i-1]>a[i]){
      if(zouka==1){
        zouka=0;
        ans++;
      }else{
        zouka=-1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;

class Program
{
    #region library
    static long n = 0;
    static long r = 0;
    static long c = 0;
    static long x = 0;
    static long y = 0;
    static string s = "";
    static string[] ss;
    static long sum = 0;
    static long cnt = 0;
    static long max = -1;
    static long min = 2147483647;
    static bool flg = false;
    static bool flg2 = false;
    static string alpha = "abcdefghijklmnopqrstuvwxyz";
    static long[] arr;
    static char[,] map;
    static long[,] imap;
    static string rl()
    {
        return Console.ReadLine();
    }
    static string[] rls()
    {
        return Console.ReadLine().Split();
    }
    static void wl(object obj = null)
    {
        Console.WriteLine(obj);
    }
    static void w(object obj)
    {
        Console.Write(obj);
    }
    static long Int(string s)
    {
        return long.Parse(s);
    }
    static void yes()
    {
        wl("YES");
    }
    static void no()
    {
        wl("NO");
    }
    static void Sum()
    {
        wl(sum);
    }
    static void Cnt()
    {
        wl(cnt);
    }
    static void setarray(long num = -1)
    {
        if (n == 0)
        {
            n = Int(rl());
        }
        arr = new long[n];
        if (num == -1) ss = rls();
        for (int i = 0; i < n; i++)
        {
            if (num == -1)
                arr[i] = Int(ss[i]);
            else
                arr[i] = num;
        }
    }
    static void setmap(char def = '@')
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        map = new char[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == '@') s = rl();
            for (int j = 0; j < c; j++)
            {
                map[i, j] = (def == '@') ? s[j] : def;
            }
        }
    }
    static void setimap(long def = -1)
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        imap = new long[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == -1) s = rl();
            for (int j = 0; j < c; j++)
            {
                imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def;
            }
        }
    }
    #endregion

    static void Main(string[] args)
    {
        setarray();
        Array.Sort(arr);
        double ans = (double)(arr[0] + arr[1]) / 2;
        for (int i = 2; i < arr.Length; i++)
        {
            ans = (ans + arr[i]) / 2;
        }
        wl(ans);
    }
        

}



Measured memory_bytes: 11348
# AGC004 A - Divide a Cuboid
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,c = nl()
V = a*b*c
ans = 0
if a%2==0 or b%2==0 or c%2==0:
    print(ans)
    exit()
odd = []

if a%2==1:
    odd.append(a)
if b%2==1:
    odd.append(b)
if c%2==1:
    odd.append(c)
d = (max(odd))//2
e = odd.count(max(odd))
S_min = 0
S_max = 0

if e==1 or e==3:
    if a == max(odd):
        S_min = d*b*c 
    if b == max(odd):
        S_min = d*a*c 
    if c == max(odd):
        S_min = d*b*a 
elif e==2:
    if a == min(odd):
        S_min = d*b*a 
    if b == min(odd):
        S_min = d*c*b 
    if c == min(odd):
        S_min = d*a*c
S_max = V-S_min
ans = S_max-S_min
print(ans)

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> X(M);
  for(int i=0; i<M; i++) cin >> X[i];
  sort(X.begin(), X.end());
  
  vector<int> diff;
  for(int i=0; i<X.size()-1; i++)
    diff.emplace_back(X[i+1]-X[i]);
  
  sort(diff.begin(), diff.end(), greater<int>());
  
  int ans = X.back() - X[0];
  for(int i=0; i<min((int)diff.size(),N-1); i++)
    ans -= diff[i];
  
  cout << ans << endl;
}


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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define endl "\n"

#define k first
#define v second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define ALL(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.k << ", " << p.v << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    int n;
    string s;
    cin >> n >> s;
    int res = 0;
    for (int i = 1; i < n - 1; i++) {
        bitset<26> left_c;
        auto lefts = s.substr(0, i);
        for (auto &c : lefts) {
            left_c[c - 'a'] = true;
        }
        bitset<26> right_c;
        auto rights = s.substr(i);
        for (auto &c : rights) {
            right_c[c - 'a'] = true;
        }
        res = max(res, (int)(left_c & right_c).count());
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main(){
    string str;

    getline(cin, str);
    
    for(int i = 0; i< str.size(); i++){
        if(isupper(str[i]))
            str[i] = tolower(str[i]);   
        else if(islower(str[i]))
            str[i] = toupper(str[i]);
    }

    cout << str << endl;

    return 0;
}


Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>

using namespace std;

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(n), b(n);
  vector<int> c(m), d(m);
  for(int i=0; i<n; i++){
    cin >> a[i] >> b[i];
  }
  for(int i=0; i<m; i++){
    cin >> c[i] >> d[i];
  }
  for(int i=0; i<n; i++){
    pair<int, int> mn(1e9, 1e9);
    for(int j=0; j<m; j++){
      int e = abs(c[j] - a[i]) + abs(d[j] - b[i]);
      mn = min(mn, make_pair(e,j));
    }
    cout << mn.second + 1 << endl;
  }
}

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

using namespace std;

int main()
{
    long long n;
    cin>>n;
    vector<string> a(n);
    unordered_map<string, int> hs;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        hs[a[i]]++;
    }
    int maxi = 0;
    set<string> b;
    for(auto i : hs)
    {
        if(maxi<=i.second)
            maxi = i.second;
    }

    for(auto i : hs)
        if(i.second == maxi)
           b.insert(i.first);
    set <string> :: iterator itr;
    for (itr = b.begin(); itr != b.end(); itr++)
    {
        cout <<*itr<<" ";
    }

    return 0;
}


Measured memory_bytes: 35016
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const vector<pll> dir={{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm (ll a,ll b) {return a*b/gcd(a,b);}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}

vector<ll> func,inv;
void init(ll n){
    func.resize(n+1);inv.resize(n+1);
    func[0]=1;
    rep(i,0,n) {func[i+1]=func[i]*(i+1)%MOD;}
    inv[n]=intpow(func[n],MOD-2);
    rrep(i,1,n+1) {inv[i-1]=inv[i]*i%MOD;}
}
ll comb(ll a,ll b) {return func[a]*inv[b]%MOD*inv[a-b]%MOD;}

inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
template<class T> inline bool chmax(T& a,T b) {if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b) {if(a>b){a=b;return 1;} return 0;}

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n),b(n-1);
    rep(i,0,n-1) cin>>b[i];
    a[0]=b[0];
    rep(i,1,n-1){
        a[i]=min(b[i-1],b[i]);
    }
    a[n-1]=b[n-2];
    ll ans=0;
    rep(i,0,n) ans+=a[i];
    cout<<ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int ans = 1;
		for (int i=1; i<1000; i++){
			for(int p=2; p<1000; p++){
				if (Math.pow(i, p) <= X && ans < Math.pow(i, p)){
					ans = (int)Math.pow(i, p);
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22996
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
    	iota(par.begin(),par.end(),0);
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

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

	UnionFind uf(N);
	for(int i=0;i<M;i++){
		int u,v,z; cin >>u>>v >>z;
		u--; v--;
		uf.unite(u,v);
	}
	set<int> par;
	for(int i=0;i<N;i++){
		par.insert(uf.find(i));
	}
	cout << par.size() << endl;
	return 0;
}


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

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

	string s;
    cin >> s;
    int len = s.length();
    int count = 0;
	int ans = 0;

    for(int i = 0; i < len; i++) {
        if(s[i] == 'A' || s[i] == 'G' || s[i] == 'T' || s[i] == 'C') {
           count = 1;
           for(int j = i + 1; j < len; j++) {
               if(s[j] == 'A' || s[j] == 'G' || s[j] == 'T' || s[j] == 'C') {
                  count++;
               }else {
                break;
           }
	     }
	   }
  	   ans = max(count, ans);
	   count = 0;
    }
    cout << ans << endl;
}

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

int main(){
    int d, n;
    cin >> d >> n;
    int ans = 0;
    if(d == 0){
        if(n<100){
            ans = n;
        }else{
            ans = 101;
        }
    }else if(d == 1){
        if(n<100){
            ans = n * 100;
        }else{
            ans = 101 * 100;
        }

    }else{
        if(n<100){
            ans = n * 10000;
        }else{
            ans = 101 * 10000;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math

n = int(input())
k = int(input())

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

def count(num_str,k):
    digits = len(num_str)
    if digits == 0:
        return 0
    else:
        if k == 0:
            # print(num_str,1)
            return 1
        if num_str[0] == '0':
            # print(num_str,count(num_str[1:],k-1))
            return count(num_str[1:],k)
        else:
            if digits == 1 and k == 1:
                # print(num_str,int(num_str))
                return int(num_str)
            elif digits == 1 and k > 1:
                # print(num_str,0)
                return 0
            if digits >= k+1:
                count_0 = combinations_count(digits-1,k)*(9**k)
            else:
                count_0 = 0
            count_1 = combinations_count(digits-1,k-1)*(9**(k-1))
            # print(num_str,count_0 + count_1*(int(num_str[0])-1)+count(num_str[1:],k-1))
        return count_0 + count_1*(int(num_str[0])-1)+count(num_str[1:],k-1)

print(count(str(n),k))

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

int n;
int dp[4][100010]={0};
int solve(int i, int a[],int b[], int c[], int f){
	if(i==0){
		if(f==1){
			return max(b[i],c[i]);
		}
		else if(f==2)
			return max(a[i],c[i]);
		else
			return max(a[i],b[i]);
	}
	if(f==1){
		if(!dp[2][i-1])
			dp[2][i-1] = solve(i-1,a,b,c,2);
		// if(!dp[1][i-1])
		// 	dp[1][i-1] = solve(i-1,a,b,c,dp,1);
		if(!dp[3][i-1])
			dp[3][i-1] = solve(i-1,a,b,c,3);
		int x = b[i]+dp[2][i-1];
		int y = c[i]+dp[3][i-1];
		return max(x,y);
	}
	if(f==2){
		if(!dp[1][i-1])
			dp[1][i-1] = solve(i-1,a,b,c,1);
		// if(!dp[1][i-1])
		// 	dp[1][i-1] = solve(i-1,a,b,c,dp,1);
		if(!dp[3][i-1])
			dp[3][i-1] = solve(i-1,a,b,c,3);
		int x = a[i]+dp[1][i-1];
		int y = c[i]+dp[3][i-1];
		return max(x,y);
	}
	if(f==3){
		if(!dp[2][i-1])
			dp[2][i-1] = solve(i-1,a,b,c,2);
		// if(!dp[1][i-1])
		// 	dp[1][i-1] = solve(i-1,a,b,c,dp,1);
		if(!dp[1][i-1])
			dp[1][i-1] = solve(i-1,a,b,c,1);
		int x = b[i]+dp[2][i-1];
		int y = a[i]+dp[1][i-1];
		return max(x,y);
	}
	
}
 
int main() {
	// int n;
	cin >> n;
	int a[n],b[n],c[n];
	// int dp[4][n] = {0};

	for(int i=0;i<n;i++)
		cin >> a[i] >>b[i]>>c[i];
	dp[1][n-1] = solve(n-1,a,b,c,1);
	dp[2][n-1] = solve(n-1,a,b,c,2);
	dp[3][n-1] = solve(n-1,a,b,c,3);

	cout<<max(dp[1][n-1],max(dp[2][n-1],dp[3][n-1]))<<endl;
}

Measured memory_bytes: 10368
N = int(input())
H = list(map(int, input().split()))
min_ = int(10**9 + 1)

for i in H[::-1]:
    if i <= min_:
        min_ = i
    elif i == min_ + 1:
        pass
    else:
        print("No")
        break
else:
    print("Yes")


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

int main() {
  int m;
  cin >> m;
  cout << 48 - m << endl;
  return 0;
}

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

int main() {
  int n, m, p;
  while (cin >> n >> m >> p, n) {
    vector<vector<vector<int>>> board(n, vector<vector<int>>(n, vector<int>(n, -1)));
    int ans = 0;
    for (int q = 0; q < p; q++) {
      int x, y;
      cin >> x >> y, x--, y--;

      if (ans > 0) continue;

      int z = n;
      while (z - 1 >= 0 && board[z - 1][x][y] < 0) z--;
      if (z < n) board[z][x][y] = q % 2;

      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          for (int k = 0; k < n - m + 1; k++) {
            vector<int> c(13, 0);
            for (int l = 0; l < m; l++) {
              if (board[i][j][k + l] == q % 2) c[0]++;
              if (board[k + l][i][j] == q % 2) c[1]++;
              if (board[j][k + l][i] == q % 2) c[2]++;
            }
            if (j < n - m + 1) {
              for (int l = 0; l < m; l++) {
                if (board[i][j + l][k + l] == q % 2) c[3]++;
                if (board[i][j + l][n - 1 - (k + l)] == q % 2) c[4]++;
                if (board[k + l][i][j + l] == q % 2) c[5]++;
                if (board[n - 1 - (k + l)][i][j + l] == q % 2) c[6]++;
                if (board[j + l][k + l][i] == q % 2) c[7]++;
                if (board[j + l][n - 1 - (k + l)][i] == q % 2) c[8]++;
              }
            }
            if (i < n - m + 1 && j < n - m + 1) {
              for (int l = 0; l < m; l++) {
                if (board[i + l][j + l][k + l] == q % 2) c[9]++;
                if (board[n - 1 - (i + l)][j + l][k + l] == q % 2) c[10]++;
                if (board[i + l][n - 1 - (j + l)][k + l] == q % 2) c[11]++;
                if (board[i + l][j + l][n - 1 - (k + l)] == q % 2) c[12]++;
              }
            }
            for (int l = 0; l < 13; l++) {
              if (c[l] == m) ans = q + 1;
            }
          }
        }
      }
      // for (int i = 0; i < n; i++) {
      //   cout << i << endl;
      //   for (int j = 0; j < n; j++) {
      //     for (int k = 0; k < n; k++) cout << board[i][j][k] << ' '; cout << endl;
      //   }
      //   cout << endl;
      // }
    }

    if (ans == 0) {
      cout << "Draw" << endl;
    } else {
      cout << ((ans % 2 == 0) ? "White" : "Black") << ' ' << ans << endl;
    }
  }
}



Measured memory_bytes: 3140
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <math.h>

using namespace std;

const int MAX_N = 10000;

typedef struct {
    int x, y;
} Pile;

typedef struct {
    int a, b;
    double cost;
} Edge;

bool operator < (const Edge& l, const Edge& r){
    return l.cost < r.cost;
}

int _par[MAX_N];
int _rank[MAX_N];

void init(int n){
    for(int i=0; i<n; i++){
        _par[i] = i;
        _rank[i] = 0;
    }
}

int root(int x){
    if(x == _par[x])
        return x;
    return _par[x] = root(_par[x]);
}

void unite(int x, int y){
    x = root(x);
    y = root(y);
    
    if(_rank[x] < _rank[y]){
        _par[x] = y;
    }else{
        _par[y] = x;
        if(_rank[x] == _rank[y])
            _rank[x]++;
    }
}

bool is_same_group(int x, int y){
    return root(x) == root(y);
}


int main(){
    int n, m;
    cin >> n >> m;
    
    vector<Pile> piles(n);
    for(int i=0; i<n; i++){
        Pile & pile = piles[i];
        cin >> pile.x >> pile.y;
    }
    
    priority_queue<Edge> edges;
    for(int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        
        double cost = sqrt((piles[a].x-piles[b].x)*(piles[a].x-piles[b].x) + (piles[a].y-piles[b].y)*(piles[a].y-piles[b].y));
        
        Edge edge;
        edge.a = a; edge.b = b; edge.cost = cost;
        
        edges.push(edge);
    }
    
    double ans = 0;
    
    init(n);
    while(!edges.empty()){
        Edge edge = edges.top(); edges.pop();
        
        if(is_same_group(edge.a, edge.b)){
            ans += edge.cost;
        }else{
            unite(edge.a, edge.b);
        }
    }
    
    printf("%.3lf\n", ans);
    
    return 0;
}

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

int main() {
  ll h, w;
  cin >> h >> w;
  if (h==1 || w==1) cout << 1 << endl;
  else cout << (h*w+1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
import math
a,b,x = map(int, input().split())
#傾けたときにちょうど三角形になる
tri = (a*b/2)*a
tan = b/a


if x <= tri:
    y = (2*x)/(a*b)
    tan = b/y
    ans = math.degrees(math.atan(tan))

else:
    emp = (a*a*b) - x
    y = (2*emp)/(a**2)
    tan = y/a
    ans = math.degrees(math.atan(tan))

print(ans)

Measured memory_bytes: 3060
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        static void Main(){
            WriteLine(Pow(ILongs()[0],3));
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
 
const int N = 110; 
char s[N][N]; 
int n, m; 
int dp[N][N]; 
 
int main() {
  scanf("%d %d", &n, &m);
  for(int i = 1; i <= n; ++i) 
    scanf("%s", s[i] + 1); 
 
  dp[1][1] = s[1][1] == '#';
  for(int i = 1; i <= n; ++i) {
    for(int j = 1; j <= m; ++j) {
      if(i == 1 && j == 1) continue; 
      dp[i][j] = 1e9; 
      if(s[i][j] == '#') {
        if(i > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j] + (s[i - 1][j] != '#')); 
        if(j > 1) dp[i][j] = min(dp[i][j], dp[i][j - 1] + (s[i][j - 1] != '#')); 
      } else {
        if(i > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j]); 
        if(j > 1) dp[i][j] = min(dp[i][j], dp[i][j - 1]); 
      }
    }
  }
 
  printf("%d\n", dp[n][m]); 
  return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
H = input().split()
H = [int(x) for x in H]

L = [0 for _ in range(N)]

for _ in range(M):
  A,B = map(int,input().split())
  x = H[A-1]
  y = H[B-1]
  if H[A-1] <= y:
    L[A-1] = 1
  if H[B-1] <= x:
    L[B-1] = 1
c = 0
for x in L:
  if x == 0:
    c +=1
print(c)

Measured memory_bytes: 20048
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<random>
#include<ctime>
using namespace std;

#define ll long long

#define debug_message 0
#define debug if (debug_message)

#define sz(x) (int)x.size()

int i,t,j;
int n,m,nt,p[20005],a[20005],b[20005],sum;
int adda,addb;
string s,s1,s2;
bool ok;

mt19937 gen(time(NULL));
uniform_int_distribution<int> dis(0,2e9);

int int_rd(int l, int r) {
	return dis(gen)%(r-l+1)+l;
}

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

	for (i=1; i<=n; ++i) {
		scanf("%d",&p[i]);
	}

//	while(ok==0) {
//		for (i=1; i<=n; ++i) {
//			a[i]=int_rd(a[i-1]+1,a[i-1]+20005);
//		}
//		
//		for (i=n; i>=1; --i) {
//			b[i]=int_rd(b[i+1]+1,b[i+1]+20005);
//		}
//		
//		ok=1;
//		for (i=1; i<=n; ++i) {
//			if (a[p[i]]+b[p[i]]<=a[p[i-1]]+b[p[i-1]]) {
//				ok=0;
//				break;
//			}
//		}
//	}
	
	for (i=1; i<=n; ++i) a[i]=i*20005;
	for (i=n; i>=1; --i) b[i]=(n-i+1)*20005;
	
	for (i=1; i<=n; ++i){
		b[p[i]]-=10000-i;
	}

	for (i=1; i<=n; ++i) printf("%d%c",a[i],i==n?'\n':' ');
	for (i=1; i<=n; ++i) printf("%d%c",b[i],i==n?'\n':' ');

	return 0;
}
/*

*/

Measured memory_bytes: 4040
#include <iostream>
#include <string>
#include <math.h>
 
using namespace std;
 
int main(void)
{
    long long int sum=0,range=0,a1,b1,a2,b2;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,money;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    string s,s1;
    cin>>s>>s1;
    cout<<s1<<s;
    return 0;
}
 

Measured memory_bytes: 256
n,A,B,C,D = map(int,input().split())
s = input()[A-1:max(C,D)]
flag = 1
a,b,c,d = 0,B-A,C-A,D-A
if s[a]=='#' or s[b]=='#' or s[c]=='#' or s[d]=='#':
  flag = 0
if bool('##' in s) == 1:
  flag = 0
if c > d:
  scut = s[b-1:d+2]
  if bool('...' in scut) == 0:
    flag = 0
if flag == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3572
object Main extends App {

  val Array(n, m, l) = io.StdIn.readLine().split(" ").map(_.toInt)

  val a = Array.ofDim[Long](n,m)
  val b = Array.ofDim[Long](m,l)
  for(i <- 0 until n)
    a(i) = io.StdIn.readLine().split(" ").map(_.toLong)
  for(i <- 0 until m)
    b(i) = io.StdIn.readLine().split(" ").map(_.toLong)

  val ans: Array[Array[Long]] = Array.fill(n,l)(0)
  for(i <- 0 until n; j <- 0 until l; k <- 0 until m)
    ans(i)(j) += a(i)(k) * b(k)(j)

  val sb = StringBuilder.newBuilder
  for(e <- ans)
    sb.append(e.mkString(" ")).append("\n")
  print(sb)
}


Measured memory_bytes: 55564
class Node
  attr_accessor :child, :parent
  def initialize
    @child = {}
    @parent = {}
  end
end

v, e = gets.split.map(&:to_i)
g = Array.new(v){Node.new}

edges = {}
e.times{
  s, t = gets.split.map(&:to_i)
  g[s].child[t] = 1
  g[t].parent[s] = 1
  edges[[s,t]] = true
}

list = []
start = []
v.times{|i|
  if g[i].parent.size == 0
    start << i
  end
}

while start.size > 0
  n = start.shift
  list << n
  ed = g[n].child.clone
  ed.each{|m, val|
    g[n].child.delete(m)
    g[m].parent.delete(n)
    edges.delete([n,m])
    start << m if g[m].parent.size == 0
  }
end

if edges.size == 0 then
  puts 0
else
  puts 1
end

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

int main(){
	int n; cin>>n;
	int l[n];
	rep(i,n) cin>>l[i];
	sort(l,l+n);
	int ans=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			for(int k=j+1; k<n; k++){
				if(l[i]!=l[j] && l[j]!=l[k] && l[i]!=l[k] 
				&& l[k]<l[i]+l[j]){
					ans++;
					//cout<<l[k]<<" "<<l[i]<<" "<<l[i]<<endl;
					
				}
				//cout<<l[k]<<" "<<l[j]<<" "<<l[i]<<endl;
			}
		}
	}
	cout<<ans<<endl;
}
		

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
using namespace std;
int n;

struct pairs{
	int id,number;
	bool operator<(const pairs& b) const{
		return number<b.number;
	}
}a[1000000];

int main(){
	cin>>n;
	for(int i = 1;i<=n;i++){
		a[i].id = i;
		cin>>a[i].number;
	}
	sort(a+1,a+n+1);
	for(int i = 1;i<n;i++){
		cout<<a[i].id<<" ";
	}
	cout<<a[n].id<<endl;
	return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int A = std.nextInt();
        int B = std.nextInt();
        int T = std.nextInt();

        double totalTime = T + 0.5;
        int takes = (int)totalTime / A;
        System.out.println(B * takes);
    }
}


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

int main() {
  LL n, m;
  cin >> n >> m;
  vector<LL> a[n];
  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < 3; j ++) {
      LL t; cin >> t;
      a[i].push_back(t);
    }
  }

  LL ans = 0;
  for (int bit = 0; bit < (1 << 3); bit ++) {
    vector<LL> b;
    for (int i = 0; i < n; i ++) {
      LL t = 0;
      for (int j = 0; j < 3; j ++) {
        if (bit & (1 << j)) t += a[i][j];
        else t -= a[i][j];
      }
      b.push_back(t);
    }

    LL sum = 0;
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());
    for (int i = 0; i < m; i ++) sum += b[i];
    ans = max(ans, sum);
  }

  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

vector<char> v;
void po(int a){
  //cout<<a<<endl;
  if(a>0){
    int i=a%26;
    if(i==0)i=26;
    v.pb('a'+i-1);
    a-=i;
    po(a/26);
  }
}
signed main(){
  int n;cin>>n;
  po(n);
  for(int i=v.size()-1;i>=0;i--)cout<<v[i];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int ans = 0;
  int n;
  cin >> n;
  rep(i, n){
    int a;
    cin >> a;
    while(a % 2 == 0){
      a /= 2;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

ll gcd(ll a, ll b) {
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main() {
	ll K;
	cin >> K;

	ll sum = 0;
	for (ll ii = 1; ii <= K; ++ii){
		for (ll jj = 1; jj <= K; ++jj){
			for (ll kk = 1; kk <= K; ++kk){
				sum += gcd(ii, gcd(jj, kk));
			}
		}
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3636
using namespace std;
#include<bits/stdc++.h>
#define Ranger159 ios_base::sync_with_stdio(false);
#define PrintLater cin.tie(0);cout.tie(0);
#define ll long long
#define phb push_back
#define break break
#define pob pop_back()
#define continue continue
#define size size
#define insrt insert
#define fir first
#define true true
#define clear clear
#define vL vector<ll> 
#define resize resize
#define sec second
#define else else
#define reverse reverse
#define lbr1 cout<<"\n";
#define lbr2 cout<<"\n\n";
#define cin(v,n) for(ll i=0;i<n;i++) cin>>v[i];
#define cout(v,n) for(ll i=0;i<n;i++) cout<<v[i]<<" "; lbr1
const ll mod=1e9+7;

int main(int argc, char const *argv[])
{
	Ranger159
	// PrintLater
	ll test=1,n,a,b,c,k,i;
	// cin>>test;
	while(test--)
	{
		cin>>n;
		vL v(n); cin(v,n);
		
		ll amnt=1000, stock=0;

		for(ll i=0;i<n;i++)
		{
			ll l=i+1, r=n, f=0;
			while(l<r and v[l]>v[i])
			{
				f=1;
				break;
			}
			if(f==1 and amnt>=v[i])
			{
				stock+=amnt/v[i];
				amnt=amnt-v[i]*(amnt/v[i]);
			}
			else if(f==0)
			{
				amnt+=stock*v[i];
				stock=0;
			}
		}
		cout<<amnt;
		lbr1
	}
	return 0;
}

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

namespace PlacingMarbles
{
    class Program
    {
        /// <summary>
        /// メイン処理
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            string mass = Console.ReadLine();

            // 結果出力
            Console.WriteLine(mass.Count(num => num == '1'));
        }
    }
}


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

using namespace std;

int main(){
        int N,tmp,mi,mx;
        cin >> N;
        for(int i=0;i<N;i++){
                cin >> tmp;
                if(i==0) mi=mx=tmp;
                if(tmp<mi) mi=tmp;
                if(tmp>mx) mx=tmp;
        }
        cout << mx-mi << endl;
        return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int n,pm,pe,pj;
char cls()
{
	if(max(pm,max(pe,pj))==100||pm+pe>=180||pm+pe+pj>=240)return 'A';
	if(pm+pe+pj>=210||pm+pe+pj>=150&&max(pm,pe)>=80)return 'B';
	return 'C';
}
int main()
{
	while(scanf("%d",&n),n)
	{
		rep(i,n)
		{
			scanf("%d%d%d",&pm,&pe,&pj);
			printf("%c\n",cls());
		}
	}
	return 0;
}

Measured memory_bytes: 0