akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;


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

int n;
cin>>n;

map<int,int> m;
for(int index = 0 ; index < n;index++)
{
   int a;
   cin>>a;

   m[a]++;
}

int ans =0;
for(auto it=m.begin();it!=m.end();it++)
{
    if(it->first<=it->second)
        ans+=it->first;
}
cout<<n-ans<<endl;

 return 0;
}


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


int main() {
  // ここにプログラムを追記
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if (a>=k)cout<<k<<endl;
  else if (k>a&&k<=b)cout <<a<<endl;
  else cout <<a- (k-b-a)<<endl;
}


Measured memory_bytes: 3536
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int n;
ll a[20][20];
ll go[1 << 16];
ll dp[1 << 16];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			cin >> a[i][j];
	for (int i = 0; i < (1 << n); ++i) {
		go[i] = 0;
		for (int j = 0; j < n; ++j) {
			if (!((i >> j) & 1))
				continue;
			for (int k = j + 1; k < n; ++k) {
				if (!((i >> k) & 1))
					continue;
				go[i] += a[j][k];
			}
		}
	}
	for (int i = 1; i < (1 << n); ++i) {
		for (int j = i; j > 0; j = (j - 1) & i)
			dp[i] = max(dp[i], go[j] + dp[i ^ j]);
	}
	cout << dp[(1 << n) - 1] << "\n";
	return 0;
}




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

int main() {
    int n ;
    cin >> n ;
    vector<int> A(n) ;
    vector<int> B(n) ;
    rep(i,n) cin >> A[i] >> B[i] ;
    sort(A.begin(),A.end()) ;
    sort(B.begin(),B.end()) ;
    int ans = 0 ;
    if( n % 2 == 1 ){
        int l = A[n/2] ;
        int r = B[n/2] ;
        ans = r - l + 1 ;
    }
    else{
        int l2 = A[n/2-1] + A[n/2] ;
        int r2 = B[n/2-1] + B[n/2] ;
        ans = r2 - l2 + 1 ;
    }
    cout << ans << endl;
}


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

int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  ll left = 4*a*b;
  ll right = (c- a- b)*(c- a- b);
  if(left < right && c - a -b > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  int N = 1e6;
  std::vector<int> p(N+1, 1);
  p[0] = p[1] = 0;
  for (int i = 2; i*i <= N; ++i) {
    if (!p[i]) continue;
    for (int j = i*i; j <= N; j += i)
      p[j] = 0;
  }

  while (true) {
    int a, d, n;
    scanf("%d %d %d", &a, &d, &n);
    if (a == 0 && d == 0 && n == 0) break;

    for (int i = a; n; i += d) {
      if (p[i] && --n == 0) printf("%d\n", i);
    }
  }
}



Measured memory_bytes: 6168
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
#define LL long long
#define mod 1000000007
#define G() Cr=getchar()
int Xr;char Cr;
inline int rd(){   //读入优化
    Xr=0,G();
    while(Cr<'0'||Cr>'9')G();
    while(Cr>='0'&&Cr<='9')Xr=(Xr<<3)+(Xr<<1)+Cr-'0',G();
    return Xr;
}
int n,x,y;
int va[2005];
int ans[2005];
int main(){
	n=rd(),x=rd(),y=rd();
	for(int i=1;i<n;i++){
		for(int j=i+1;j<=n;j++){
			if(j<=x)ans[j-i]++;
			else if(i<=x&&j>=y){
				ans[j-i-y+x+1]++;
			}
			else if(i<=x&&j<y){
				ans[min(j-i,x-i+1+y-j)]++;
			}
			else if(i>x&&i<y){
				if(j<=y){
					ans[min(j-i,i-x+1+y-j)]++;
				}
				else{
					ans[min(j-i,i-x+1+j-y)]++;
				}
			}
			else{
				ans[j-i]++;
			}
		} 
	}
	for(int i=1;i<n;i++)printf("%d\n",ans[i]);
}

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

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

        long n = sc.NextLong();
        long k = sc.NextLong();
        long[] aa = sc.LongArray();

        int ok = 1000000000; // 解が存在する値
        int ng = 0; // 解が存在しない値
        while (Math.Abs(ok - ng) > 1)
        {
            int mid = (ok + ng) / 2;

            long count = 0;
            for (int i = 0; i < n; i++)
            {
                count += (aa[i] / mid) + (aa[i] % mid == 0 ? 0 : 1) - 1;
            }

            if (count <= k)
            {
                ok = mid;
            }
            else
            {
                ng = mid;
            }
        }

        long answer = ok;

        Console.WriteLine(answer);
    }

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

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

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

            return _line[_index++];
        }

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

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

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


Measured memory_bytes: 45648
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N)]
cd = [list(map(int,input().split())) for _ in range(M)]
m = 10**9
for i in range(N):
    for l in range(M):
        c = abs(ab[i][0]-cd[l][0])+abs(ab[i][1]-(cd[l][1]))
        if c < m :
            m = c
            t = l+1
    print(t)
    m = 10**9

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

int factors[1000003];
bool flag = false;

void func(int n){
	if(flag) return;
	for(int i=1; i*i<=n; i++){
		if(n%i==0){
			int x = i;
			int y = n/i;
			
			if(x==y){
				x = i;
				y = 1;
			}
			if(x!=1){
				if(factors[x]){
					flag = true;
					return;
				}
				factors[x]++;
			}
			if(y!=1){
				if(factors[y]){
					flag = true;
					return;
				}
				factors[y]++;
			}
		}
	}
}

main(){
	int n; cin>>n;
	int a[n];
	for(auto &it : a) cin>>it;
	
	int gcd = a[0];
	func(a[0]);
	
	for(int i=1; i<n; i++){
		func(a[i]);
		gcd = __gcd(gcd,a[i]);
	}
	if(!flag) cout<<"pairwise coprime";
	else if(gcd==1) cout<<"setwise coprime";
	else cout<<"not coprime";
}

Measured memory_bytes: 7796
#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, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i, n)
  {
    cin >> c[i];
    rep(j, m)
      cin >> a[i][j];
  }
  int ans = INT_MAX;
  rep(i, 1<<n)
  {
    int total = 0;
    vector<int> rikai(m, 0);
    rep(j, n)
      if (i>>j&1)
      {
        total += c[j];
        rep(k, m)
          rikai[k] += a[j][k];
      }
    bool chk = true;
    rep(j, m)
      if (rikai[j] < x)
        chk = false;
    if (chk)
      ans = min(ans, total);
  }
  if (ans == INT_MAX)
    ans = -1;
  cout << ans << endl;
  return 0;
}

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

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

int array_min_max(int* p, int n,bool f)  //f: true→min false→max
{
	int tmp;

	if (f)
		tmp = INF;
	else
		tmp = 0;

	for (int i = 0; i < n; i++)
	{
		if (f)
		{
			if (p[i] < tmp)
				tmp = p[i];
		}
		else
		{
			if (p[i] > tmp)
				tmp = p[i];
		}
	}
	return tmp;
}

int main()
{
	int T[5];
	int min = 1000;
	int num;
	int ans = 0;

	for (int i = 0; i < 5; i++)
	{
		scanf("%d", &T[i]);
		if (T[i] % 10 != 0 && T[i] % 10 < min)
		{
			min = T[i]%10;
			num = i;
		}
	}

	//printf("-----%d %d--\n", min, num);

	for (int i = 0; i < 5; i++)
	{
		if (i != num)
		{
			ans += (T[i] + 9) / 10 * 10;
		}
		else
			ans += T[i];
	}

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

}

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

using namespace std;

int is_square_number(int number) {
    int n = static_cast<int>(sqrt(static_cast<double>(number)));
    int tmp = n*n;

    return number == tmp;
}

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

    int p[N][D];

    for (int i { 0 }; i < N; ++i) {
        for (int j { 0 }; j < D; ++j) {
            cin >> p[i][j];
        }
    }

    int result { 0 };
    for (int i { 0 }; i < N; ++i) {
        for (int j { i + 1 }; j < N; ++j) {

            int distance { 0 };
            for(int k { 0 }; k < D; ++k) {
                const int p_1 { p[i][k] };
                const int p_2 { p[j][k] };
                const int diff { p_2 - p_1 };
                distance += diff * diff;
            }

            if (is_square_number(distance)) {
                result++;
            }
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
def isprime(n):
    if(n==1):
        return False
    if(n==2):
        return True
    if(n%2==0):
        return False
    i=3
    while( i**2 <=n):
        if(n%i==0):
            return False
        i+=2
    return True


sosuu=[False]*(10**5+1)
for i in range(1,10**5+1):
    sosuu[i]=isprime(i)

like_2017=[0]*(10**5+1)
i=3
while(i<=10**5):
    if( sosuu[i] & sosuu[(i+1)//2]):
        like_2017[i]=1
    i+=2

ruiseki=[0]*(10**5 + 2)
for i in range(1,10**5+2):
    ruiseki[i]=ruiseki[i-1] + like_2017[i-1]

q=int(input())
for _ in range(q):
    l,r=map(int,input().split())
    print(ruiseki[r+1] - ruiseki[l])

Measured memory_bytes: 8052
let fix c = if c='1' then '9' else (if c='9' then '1' else c);;
let f a b c = List.map fix [a;b;c] |> List.map (String.make 1) |> String.concat "";;
let () = Scanf.scanf "%c%c%c" f
|> Printf.printf "%s\n"

Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Lucky PIN Mitsui 2019 D
        // S から N−3 桁を消して残りの 3 桁を左から読んだものを暗証番号として設定することにしました
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S = sc.next();
        int ans = 0;
        // Sの持つ数値について左から3桁、1桁ずつ検証する.
        for (int i = 0; i <= 9; i++) {
            // char + int ex. '0' + 0 = 48, '0' + 1 = 49, '0' + 2 = 50
            // indexOf(48, 0) は 48 = 文字列char'0' を検証する
            int p1 = S.indexOf('0' + i, 0);
            // p1 は i([0-9])のある桁数(index番号)
            if (p1 == -1) {
                // もし整数iがSに含まれていなければ、検証する必要がないので
                // continueする
                continue;
            }
            for (int j = 0; j <= 9; j++) {
                // 左から順番にだから p1(index番号) + 1
                int p2 = S.indexOf('0' + j, p1 + 1);
                if (p2 == -1) {
                    continue;
                }
                for (int k = 0; k <= 9; k++) {
                    // 左から順番にだから p2(index番号) + 1
                    int p3 = S.indexOf('0' + k, p2 + 1);
                    if (p3 == -1) {
                        continue;
                    }
                    // ここまで検証できれば、3桁の暗証番号が成立することがわかる
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}

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

int main(){
  int N,T,A;
  cin>>N>>T>>A;
  vector<double>t(N);
  vector<double>d(N);
  for(int i=0;i<N;i++){
    int H;
    cin>>H;
    t.at(i)=T-0.006*H;
    d.at(i)=abs(A-t.at(i));
  }
  double min=d.at(0);
  int res=1;
  for(int i=1;i<N;i++){
    if(min>d.at(i)){
      min=d.at(i);
      res=i+1;
    }
  }
  cout<<res;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;

long long int a[110][2];
long long int dp[110][100010];

long long int q(int k, int w) {
    if (dp[k][w] != -1) return dp[k][w];

    if (k == 0) dp[k][w] = 0;
    else if (a[k][0] > w) dp[k][w] = q(k-1, w);
    else dp[k][w] = max(q(k-1, w), q(k-1, w-a[k][0]) + a[k][1]);

    return dp[k][w];
}

int main() {
    int i, k, N, W;

    cin >> N >> W;
    for (k=1; k<=N; k++) {
        for (i=0; i<2; i++) {
            cin >> a[k][i];
        }
    }

    for (k=0; k<110; k++) {
        for (i=0; i<100010; i++) {
            dp[k][i] = -1;
        }
    }

    cout << q(N, W) << endl;
}

Measured memory_bytes: 86144
#include <bits/stdc++.h>
using namespace std;
 
#define     all(x) x.begin(),x.end()
#define     ff first
#define     ss second
#define     ll long long
#define     ld long double
#define     pb push_back
#define     MOD 1000000007
#define     REP(i,n) for(ll i=0;i<(n);i++)
#define     FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define     FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define     BLOCK 555

typedef     vector <ll> vll;
typedef     vector <pair<ll,ll>> vp;
typedef     vector<vector<ll> >vvll;

// log(y) power calculation
ll power_mod(ll x, ll y, ll m){
    ll ans = 1;
    x%=m;
    while(y){
        if(y&1){
            ans=(ans*x)%m;
        }
        y>>=1;
        x=(x*x)%m;
    }
    return ans;
}

ll power(ll x, ll y){
    ll ans = 1;
    while(y){
        if(y&1){
            ans*=x;
        }
        y>>=1;
        x = x*x;
    }
    return ans;
}


ll mod_inv(ll x,ll m){
    return power_mod(x,m-2,m);
}


// customized hash function for lowering the collision in UNORDERED_MAP
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
       
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
 

bool comp(const pair<ll,ll> &a, const pair<ll,ll> &b) { 
    if(a.ff == b.ff){
        return (a.second < b.second); 
    }
    return (a.ff < b.ff); 
} 

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

bool isPalindrome(string s){
    bool flag = true;
    for(int i=0;i<s.length()/2;i++){
        if(s[i]!=s[s.length()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}


void solve(){
    ld l;
    cin>>l;
    ld val = l/3;
    ld ans = val*val*val*1.000000;
    cout<<fixed<<setprecision(6)<<ans<<endl;
}


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


    // ll t;
    // cin>>t;
    // while(t--){
        solve();
    // }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    long long A, B, C = 0;
    cin >> A >> B;
    for (int i = 2; i < n; i++) { long long a; cin >> a; C ^= a; }
    const long long INF = 1LL<<60;
    long long min_s[2][2] = {{INF, INF}, {INF, INF}};
    for (int s = 0; s < min(A, 1LL<<20); s++) {
        int p = (A % (1<<20)) >= s,
            q = B % (1<<20) + s < (1<<20);
        if ((((A - s) ^ (B + s) ^ C) & ((1<<20) - 1)) == 0)
            min_s[p][q] = min(min_s[p][q], (long long)s);
    }
    long long ans = 1LL<<60;
    for (int p = 0; p < 2; p++)
        for (int q = 0; q < 2; q++) {
            long long s = min_s[p][q];
            if (s == INF) continue;
            for (long long t = 0; t < 1LL<<20; t++) {
                long long u = (t << 20) + s;
                if (u < A && ((A - u) ^ (B + u)) == C)
                    ans = min(ans, u);
            }
        }
    cout << (ans == 1LL<<60 ? -1 : ans) << endl;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
    char s[7];
    scanf("%s", s);
    if (s[2] == s[3] && s[4] == s[5])
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 3732
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

const ll INF = 100000000000000000;
int main() {
  int n; cin >> n;
  vector<ll> A(n);
  loop(i,0,n) cin >> A[i];
  ll sum = 0;
  loop(i,0,n) sum += A[i];
  ll acc = 0;
  ll min_ = INF;
  loop(i,0,n-1) {
    acc += A[i];
    min_ = min(min_, abs(sum - 2 * acc));
  }
  cout << min_ << endl;
  return 0;
}


Measured memory_bytes: 4792
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split("").map(&:to_i)
end
nums = gets_i_list

0.upto(2**4 - 1) do |i|
  total = nums[0]
  ops = sprintf("%0*b",3,i).chars
  ops.each_with_index do |op, i|
    if op == "0"
      ops[i] = "+"
    else
      ops[i] = "-"
    end
  end

  ops.each_with_index do |op, i|
    if op == "+"
      total += nums[i+1]
    else
      total -= nums[i+1]
    end

    if total == 7
      puts [nums[0],ops[0],nums[1],ops[1],nums[2],ops[2],nums[3],"=7"].join
      exit
    end
  end
end

Measured memory_bytes: 14388
#include <iostream>

using namespace std;

int main()
{
	int n, t[100];
	int m, p[100];
	int x[100];
	int anstime[100] = {0};
	
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	
	cin >> m;
	
	for (int i = 0; i < m; i++) {
		cin >> p[i] >> x[i];
	}
	
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			anstime[i] += t[j];
		}
	}
	
	for (int i = 0; i < m; i++) {
		anstime[i] = anstime[i] - t[p[i] - 1] + x[i];
	}
	
	for (int i = 0; i < m; i++) {
		cout << anstime[i] << endl;
	}
	
	return (0);
}


Measured memory_bytes: 256
def main():
    N = int(input())
    h = list(map(int, input().split()))
    dp = [float("inf")]*N
    dp[0] = 0
    for i in range(1, N):
        if i-1 >= 0:
            dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]))
        if i-2 >= 0:
            dp[i] = min(dp[i], dp[i-2]+abs(h[i]-h[i-2]))
    print(dp[-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 13928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S;
  cin >> N;
  int i;
  for(i = 0;i < N;i++){
    cin >> S;
    if(S == "Y"){
      cout << "Four" << endl;
      break;
    }
    else if(i == N-1){
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 3592
import sys
H,W = map(int,input().split())
array_list = []
for I in range(H):
    array_list.append(list(map(str,input())))

if not ( 1 <= H <= 100 and 1 <= W <= 100 ):
    sys.exit()

# print(array_list)

Horizon_list = []
Vertical_list = []
# Horizon check
for J in range(len(array_list)):
    if array_list[J].count('.') == W:
        Horizon_list.append(J)
# Vertical check
list_check = [list(x) for x in zip(*array_list)]
for K in range(len(list_check)):
    if list_check[K].count('.') == H:
        Vertical_list.append(K)
# print(Horizon_list)
# print(Vertical_list)
for L in range(H):
    for M in range(W):
        if (L not in Horizon_list ) and (M not in Vertical_list):
            print(array_list[L][M],end='')
    print('\n')

Measured memory_bytes: 9316
#include<bits/stdc++.h>
using namespace std;
#define _overload3(_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(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev


int main(){
  int N,M;
  cin >> N >> M;
  vector<int> v[100001];
  REP(i,N){
    int a,b;
    cin >> a >> b;
    v[a].push_back(b);
  }

  priority_queue<int> pq;
  int ans = 0;
  REP(i,1,M+1){
    for(auto x : v[i]) pq.push(x);
    if(pq.empty()) continue;
    ans += pq.top();
    pq.pop();
  }

  cout << ans << endl;
}

Measured memory_bytes: 5632
# -*- coding: utf-8 -*-


def main():
    x, y, z, k = map(int, input().split())
    a = sorted(list(map(int, input().split())), reverse=True)
    b = sorted(list(map(int, input().split())), reverse=True)
    c = sorted(list(map(int, input().split())), reverse=True)
    ac = list()

    for ai in a:
        for ci in c:
            ac.append(ai + ci)

    count = min(x * z, k)
    acs = sorted(ac, reverse=True)[:count]
    ans = list()

    for bi in b:
        for ac_i in acs:
            ans.append(bi + ac_i)

    for j in sorted(ans, reverse=True)[:k]:
        print(j)


if __name__ == '__main__':
    main()


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

int grid[105][105];

int main(){
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n) cin>> a[i];
    ll ans = 0;
    rep(i,n-1){
        ans += a[i]/2;
        a[i] %= 2;
        if(a[i+1]>0&&a[i]==1){
            ans++;
            --a[i+1];
            --a[i];
        }
    }
    ans += a[n-1]/2;

    cout << ans << endl;
}

Measured memory_bytes: 3684
import random
d=int(input())
c=list(map(int,input().split()))
num=[0]*26
ans=[]
numans=0
s=[]
for i in range(1,d+1):
    num1=1
    num2=-(10**100)
    num3=[0]*26
    for j in range(26):
        num3[j]=-1*((i-num[j])*c[j])
    s.append(list(map(int,input().split())))
    for j in range(26):
        num5=s[i-1][j]-num3[j]
        if num5>num2:
            num1=j+1
            num2=num5
    ans.append(num1)
    numans+=num2+s[i-1][num1-1]
    num[num1-1]=i
def sco(n1,n2,n3):
    n0=0
    n01=[0]*26
    old=ans[n1]
    ans[n1]=n2
    for k in range(n3):
        n0+=s[k][ans[k]-1]
        n01[ans[k]-1]=k+1
        for l in range(26):
            n0-=(k+1-n01[l])*c[l]
    return n0
for i in range(1545):
    num6=random.randint(1,26)
    num7=random.randint(1,365)
    num100=sco(num7-1,num6,d)
    if num100>numans*4/5:
        ans[num7-1]=num6
for i in range(d):
    print(ans[i])


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

using namespace std;

const int INF = 1e9;

const int dirx[] = {0, 0, 1, -1};
const int diry[] = {1, -1, 0, 0};

int n, m, i, j, mat[55][55], dp[1005][55][55];

int main(){
	scanf("%d%d", &n, &m);
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
		scanf("%d", &mat[i][j]);
	}
	
	for(int i = 0; i < n * m; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < m; k++)
			dp[i][j][k] = INF;
		}
	}
	
	dp[0][0][0] = 0;
	
	for(int i = 1; i < n * m; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < m; k++){
				for(int ii = 0; ii < 4; ii++){
					int newx = j + dirx[ii];
					int newy = k + diry[ii];
					
					if(newx < 0 || newx >= n || newy < 0 || newy >= m) continue;
					
					dp[i][j][k] = min(dp[i][j][k], dp[i - 1][newx][newy] + 2 * (i - 1) * mat[j][k] + mat[j][k] + 1);
				}
			}
		}
	}
	
	int res = INF;
	
	for(int i = 0; i < n * m; i++)
	res = min(res, dp[i][n - 1][m - 1] - i);
	
	printf("%d\n", res);
}



Measured memory_bytes: 12560
#include<stdio.h>
#include<math.h>


int main(){
	int a,b,c;
	int cho=0;
	int hisi=0;
	
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(pow(a,2)+pow(b,2)==pow(c,2))
			cho++;
		
		if(a==b)
			hisi++;
	}
	
	printf("%d\n%d\n",cho,hisi);
	
	return 0;
	
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout(n) cout << fixed << setprecision(n)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acosl(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int n;
int S[100010];
int q;
int T[50010];


signed main(){
    cin >> n;
    rep(i, 0, n) cin >> S[i];
    cin >> q;
    rep(i, 0, q) cin >> T[i];

    int ans = 0;
    rep(i, 0, q) if(*lb(S, S+n, T[i]) == T[i]) ans++;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4236
a,b,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

min1 = min(A) + min(B)
for i in range(m):
    x,y,c = map(int,input().split())
    min1 = min(min1,(A[x-1] + B[y-1] -c))
print(min1)

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

int f[10],g[10];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<=9;i++) f[i]=-1e9;
	f[0]=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		for(int j=0;j<10;j++) g[(j+x)%10]=f[j]+x;
		for(int j=0;j<10;j++) f[j]=max(f[j],g[j]);
	}
	int Ans=0;
	for(int i=1;i<10;i++) Ans=max(Ans,f[i]);
	cout<<Ans<<endl;
}
	

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

unordered_map<int,vector<int>>H;
int dfs(int i){
	vector<int>a;
	for(auto &e:H[i])a.push_back(-dfs(e));
	sort(a.begin(),a.end());
	int r=0;
	for(int i=1;i<=a.size();i++)r=max(r,i-a[i-1]);
	return r;
}
 
int main(){
	int N,a;
	scanf("%d",&N);
	for(int i=2;i<=N;i++){
		scanf("%d",&a);
		H[a].push_back(i);
	}
	printf("%d\n",dfs(1));
}

Measured memory_bytes: 18340
#include "algorithm"
#include "iostream"
#include "cmath"
#include "string"
#include "map"
#include "iomanip"
using namespace std;

#define TEST 0
#if TEST
FILE *in = freopen("./Q/question.txt", "r", stdin);
FILE *out = freopen("./A/answer.txt", "w", stdout);
#endif


int main(){
  int n,m;
  while(true){
    int tarousum=0,hanakosum=0,ans=1000,idxi=-1,idxj=-1;
    cin >> n >>m;
    int tarous[n],hanakos[m];
    if(!n&&!m)break;
    for(int i=0;i<n+m;++i){
      int a;
      cin >> a;
      if(i<n){
        tarous[i]=a;
        tarousum+=a;
      }else{
        hanakos[i-n]=a;
        hanakosum+=a;
      }
    }

    // cout <<tarousum <<" "<<hanakosum <<endl;
    for(int i=0;i<n;++i){
      for(int j=0;j<m;++j){
        if(tarousum<=hanakosum){
          if(hanakos[j]>=tarous[i]){
          if((tarousum+hanakos[j]-tarous[i])==(hanakosum+tarous[i]-hanakos[j])){
            if(ans>hanakos[j]+tarous[i]){
              ans=hanakos[j]+tarous[i];
              idxi=i;
              idxj=j;
            }
          }
        }
      }else{
        if(hanakos[j]<tarous[i]){
        if((tarousum+hanakos[j]-tarous[i])==(hanakosum+tarous[i]-hanakos[j])){
          if(ans>hanakos[j]+tarous[i]){
            ans=hanakos[j]+tarous[i];
            idxi=i;
            idxj=j;
          }
        }
      }
      }
      }
    }
    if(ans==1000)cout <<-1<<endl;
    else cout <<tarous[idxi]<<" "<<hanakos[idxj]<<endl;
  }
  #if TEST
  fclose(in);
  fclose(out);
  #endif
  return 0;
}

Measured memory_bytes: 2980
/*input
4
3 4 3 2
*/
#include <bits/stdc++.h>
using namespace std;
 
#define mx 500005
#define ll long long
#define MOD 2000000000000007ll
#define fs first
#define sc second
 
 
int main()
{
    int n;
    scanf("%d", &n);
    ll ara[n];
    for(int i = 0; i<n; i++)
        scanf("%lld", &ara[i]);
    ll l = 1, r = MOD;
    int found = 0;
    ll ansa = 0, ansb = 0 ;
    while(l <= r)
    {
        ll mid = (l + r) / 2ll;
        ll now = mid;
        for(int i = 0; i < n; i++)
        {
            mid = (mid/ara[i]) * ara[i];
        }
        if(mid == 2){
            found = 1;
            ansa = now;
            r = now - 1;
        } else if(mid > 2){
            r = now - 1;
        } else l = now + 1;
    }
    if(found == 0){
        printf("-1\n");
        return 0;
    }
    l = 1, r = MOD;
    while(l <= r)
    {
        ll mid = (l + r) / 2;
        ll now = mid;
        for(int i = 0; i < n; i++)
        {
            mid = (mid/ara[i]) * ara[i];
        }
        if(mid > 2){
            r = now - 1;
        } else if(mid==2){
            ansb = now;
            l = now + 1;
        }else{
            l = now + 1;
        }
    }
    cout << ansa << " " << ansb << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    string s;cin >> s;
    vector<ll> v(4);
    vector<string> pm(3);
    rep(i,4){
        v[i]=s[i]-'0';
    }

    rep(j,9){
        int sum=v[0];
        rep(i,3){
            if(j&(ll(1) << i)){
                sum+=v[i+1];
                pm[i]="+";
            }else{
                sum-=v[i+1];
                pm[i]="-";
            }
        }
        if(sum==7){
            break;
        }
    }
    cout << v[0] << pm[0] << v[1] << pm[1] << v[2] << pm[2] << v[3] << "=7" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    int n,k;
    cin>>n >>k;
    vector<int>a(n);
    vector<int>tasu(n);
    vector<int>h(n);
    
    rep(i,n)
    {
        cin>>a[i];
        tasu[i];
        h[i];
    }
    if(n<=k){
        rep(i,n)cout<<n<<" ";
        cout<<endl;
        return 0;
    }
    rep(t,k)
    {   
        tasu=h; 
        rep(i,n)
        {
            tasu[max(0,i-a[i])]++;
            int tasuin=i+a[i]+1;
            if(tasuin<n)tasu[tasuin]--;
        }
        ll now=0;
        bool finish=true;
        rep(i,n-1)
        {
            tasu[i+1]+=tasu[i];
        }
        if(tasu==a)break;
        a=tasu;
    }
    rep(i,n)cout<<a[i]<<" ";
    cout<<endl;
    return 0;

}

Measured memory_bytes: 5620
L, R = gets.split.map(&:to_i)

if R-L > 2019
    puts 0
else
    ans = 2020
    for i in L..R 
        for j in i+1..R 
            a = i % 2019
            b = j % 2019
            ans = [ans, (a*b)%2019].min
        end
    end
end

puts ans

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

string op = "+-/*";

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,s2;
  double ans;
  stack<double> n;
  while(1){
    getline(cin,s);
    if(cin.eof()) break;
    ans = 0;
    s += ' ' ;
    rep(i,s.size()){
      if(s[i] != ' '){
        s2 += s[i];
      }
      else{
        double a,b;
        if(s2 == "+"){
          b = n.top(),n.pop();
          a = n.top(),n.pop();
          ans = a + b;
          n.push(ans);
        }
        else if(s2 == "-"){
          b = n.top(),n.pop();
          a = n.top(),n.pop();
          ans = a - b;
          n.push(ans);
        }
        else if(s2 == "*"){
          b = n.top(),n.pop();
          a = n.top(),n.pop();
          ans = a * b;
          n.push(ans);
        }
        else if(s2 == "/"){
          b = n.top(),n.pop();
          a = n.top(),n.pop();
          ans = a / b;
          n.push(ans);
        }
        else{
          n.push(ston(s2,1.0));
        }
        s2.clear();
      }
    }
    fcout(6) << n.top() << endl;
  }
  return 0;
}

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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

signed main(){
    io();
    int n, m; cin >> n >> m;
    int ac = 0, pe = 0;
    vector<int> ok(n + 1, 0);
    vector<int> wa(n + 1, 0);
    for(int i = 0, x; i < m; ++i){
        string s;
        cin >> x >> s; --x;
        if(!ok[x]){
            if(s == "AC"){
                ++ac;
                pe += wa[x];
                ok[x] = 1;
            }else{
                ++wa[x];
            }
        }
    }
    cout << ac << ' ' << pe << '\n';
    return 0;
}

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

int main(){
  int Q;
  cin>>Q;
  std::vector<int> l(Q),r(Q);
  for(int i=0;i<Q;i++)cin>>l[i]>>r[i];
  std::vector<int> v(100005,0);
  v[1]=0;
  int k;
  for(int i=3;i<100003;i+=2){
    k=0;
    for(int j=2;j*j<=i;j++)if(i%j==0)k++;
    for(int j=2;j*j<=(i+1)/2;j++)if(((i+1)/2)%j==0)k++;
    if(k)v[i]=v[i-2];
    else v[i]=v[i-2]+1;
  }
  for(int i=0;i<Q;i++){
    if(l[i]==1)cout<<v[r[i]]-v[l[i]]<<endl;
    else cout<<v[r[i]]-v[l[i]-2]<<endl;
  }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
// #define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;
#define PI 3.14159265358979323846264338327950L


using Graph = vector<vector<int>>;

signed main() {
  int a,b;
  cin >> a >> b;
  int cnt = 1;
  int ans = 0;
  while (cnt<b) {
    cnt += a-1;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner
import kotlin.system.exitProcess

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val sheet = Array(3){IntArray(3){scn.nextInt()} }
	val n = scn.nextInt()
	val bs = IntArray(n){scn.nextInt()}
	val holes = Array(3){i -> BooleanArray(3){j -> sheet[i][j] in bs} }
	repeat(3){ i ->
		if (holes[i].all { it }) yes()
		if (holes.all {it[i]}) yes()
	}
	if ((0..2).all{holes[it][it]}) yes()
	if ((0..2).all{holes[it][2-it]}) yes()
	print("No")
}

fun yes(){
	print("Yes")
	exitProcess(0)
}

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

const int MAX_N = 100000;
const long long MOD = 1000000007LL;

int main() {
  long long N, a[MAX_N] = {0}, ans;
  cin >> N;
  for (int i=0; i<N; i++) {
    int tmp;
    cin >> tmp;
    a[tmp]++;
  }
  bool flag = false, odd = ((N&1)==1 && a[0]!=1);
  for (int i=1+(N&1); i<N; i+=2) {
    if (a[i] != 2) flag = true;
  }
  if (flag || odd) {
    cout << 0 << endl;
  } else {
    long long ans = 1;
    for (int i=0; i<N/2; i++) {
      ans *= 2;
      ans %= MOD;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int primer(int num) {
	int prime = 0;
	for (size_t i = 2; i < sqrt(num); i++)
	{
		if (num%i==0)
		{
			prime = 1;
			break;
		}
	}
	return prime;
}
int main() {
	int A,N=1;
	cin >> A;
	while (N!=0)
	{
		N = primer(A);
		A++;
	}
	cout << A - 1;

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	string ans;	
	string input;

	cin >> input;

	int len = input.length();
	for(int i=0;i<len;i++){
		if(input[i] >='A' && input[i] <= 'C'){
			switch(input[i]){
				case 'A':
					ans += 'X';
					break;
				case 'B':
					ans += 'Y';
					break;
				case 'C':
					ans += 'Z';
					break;
			}
		}
		else{
			ans += input[i]-3;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1180
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int a = sc.nextInt();

		if (n % 500 <= a) {
			pr.println("Yes");
		} else {
			pr.println("No");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 20948
// AtCoder Begginer Contest 140 B - Buffet
// https://atcoder.jp/contests/abc140/tasks/abc140_b

#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
using uint = unsigned int;

int main() {
	uint N;
	cin >> N;
	
	vector<uint> A(N);
	for (uint i=0; i<N; i++) {
		cin >> A[i];
	}
	
	vector<uint> B(N);
	for (uint i=0; i<N; i++) {
		cin >> B[i];
	}
	
	vector<uint> C(N);
	for (uint i=0; i<N; i++) {
		cin >> C[i];
	}
	
	uint mnz = accumulate(B.begin(), B.end(), 0);
	
	for (uint i=0; i<N-1; i++) {
		if (A[i] + 1 == A[i+1]) {
			mnz += C[A[i]-1];
		}
	}

	cout << mnz;
	
	return 0;
}

Measured memory_bytes: 888
<?php
// Your code here!
$template = trim(fgets(STDIN));
$target = trim(fgets(STDIN));

if(check($template,$target)){
    echo 'Yes';
}else{
    echo 'No';
}

function check($template,$target){
    if(substr($target,0, -1) === $template ){
        return true;
    }else{
        return false;
    } 
}

?>

Measured memory_bytes: 16180
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

ll k; //  :))
int n, m, u, v, x, y, t, a, b;
int TR[MAXN][2], bad[MAXN], ans[MAXN], ts;
string S[MAXN];

void dfs(int v, int h){
	if (bad[v]) return ;
	for (int i:{0, 1}){
		int u=TR[v][i];
		if (u) dfs(u, h+1);
		else if (h!=k) ans[__builtin_ctzll(k-h)]^=1;
	}
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>k;
	for (int i=1; i<=n; i++){
		cin>>S[i];
		int v=0;
		for (char ch:S[i]){
			if (!TR[v][ch-'0']) TR[v][ch-'0']=++ts;
			v=TR[v][ch-'0'];
		}
		bad[v]=1;
	}
	dfs(0, 0);
	for (int i=0; i<MAXN; i++) if (ans[i]) kill("Alice")
	kill("Bob")
	
	return 0;
}


Measured memory_bytes: 9840
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
//#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){


    int N;
    cin >> N;
    for( int ni = 1 ; ni < 10 ; ni++ ){
        int kai;
        kai = ni * 111;
        if(N <= kai){
            cout << kai;
            break;
        }
    }
    

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int H, W;
	cin >> H >> W;
	char a[H][W];
	int cnt_r[H], cnt_c[W];
	for(int j = 0; j < W; j++){
		cnt_c[j] = 0;
	}
	for(int i = 0; i < H; i++){
		cnt_r[i] = 0;
		for(int j = 0; j < W; j++){
			cin >> a[i][j];
			if(a[i][j] == '#'){
				cnt_r[i]++;
				cnt_c[j]++;
			}
		}
	}
	//cout << endl;
	for(int i = 0; i < H; i++){
		if(cnt_r[i] != 0){
			for(int j = 0; j < W; j++){
				if(cnt_c[j] != 0){
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [ab, bc, ca] <- readInts
  print $ solve ab bc ca

solve :: Int -> Int -> Int -> Int
solve ab bc ca =
  (if ab > bc && ab > ca
    then bc * ca
    else
      if bc > ab && bc > ca then ab * ca else ab * bc) `div` 2

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

toTup2 :: [[a]] -> [(a, a)]
toTup2 = map (\ys -> case ys of y : z : zs -> (y, z))

encIdx2 :: Int -> (Int, Int) -> Int
encIdx2 mx (y, x) = y * mx + x

decIdx2 :: Int -> Int -> (Int, Int)
decIdx2 mx idx = (idx `div` mx, idx `mod` mx)

encIdx3 :: (Int, Int) -> (Int, Int, Int) -> Int
encIdx3 (my, mx) (z, y, x) = z * my * mx + y * mx + x

decIdx3 :: (Int, Int) -> Int -> (Int, Int, Int)
decIdx3 (my, mx) idx = (z, y, x)
  where
    basez = my * mx
    z = idx `div` basez
    y = (idx `mod` basez) `div` mx
    x = idx `mod` mx

while :: Monad m => m Bool -> m () -> m ()
while cond body = do
  b <- cond
  when b $ do
    body
    while cond body


Measured memory_bytes: 380
#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << (#x) << " = " << x << endl;
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;

using namespace std;

ll modInverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}

/* nCr % mod
ll fact[6*N];
ll inv[6*N],invfac[6*N];
ll mod = 998244353;

void factorial()
{
    fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=5*N + 10;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
        invfac[i] = (invfac[i-1]*inv[i])%mod;
    }
}*/

bool prime[100005];

void Sieve(int n)
{
    //bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    /*for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";*/
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int Nmax = 1e6 + 5;
ll mod = 1e9 + 7;

int cnt[Nmax];

bool divisor(int n)
{
    bool ans = true;
    for(int i=1;i<=sqrt(n);i++)
    {
        if(n%i == 0)
        {
            int a = i;
            int b = n/i;
            if(cnt[a] > 0)
                return false;
            if(cnt[b] > 0)
                return false;
        }
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int arr[n];
    mem(cnt,0);
    int ans = 0;
    for(int i=0;i<n;i++)
    {
        cin >> arr[i];
        cnt[arr[i]]++;
    }
    for(int i=0;i<n;i++)
    {
        cnt[arr[i]]--;
        if(divisor(arr[i]))
            ans++;
        cnt[arr[i]]++;
    }
    cout << ans;
}


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

int main(){
    int x;
    cin >> x;
    cout << x/3600 << ":" << (x - (x/3600)*3600)/60 << ":" << x - (x/3600)*3600 - ((x - (x/3600)*3600)/60)*60 << endl;

   return 0;
}

Measured memory_bytes: 1164