akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdlib>
#include <string>
#include <queue>

using namespace std;

struct Process {
    Process(string _name, int _time) :
	name(_name), time(_time) {

    }
    int		time;
    string	name;
};

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

    int n;
    int q;
    int sumTime = 0;
    queue<Process> Q;

    cin >> n >> q;
    for (int i = 0; i < n; i++) {
	string name;
	int time;
	cin >> name >> time;
	Q.push(Process(name, time));
    }

    while (!Q.empty()) {
	Process p = Q.front(); Q.pop();
	if (p.time <= q) {
	    sumTime += p.time;
	    cout << p.name << " " << sumTime << "\n";
	}
	else {
	    p.time -= q;
	    sumTime += q;
	    Q.push(p);
	}
    }
    
    return 0;
}

Measured memory_bytes: 6316
def f(rest, k)
    if k == 1
        0 <= rest && rest <= 1000 ? 1 : 0
    else
        ([0, rest-1000*(k-1)].max..[1000, rest].min).map{|x| f(rest-x, k-1)}.inject(:+)
    end
end

module Memoizable
    def memoize(name)
        original = "__original_#{name}__"
        ([Class, Module].include?(self.class) ? self : self.class).class_eval {
            alias_method(original, name)
            private(original)
            cache = {}
            define_method(name){|*args|
                cache[args] ||= send(original, *args)
            }
        }
    end
end

include Memoizable
memoize :f

p f($_.to_i, 4) while gets

Measured memory_bytes: 7032
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int[] n;
		RPS rps;
		
		out : while(true){
			n = new int[5];
			for(int i=0;i<5;i++){
				n[i] = scan.nextInt();
				if(n[i] == 0){
					break out;
				}
			}
			
			rps = new RPS(n);
			rps.game();
			for(int i=0;i<5;i++){
				System.out.println(rps.getResult(i));
			}
		}
	}
}

class RPS{
	int[] hand,result;
	boolean rock,paper,scissors;
	
	RPS(int[] hand){
		this.hand = hand;
		result = new int[5];
		rock = false;
		scissors = false;
		paper = false;
	}
	
	public void game(){
		for(int i=0;i<hand.length;i++){
			if(hand[i] == 1){
				rock = true;
			}else if(hand[i] == 2){
				scissors = true;
			}else{
				paper = true;
			}
		}
		
		for(int i=0;i<hand.length;i++){
			if(rock && scissors && paper){
				result[i] = 3;
			}else if(rock && scissors){
				if(hand[i] == 1){
					result[i] = 1;
				}else{
					result[i] = 2;
				}
			}else if(scissors && paper){
				if(hand[i] == 2){
					result[i] = 1;
				}else{
					result[i] = 2;
				}
			}else if(paper && rock){
				if(hand[i] == 3){
					result[i] = 1;
				}else{
					result[i] = 2;
				}
				
			}else{
				result[i] = 3;
			}
		}
	}
	
	public int getResult(int index){
		return result[index];
	}
}

Measured memory_bytes: 20804
-- SPDX-License-Identifier: X11
-- 2020-09-22
-- ∴ (Therefore) (100pt)

f :: Char -> String
f x = let h = "24579"
          p = "0168"
      in g x h p : "on"
  where
    g :: Char -> String -> String -> Char
    g y h p
      | y `elem` h = 'h'
      | y `elem` p = 'p'
      | otherwise  = 'b'

main :: IO ()
main = getLine >>= \x -> putStrLn . f . last $ x


Measured memory_bytes: 3772
#include<stdio.h>

int main(void){

  char s[100000];
  scanf("%s",s);
  int i;
  int m;
  int a=0;
  int b=0;
  int count=0;
  for(m=0;s[m]!='\0';m++){
    count++;
  }
if(m%2==0){
  for(i=0;i<count;i=i+2){
    if(s[i]!='0'){
      a++; 
    }
  }
  for(i=1;i<=count;i=i+2){
    if(s[i]!='1'){
      a++;
    }
  }

  for(i=0;i<count;i=i+2){
    if(s[i]!='1'){
      b++;
    }
  }
  for(i=1;i<=count;i=i+2){
    if(s[i]!='0'){
      b++;
    }
  }
}

if(m%2!=0){
  for(i=0;i<=count;i=i+2){
    if(s[i]!='0'){
      a++;
    }
  }
  for(i=1;i<count;i=i+2){
    if(s[i]!='1'){
      a++;
    }
  }

  for(i=0;i<=count;i=i+2){
    if(s[i]!='1'){
      b++;
    }
  }
  for(i=1;i<count;i=i+2){
    if(s[i]!='0'){
      b++;
    }
  }
}
  //少ない方を出力

  if(a>b){
    printf("%d",b);
  }else if(b>a){
    printf("%d",a);
  }else{
    printf("%d",a);
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define V vector
#define L long
using namespace std;L E=70,M=2e17,i,a,b;V<L> S(V<V<L>>p){if(!E)return{1,0};V<V<V<L>>>T(2);for(V<L>x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1)T[x[1]&1].push_back({x[0]/2,++x[1]/2});}for(L i;i<2;i++){a=0;for(V<L>x:T[!i])a^=(2*x[0]+x[1])%3+1;if(!a){E--;V<L>A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(V<L>&v:p)v[0]++;V<L> A=S(p);A[0]--;return A;}int main(){cin>>i;V<V<L>>p(i);while(i--,cin>>a>>b)p[i]={a+M,b+M};V<L> x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

Measured memory_bytes: 62908
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

bool check (string S, string T, int k)
{
   corner(T.size() + k > S.size(),"Out of Size");
   bool check = 1;
   for (int i = 0; i < T.size(); i++)
   {
    if((S[k+i] == T[i] || S[k+i] == '?')^(true)) check = 0;
   }

   return check;
}

string fill(string S,string T,int k)
{
  string filled = S;
  for (int i = 0; i < T.size(); i++)
  {
    filled[k+i] = T[i];
  }
  for (int i = 0; i < S.size(); i++)
  {
    if(filled[i] == '?')filled[i] = 'a';
  }
  
  return filled;
}
void solve(void)
{
  int N;
  cin>>N;
  int ANS = 0;
  for (int i = 1; i*i <= N; i++)
  {
    ANS = i;
  }
  cout<<ANS*ANS;
  
   
}


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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>

bool is_all_connected(int pt, std::vector<std::vector<int>>& connections, long long& record, long long all_mask, int step)
{
    //std::cout << "step:" << step << ", pt: " << pt << ", record: " << std::hex << record << std::dec << std::endl;
    if(record == all_mask) return true;

    for(unsigned int i = 0; i < connections.at(pt).size(); i++){
        int np = connections.at(pt).at(i);
        long long m = (1LL << np);
        if((record & m) == 0){
            record |= m;
            bool f = is_all_connected(np, connections, record, all_mask, step+1);
            if(f == true) return true;
        }
    }
    return false;
}


int main(int argc, char **argv)
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> a(M), b(M);
    for(int i = 0; i < M; i++){
        std::cin >> a.at(i) >> b.at(i);
    }

    int ans = 0;
    long long all_mask = (1LL << N) - 1;
    //std::cout << std::hex << "all: " << all_mask << std::dec << std::endl;
    for(int j = 0; j < M; j++){
        std::vector<std::vector<int>> connections(N, std::vector<int>());
        for(int i = 0; i < M; i++){
            if(i != j){
                connections.at(a.at(i)-1).push_back(b.at(i)-1);
                connections.at(b.at(i)-1).push_back(a.at(i)-1);
            }
        }
        long long record = 1LL;
        bool f = is_all_connected(0, connections, record, all_mask, 0);
        //std::cout << "check: " << f << std::endl;
        if(f == false){
            ans++;
        }
    }
 
    std::cout << std::dec << ans << std::endl;
}

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

int main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; s[i] != '\0'; i++) {
		if (s[i] != t[i]) ans = 1;
	}
	if (ans == 1) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void){
    int AB = 0, BC = 0, CA = 0;
    int ans = 0;

    //入力
    cin >> AB >> BC >> CA;
    
    //処理
    ans = AB * BC / 2;

    //出力
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder.Contest.C
{
	static class Program
	{
		public static void Solve(Scanner cin)
		{
			long x = cin.ReadLong();
			Console.WriteLine(((x - 1) / 11) * 2 + ((x - 1) % 11 + 1 > 6 ? 2 : 1));
		}

		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);
			var cin = new Scanner();
			Solve(cin);
			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Read() => ReadString();

		public string ReadString()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return ReadString();
			i = 0;
			return s[i++];
		}

		public string[] ReadStringArray(int N)
		{
			string[] Array = new string[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadString();
			}
			return Array;
		}

		public int ReadInt()
		{
			return int.Parse(ReadString());
		}

		public int[] ReadIntArray(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadInt() + add;
			}
			return Array;
		}

		public long ReadLong()
		{
			return long.Parse(ReadString());
		}

		public long[] ReadLongArray(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadLong() + add;
			}
			return Array;
		}

		public double ReadDouble()
		{
			return double.Parse(ReadString());
		}

		public double[] ReadDoubleArray(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadDouble() + add;
			}
			return Array;
		}

		public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1));

	}
}

Measured memory_bytes: 13140
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
	string num;

	cin >> num;

	if (num[1] == num[2]) {
		if ((num[1] == num[0]) || (num[1] == num[3])) {
			cout << "Yes" << "\n";
		}
		else {
			cout << "No" << "\n";
		}
		
	}
	else {
		cout << "No" << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int H,W;cin >> H >> W;
    int N;cin >> N;
    vector<int> a(N);
    vector<int> b(N);
    rep(i,N)cin >> a[i] >> b[i];

    map<pair<int,int>,bool> m;
    map<pair<int,int>,bool> ch;
    rep(i,N)m[{a[i],b[i]}] = true;


    int ds[9] = {-1,-1,-1,0,0,0,1,1,1};
    int dt[9] = {-1,0,1,-1,0,1,-1,0,1};

    vector<LL> ans(10,0);
    ans[0] = H*W;
    rep(i,N)rep(j,9){
        int ct = 0;
        int s = a[i] + ds[j];
        int t = b[i] + dt[j];
        if(s >= 2 && s <= H-1 && t >= 2 && t <= W-1 && !ch[{s,t}]){
       //     cout << "(" << s << "," << t << ")" << endl;
            ch[{s,t}] = true;
            int tmp = 0;
            rep(k,9){
                int s2 = s + ds[k];
                int t2 = t + dt[k];
                if(m[{s2,t2}])tmp++;
            }
            if(tmp != 0)ans[tmp]++;
        }
        else{
            continue;
        }     
    }

    LL sum = 0;
    for(int i = 1;i < 10;++i)sum += ans[i];
    ans[0] = (LL)(H-2)*(W-2) - sum;

    rep(i,10)cout << ans[i] << endl;
}


Measured memory_bytes: 215552
using System;
using System.Collections.Generic;
using System.Linq;

class quiz
{
    public int solve(int n, int[] v)
    {
        int[] odd = new int[(int)n / 2];
        int[] even = new int[(int)n / 2];
        Dictionary<int, int> odic = new Dictionary<int, int>();
        Dictionary<int, int> edic = new Dictionary<int, int>();

        for (int i = 0; i < n / 2; i++)
        {
            even[i] = v[2 * i];
            odd[i] = v[2 * i + 1];
        }

        for (int i = 0; i < n / 2; i++)
        {
            edic[even[i]] = 0;
            odic[odd[i]] = 0;
        }

        for (int i = 0; i < n / 2; i++)
        {
            edic[even[i]]++;
            odic[odd[i]]++;
        }

        if (edic.Count == 1 && odic.Count == 1)
        {
            if (odd[0] != even[0])
                return 0;
            else
                return (int)n / 2;
        }

        var ne = edic.OrderBy(x => x.Value);
        var no = odic.OrderBy(x => x.Value);

        if (ne.ElementAt(ne.Count() - 1).Key != no.ElementAt(no.Count() - 1).Key)
            return n - ne.ElementAt(ne.Count() - 1).Value - no.ElementAt(no.Count() - 1).Value;

        if (ne.Count() == 1)
            return n - ne.ElementAt(ne.Count() - 1).Value - no.ElementAt(no.Count() - 2).Value;

        if (no.Count() == 1)
            return n - ne.ElementAt(ne.Count() - 2).Value - no.ElementAt(no.Count() - 1).Value;
        
        if (ne.ElementAt(ne.Count() - 1).Value + no.ElementAt(no.Count() - 2).Value >= ne.ElementAt(ne.Count() - 2).Value + no.ElementAt(no.Count() - 1).Value)
            return n - ne.ElementAt(ne.Count() - 1).Value - no.ElementAt(no.Count() - 2).Value;

        else
            return n - ne.ElementAt(ne.Count() - 2).Value - no.ElementAt(no.Count() - 1).Value;

        return -1;
    }

    public int[] ParseIntBySpace(string str)
    {
        int[] array = new int[str.Length];
        int lastloc = 0, spaceloc = -1;

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == ' ')
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc - 1));
                spaceloc = i;
            }
            else if (i == str.Length - 1)
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc));
            }
        }

        Array.Resize(ref array, lastloc);

        return array;
    }
}

class Example
{
    static void Main()
    {
        quiz ex = new quiz();

        //while (true)
        //{
        Console.WriteLine(ex.solve(int.Parse(Console.ReadLine()), ex.ParseIntBySpace(Console.ReadLine())));
        //}
    }
}

Measured memory_bytes: 29280
#include<stdio.h>
int main(void)
{
 int x[101]={0};
 int y[101]={0};
 int i=0,max;
 while(scanf("%d",&x[i])!=EOF)
 {
   y[x[i]] ++;
   i ++;
 }
 max = y[0];
 for(i=1; i<101; i++){
 if(max < y[i]) max = y[i];
 }    //maxは、数字のカウントの最大。つまり、何回カウントしたか。
 for(i=0; i<101; i++){
     if(max == y[i]) //カウント数が等しかったら、
     {
      printf("%d\n",i); //添字を出力する。
     }
 }
return 0;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n = in();
    vint s = in(n);

    vector<bool> used(n, false);
    sort(ALL(s), greater<int>());

    int ans = 0;
    while (1)
    {
        bool updated = false;
        rep(i, n)
        {
            if (used[i])
                continue;

            if ((s[i] + ans) % 10 != 0)
            {
                used[i] = true;
                ans += s[i];
                updated = true;
                break;
            }
        }
        if (!updated)
            break;
    }
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
package main

// Solution for https://atcoder.jp/contests/abc175/tasks/abc175_b

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

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	l := make([]int, n)
	for i := 0; i < n; i++ {
		con.Scan(&l[i])
	}
	c := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			for k := j + 1; k < n; k++ {
				m := []int{l[i], l[j], l[k]}
				sort.Ints(m)
				if m[0] != m[1] && m[1] != m[2] && m[2] < m[0]+m[1] {
					c++
				}
			}
		}
	}
	con.Println(c)
	return nil
}


Measured memory_bytes: 6356
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n, s;
	while (cin >> n >> s) {
		if (n == 0 && s == 0) {
			break;
		}
		vector<int> r(n);
		for (int i = 0; i < n; i++) {
			cin >> r[i];
		}
		sort(r.begin(), r.end());
		int a = 0;
		vector<int>::iterator ii = r.begin();
		ii++;
		for (int i = 0; i < n; i++) {
			vector<int>::iterator ite = lower_bound(ii, r.end(), s+1-r[i]);
			int b = ite-r.begin();
			a += n-b;
			ii++;
		}
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
int main(){
   int k,t,c=0;
   cin >> k >> t;
   for(int i=0;i<t;i++){
       int a;
       cin >> a;
       c = max(a,c);
   }
   cout << max(2*c-1-k,0) << endl;
}

Measured memory_bytes: 256
long a[3001],p[3001][3001];i,j;
main(n){
	for(scanf("%d",&n);~scanf("%d",a+i++);)for(j=i;j--;)p[i][j]=fmax(a[i-1]-p[i-1][j],a[j]-p[i][j+1]);
	printf("%ld",*p[n]);
}

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

using namespace std;

class Pipe
{
private:
	queue<int> pipe;
	vector<int> a, b;
public:
	Pipe( queue<int> input )
	{
		pipe = input;
	}

	void pushA()
	{
		a.push_back( pipe.front() );
		pipe.pop();
	}

	void pushB()
	{
		b.push_back( pipe.front() );
		pipe.pop();
	}

	bool empty()
	{
		return pipe.size() == 0;
	}

	bool sorted()
	{
		for ( unsigned int i = 0; i + 1 < a.size(); i++ )
		{
			if ( a[i + 1] < a[i] )
			{
				return false;
			}
		}

		for ( unsigned int i = 0; i + 1 < b.size(); i++ )
		{
			if ( b[i + 1] < b[i] )
			{
				return false;
			}
		}

		return true;
	}
};

bool dfs()
{
	int buffer;
	queue<int> que;
	for ( int i = 0; i < 10; i++ )
	{
		cin >> buffer;
		que.push( buffer );
	}

	Pipe init( que );
	stack<Pipe> st;
	st.push( init );

	while ( !st.empty() )
	{
		Pipe current = st.top();
		st.pop();

		if ( current.empty() )
		{
			if ( current.sorted() )
			{
				return true;
			}
			else
			{
				continue;
			}
		}
		
		Pipe next = current;
		next.pushA();
		st.push( next );

		next = current;
		next.pushB();
		st.push( next );
	}

	return false;
}

int main()
{
	int n;

	cin >> n;

	for ( int i = 0; i < n; i++ )
	{
		cout << ( dfs() ? "YES" : "NO" ) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
using namespace std;
using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;
// " ", ' '
// std::string str;
// str = std::to_string(int i);

// プロトタイプ宣言
// int myfunc(int, vvec);

// グローバル変数
// int N, M;
// vvec data(N, vec(M));

// 関数：

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N,K;
	int count=0;
	cin>>N;
	cin>>K;
	vector<int> h(N);
	for(int i=0;i<N;i++){
		cin>>h.at(i);
	}
	for(int i=0;i<N;i++){
		if(h.at(i)>=K){
			count+=1;
		}
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,M = map(int,input().split())
Q = int(input())
A = [int(x) for x in input().split()]

used = [False] * (M+1)
arr = []
for x in A[::-1]:
    if used[x]:
        continue
    used[x] = True
    arr.append(x)
for x in range(1,M+1):
    if used[x]:
        continue
    arr.append(x)

x_to_i = {x:i for i,x in enumerate(arr,1)}

made = [N] + [0] * M

for x in A[::-1]:
    i = x_to_i[x]
    if made[i-1] > 0:
        made[i-1] -= 1
        made[i] += 1

L = 0
prev = M+100
for x in arr[::-1]:
    if x >= prev:
        break
    prev = x
    L += 1

x = sum(made[::-1][:L+1])
answer = 'Yes' if x == N else 'No'
print(answer)

Measured memory_bytes: 24452
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
for i in range(m):
  a,b = map(int,input().split())
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)

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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int N = int.Parse(input);
            if (N % 2 == 0) { Console.WriteLine(N); }
            if (N % 2 != 0) { Console.WriteLine(N * 2); }
        }
    }
}

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

class Program
{
	/*
	Cf. 計算量について
	n = 20くらいまでならbit全探索できるよ
	*/

	//n通りのマスクを吐き出す関数（2^0から2^(n-1)まで）
	static List<int> GetMasks(int n){
		//マスクを格納するリストを初期化
		List<int> maskLs = new List<int>();

		//順にリストに格納
		int tempo = 1;
		for(int i=0; i<n; i++){
			maskLs.Add(tempo);
			//1ビット左シフト
			tempo = tempo << 1;
		}

		return maskLs;
	}

	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] S = Console.ReadLine().Split(' ');
		int H = int.Parse(S[0]);
		int W = int.Parse(S[1]);
		int N = H + W;
		int K = int.Parse(S[2]);

		//グリッドを取得
		char[][] grid = new char[H][];
		for(int i=0; i<H; i++){
			string line = Console.ReadLine();
			grid[i] = new char[H];
			grid[i] = line.ToCharArray();
		}

		//1. 2^n通りの上限値（半開区間で考える：0 〜 2^N - 1（0 <= i < max）までの全整数を探索すれば良い）
		int max = (int)Math.Pow(2, N);

		//2. マスクを取得
		List<int> maskLs = new List<int>();
		maskLs = GetMasks(N);

		//3. それぞれ、マスクと照らし合わせて計算
		int ans = 0;

		for(int i=0; i<max; i++){
			//黒いマスのカウンター
			int cnt = 0;

			//マスをカウントするが、マスクと照合してフラグが立っていた場合、スキップ
			for(int j=0; j<H; j++){
				//j行のフラグが立っている場合、スキップ
				if((maskLs[j] & i) != 0){
					continue;
				}
				else{
					for(int k=0; k<W; k++){
						//k列のフラグが立っている場合、スキップ
						if((maskLs[k+H] & i) != 0){
							continue;
						}
						//そうでない場合、黒マスならカウント
						else if(grid[j][k] == '#'){
							cnt ++;
						}
					}
				}
			}

			//ちょうどK個なら、答えを増やす
			if(cnt == K){
				ans ++;
			}
		}

		Console.WriteLine(ans);
	}
}



Measured memory_bytes: 18280
#include <bits/stdc++.h>
#include <iterator>
#include <tuple>
using namespace std;
using ll = long long;

int main()
{
  string s;
  cin >> s;
  ll k;
  cin >> k;
  if (s[0] != '1')
  {
    cout << s[0] << endl;
  }
  else
  {
    int cnt = 0;
    for (int i = 0; i < s.size(); ++i)
    {
      if (s[i] == '1')
        cnt++;
      else
        break;
    }
    if (k <= cnt)
      cout << '1' << endl;
    else
      cout << s[cnt] << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define speed_demon; ios_base::sync_with_stdio(0);
#define ll long long
using namespace std;
int main(){
	speed_demon;
	ll n,m,l=0;
	cin>>n>>m;
	ll a[m];
	for(int i=0;i<m;i++){
		cin>>a[i];
		l+=a[i];
	}
	if(l>=n){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}



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

using namespace std;

#define ll long long
#define endl '\n'
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
ll dp[N][2][2];
ll binpow(ll u, ll p){
        if (p == 0) return 1;
        if (p == 1) return u;
        ll t = binpow(u, p / 2);
        if (p & 1) return t * t % mod * u % mod;
        else return t * t % mod;
}
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("A.inp", "r")){
                freopen("test.inp", "r", stdin);
                freopen("test.out", "w", stdout);
        }
        ll n;
        cin >> n;
        dp[0][0][0] = 1;
        for (int i = 1; i <= n; i++){
                dp[i][0][0] = dp[i - 1][0][0] * 8 % mod;
                dp[i][0][1] = (dp[i - 1][0][0] + dp[i - 1][0][1] * 9) % mod;
                dp[i][1][0] = (dp[i - 1][0][0] + dp[i - 1][1][0] * 9) % mod;
                dp[i][1][1] = (dp[i - 1][0][1] + dp[i - 1][1][0] + dp[i - 1][1][1] * 10) % mod;
        }
        cout << dp[n][1][1];
}
/*
*/


Measured memory_bytes: 34776
#include<cstdio>
int p[100001],par[100001];
int root(int x) {
	if (par[x] == x)return x;
	else return par[x] = root(par[x]);
}
void unite(int x, int y) {
	par[root(x)] = root(y);
}
bool same(int x, int y) {
	return root(x) == root(y);
}
int main() {
	int n, m, i, x, y, ans = 0;
	scanf("%d%d", &n, &m);
	for (i = 1; i <= n; i++) {
		scanf("%d", &p[i]);
		par[i] = i;
	}
	for (i = 1; i <= m; i++) {
		scanf("%d%d", &x, &y);
		unite(x, y);
	}
	for (i = 1; i <= n; i++) {
		if (same(i, p[i]))ans++;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/
int main()
{
  lli n;
  cin>>n;
  //string s="abcdefghijklmnopqrstuvwxyz";
  char s[100];
  int l=99;
  while(n){
      n--;
      s[l]='a'+(n%26);
      n=n/26;
      l--;
  }
  l++;
  reps(i,l,100) cout<<s[i];
  cout<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 

const int MOD = 1000000007;

int main()
{
    string S;
    cin  >> S;

    if (S == "Sunny") {
        S = "Cloudy"; 
    } else if (S == "Cloudy") {
        S = "Rainy";
    } else {
        S = "Sunny";
    }

    cout << S << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_V(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_M(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}

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

    V<ll> a(n);
    priority_queue<ll> que;
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
        que.push(a[i]);
    }

    for (int i = 0; i < m; ++i) {
        ll x = que.top();
        que.pop();
        x/=2LL;
        que.push(x);
    }

    ll ans = 0LL;
    while(!que.empty()){
        ll x = que.top();
        que.pop();
        ans += x;
    }
    cout<<ans<<endl;

    return 0;
}

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

long double PI = 3.14159265358979323846264338327950L;

long double solve(long double a,long double b,long double h, long double m) {
  
  long double a_a = 360*(h/12) + 30 * (m/60);
  long double b_a = 360*(m/60);
  long double theta = a_a > b_a ? (a_a - b_a) : (b_a - a_a);
  if(theta == 180) {
    return a + b;
  }
  if(theta > 180) {
    theta = 360 - theta;
  }
  //cout << h << " " << m << " a_a " << a_a << " b_a " << b_a << " -> " << theta << endl;

  return sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(PI*theta/180));

}

int main() {
  long double a, b, h, m;
  cin >> a >> b >> h >> m;

  cout << fixed << setprecision(10) << solve(a, b, h, m); 
}

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

int main() {
  char in;
  string s = "aiueo";
  cin >> in;
  if (s.find(in) != string::npos) {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline--------------------------------------------
    h,w = map(int,input().split())
    if not (h == 1 or w == 1): 
        print(h*w // 2 if h % 2 == 0 or w % 2 == 0 else h*w // 2 + 1)
    else:
        print(1)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 5684
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int a;
	string s;
	cin >> a >> s;
	
	if( a >= 3200 ) cout << s << endl;
	else cout << "red" << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	int T;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main tr = new Main();
		tr.test(sc);
		sc.close();
	}

	void test(Scanner sc){
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int n[] = new int[N];
		int m[] = new int[M];
		for (int i = 0; i < N; i++) {
			n[i] = sc.nextInt();	
		}
		for (int i = 0; i < M; i++) {
			m[i] = sc.nextInt();	
		}
		Arrays.sort(n);
		Arrays.sort(m);
		if(X<Y && n[N-1]<m[0] && X<m[0] && n[N-1]<Y){
			System.out.println("No War");
		}else{
			System.out.println("War");
		}
	}
}


Measured memory_bytes: 23508
import bisect


def bisect_find(s, i):
    index = bisect.bisect_left(s, i)
    if s[index] == i:
        return True
    return False


input()
s = [int(i) for i in input().split()]
input()
t = [int(i) for i in input().split()]
ans = len([i for i in t if bisect_find(s, i)])
print(ans)



Measured memory_bytes: 16928
def prime(n):
    is_prime=[True]*(n+1)
    is_prime[0],is_prime[1]=False,False
    for i in range(2,int(n**0.5)+1):
        if not is_prime[i]:continue
        for j in range(i*2,n+1,i):
            is_prime[j]=False
    return [i for i in range(n+1) if is_prime[i]]


n=int(input())
prime=prime(10**6)
for i in prime:
    if i>=n:print(i);exit()

Measured memory_bytes: 51312
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author indy256
 */

#include <bits/stdc++.h>

using namespace std;

void solve(istream &in, ostream &out) {
    int t1, t2;
    long long a1, a2, b1, b2;
    in >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

    long long d = (a1 - b1) * t1 + (a2 - b2) * t2;
    if (d == 0) {
        out << "infinity" << endl;
        return;
    }

    if (d < 0) {
        swap(a1, b1);
        swap(a2, b2);
        d = -d;
    }

    long long res = 0;
    long long d1 = (a1 - b1) * t1;
    if (d1 < 0) {
        d1 = -d1;
        res = d1 / d * 2 + 1 - (d1 % d == 0 ? 1 : 0);
    }

    out << res << '\n';
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solve(in, out);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    int sum = 0;
    while(N > 0) {
        sum += N % 10;
        N /= 10;
    }
    if(sum == 1) {
        output(10);
    }
    else {
        output(sum);
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, m; cin >> n >> m;
    vint change = {0,2,5,5,4,5,6,3,7,6};
    vint a(m);
    rep(i,m) cin >> a[i];
    set<int> st;
    rep(i,m) st.insert(change[a[i]]);
    vint dp(n+1,-1);    
    dp[0] = 0;
    REP(i,n+1) {
        for (auto x : st) {
            if (i-x >= 0 && dp[i-x] != -1) {
                chmax(dp[i],dp[i-x]+1);
            }
        }
    }
    int n_split = dp[n];
    sort(rall(a));
    string ans;
    while (n_split--) {
        rep(i,m) {
            if (n-change[a[i]] < 0) continue;
            if (dp[n-change[a[i]]] == dp[n] - 1) {
                ans += to_string(a[i]);
                n -= change[a[i]];
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3736
N,x=map(int,input().split())
a=[int(i) for i in input().split()]
b=[[0 for k in range(N)] for i in range(N)]
for k in range(N):
    for i in range(N):
        if k==0:
            b[i][k]=a[i]
        else:
            b[i][k]=min([b[i][k-1],a[i-k]])
ans=sum(a)
for k in range(N):
    tmp=k*x
    for i in range(N):
        tmp+=b[i][k]
    if tmp<ans:
        ans=tmp
print(ans)


Measured memory_bytes: 75740
#B
N=input()
L =list(map(int, input().split()))
import itertools
combi=list(sorted(itertools.combinations(L,3)))
for i in range(len(combi)):
    combi[i]=sorted(combi[i])
count=0
for i in range(len(combi)):
    if combi[i][2] != combi[i][1] and combi[i][2] != combi[i][0] and combi[i][1] != combi[i][0]:
        if combi[i][2] < combi[i][1] + combi[i][0]:
            count +=1
print(count)

Measured memory_bytes: 28368
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <numeric>
#include <climits>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    double ans = 0;
    int ansmas = 100 * min(A, B);
    int anssu = 0;
    rep(i, F + 1){
        int water = 0;
        int sugar = 0;
        rep(j, F + 1){
            water = 100 * (A * i + B * j);
            if(water == 0 || water > F) break;
            rep(k, F + 1){
                rep(l, F + 1){
                    sugar = C * k + D * l;
                    if(water + sugar <= F && (E * water/100) >= sugar){
                        if(ans < 100.0 * sugar/(water + sugar)){
                            ans = 100.0 * sugar/(water + sugar);
                            ansmas = water + sugar;
                            anssu = sugar;
                        }
                    }
                }
            }
        }
    }
    cout << ansmas << " " << anssu << endl;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n, r;
    cin >> n >> r;
    if (n>=10) cout << r << endl;
    else cout << max(0,r+100*(10-n)) << endl;
    return 0;
}





























Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a, b, c, tmp;
  scanf("%d %d %d", &a, &b, &c);
  if (b < a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  if (c < b) {
    tmp = b;
    b = c;
    c = tmp;
    if (b < a) {
      tmp = a;
      a = b;
      b = tmp;
    }
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}

Measured memory_bytes: 596
// Learn more about F# at http://fsharp.org
open System

[<EntryPoint>]
let main argv =
    let [ a; b; x ] =
        Console.ReadLine().Split(' ')
        |> List.ofArray
        |> List.map int64

    let ans =
        if a = 0L then b / x + 1L
        else b / x - (a - 1L) / x

    printfn "%d" ans
    0 // return an integer exit code


Measured memory_bytes: 14044
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[])
{
	int N;
	double inf = 1e9;
	double lx[3] = {inf, inf, inf};
	double rx[3] = {-inf, -inf, -inf};
	double ly[3] = {inf, inf ,inf};
	double ry[3] = {-inf, -inf, -inf};

	cin >> N;

	for (int i = 0; i < N; i++) {
		double x, y;
		char d;
		cin >> x >> y >> d;
		if (d == 'R') {
			lx[2] = min(lx[2], x);
			rx[2] = max(rx[2], x);
			ly[1] = min(ly[1], y);
			ry[1] = max(ry[1], y);
		}
		if (d == 'L') {
			lx[0] = min(lx[0], x);
			rx[0] = max(rx[0], x);
			ly[1] = min(ly[1], y);
			ry[1] = max(ry[1], y);
		}
		if (d == 'U') {
			lx[1] = min(lx[1], x);
			rx[1] = max(rx[1], x);
			ly[2] = min(ly[2], y);
			ry[2] = max(ry[2], y);
		}
		if (d == 'D') {
			lx[1] = min(lx[1], x);
			rx[1] = max(rx[1], x);
			ly[0] = min(ly[0], y);
			ry[0] = max(ry[0], y);
		}
	}

	vector<double> ts;
	ts.push_back(0);
	ts.push_back(inf);
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < i; j++) {
			double t = (lx[j] - lx[i]) / (i - j);
			if (t > 0) {
				ts.push_back(t);
			}
			t = (rx[j] - rx[i]) / (i - j);
			if (t > 0) {
				ts.push_back(t);
			}
			t = (ly[j] - ly[i]) / (i - j);
			if (t > 0) {
				ts.push_back(t);
			}
			t = (ry[j] - ry[i]) / (i - j);
			if (t > 0) {
				ts.push_back(t);
			}
		}
	}
	sort(ts.begin(), ts.end());

	double ans = 1e18;
	for (double t : ts) {
		double dx, dy;
		double nl = inf, nr = -inf;
		for (int i = 0; i < 3; i++) {
			nl = min(nl, lx[i] + i * t);
			nr = max(nr, rx[i] + i * t);
		}
		dx = nr - nl;
		nl = inf;
		nr = -inf;
		for (int i = 0; i < 3; i++) {
			nl = min(nl, ly[i] + i * t);
			nr = max(nr, ry[i] + i * t);
		}
		dy = nr - nl;
		ans = min(ans, dx * dy);
	}

	printf("%.9lf\n", ans);

	return 0;
}

Measured memory_bytes: 384
s = gets.chomp
n = s.size

if n == 1
  p 0
else
  d, m = n.divmod(2)
  s0 = '01' * d + '0' * m
  s1 = '10' * d + '1' * m

  def diff_count(a, b)
    a.size.times.count { |i| a[i] != b[i] }
  end

  p [diff_count(s, s0), diff_count(s, s1)].min
end


Measured memory_bytes: 2300
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;

    vector<int> d(N);

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

    sort(d.begin(),d.begin()+N);

    cout << d[N/2] - d[N/2-1] << endl; 
    
    return 0;
}

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

int main() {
	//input
	int A, B, M;
	cin >> A >> B >> M;

	vector<int> a(A);
	for (int i = 0; i < A; i++) {
		cin >> a[i];
	}

	vector<int> b(B);
	for (int i = 0; i < B; i++) {
		cin >> b[i];
	}

	vector<int> x(M);
	vector<int> y(M);
	vector<int> c(M);
	for (int i = 0; i < M; i++) {
		cin >> x[i] >> y[i] >> c[i];
	}

	//calculation
	vector<int> discount(M);
	for (int i = 0; i < M; i++) {
		discount[i] = a[x[i] - 1] + b[y[i] - 1] - c[i];
	}
	sort(discount.begin(), discount.end());

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	int output = min(discount[0], a[0] + b[0]);

	//output
	cout << output << endl;


	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N,a;
    cin >> N;
    a=N%10;
    if(a==3){
        cout << "bon";
    }else if(a==0||a==1||a==6||a==8){
        cout << "pon";
    }else cout << "hon";
    return 0;
}


Measured memory_bytes: 3120
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;

int n;
int a[15];
int t[15];
int b[15], c[15];

void get(int x) {
	int tot = 0;
	while(x > 0) {
		b[++tot] = x % 3;
		x = x / 3;
	}
}

int main()
{
	t[0] = 1;
	for(int i = 1; i <= 10; i++)
		t[i] = t[i - 1] * 3;
	while(scanf("%d", &n) != EOF)
	{
		int cnt = 0;
		int tu = 0;
		for(int i = 0; i < n; i++)
			tu += t[i] * 2;
		for(int i = 1; i <= n; i++) {
			scanf("%d", &a[i]);
		}
		for(int i = 0; i <= tu; i++) {
			get(i);
			for(int j = 1; j <= n; j++) {
				if(b[j] == 0) {
					c[j] = a[j] - 1;
				}
				else if(b[j] == 1) {
					c[j] = a[j];
				}
				else if(b[j] == 2) {
					c[j] = a[j] + 1;
				}
			}
			int res = 1;
			for(int j = 1; j <= n; j++)
				res = res * c[j];
			if((res & 1) == 0) cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}

Measured memory_bytes: 128