akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  vector<int> b(3);
  string s; cin>>s;
  int a;
  rep(i,4){
    if(i==0) a=s[i]-'0';
    else b[i-1]=s[i]-'0';
  }
  // rep(i,3) cout<<b[i]<<endl;
  for(int bit=0;bit<(1<<3);bit++){
    // cout<<bitset<8>(bit)<<endl;
    int sum=a;
    rep(i,3){
      int d=(1<<i);
      if((bit&d)!=0) sum+=b[i];
      else sum-=b[i];
      // cout<<sum<<" ";
    }
    // cout<<endl;
    if(sum==7){
      cout<<a;
      rep(i,3){
        int d=1<<i;
        if((bit&d)!=0) cout<<"+";
        else cout<<"-";
        cout<<b[i];
      }
      cout<<"=7"<<endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    long long n, m;
    cin >> n >> m;
    long long ans = 0;
    if(n >= m/2){
        cout << m/2 << endl;
    }else{
        ans += n;
        m -= n*2;
        ans += m/4;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main()
{
    long long a, b, c;
    cin >> a >> b >> c;

    long long d;
    bool f;
    if(c >= a+b)
    {
        d = c - a - b;
        f = 4*a*b<d*d;
    }
    else
    {
        f = false;
    }

    if(f)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

int main() {
  long long A, B, K = 0;
  long long d1, d2, d3 = 0;
  cin >> A >> B >> K;
  if(A - K > 0) {
    d1 = A - K;
    d2 = B;
    d3 = 0;
  }
  else {
    d1 = 0;
    d2 = B;
    d3 = K - A;
    if(A + B - K > -1) {
      d2 = A + B - K;
      d3 = 0;
    }
    else {
      d2 = 0;
      d3 = K - A - B;
    }
  }
  cout << d1 << " " << d2 << endl;
}


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

int h[100007] = {};
int dp[100007] = {};

int main() {
	
	int i,j;
	int N;
	
	cin >> N;
	for( i=1; i<=N; i++) {
		cin >> h[i];
		dp[i] = ULTRA;
	}
	dp[1] = 0;
	for( i=1; i<=N; i++) {
		dp[i+1] = min( dp[i] + abs( h[i]-h[i+1]), dp[i+1]);
		dp[i+2] = min( dp[i] + abs( h[i]-h[i+2]), dp[i+2]);
	}
	cout << dp[N] << "\n";
	
	return 0;
}

Measured memory_bytes: 4284
// AOJ 2706: Let's Solve Geometric Problems
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <math.h>

#define SIZE  20
int factor[SIZE], size;

int ptbl[] = {
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997, 0 };

void prime_factor(int n)
{
  int i, d;
  int sw;
  int *pp;

  size = 0;
  if ((n & 1) == 0) {
    factor[size++] = 2;
    do n >>= 1;
    while ((n & 1) == 0);
  }
  for (pp = ptbl; n > 1 && *pp > 0; pp++) {
    if (n % *pp) continue;
    d = *pp;
    factor[size++] = d;
    do n /= d;
    while (n % d == 0);
  }
  if (n > 1) {
    d = (int)sqrt(n);
    for (i = 1009, sw = 0; n > 1; ) {
      if (i > d) {
        factor[size++] = n;
        break;
      }
      if (n % i == 0) {
        factor[size++] = i;
        do n /= i;
        while (n % i == 0);
      }
      if (sw) { i += 2, sw = 0; }
      else    { i += 4, sw = 1; }
    }
  }
}

int gcd(int a, int b)
{
	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

int main()
{
	int p, q, i, ans;

	scanf("%d%d", &p, &q);
	i = gcd(p, q), p /= i, q /= i;
	prime_factor(q);
	for (ans = 1, i = 0; i < size; i++) ans *= factor[i];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1828
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>> n;
  map<char, int> mp;

  for(int i = 0; i < n; i++) {
    char c;
    cin>> c;
    mp[c] = 1;
  }
  
  if(mp.size() == 3) cout<< "Three" <<endl;
  else                cout<< "Four"  <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define to_int(s) stoi(s)

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    string s;
    cin >> s;

    int min_abs = 1000000000;
    int tmp = 0;
    for (int i = 0; i < s.length() - 2; i++) {
        tmp = abs(to_int(s.substr(i, 3)) - 753);
        if (tmp < min_abs) {
            min_abs = tmp;
        }
    }
    cout << min_abs << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   string s;
   cin >> s;
   int ans = 700;
   if (s[0] == 'o') ans += 100;
   if (s[1] == 'o') ans += 100;
   if (s[2] == 'o') ans += 100;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int[] c1 = new int[1001];
        int[] c2 = new int[1001];
        while(true){
            String s = sc.nextLine();
            if(s.equals(""))break;
            c1[Integer.parseInt(s.split(",")[0])]++;
        }
        while(sc.hasNext()){
            c2[Integer.parseInt(sc.nextLine().split(",")[0])]++;
        }
        sc.close();
        for(int i = 0; i <= 1000; i++) {
        	if(c1[i] != 0 && c2[i] != 0) {
        		System.out.printf("%d %d\n", i, c1[i] + c2[i]);
        	}
        }
	}
}


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

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

    int k=s.length();
    string sii(s, s.length()-1, 1);
    for(int i=s.length()-2;i>=0;i--){
        string si(s, i,1);
        if(si==sii){
            if(i!=0){
                si=si+s[i-1];
                i--;
            }
            k--;
        }
        sii=si;
    }

    cout<<k<<endl;
}

Measured memory_bytes: 640
<?php
list($r,$c) = explode(" ",trim(fgets(STDIN)));
$l = array_fill(0,$c+1,0);
for($i = 0; $i < $r; $i++){
    $arr = explode(" ",trim(fgets(STDIN)));
    $arr[] = array_sum($arr);
    foreach($arr as $k => $v){
        $l[$k] += $v;
    }
    echo implode(" ",$arr)."\n";
}
echo implode(" ",$l)."\n";

Measured memory_bytes: 15556
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n, h;
    cin >> h >> n;
    rep(i,n){
        lli a;
        cin >> a;
        h -= a;
    }
    YN(h <= 0);
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <queue>
#include <unordered_map>
#define ll long long
#define pii pair <int, int>
#define pll pair <long long, long long>
#define plxy pair <long long, pll>
#define INT_MAX 1e18
#define Keep_calm_You_are_still_learning ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace std;
const int mod=1e9+7;
const int N=1e5+5;
ll dp[N];
int main()
{
    ll n,arr[N];
    cin>>n;
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(ll i=2;i<n;i++)
    {
        dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);
    }
    cout<<dp[n-1];
    return 0;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p.at(i);
    sort(p.begin(),p.end());
    int ans = 0;
    rep(i,k) ans += p.at(i);
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
int main(){
string s;
cin >> s;
ll n = s.size() + 1;
vector<ll> ans(n,0);
for (ll i = 0; i < n;i++){
    if (s[i] == '<') chmax(ans[i + 1], ans[i] + 1);
}
for (ll i = n - 2; i > -1;i--){
    if (s[i] == '>') chmax(ans[i], ans[i + 1] + 1);
}
ll mini = *min_element(ans.begin(), ans.end());
for (ll i = 0; i < n; i++) {
    ans[i] -= mini;
}
ll res = 0;
for (ll i = 0; i < n; i++) res += ans[i];
cout << res << endl;
}

Measured memory_bytes: 7700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second


int n,A,B,C;
vector<int> v(n);

int dfs(vector<int> a,vector<int> b,vector<int> c,int i){

    if(i == n){
        if(a.size()==1 || b.size()==1 || c.size()==1){
            return pow(10,9);
        }
        int anss=0,asum=0,bsum=0,csum=0;
        for(int i=0;i < (int)a.size();i++)
        {
            asum+=a.at(i);
        }
         for(int i=0;i < (int)b.size();i++)
        {
            bsum+=b.at(i);
        }
         for(int i=0;i < (int)c.size();i++)
        {
            csum+=c.at(i);
        }
        anss += 10*max((int)(a.size()-2),0);
        anss += 10*max((int)(b.size()-2),0);
        anss += 10*max((int)(c.size()-2),0);//最初に０入れたので
        anss += abs(asum-A);
        anss += abs(bsum-B);
        anss += abs(csum-C);

        return anss;
    }//終了条件 
    vector<int> as,bs,cs;
    as=a;bs=b;cs=c;
    as.push_back(v.at(i));
    bs.push_back(v.at(i));
    cs.push_back(v.at(i));
    return min({dfs(as,b,c,i+1),dfs(a,bs,c,i+1),dfs(a,b,cs,i+1),dfs(a,b,c,i+1)});
    //枝にどれを担当させるか
}
    
int main(){
    cin >> n >> A >> B >> C;
    v.resize(n);
    for(int i=0;i < n;i++)
    {
        cin >> v.at(i);
    }
    
    cout << dfs({0},{0},{0},0) << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] a = new int[N];

        for (int i = 0; i < N; i++) {
            a[i] = Integer.parseInt(sc.next());
        }

        int count = 0;
        int k = 1;
        for (int i = 0; i < N; i++) {
            if (a[i] == k) {
                k++;
            } else {
                count++;
            }
        }

        if (count == N) {
            System.out.println(-1);
        } else {
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 50672
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
  
using namespace std;

int main()
{
	int n, m;
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0) break;
		int h[1500], w[1500];
		int sumh = 0, sumw = 0;
		for(int i = 0; i < n; i++){
			cin >> h[i];
			sumh += h[i];
		}
		for(int i = 0; i < m; i++){
			cin >> w[i];
			sumw += w[i];
		}
		int resulth[sumh + 1], resultw[sumw + 1];
		for(int i = 0; i < sumh + 1; i++){
			resulth[i] = 0;
		}
		for(int i = 0; i < sumw + 1; i++){
			resultw[i] = 0;
		}
		for(int i = 0; i < n; i++){
			int tmp = 0;
			for(int j = i; j < n; j++){
				tmp += h[j];
				resulth[tmp]++;
			}
		}
		for(int i = 0; i < m; i++){
			int tmp = 0;
			for(int j = i; j < m; j++){
				tmp += w[j];
				resultw[tmp]++;
			}
		}
		int ans = 0;
		for(int i = 1; i < min(sumh, sumw) + 1; i++){
			ans += resultw[i] * resulth[i];
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 5104
Flag = True
data = []
while Flag:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        Flag = False
    else:
      data.append((H, W))
#print(data)

for (H, W) in data:
    for i in range(H):
        print('#' * W)
    print('\n', end="")


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

int	main() {
	int N;
	cin >> N;
	vector<string> W(N);
	cin >> W.at(0);
	for (int i=1; i<N; i++) {
		cin >> W.at(i);
		if (W.at(i-1).at(W.at(i-1).size()-1) != W.at(i).at(0)) {
			cout <<"No" <<endl;
			return 0;
		}
	}
	sort(W.begin(), W.end());
	for (int i=1; i<N; i++) {
		if (W.at(i-1) == W.at(i)) {
			cout <<"No" <<endl;
			return 0;
		}
	}
	cout <<"Yes" <<endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w+h==0) break;
			int[][] tile = new int[h+2][w+2];
			int start_x = 0, start_y = 0;
			for(int i=1; i<=h; i++){
				String temp = sc.next();
				for(int j=1; j<=w; j++){
					if(temp.charAt(j-1)=='.'){
						tile[i][j] = 1;
					}else if(temp.charAt(j-1)=='@'){
						tile[i][j] = 1;
						start_x = j;
						start_y = i;
					}
				}
			}
			int count = Main.Count_tile(tile, start_x, start_y);
			System.out.println(count);
		}
	}

	static final int[] dx = {1, 0, -1, 0};
	static final  int[] dy = {0, 1, 0, -1};

	static int Count_tile(int[][] tile, int x, int y){
		int sum = 1;
		tile[y][x] = 0;
		for(int i=0; i<4; i++){
			if(tile[y+dy[i]][x+dx[i]]==1){
				sum += Main.Count_tile(tile, x+dx[i], y+dy[i]);
			}
		}
		return sum;
	}
}

Measured memory_bytes: 38588
h , w = map(int, input().split())
A = []
for i in range(h):
    A.append(list(input()))
#行に対しての作業
ans = 0
'''
for i in A:
    print(A.index)
    if(i.count('.') == w):
        del A[A.index(i)]   
'''
B = []
for i in range(h):
    if(A[i].count('.') != w):
        B.append(A[i])


count=0
ans=0
for i in range(w):
    i -=ans
    for j in B:
        if(j[i] == '.'):
            count+=1
    if(count==len(B)):
        for j in B:
            del j[i]
        ans +=1
    count=0

for i in B:
    for j in i:
        print(j, end="")
    print()

Measured memory_bytes: 4596
# encoding:utf-8
import copy
import numpy as np
import random


s = list(str(input()))

dna = ["A","T","G","C"]
count = 0
ans = 0
for i in s:
    if i in dna:
        count += 1
    else:
        count = 0
    ans = max(count,ans)

print(ans)


Measured memory_bytes: 13864
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    int ans = 0;
    int c1 = n - 1;
    for(int c0 = 0; c0 < n && c0 != c1; c0++)
    {
        auto c = s[c0];
        if(c == 'W')
        {
            for(; c1 > c0; c1--)
            {
                if(s[c1] == 'R')
                {
                    ans++;
                    s[c1] ='W';
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3720
n, k = map(int, input().split())
rsp = list(map(int, input().split()))
t = input()
dp = [[0]*(n+1) for _ in range(3)]
d = {"r":0, "s":1, "p":2}
for i in range(1, n+1):
    now = d[t[i-1]]
    if i <= k:
        for j in range(3):
            if (now - j)%3 == 1:
                dp[j][i] = rsp[j]
    else:
        for j in range(3):
            c = 0
            for l in range(3):
                if l != j:
                    c = max(c, dp[l][i-k])
            dp[j][i] += c
            if (now - j)%3 == 1:
                dp[j][i] += rsp[j]
ans = 0
for i in range(n-k+1, n+1):
    c = 0
    for j in range(3):
        c = max(c, dp[j][i])
    ans += c
print(ans)

Measured memory_bytes: 15084
// Aizu Vol-1 0153: Triangle and Circle
// 2017.8.12 bal4u@uu

#include <stdio.h>

long long x[10], y[10];
long long xe, ye, r;

int atSameSide(long long x1, long long y1, long long x2, long long y2,
	long long xa, long long ya, long long xb, long long yb)
{
	long long sa, sb;
	sa = (x2 - x1) * (ya - y1) + (y2 - y1) * (x1 - xa);
	sb = (x2 - x1) * (yb - y1) + (y2 - y1) * (x1 - xb);
	return (sa >= 0 && sb >= 0) || (sa < 0 && sb < 0);
}

int between(long long x1, long long y1, long long x2, long long y2,
	long long x, long long y)
{
	long long sa, sb;
	sa = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
	sb = (x1 - x2) * (x - x2) + (y1 - y2) * (y - y2);
	return (sa >= 0 && sb >= 0) || (sa < 0 && sb < 0);
}

int disCmp(long long x1, long long y1, long long x2, long long y2,
	long long x, long long y, long long r)
{
	long long a, b, c, t;			/* ax + by + c = 0 */
	long long squ;
	a = y1 - y2, b = x2 - x1, c = y2*x1-x2*y1;
	squ = a*a + b*b;
	if (squ == 0) return 0;
	t = (a * x) + (b * y) + c;
	t = t*t - r*r*squ;
	if (t > 0) return 1;
	if (t < 0) return -1;
	return 0;
}

int main()
{
	int i, f;
	long long d[3], rr;

	while (1) {
		for (i = 0; i < 3; i++) {
			scanf("%lld%lld", x + i, y + i);
			if (!i && !x[0] && !y[0]) return 0;
			x[i + 3] = x[i], y[i + 3] = y[i];
		}
		scanf("%lld%lld%lld", &xe, &ye, &r); rr = r*r;

		for (i = 0; i < 3; i++)
			d[i] = (x[i] - xe)*(x[i] - xe) + (y[i] - ye)*(y[i] - ye);
		if (rr >= d[0] && rr >= d[1] && rr >= d[2]) { puts("b"); continue; }
		if (rr >= d[0] || rr >= d[1] || rr >= d[2]) { puts("c"); continue; }

		for (f = 1, i = 0; f && i < 3; i++)
			f = atSameSide(x[i], y[i], x[i + 1], y[i + 1],
				x[i + 2], y[i + 2], xe, ye);
		for (i = 0; i < 3; i++)
			d[i] = disCmp(x[i], y[i], x[i + 1], y[i + 1], xe, ye, r);
		if (f) { puts(d[0] >= 0 && d[1] >= 0 && d[2] >= 0 ? "a" : "c"); continue; }
		if (d[0] > 0 && d[1] > 0 && d[2] > 0) { puts("d"); continue; }

		for (f = 1, i = 0; f && i < 3; i++)
			if (between(x[i], y[i], x[i + 1], y[i + 1], xe, ye) && d[i] <= 0) f = 0;
		puts(f ? "d" : "c");
	}
	return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;

public class Main {


		public static void main(String[] args) {

			Scanner scan = new Scanner(System.in);
			String N = scan.next();
			String [] token = N.split(" ");
			long a = Long.parseLong(token[0]);
			long b = Long.parseLong(scan.next());
			long c = Long.parseLong(scan.next());
			long d = Long.parseLong(scan.next());


			long max = Long.MIN_VALUE;
			max = Math.max(max, b*d);
			max = Math.max(max, a*c);
			max = Math.max(max, a*d);
			max = Math.max(max, b*c);
			System.out.println(max);
			scan.close();
		}

}

Measured memory_bytes: 35592
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;


int main(){

    int n,tmp;
    scanf("%d",&n);

    int L[n],length = 0,left,right,m;

    for(int i=0; i < n; i++){
        scanf("%d",&tmp);

        if(i == 0){
            L[0] = tmp;
        }else{
            if(L[length] < tmp){
                length++;
                L[length] = tmp;
            }else{
            	left = 0,right = length+1;
            	m = left;
            	while(true){
            		if(L[m] >= tmp){
            			for(;m >= 0 && L[m] >= tmp; m--);
            			L[m+1] = tmp;
            			break;
            		}else{
            			left = m;
            			m = (left+right)/2;
            		}
            	}
            }
        }
    }

    printf("%d\n",length+1);

    return 0;
}

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

using ll = long long;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((a+d-1)/d < (c+b-1)/b) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3628
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<string> s(n);
    REP(i,n) cin >> s[i];
    map<string,int> mp;
    rep(i,n){
        int a=0;
        a=mp[s[i]];
        mp[s[i]]=a+1;
    }

    // cout<<endl;
    ll ans=0;
    for(auto x : mp){
        // cout<<x.fs<<" "<<x.sc<<endl;
        chmax(ans,x.sc);
    }
    for(auto x : mp){
        if(ans==x.sc){
            cout<<x.fs<<endl;
        }
    }
    

    
}

Measured memory_bytes: 25472
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	string s;
	cin >> s;
	
	if(s.size() == 6){
		if(s[2] == s[3] && s[4] == s[5]){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int N, A, B, C, COST=0;
vector<int> L;
int minl[3]={100000, 100000, 100000};

int calc_mp(int cur, int a, int b, int c) {
    if(cur==N) {
        if(min(a, min(b, c))!=0) {
            return abs(A-a)+abs(B-b)+abs(C-c)-30;
        } else {
            return 100000;
        }
    }
    
    int retn=calc_mp(cur+1, a, b, c);
    int reta=calc_mp(cur+1, a+L[cur], b, c)+10;
    int retb=calc_mp(cur+1, a, b+L[cur], c)+10;
    int retc=calc_mp(cur+1, a, b, c+L[cur])+10;
    return min(min(retn, reta), min(retb, retc));
}

// void dfs(int index, int cost, int a, int b, int c) {
//     if(index==L.size()) {
//         if(abs(A-a)+abs(B-b)+abs(C-c)<abs(A-minl[0])+abs(B-minl[1])+abs(C-minl[2])\
//             && a!=0 && b!=0 && c!=0) {
//             minl[0]=a;
//             minl[1]=b;
//             minl[2]=c;
//             COST=cost;
//         }
//         return ;
//     }
    
//     index++;
//     dfs(index, cost, a, b, c);
//     dfs(index, cost+10, a+L[index-1], b, c);
//     dfs(index, cost+10, a, b+L[index-1], c);
//     dfs(index, cost+10, a, b, c+L[index-1]);
// }

int main() {
    cin >> N >> A >> B >> C;
    
    for(int i=0; i<N; i++) {
        int l;
        cin >> l;
        L.push_back(l);
    }
    
    // dfs(0, COST, 0, 0, 0);
    
    // cout << COST-30+abs(A-minl[0])+abs(B-minl[1])+abs(C-minl[2]) << endl;
    
    cout << calc_mp(0, 0, 0, 0) << endl;

    return 0;
    
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) begin(x),end(x)

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

const int INF = 0x3fffffff;

int V, E;
int C[1005];
int F[1005];
vector<pii> e[105];
int solve(int n, int c, vector<bool> &bf){
	if( bf[n] || c==0 ) return 0;
//	cout << "solve: " << n << " " << c << endl;
	if( n == V-1 ) return c;
	bf[n] = true;
	for(auto to: e[n]){
		int i = to.second;
		int cc = ( i>0 ? C[i]-F[i] : F[-i] );
//		cout << "flow " << n << endl;
		int flow = solve(to.first, min(c, cc), bf); 
		if( flow > 0 ){
			F[ abs(i) ] += flow * (i/abs(i));
			return flow;
		}
	}
	return 0;
}

int main(){
	cin >> V >> E;
	rep(i,E+1){
		if(i==0) continue;
		int u, v, c;
		cin >> u >> v >> c;
		e[u].emplace_back(v,  i);
		e[v].emplace_back(u, -i);
		C[i] = c;
	}
	int ans = 0;
	vector<bool> bf(105, false);
	for(int add; add = solve(0,INF,bf); fill(all(bf),false)) ans += add;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
const int  mod = 1e9 + 7;
int main(int argc, const char** argv) {
    int H,W,i,j;
    cin>>H>>W;
    char matrix[H][W];
    int dp[H][W]={0};
    dp[0][0] = 1;
    
    for(i=0;i<H;i++)
        for(j=0;j<W;j++)
            cin>>matrix[i][j];

    for(i=1;i<H;i++)
        if(matrix[i][0]=='.')
            dp[i][0] = dp[i-1][0];
        else
            dp[i][0] = 0;

    for(i=1;i<W;i++)
        if(matrix[0][i]=='.')
            dp[0][i] = dp[0][i-1];
        else
            dp[0][i] = 0;

    
    for(i=1;i<H;i++){
        for(j=1;j<W;j++)
            if(matrix[i][j]=='#')
                dp[i][j] = 0;
            else
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
    }
    cout<<dp[H-1][W-1]<<endl;
    return 0;
}

Measured memory_bytes: 5120
import sys
input=sys.stdin.readline
n=int(input())
A=[int(input()) for _ in range(n)]
ans=A[0]-1
cnt=2
for i,a in enumerate(A[1:]):
    if a<cnt:
        continue
    if a==cnt:
        cnt+=1
    else:
        ans+=(a-1)//cnt
print(ans)

Measured memory_bytes: 44764
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
struct UnionFind {
  vi d;
  UnionFind(int n): d(n,-1) {}
  int root(int x) {
    if (d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y){
    return root(x) == root(y);
  }
  int size(int x){
    return -d[root(x)];
  }
};
int main(){
  int n,m,k;
  cin >> n >> m >> k;
  vi root(n);
  UnionFind tree(n);
  rep(i, m){
    int a,b;
    cin >> a >> b;
    a--; b--;
    root[a]++;
    root[b]++;
    tree.unite(a,b);
  }
  vvi block(n);
  rep(i, k){
    int c,d;
    cin >> c >> d;
    c--; d--;
    block[c].push_back(d);
    block[d].push_back(c);
  }
  rep(i, n){
    int ans = tree.size(i) - 1 - root[i];
    for(int a : block[i]){
      if(tree.same(i, a)) ans--;
    }
    cout << ans;
    if(i != n - 1) cout << " ";
    else cout << endl;
  }
}

Measured memory_bytes: 6784
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    H, W = lr()
    a = H*W
    if H == 1 or W == 1:
        print(1)
    elif a%2 == 1:
        print((a+1)//2)
    else:
        print(a//2)
    return
resolve()

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

int main()
{ 
  vector<string> A;
  vector<string> B;
  int N,M;
  cin>>N>>M;

  for(int i = 0;i < N;++i){
    string temp;
    cin>>temp;
    A.push_back(temp);
  }
  for(int i = 0;i < N;++i){
    string temp;
    cin>>temp;
    B.push_back(temp);
  }

  int ans = 0;
  for(int i = 0;i < N;++i){
    string a = A.at(i);
    string b = B.at(i);

    for(int j = 0;j < M;++j){
      char a2 = a[j];
      char b2 = b[j];

      if(a2 != b2){
        ++ans;
      }
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 11100
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	sc.Scan()
	in := sc.Text()
	tokens := strings.Split(in, " ")
	stack := Stack{}
	for _, token := range tokens {
		switch token {
		case "+":
			r, err := strconv.Atoi(stack.Pop())
			if err != nil {
				panic(err)
			}
			l, err := strconv.Atoi(stack.Pop())
			if err != nil {
				panic(err)
			}
			stack.Push(fmt.Sprintf("%d", l+r))
		case "-":
			r, err := strconv.Atoi(stack.Pop())
			if err != nil {
				panic(err)
			}
			l, err := strconv.Atoi(stack.Pop())
			if err != nil {
				panic(err)
			}
			stack.Push(fmt.Sprintf("%d", l-r))
		case "*":
			r, err := strconv.Atoi(stack.Pop())
			if err != nil {
				panic(err)
			}
			l, err := strconv.Atoi(stack.Pop())
			if err != nil {
				panic(err)
			}
			stack.Push(fmt.Sprintf("%d", l*r))
		default:
			stack.Push(token)
		}
	}
	fmt.Println(stack.Pop())
}

type Stack struct {
	tokens []string
}

func (s *Stack) Push(v string) {
	s.tokens = append(s.tokens, v)
}

func (s *Stack) Pop() string {
	result := s.tokens[len(s.tokens)-1]
	s.tokens = s.tokens[:len(s.tokens)-1]
	return result
}



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

int main()
{
	int n,m,l;

	cin >> n >> m >> l;

	int a[101][101] = {};
	int b[101][101] = {};
	long c[101][101] = {};

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j < l; j++)
		{
			cin >> b[i][j];
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < l; j++)
		{
			for (int k = 0; k < m; k++)
			{
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0, k = 0; j < l; j++, k++)
		{
			if (k != 0)
			{
				cout << " ";
			}
			cout << c[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1328
import math

inputs = list(map(int, (input().split())))


a = inputs[0]
b = inputs[1]
c = inputs[2]

# aa = math.sqrt(a)
# bb = math.sqrt(b)
# cc = math.sqrt(c)

if a + b >= c:
    print("No")
    exit(0)

if ((c - a - b)**2 > 4*a*b):
    print("Yes")
else:
    print("No")


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

int main(){

int N;
cin >> N;
vector<int> v(N);
for(int i=0;i<N;i++)cin >> v.at(i);
sort(v.begin(),v.end());
double sum = 0.0;
for(int x:v){
  if(sum == 0) sum+=x;
  else{
    sum += x;
    sum /= 2.0;
  }
}

cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>

int main() {
	long long x;

	std::cin >> x;

	long long a = x % 100; // 端数
	long long b = x / 100;

	long long count = 0;

	for (size_t i = 5; i > 0; i--)
	{
		count += (a / i);
		a %= i;
	}

	if (count <= b) {
		std::cout << 1 << std::endl;
	}
	else {
		std::cout << 0 << std::endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

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

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

  if (N == 1) {
    cout << "Hello World" << endl;
  } else if (N == 2) {
    int A, B;
    cin >> A >> B;
    cout << A + B << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*
  GOOD is not Enough
  You've got to be GREAT.
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define pii pair<int,int>
#define dbg(x) cout << (#x) << " is " << (x) << '\n' 
#define F first
#define S second
#define all(a) a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

void solve()
{
  int n;
  cin >> n;
  n%=10;
  if(n==3)
    cout << "bon\n";
  else if(n==0 || n==1 || n==6 || n==8)
    cout << "pon\n";
  else
    cout << "hon\n";
  return;
} 

signed main()
{
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3556
package main

import "fmt"

func main() {
	var h, n int
	fmt.Scan(&h, &n)
	atk := 0
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		atk += tmp
	}

	if h-atk <= 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 7424
#include <stdio.h>

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

    int i;
    for(i = 3; i <= n; ++i)
    {
        if(i % 3 == 0)
        {
            printf(" %d", i);
            continue;
        }

        int x = i;
        while(x)
        {
            if(x % 10 == 3)
            {
                printf(" %d", i);
                break;
            }
            
            x /= 10;
        }
    }

    printf("\n");
    return 0;
}

Measured memory_bytes: 600
A=int(input())
B=int(A/100)
C=A%100
if 1<=B and B<=12:
 if 1<=C and C<=12:
  print("AMBIGUOUS")
 else:
  print("MMYY")
else:
 if 1<=C and C<=12:
  print("YYMM")
 else:
  print("NA")

Measured memory_bytes: 2940
import sys
import math
import itertools
from functools import reduce

def prime_factors(n):
    for i in itertools.chain([2], itertools.count(3, 2)):
        if n <= 1:
            break
        while n % i == 0:
            n //= i
            yield i

def factors(n):    
    return set(reduce(list.__add__, 
                ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def main():
    X = int(input())
    divisors = factors(X)
    A = 0
    while True:
        for d in divisors:
            B = A - d
            check1 = A**5 - B**5
            check2 = -check1
            if check1 == X:
                print('{} {}'.format(A, B))
                sys.exit(0)
            if check2 == X:
                print('{} {}'.format(B, A))
                sys.exit(0)
        A += 1
            


if __name__ == "__main__":
    main()

Measured memory_bytes: 9912
N = int(input())
H = list(map(int, input().split()))
Hr = H[::-1]
cnt = 0


for i in range(N):
    flg = True
    for j in range(i+1, N):
        if Hr[i] < Hr[j]:
            flg = False
            break
    if flg == True:
        cnt += 1

print(cnt)


Measured memory_bytes: 38256
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let nk: Vec<i64> = util::gets();

    let c: Vec<i64> = (0..nk[0])
        .map(|_| util::get::<i64>() - nk[1])
        .fold((Vec::new(), 0), |(mut v, acc), a| {
            v.push(acc + a);
            (v, acc + a)
        })
        .0;

    let d: Vec<usize> = {
        let mut uniq_sorted = c.clone();
        uniq_sorted.sort();
        uniq_sorted.dedup();

        c.iter()
            .map(|x| uniq_sorted.binary_search(x).unwrap())
            .collect()
    };

    let mut ans: u64 = c.iter().filter(|&&x| x >= 0).count() as u64;
    let n = d.len();
    let mut bit = vec![0u64; n + 1];

    for x in &d {
        let x = x + 1;

        {
            let mut i = x as isize;
            while i > 0 {
                ans += bit[i as usize];
                i -= i & -i;
            }
        }

        {
            let mut i = x as isize;
            while i as usize <= n {
                bit[i as usize] += 1;
                i += i & -i;
            }
        }
    }

    println!("{}", ans);
}


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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 4000000000; //4*10^9;
constexpr auto MOD = 1000000007; //10^9+7;



int main()
{
    int n;
    string s;

    cin >> n >> s;
    int ans = 0;

    rep(i, n - 2) {
        if (s[i] != 'A') continue;
        if (s[i+1] != 'B') continue;
        if (s[i+2] != 'C') continue;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cmath>
#include<bits/stdc++.h>
#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define repr(i,n) for(lint i=(lint)(n);i>0;--i)
#define reps(i,a,b) for(lint i=a;i<=(lint)(b);i++)
typedef long long lint;
typedef long double ld;
using namespace std;
const ld PI = acos(-1.0);

int main(){
    int x[5];
    rep(i,5) cin >> x[i];
    int min=9, sum=0;
    rep(i,5) {
        min=MIN(min,((x[i]+10)%10==0?10:(x[i]+10)%10));
        sum+=(x[i]%10==0?x[i]:10*(x[i]/10)+10);
    }
    int prod=1;
    rep(i,5) prod*=x[i];
    if(prod%100000!=0) sum-=(10-min);
    cout << sum << endl;
    return 0;
}

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

using namespace std;

int main(void)
{
	int a, b, c;
	string K;
	cin >> a >> K;
	vector<int> vec;

	if (K.size() > a)
	{
		for (int i = 0; i < a; i++)
		{
			cout << K[i];
		}
		cout << "..." << endl;
	}
	else
	{
		cout << K << endl;
	}

}

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

namespace AtCoder
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var x = Console.ReadLine ().Split (' ').Select(int.Parse).ToArray ();
			var a = new string[x [0], x [1]];
			var result = new string[x[0]+2,x[1]+2];
			for (int i = 0; i < x[0]; i++) {
				var k = Console.ReadLine ().Split (' ').ToArray ();
				for (int j = 0; j < k.Length; j++) {
					a [i,j] = k[j];
				}
			}
			for (int i = 0; i < x[1]+1; i++) {
				result[0,i+1] = result[x[0]+1,i+1] = "#";
			}
			for (int i = 0; i < x[0]+1; i++) {
				result[i+1,0] = result[i+1,x[1]+1] = "#";
			}
			for (int i = 0; i < x[0]; i++) {
				for (int j = 0; j < x[1]; j++) {
					result [i + 1, j + 1] = a [i, j];
				}
			}
			result[0,0] = "#";
			for (int i = 0; i < x[0]+2; i++) {
				for (int j = 0; j < x[1]+2; j++) {
					Console.Write (result [i,j]);
				}
				Console.WriteLine ();
			}

		}
	}
}


Measured memory_bytes: 11360
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	
	static class Priorityqueue {
		public void priorityqueue (InputReader ir) {
			
			Queue<Integer> pq = new PriorityQueue<> (Collections.reverseOrder());;
			StringBuilder sb = new StringBuilder ();
			
			while (true) {
				
				String ord = ir.nextString();
				
				if (ord.equals("end")) break;
				
				if (ord.equals("insert")) pq.add(ir.nextInt());
				else if (ord.equals("extract")) sb.append(pq.poll()).append("\n"); 
				
			}
			
			System.out.print(sb);
			
		}
	}

	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		Priorityqueue obj = new Priorityqueue ();
		obj.priorityqueue (in);
	}
	
	
}



Measured memory_bytes: 196808
#include<iostream>
#include<vector>
using namespace std;
int main() {

	int s;
	vector<int> a;
	cin >> s;
	a.push_back(s);
	while(1) {
		if (s % 2 == 0) {
			s = s / 2;
		}
		else s = 3 * s + 1;
		a.push_back(s);
		for (int j = a.size()-2; j >= 0; j--) {
			if (a[j] == a[a.size() - 1]) goto END;
		}
	}
	END:
	cout << a.size() << endl;

	return 0;
}

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

int main()
{	
	int w;

	while (cin >> w) {
		int i = 0;
		bool f = 0;
		while ((1 << i) <= w) {
			if ((1 << i) & w) {
				if (f)
					cout << " ";
				else
					f = 1;

				cout << (1 << i);
			}

			i++;
		}

		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int h = in.nextInt();
		int w = in.nextInt();
		boolean[][] s = new boolean[h+2][w+2];
		for(int i=1;i<=h;i++) {
			String str = in.next();
			for(int j=1;j<=w;j++) {
				if(str.charAt(j-1)=='#') {
					s[i][j] = true;
				}
			}
		}
		
		boolean drawable = true;
		for(int i=1;i<=h;i++) {
			for(int j=1;j<=w;j++) {
				if(s[i][j]) {
					 if(s[i-1][j] || s[i+1][j] || s[i][j-1] || s[i][j+1]) {
						
					 }else {
						 drawable = false;
						 break;
					 }
				}
			}
			if(!drawable) break;
		}
		
		if(drawable) System.out.println("Yes");
		else System.out.println("No");
		
		in.close();

	}

}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll a,b,k,flag=0;
    scanf("%lld%lld%lld",&a,&b,&k);
    while(k--)
    {
        if(flag&1)
        {
            if(b%2==1) b--;
            a+=b/2;
            b/=2;
        }
        else
        {
            if(a%2==1) a--;
            b+=a/2;
            a/=2;
        }
        flag++;
    }
    printf("%lld %lld\n",a,b);
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>

using namespace std;

int main(void){
    string input;
    char buf1[3] = {0};
    char buf2[3] = {0};
    int a = 0;
    int b=0;
    int a_pattern = 0;
    int b_pattern = 0;

    cin >> input;
    buf1[0] = input[0];
    buf1[1] = input[1];
    buf2[0] = input[2];
    buf2[1] = input[3];

    a = atoi(buf1);
    b = atoi(buf2);

    if(a ==0 || a>12){
        a_pattern =1;
    }

    if(b ==0 || b>12){
        b_pattern =1;
    }

    if(a_pattern==1 && b_pattern ==1){
        printf("NA");
    }else if(a_pattern ==1){
        printf("YYMM");
    }else if(b_pattern ==1){
        printf("MMYY");
    }else{
        printf("AMBIGUOUS");
    }

    return 0;
}

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

int main(){

    int h,n;
    cin>>h>>n;
    vector<int> a(n);

    for(int i=0;i<n;i++){

        cin>>a.at(i);
        h-=a.at(i);

    }

    if(h<=0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



    return 0;
}

Measured memory_bytes: 640
void main()
{
    int n = readln.chomp.to!int;
    int[] s = new int[n];
    foreach (i; 0 .. n)
    {
        s[i] = readln.chomp.to!int;
    }

    bool[] dp = new bool[10001];
    dp[0] = true;
    foreach (p; s)
    {
        foreach_reverse (i, d; dp)
        {
            if (d)
            {
                dp[i+p] = true;
            }
        }
    }

    foreach_reverse (i, d; dp)
    {
        if (d && (i % 10 != 0 || i == 0))
        {
            i.writeln;
            break;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int A,B;
  cin >> A >> B;
  int ans = -1;
  for(int i=1;i<=1250;i++){
    if(A == (int)(i*0.08) && B == (int)(i*0.1)){
      ans = i;
      break;
    }
  }
  cout << ans << endl;;
}

Measured memory_bytes: 256
a = int(input())
if(a > 81 or a==0):
    print("No")
elif(0<a<10):
    print("Yes")
else:
    for i in range(9, 0, -1):
        if(a%i==0):
            a = a//i
            break
    if(a>9):
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 3060